Menu « Menu « Java Swing Q&A





1. Using Mac OS X Services-menu from a Java/Swing application    stackoverflow.com

I would like to make my Java/Swing application compatible with the Services-menu available on Mac OS X. For example, so that the user could select some text in JTextArea and have ...

2. Swing: Canvas overlaps menu    stackoverflow.com

I have a JFrame with a menu bar and a canvas covering all the remaining surface. When I click on the menu bar, the menu opens behind the Canvas and I ...

3. Swing Menu that can be customized by user    stackoverflow.com

Is there any framework or lib out there to create a Java swing menue that can be edited by the user via drag and drop? Added: Implementing a polished solution myself can ...

4. Java OS X Dock Menu    stackoverflow.com

Is it possible to add items to the applications dock menu? EDIT: I think i miss phrased the question, i am not looking for a way to add an icon to the ...

5. Java Menu issue    stackoverflow.com

I have a menu with a few JCheckBoxMnuItems. How do I ensure that the Menu stays open until I have done all my selections (i.e. checked the menuitems) and does not ...

6. Java GUI File Menu    stackoverflow.com

I have a GUI with a Menu named file how do I Add a file open and close function to the program. If the program is in the encrypting mode, it ...

7. Battleship Application crashes if I run it through the main menu after slicking on start    stackoverflow.com

I am creating a battleship game with 4 classes using sockets. A computer, player message and a menu class. To start the game I run the computer class which is the ...

8. Swing: link toggle buttons together with a button group, along with corresponding menu items    stackoverflow.com

For a school project, I need to make a simple paint application that can draw lines, ovals, and rectangles. The assignment specifies that I need toolbar buttons and menu items for each ...

9. Menu (Command) using J2ME Polish and Generic MPDP2 build    stackoverflow.com

I am using J2ME Polish for my application. The app itself is fairly simple but we are using polish for it's nice UI. I would like to have a popup menu ...





10. Java/Swing: adding items to the system menu    stackoverflow.com

I forget what this is called exactly (I think it's the "system menu"), but in Windows there's an icon in the upper left of a window and if you click it, ...

11. How to create the flamingo ribbon menu?    stackoverflow.com

I'm using flamingo ribbon, but when i tried to put the menu, it didn't appear. I used this code:

RibbonApplicationMenuEntryPrimary  menu1 = new RibbonApplicationMenuEntryPrimary(getResizableIconFromResource("/prog/Imagenes/Algo.png"), "Prueba 1", new ActionListener() {
    ...

12. JRuby with Swing: "The OSX menu"    stackoverflow.com

I am using JRuby with the Swing library to create an OSX application. I would like to know if(and especially how) I can interact (add menu items etc) Application Menu in ...

13. Is there a Java/Swing implementation of "compound menu item" as in Chrome?    stackoverflow.com

First of all, is there an "official" name for menu items like Edit and Zoom in the Chrome browser? enter image description here Is there an existing Swing implementation? On the surface ...

14. Java swing menu doesn't stay up    stackoverflow.com

So I'm running netbeans 7.0-1 using Arch Linux. I'm running xming for my x-server. What's going on is, when I use netbeans' Desktop Applications, it starts with two menus: File and ...

15. Problem opening in Swing Frames (from Menu Items) with JWS or created exe from Jar file    stackoverflow.com

I have a Java Swing GUI for an application (I am using Neetbeans 6.9+XP+java 1.6), it has a few menus in Menu bar and several fields to fill. This application works ...

16. How do I prevent underlying dividers from poking through my menu!    stackoverflow.com

I've got a Swing form made up of a JFrame containing a JMenuBar and a JSplitPane (further subdivided into resizeable JPanels). The problem is that when I select one of ...





17. Menu GUI help in Java    stackoverflow.com

I can't compile this code because of several errors. Most of the errors are under the initUI() method, which was copied from a tutorial site. How do I fix this?

...

18. Tutorial to set or save menu data    stackoverflow.com

I am looking for a Java tutorial to create a menu where you can store data or set default data. Where you can type in an database connection etc. etc. ...

19. Using GUI Menu Buttons to open a Text Window (Total Beginner)    forums.netbeans.org

Hello. I'm trying to see if I can build a Main Menu for a game I'm making(I'm just making the menu at the moment. First things first, I guess). I can already make the Quit button work, but I want to make a text box appear when somebody clicks the other buttons. How would I go about doing that? I'm a ...

20. Why can't I add a menu item to more than one menu?    coderanch.com

Not sure why its not showing up. But when I try to add a menu item to two menu's it only shows up on the last one I added to. For instance: fileMenu.add(newItem); editMenu.add(newItem); This will result in it showing up on the editMenu but not the fileMenu. Its weird but I don't know how to do it either. It should ...

21. Need Menu design/coding tips    coderanch.com

Hi, I am fairly new to Java programming, but experienced programmer in xBase languages. In some of those "visual oop" languages, the components such as menus and menu items are "self-contained" i.e. they handle their own events. I'm starting an application and as I add functionalities (menus and menu items) basing my coding on some samples that I read, and using ...

22. Problem setMnemonic for Menu Items    coderanch.com

Hello, I have a problem using setMnemonic for selecting menu items. For example, if I have a menu with two options 'File' and 'Edit' and under 'Edit' I define a 'Find' option, I set the keyboard mnemonics 'F' for the mnemonic for both 'File' and 'Edit'> 'Find'. Now here is the problem...When select 'Alt-E' the Edit menu is selected. Next, I ...

23. Menu question    coderanch.com

Heres my code: Menu menu = new MenuBar(); m3 = new Menu("Test"); review = new MenuItem("Review.."); m3.add(review); As it is now. I am able to create a menu bar with a heading "file". When the user clicks on "file" the menu pops up and they can actually select one of four choices; I only have one of them listed here,"review". How ...

24. How to force Menu to downwards, if more than 50 menu items exist    coderanch.com

Hi I have a menu list in my Applet which exeeds 50 menuItems. when I click a Menu, it will show the menuItems upward. In general Menu will show Menu items downward(if menu Items are in minimum number which will not go beyond your frame, once it goes beyond it, it's showing upwardly, only few menu items are visiable in this ...

25. menu problem..please help ASAP..    coderanch.com

26. Urgent - Need to add a menu into an MDI    coderanch.com

I want to build a main MDI, which contains a file menu. When I click on an item from the menu, it should close the current frame and open the new frame. I would use the main MDI to navigate and I need any help. What do I need and how to go about it. Anything would help. Thanks.

27. Menu problem    coderanch.com

In all honesty i have no idea what u mean by heavyweight and lightweight, but i've posted the code relating to the panel and the menu. Panel p = new Panel(); p.setForeground(maroon); p.setBackground(Color.white); p.setLayout(gridBagLayout2); this.getContentPane().add(p, new GridBagConstraints(1, 0, 5, 1, 0.0, 0.0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); JMenu jM_Database = new JMenu(); menuFile.add(MI_Archive); menuFile.add(jMExtract); menuFile.addSeparator(); menuFile.add(MI_Exit); menuHelp.add(menuHelpAbout); menuBar1.add(menuFile); ...

29. Why does a menu stay pulled down?    coderanch.com

30. Menu question?    coderanch.com

31. i need space between menus ...    coderanch.com

32. Problem in Jpopup Menu    coderanch.com

Hi everybody, My problem is like this. I have Jpopupmenu object and im making it shown when i press right mouse button click. When i press mouse near the borders of the container, the part of it become invisible. for eg, if my container object is occupying full screen and im pressing right click on the right border of the container, ...

33. Adding a menu in JBuilder    coderanch.com

34. sub menus...    coderanch.com

35. link from the main menu to other    coderanch.com

36. Implementing a Menu (Help)    coderanch.com

37. Help Screen From Menu    coderanch.com

If your question is how to display a full blown help system, the previous reply is right on. If your question is how to hook up some code to the menu, here's a rather elaborate scheme I use: private void initMenu() { JMenu lHelp = makeMenu( "Help", KeyEvent.VK_H ); lHelp.add( mHelp = makeMenuItem( "Comparator Help", KeyEvent.VK_C ) ); lHelp.add( mHelpAbout = ...

38. How to use menus?    coderanch.com

I am having, what must be a simple problem. When I place a JTable, or any other object, on the content pane when starting the program all is well, but when I place it on the pane in response to a menu item action, the table does not display. What am I doing wrong, or more likely, what do I not ...

39. Menu based swing application    coderanch.com

What is the good practice/design for swing based menu application. I mean, based on menu selection I would like to display new screen /panel with in that frame. What is the best appraoch for this ?. Do I have to create multiple panels and attach to JFrameContentPane and make visible depends on menu selection ? If so , Is it possible ...

40. menu design    coderanch.com

41. question on menu item    coderanch.com

42. Menu Problems    coderanch.com

Hi, I am working on a simple menu and running into a bit of difficulty. I have the menu created and it works well except for one issue, I cannot get the greying out of options to work. Specifically, when I select EDIT / OPTIONS / READ ONLY it should grey out the save/saveas options but instead I get a null ...

43. drag & drop menu elements?    coderanch.com

44. How to put menu item in Title bar    coderanch.com

Dear All, I have a problem with my GUI. Actually in Java generally we put menu & menu-items in menubar which is shown just below the Title bar ( in a JFrame ) But I want to put my Menu ( & further menu-item through pop-up or so) in Title bar so that I do not have to put the Menu-bar. ...

45. Menu Clears Out Graphics    coderanch.com

Hi There I'm writing a graphics program. The problem I'm having is that whenever the menu drops over the graphics area, it erases the lines that I have drawn. Also when I minimize and the restore the window, all the graphics is lost. Is there something I'm missing to preserve the lines I've drawn in the graphics area. I've included the ...

46. enabling menu items    coderanch.com

Of course, you can pass the status of ok button from the registerframe class back to the caller class mdiapplication. I don't understand that much about the real requirement of your application, but I can see that OK button and menuitems arein different classes... Of course, there are ways to send the status of your button back and forth the class... ...

47. Menu+Tool    coderanch.com

An example: import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.text.*; public class MenuAndToolBar { public static void main(String[] args) { JToolBar toolBar = new JToolBar(JToolBar.VERTICAL); toolBar.add(cut); toolBar.add(copy); toolBar.add(paste); JTextField tf1 = new JTextField(12), tf2 = new JTextField(12); JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.weighty = 1.0; gbc.gridwidth = gbc.REMAINDER; panel.add(tf1, gbc); panel.add(tf2, gbc); JFrame f = ...

48. Log-In Menu    coderanch.com

how do i do that? when i click admin on the first screen, then it should open an adminDialog which asks for userID and password. here is my code: import java.awt.*; import javax.swing.*; import java.awt.event.*; class hovedVin extends JFrame { JButton btnAdmin; private adminDialog dialogboks = new adminDialog(this); private Container guiBeholder; public hovedVin() { setTitle("System"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); guiBeholder = getContentPane(); guiBeholder.setLayout(new FlowLayout()); ...

49. Recently used menus only visible    coderanch.com

50. Interesting JPop-up menu Problem    coderanch.com

Hi Ranchers, I have a JPop-up Menu which pops up on right-click; everything works alright with the menu; Pop-up menu shows up until I select a menu item or I click on some other component. Now the problem area is: 1> My menu is dynamically generated; I mean to say the data can change due to external factors too.. and b'coz ...

51. How to change the fonts in all menus and buttons?    coderanch.com

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - ...

52. incomplete menu shown    coderanch.com

53. How to update the help menu?    coderanch.com

Hi everyone, I want some advice on how to update the help menu...I beleive i must use the java help system for this...the problem is a particular panel(table)in my GUI has been changed(now it has 4 colums,previously it had 3),but in the help section,still the old panel is shown...how do i change tht? Since all help pages are html documents,can i ...

54. Using Menus    coderanch.com

55. Need a very simple menu system, but stuck....    coderanch.com

Basically (hey this is beginner section ) I need some kind of simple to use and understand menu system, but am a bit stuck of how to go about it. If I create a drop down box to say select to go to either screen 1, or screen 2, how would it be easiest to do it? I know how to ...

56. create a html help menu    coderanch.com

hi all, i'd like to create a help menu for my java application (swing gui). this should display some html sites where the functions of the application are explained. what is a good way to do this? it is easy to display html sites in a jframe? for me, it would also be ok to just open a html browser window ...

57. Menu update    coderanch.com

I am currently working on an eclipse RCP client. My apologies if this the wrong forum. I have 2 actions, which are associated with 2 Menu items. When one action is enabled the other is disabled. The problem I am having is that when a user selects a menu item, the other action is never notified, and there is never enabled. ...

58. How to make an Expanding Menu    coderanch.com

I have the following code: MenuBar mb = new MenuBar(); setMenuBar(mb); Menu newGame = new Menu("Game"); Menu newHelp = new Menu("Help"); MenuItem newGameNew = new MenuItem("New"); MenuItem newGameExit = new MenuItem("Exit"); MenuItem newHelpAbout = new MenuItem("About"); MenuItem newHelpHelp = new MenuItem("Help"); MenuItem newGameNewOpt1 = new MenuItem("2 x 2"); MenuItem newGameNewOpt2 = new MenuItem("3 x 3"); MenuItem newGameNewOpt3 = new MenuItem("4 x ...

59. Scrolling JPopup Menu    coderanch.com

60. Adding a 'left pane' Menu to an MDI    coderanch.com

import java.awt.*; import java.awt.event.*; import javax.swing.*; public class ExtraTabs { private JTabbedPane getContent() { String[] ids = { "JCheckBoxBorder", "JCollapsableTable", "JSlideTab", "JXPMenu", "JOutLookBar", "JTreeCellRendererExtendor", "JButtonMenu" }; JPanel right = new JPanel(new BorderLayout()); right.add(new JLabel("Event Messages:"), "First"); right.add(new JScrollPane(new JTextArea(12,16))); JPanel composite = new JPanel(new GridBagLayout()); composite.setBorder(BorderFactory.createRaisedBevelBorder()); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(5,5,5,5); gbc.weighty = 1.0; gbc.fill = GridBagConstraints.VERTICAL; ...

61. How to add a shortkey to Menu    coderanch.com

62. Why menu doesn't display    coderanch.com

import java.io.*; import java.awt.*; import javax.swing.*; import java.util.Hashtable; import java.awt.event.*; import javax.swing.event.*; import java.applet.Applet; public class Combox extends JApplet{ private JMenuBar menuBar; private JMenu menu; ... public void init(){ try { SwingUtilities.invokeAndWait(new Runnable() { public void run() { initComponents(); } }); } catch (Exception ex) { ex.printStackTrace(); } } private void initComponents() { jPanel1 = new JPanel(); jPanel1.setLayout(new java.awt.GridBagLayout()); GridBagConstraints gbc ...

63. Creating menu for this file    coderanch.com

64. menu in loop    coderanch.com

65. Reloading/refreshing menu items    coderanch.com

Hi all, Im trying to create a list(10) of the most recent jobs that refresh/replaces(the menuItems) each time a user opens a new job, almost exactly like in Microsoft office word. The code works perfectly when i run it from eclipse/netbeans but as soon as run it on the browser as an applet it losses some functionality(wont refresh and jobs wont ...

67. getting the name of a menu item's parent menu    coderanch.com

Hi! I'm wondering if there's a way to get the name of a menu item's parent item. For example: Main menu (name: main) [note, this is a popup menu] first submenu (name: sub1) second submenu (name: sub2) first subsubmenu (name: foo) if the user clicks an item in foo, is there any way to get at the names of "sub2" and ...

69. Swing Menu item with no children?    coderanch.com

Hello, Hopefully a basic question. I have a form with a Menu bar. What I want is one menu item added that has no children... so when the menu is clicked it simply performs an action (in this case fires up a dialog). So the menu text itself is like this: Settings... to indicated that selection will do something immediately. It ...

70. Menu Items are not appearing.    coderanch.com

Hello Friends , i got a small problem, below is the code. Thanks in advance. My OS is windows 7. import javax.swing.*; import javax.swing.border.*; import java.awt.*; import java.awt.event.*; public class ToolBar extends JFrame { JToolBar toolbar; JLabel statusbar; public ToolBar() { setSize(350,250); setTitle("Tool Bar - 1"); setDefaultCloseOperation(EXIT_ON_CLOSE); Toolkit tk = getToolkit(); Dimension d= tk.getScreenSize(); setLocation(d.width/2-getWidth()/2,d.height/2-getHeight()); setLocationRelativeTo(null); JMenuBar menubar = new JMenuBar(); ...

71. Menu Problem/Java Update 23    coderanch.com

72. menu not showing up on gui window    coderanch.com

73. Designing menu item State    coderanch.com

Hi all i have added a Popup menu on a Jtable. i have to enable or disable based on selection or rows. like i have to enable or disable some menu item if selection is only one row. and the menu item's state is different if selection is multiple. and also based on different parameter. i am tiered of adding logical ...

74. Menu Creation    java-forums.org

75. Java Menu Problem    java-forums.org

76. Menus Not Displaying    java-forums.org

Java Code: import javax.swing.*; import java.awt.*; import java.awt.event.*; public class NotepadInJava //implements ActionListener { //preparing container JFrame notepadFrame; JTextArea theTextArea; JScrollPane scrollPane = new JScrollPane(theTextArea); //File menu items JMenu file; JMenuItem open; JMenuItem save; JMenuItem exit; //Edit menu items JMenu edit; JMenuItem copy; JMenuItem cut; JMenuItem selectAll; JMenuItem paste; public static void main(String[] args) { NotepadInJava app = new NotepadInJava(); } ...

77. Menu Type cast Exception    java-forums.org

78. menu display on mousclick    java-forums.org

79. Multiple Menu Program    java-forums.org

Hi, I want to create a program in Java, and I am using JFrames for my GUI. What the program does is that it has some buttons on a JFrame and each button does an event. One of this buttons has to lead in a new menu. I have decided that the best way to do this is to create two ...

80. About MENU Personalization    java-forums.org

81. Menus stay extended in some scenarios    java-forums.org

Hi all, I have one application in which i have used JMenuBar with menus & submenus. the functionality of menus is working fine but in some scenarios menus does not get closed. steps: 1. click on menu then menu get extended. 2. when i click outside the menu ... the menu get closed. --- working fine 2. but when i perform ...

82. override the menu items    java-forums.org

Hey, iv been looking for a way to override the jmenu items so i can give it a custom look using java 2d, however i want to keep the standard methods such as the mouse over event that awt/swing uses but cannot seem to override in the same way i have been doing with a jpanel and jbutton to keep the ...

83. Check Menu active    java-forums.org

Hi all I have a problem in check menu item is active or not. In the Active button ,what i want when some one click on active button then show Message ,it is in use. Plz help[ me Java Code: import java.awt.*; import javax.swing.*; public class Abc extends Dialog { private Button button; private Checkbox ACTIVE; public Abc(Frame parent) { super(parent,"lock", ...

84. GUI Menu and method to set LineBorder    forums.oracle.com

One way to do is this: 1) create an inner ActionListener class, say call it ColorLineListener, and have it implement the ActionListener interface (of course) 2) Give this class a constructor that takes two variables: a Color variable, color, and an int parameter width, and pass these parameters to corresponding fields of your actionlistener class. 3) Create a new object of ...

85. GUI help with menu    forums.oracle.com

It's a class assignment. I just want a user to select File Menu to open (or new) and when they did a new Jpanel will open. If you can show or tell me how to do that it would be great. thanks red Are you trying to open this JPanel as a new window? If so (and I may be wrong), ...

86. Adding menu to Swing application    forums.oracle.com

87. swing menu!    forums.oracle.com

88. java Swing frame for modification Excel file or Word file with All menu...    forums.oracle.com

public class TestReader { private static void createAndShowUI() { JFrame.setDefaultLookAndFeelDecorated(true); JFrame frame=new JFrame("Test Reader"); JButton button=new JButton("Edit"); button.addActionListener(new ButtonListener()); frame.getContentPane().add(button); frame.setVisible(true); frame.pack(); } static class ButtonListener implements ActionListener { public void actionPerformed(ActionEvent event) { openTheFile(); } } private static void openTheFile() { try { String commands[]=new String[3]; commands[0]="cmd.exe"; commands[1]="/C"; commands[2]="INSTALL.LOG"; // here file name is supposed to be in the working ...

89. Swing Language Menu    forums.oracle.com