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
3
votes
4 answers

How to add three Shortcut keys ( Ctrl + Shift + C) in Java Swing Menubar?

I want to add shortcut keys in Java Swing Menubar. Below is what I have tried. jMenuItem1.setText("Create"); jMenuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,ActionEvent.CTRL_MASK)); Here I want three KeyEvent.VK_C,…
Kernel
  • 165
  • 4
  • 14
3
votes
1 answer

Setting icon in JMenuItem makes menu text match icon color

When adding a menu item (whether hard-coded as in my example below or with an Action), the color of the icon causes the color of the text of the menu item to change. This is strange and, in the case of a white or very light icon, can cause the menu…
Cajunluke
  • 3,103
  • 28
  • 28
3
votes
2 answers

How to keep menu item on top of text area?

I'm using netbeans to write the GUI. I have a menu bar with few menu items and the main window has a text area all over it. when I press the menu item,I cant see it because the text area is on top (the menu item internal frame is behind the text…
Avi
  • 69
  • 1
  • 2
3
votes
1 answer

How to remove the empty icon gap from a JMenuItem (Java Swing)?

TL;DR Is there a way to getting rid of the icon gap between the MenuItem border and the defined text? It appears as soon as I create the menu item, even if I do not set an icon, as well as if I set the icon to null. Long Version The Java application…
Iamnino
  • 360
  • 1
  • 4
  • 17
3
votes
2 answers

Keys shortcuts, Java

I want to add a hotkey to JMenuItem. I learned how to add key that look like CTRL+SOME_KEY. But what I need, is a triple hotkey. Somthing like CTRL+ALT+W. I want to add a hotkey to JMenuItem. But how should I create such hotkey?
nicks
  • 2,161
  • 8
  • 49
  • 101
3
votes
1 answer

JMenuItems painting over higher components in JLayeredPane

I have a set of JMenuItems in a JPanel on one layer of a JLayeredPane, and an emulated cursor painted in a JPanel on a higher layer. When the menu items repaint, they paint over the emulated cursor (without triggering a repaint of the cursor…
Aaron Novstrup
  • 20,967
  • 7
  • 70
  • 108
3
votes
2 answers

How to take out white borders in JMenu and JMenuItems

I'm doing this Graphic Interface with Swing. The problem that i'm having is that i can't take the white borders that are arround the JMenuItems, and paint it all of black. Here is an image: I would like to paint it like this (I have edited the…
Joaco Terniro
  • 115
  • 1
  • 2
  • 13
3
votes
2 answers

How to make window close on clicking "exit" MenuItem()?

public class Manubar extends JFrame { JMenuBar jmb; JMenu jm; JMenu jm2; JMenuItem jmt; JMenuItem jmt2; public Manubar() { setSize(500, 500); jmb = new JMenuBar(); jm = new JMenu("file"); …
chris
  • 141
  • 2
  • 8
3
votes
2 answers

How to get boolean of JCheckBoxMenuItem?

I have this JCheckBoxMenuItem as a field: private JCheckBoxMenuItem chckbxmntmDisableSending = new JCheckBoxMenuItem("Disable Sending"); I need to find out whether it is checked or not some time later, when doing something else (pressing the send…
ifly6
  • 5,003
  • 2
  • 24
  • 47
3
votes
1 answer

how to return to my main panel in java?

I want to back to the main panel in my java application with a jMenuItem, my panels and other stuff are set with a CardLayout. So I have 3 panels and from any of them I want to be able to return to the first panel using this menu item to start a new…
Angel Ruvalcaba
  • 105
  • 1
  • 6
3
votes
3 answers

Adding a submenu

So I tried to look at the Java docs for help for this but got confused pretty quickly. I am trying to add a submenu to the menu item 'Edit' which will have submenus Copy and Paste, and I'm note sure how to do it. I have a submenu variable created,…
Daniel D
  • 369
  • 3
  • 5
  • 14
3
votes
0 answers

How to remove the border on a JMenu or JMenuItem

I'm using Eclipse Luna with Java 1.7 and am trying to create a JPanel that has a JMenuBar. This JMenuBar contains a JMenu which again contains a JMenuItem. To fit the whole JMenuBar into my project's visual design, I changed the background and…
Almato
  • 53
  • 8
3
votes
3 answers

How to get the index of a JMenuItem in the JMenu?

I need to find the index of a specific JMenuItem in a JMenu so I can programatically insert() a new JMenuItem right before it. How can I go about doing that?
Aviv Cohn
  • 15,543
  • 25
  • 68
  • 131
3
votes
1 answer

How to change icon for JmenuItem on rollover

I want to put a rollover effect in my JMenu this is my code: Icon firstPicAcc= new ImageIcon(Welcome.class.getResource("/app/resources/user1.jpg")); Icon secPicAcc= new ImageIcon(Welcome.class.getResource("/app/resources/user2.jpg")); JMenu…
harraypotter
  • 111
  • 2
  • 2
  • 11
3
votes
3 answers

How to set a size for JMenuItem?

As you can see, it's ugly to have these kind of JMenuItems. The width of the menu items is quite small. Here is the code: JMenu menuOne=new JMenu("MenuOne"); JMenu menuTwo=new JMenu("MenuTwo"); JMenu menuThree=new JMenu("MenuThree"); …
Zalberth
  • 308
  • 1
  • 2
  • 12
1 2
3
22 23