By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,276 Members | 1,218 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,276 IT Pros & Developers. It's quick & easy.

Need help creating a menu bar

P: 5
I'm very green when it comes to writing code and I'm trying to create a menu bar and pull down menus. The menu bar contains three options: File, Edit and Help.

The File menu contains four options: New, Open, Close and Send To. Among these four, the Send To entry itself is a menu with the following three options: Mail Recipient, Exchange Server and Floppy Disk

The Edit menu has the following entries: Cut, Copy and Paste.

The Help menu has two options: Contact Us and About Software

Any help would be greatly appreciated.
May 8 '07 #1
Share this Question
Share on Google+
7 Replies


RedSon
Expert 5K+
P: 5,000
Have you looked at eclipse's visual dialog creation tools? They will help you create your menus and other windows. As for getting all the code to make it do what you want, thats another story.
May 8 '07 #2

RedSon
Expert 5K+
P: 5,000
Here is their Graphic Modeling Framework. It is the plugin that you will need to use to allow eclipse to help you create model your GUIs.

http://download.eclipse.org/modeling...oads/index.php
May 8 '07 #3

RedSon
Expert 5K+
P: 5,000
Here's a picture of what you are looking for.

http://www.eclipse.org/screenshots/i...Editor-KDE.png
May 8 '07 #4

Expert 10K+
P: 11,448
I'm very green when it comes to writing code and I'm trying to create a menu bar and pull down menus. The menu bar contains three options: File, Edit and Help.

The File menu contains four options: New, Open, Close and Send To. Among these four, the Send To entry itself is a menu with the following three options: Mail Recipient, Exchange Server and Floppy Disk

The Edit menu has the following entries: Cut, Copy and Paste.

The Help menu has two options: Contact Us and About Software

Any help would be greatly appreciated.
I'd skip all those visual tools if I were you. The problem description almost
naturally leads to the following code:
Expand|Select|Wrap|Line Numbers
  1. JMenuBar createMenuBar() {
  2.    JMenuBar bar= new JMenuBar();
  3.    bar.add(createFileMenu());
  4.    bar.add(createEditMenu());
  5.    bar.add(createHep[Menu());
  6.  
  7.    return bar;
  8. }
  9. JMenu createFileMenu() {
  10.    JMenu menu= new JMenu("File");
  11.  
  12.    menu.add(createNewMenuItem());
  13.    menu.add(createOpenMenuItem());
  14.    menu.add(createCloseMenuItem());
  15.    menu.add(createSendToMenu());
  16.  
  17.    return menu;
  18. }
  19. ...
  20. // etc.etc. etc.
kind regards,

Jos
May 8 '07 #5

RedSon
Expert 5K+
P: 5,000
I'd skip all those visual tools if I were you. The problem description almost
naturally leads to the following code:
Expand|Select|Wrap|Line Numbers
  1. JMenuBar createMenuBar() {
  2.    JMenuBar bar= new JMenuBar();
  3.    bar.add(createFileMenu());
  4.    bar.add(createEditMenu());
  5.    bar.add(createHep[Menu());
  6.  
  7.    return bar;
  8. }
  9. JMenu createFileMenu() {
  10.    JMenu menu= new JMenu("File");
  11.  
  12.    menu.add(createNewMenuItem());
  13.    menu.add(createOpenMenuItem());
  14.    menu.add(createCloseMenuItem());
  15.    menu.add(createSendToMenu());
  16.  
  17.    return menu;
  18. }
  19. ...
  20. // etc.etc. etc.
kind regards,

Jos
Fine, make it easy. See if I care :P

The reason I was suggesting those visual tools is because it will be easier to make rich and complicated interfaces with them instead of creating them all programatically.
May 8 '07 #6

P: 5
I'd skip all those visual tools if I were you. The problem description almost
naturally leads to the following code:
Expand|Select|Wrap|Line Numbers
  1. JMenuBar createMenuBar() {
  2.    JMenuBar bar= new JMenuBar();
  3.    bar.add(createFileMenu());
  4.    bar.add(createEditMenu());
  5.    bar.add(createHep[Menu());
  6.  
  7.    return bar;
  8. }
  9. JMenu createFileMenu() {
  10.    JMenu menu= new JMenu("File");
  11.  
  12.    menu.add(createNewMenuItem());
  13.    menu.add(createOpenMenuItem());
  14.    menu.add(createCloseMenuItem());
  15.    menu.add(createSendToMenu());
  16.  
  17.    return menu;
  18. }
  19. ...
  20. // etc.etc. etc.
kind regards,

Jos
I'm still not understanding the main part - JMenu createFileMenu() {
JMenu menu= new JMenu("File");

Does this create a pull down menu?
May 9 '07 #7

Expert 10K+
P: 11,448
I'm still not understanding the main part - JMenu createFileMenu() {
JMenu menu= new JMenu("File");

Does this create a pull down menu?
Yup, and you add that menu to the menu bar. You can add menus or menu
items to the menu itself. Read the API documentation for those classes.

kind regards,

Jos
May 9 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.