Questions tagged [jmenuitem]

JMenuItem is an implementation of an item in a menu. A menu item is essentially a button sitting in a list. When the user selects the "button", the action associated with the menu item is performed.

JMenuItem is an implementation of an item in a menu. A menu item is essentially a button sitting in a list. When the user selects the "button", the action associated with the menu item is performed. For more info, see this link.

342 questions
-1
votes
1 answer

Why i'm getting a white area beside jmenubar?

I'm trying to create a dialog box which contains two splitPanel and a menu bar. Both of the splitPanel contain jlist. But when i run my code i get white area beside the menu bar .In the picture below a white area is created beside Organize. Here is…
IAmBlake
  • 457
  • 6
  • 21
-1
votes
3 answers

How to get my sort function working

Ok i have a Swing app that I'd like to be able to sort my arrays. I have built the sort method I just need the condition trigger to work. For some reason I can't figure out how to get the sort by JMenuBar items to trigger it. As you can see in my…
Reign
  • 289
  • 1
  • 9
-1
votes
3 answers

JMenu and JMenuItem

So, I have the following code: JMenu debug = new JMenu("Debug"); debug.add(new Debug()); And then the Debug class is: public class Debug extends JMenuItem { public final String TEST_DEBUG = "Test"; public Debug() { …
-1
votes
2 answers

how to list all visible jinternal frame from desktoppane to window menu in java

Am creating an MDI application .I have added all internalframe to desktoppane. My problem is to add all visible internal frames as menu items to "window" menu. and when another frame is selected from menu it should set focus. And i have to cal same…
Devu
  • 1
  • 3
-1
votes
1 answer

JMenuItem doesn't execute action

I've looked through the swing tutorials and i do not see what i'm doing wrong. Why is nothing happening when i click on the jmenuitem? my first class: import javax.swing.*; public class WordProcess{ /*TODO: make program end on close */ public…
user2465510
  • 99
  • 10
-1
votes
1 answer

How to add ActionListener to JMenuItem?

I'm trying to add ActionListener to JMenuItem in my java menu. Here is a screenshot of the menu: I want to add ActionListener to "Rectangle" JMenuItem in order to show up the rectangle shape upon clicking on the "Rectangle" menu item. I tried many…
Mina Hafzalla
  • 2,681
  • 9
  • 30
  • 44
-2
votes
1 answer

Pop-up window when clicking a JMenuItem

I'm trying to show a pop-up window when the user clicks on a JMenuItem. I've got the following piece of code: menuAnular = new JMenuItem(w.translate("ETI_ANULAR"),imageAnular); menuAnular.addActionListener(new ActionListener() { @Override …
gab
  • 29
  • 5
-2
votes
1 answer

Java, How Do I setText of JMenuItem from another class?

Unfortunately I did not learn Java, I know other programming languages with the exception of Java. I know how to create a Menu and add items to the menu. I figured that out from my simple basic java books. However I have access to a piece of open…
-2
votes
3 answers

Casting JMenuItem

Inside my actionPerformed method I have the two following lines of code, JButton pressed =(JButton)e.getSource(); JMenuItem pressedSave = (JMenuItem)e.getSource(); Why is this not allowed? I get the following compiler error Exception in thread…
ugCode
  • 29
  • 3
-2
votes
1 answer

How to show a menu depending on what is selected?

In swing, how do i show a menu depending on what was selected from another menu. For example: Select Country drop down. This is followed by a State drop down, followed by city. When a particular Country is selected, then show the states for that…
Korg
  • 93
  • 2
  • 9
-3
votes
1 answer

JAVA - JMenu built from file

I would like to build a JMenu using the content of a text file with this layout / appearance (# for separator ; JMenu X and JMenuItem X will be replaced by String sequences) : JMenu 1 # JMenuItem 1 JMenu 1 # JMenuItem 2 JMenu 1 # JMenuItem 3 JMenu 2…
Fred
  • 169
  • 1
  • 3
  • 19
-3
votes
1 answer

How to get the currently selected Menu or MenuItem

How can I retrieve the currently selected menu or menu item when clicked on it and the subsequent path will be printed on console. In this code I have done the menus and sub menus up to 4 levels. And want to print the path of selected menus and…
Rabi Narayan
  • 23
  • 1
  • 3
1 2 3
22
23