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
2
votes
0 answers

How to make a JCheckMenuitem stay visible for multiple selections

I have a number of JCheckMenuItem's under a main menuitem.. With the first selection of the CheckMenuItem closes the menu, need to check the multiple CheckMenuItem's till that how to make JMenu visible here the piece of code .. JMenuBar menuBar…
Lingaraj
  • 99
  • 2
  • 13
2
votes
2 answers

Java - Is It Possible To Add A JMenu Over On The Far Right-Hand Side Of A JMenuBar?

I am in the process of developing a simple JFrame based GUI to which I've added a JMenuBar and which in turn has the usual JMenuItems added to it - "File:", "Edit:", etc. I would like to be able to add another JMenuItem - "About:" - to the far…
The Thing
  • 625
  • 1
  • 9
  • 23
2
votes
1 answer

How to prevent JCheckBoxMenuItem from closing once clicked?

I have attached some JCheckBoxMenuItems to my JMenu in place of a JMenuItem. When the user clicks on the JMenu, it displays the JCheckBoxMenuItems. Once the user selects one of the boxes from the JCheckBoxMenuItem, the list of JCheckBoxMenuItems…
bob dylan
  • 647
  • 1
  • 10
  • 25
2
votes
0 answers

How to copy a text if the user highlight it using a JMenuItem?

I am trying to copy some text from a JTextPane if the user highlights it and selects a JMenuItem. Thanks to a previous post that someone answered, I know that I should use the following if the user presses Ctrl-C menuItem = new JMenuItem(new…
bob dylan
  • 647
  • 1
  • 10
  • 25
2
votes
1 answer

I tried put JMenuBar with actionlistner and paintComponent together as the first panel,a slider and String for the second panel, but nothing shows up

This is a assignment that have a Menubar including the types of rides which user can pick from, after a ride is picked, there would be a messege appearing on the second panel regarding the safety and and also a slider for rider's height. I tried put…
Hallllis
  • 31
  • 2
2
votes
1 answer

JMenuItem and ENTER key released

I have a JMenuItem and I want to receive user input. The user has to be able to start the item's functionality by mouse or keyboard. The item's functionality contains a JDialog to be opened. This dialog listens to released ENTER keys and starts its…
vern
  • 103
  • 2
  • 10
2
votes
1 answer

Adding a JMenuItem to JMenuBar to create a toggle button in menu

What I want to achieve is this: The image means I want to put some button, like JMenuItem, into the application menu bar (JMenuBar) to allow toggling some operation. So I wrote such code: // Start button JMenuItem startbut = new…
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
2
votes
2 answers

Force JMenuItem size

When I add an icon to a JMenuItem, it's scaled up to the size of the icon. See the difference here: Can I somehow force it to scale back down to original? If not, is there default icon size for JMenuItem (meaning, what would be the size of the…
user3879542
  • 125
  • 1
  • 2
  • 11
2
votes
1 answer

Java Swing JMenu text animation does not works as expected

I need to animate some selected menuitems and their perent menus. So far the solution I got that works well with menuitems but doesn't work well with their parent menu. (Solution source :Is it possible to make some items in the menu to fade in with…
2
votes
3 answers

Eclipse not displaying JMenu items after adding to and setting JMenuBar visible?

Not getting any errors however the program only displays the word "menu" at the top in the program. It doesn't display the 3 JMenu items: "home", "about" and "explore". JPanel p5 = new JPanel(new GridBagLayout()); …
user3289740
  • 271
  • 3
  • 6
  • 17
2
votes
1 answer

Java Swing JMenuItem intercepts its accelerator key even entered into a JTextField component

Example code: public class FrameMenuTextFieldTest { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { final JFrame frame = new…
kavai77
  • 6,282
  • 7
  • 33
  • 48
2
votes
3 answers

How to Set Vertical Separators for JMenuItems

I can only set horizontal separator to my code , how to set vertical one ? Similar to this http://jade-cheng.com/hpu/2012-spring/csci-2912/assignment-5/blueprint-2.png file.add(newMenuItem); file.add(openMenuItem); …
mussdroid
  • 732
  • 1
  • 9
  • 22
2
votes
2 answers

Where do you store the logic for a JPopupMenu?

I'm a little confused on where the action logic (what happens when a user selects a menu item from the popup) should be placed. Currently, I have it stored in a subclass of JPopupMenu, but it doesn't seem to call the event when I click on a menu…
Zack Yoshyaro
  • 2,056
  • 6
  • 24
  • 46
2
votes
1 answer

Java - How to setEnabled() on paste Action?

I am doing my own Notepad in Java. Basic part is almost done. But i have big problem with JMenuItem which pastes words to JTextPane. It works(pasting), but i want that JMenuItem reacts: when is something in memory(copy - from anywhere) => JMenuItem…
MmM ...
  • 131
  • 1
  • 2
  • 14
2
votes
2 answers

JMenuBar SelectionModel ChangeListener only fires once

I am trying to get my JMenuBar to model the behavior of the menu bars of Firefox and iTunes. The behavior: the menu bar is initially hidden. But, when you press Alt, the menu bar appears (with the first item selected) and when you don't have a menu…
ryvantage
  • 13,064
  • 15
  • 63
  • 112