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
0
votes
1 answer

Java: How to change content of JPanel according to choice a item menu or JTree node?

I'm a web developer and I'm new in Java and I want know how to change content of a JPanel when choice any node of JTree or any item of menu. Because I don't want display many windows when click in any option but will reload only part of the program…
SoldierCorp
  • 7,610
  • 16
  • 60
  • 100
0
votes
1 answer

java actionlisteners advice needed, Jmenuitems

"Firstly, add ActionListeners to each of the JMenuItem objects. For example, when you select “Square” from the menu, the ActionListener attached to the ‘Square’ menu item must create an instance of your ‘Square’ class. These ActionListeners…
john
  • 65
  • 1
  • 9
0
votes
2 answers

How to prevent multiple instances of MDI child forms in netbeans

Im developing a java app with MDI application forms. I have assigned menu items to open two internal child forms. when i click them repetitively they create instances for each click how can i stop this and show the previously instantiated form at…
buwaneka
  • 191
  • 1
  • 4
  • 11
0
votes
1 answer

Is there some kind of way to make sub-menu items?

Say I had a JMenuBar. On that JMenuBar, I had a JMenu. On that JMenu, there was another menu, and on that menu, there were items. Is there a way to do this?
user1610406
  • 722
  • 1
  • 13
  • 24
0
votes
2 answers

Select JTabbedPane Panel with JMenuItem

I have a menu-bar and a tabbed pane in a frame, and i want that if i select a menuitem, then the requested tab will open. Please help me with this, thanks!!!
0
votes
2 answers

JMenuItem Constructor Not Accepting Action

JMenuItem has the following constructor: (Source: GrepCode) public JMenuItem(Action a) { this(); setAction(a); } However, when my code has import javax.swing.*; import java.awt.event.ActionEvent; public class ActionTest extends JApplet { …
gobernador
  • 5,659
  • 3
  • 32
  • 51
0
votes
1 answer

Java 1.6.15, Mac OS X, JMenuItem does not disapear

My application uses some implementation of licensing mechanics. Depending of license type some menu items must be invisible. And now I've run into problem on Mac OS X 10.6.2. Java version 1.6.0_15. Menu items just won't disapear no matter what. I…
Aleksandr Kravets
  • 5,750
  • 7
  • 53
  • 72
0
votes
2 answers

Java Swing OSX Window Menu Icon Alignment

Java Swing seems to place the 'Menu Text' after the icon (if present) on MenuItems. See example below. It does NOT look very nice. Is there a way around this? On OSX the icon fits in the left margin and the text aligns with all other MenuItems.
Lyndon
  • 573
  • 6
  • 24
0
votes
2 answers

Adding a JMenuItem to multiple Menus

I wish to add the same JMenuItems to multiple JMenus, but it only shows up for the last JMenu. Here's the code that I've written. I want the three JMenu items to be shown for all of the JMenu states. With this code the first two states have no…
nikhil
  • 8,925
  • 21
  • 62
  • 102
-1
votes
2 answers

MenuItem inside/Sub of another MenuItem in Java?

How to add a menuItem inside/sub of another menuItem in Java? is it possible ?
Sobiaholic
  • 2,927
  • 9
  • 37
  • 54
-1
votes
1 answer

Can you change the order of JMenuItems?

This a really straightforward question. Can I change the order of JMenuItems in a JPopupMenu? Or is there a way to specify something like an index when adding a menu item to a popup menu like you can with a list (e.i. List.add(int,…
Cardinal System
  • 2,749
  • 3
  • 21
  • 42
-1
votes
1 answer

JMenuItem to access and manipulate a variable

I am implementing a game in java and I am setting up the difficulty settings. I have each difficulty setting in a JMenuItem on a menu bar. I was wondering how do I access and manipulate a variable in another class by using those menu items. Thanks…
-1
votes
2 answers

What listener should I use? (Java)

I want a listener that defines if a JMenuItem was selected. Not pressed, but just highlighted. I don't need MouseOver listener, because the selection is supposed to be performed from keyboard. What listener should I use? Thanks in advance :)
nicks
  • 2,161
  • 8
  • 49
  • 101
-1
votes
1 answer

Getting a prompt from a JMenuItem

I'm trying to exit my application by choosing the exit-option in the menu bar, but I need to get a prompt before the program close. I have tried to find the answer here by reading similar questions, but many solutions just ends with…
Vicky123
  • 1
  • 3
-1
votes
1 answer

java 8 lambda expressions set enabled in JMenuItem ActionListener

I have a lambda expression for swing menu. JMenu color = new JMenu("Color"); color.add(new JMenuItem("Red")).addActionListener(evt -> panel.setSelectColor(Color.RED)); color.add(new JMenuItem("Green")).addActionListener(evt ->…
Peyo Peev
  • 107
  • 1
  • 10
1 2 3
22
23