Questions tagged [jmenu]

361 questions
5
votes
2 answers

JMenuBar not showing

I seem to have done everything correct. I just need to implement a simple JMenuBar but it seems to be not working. Can someone please help me out in this? import java.awt.*; import java.awt.event.*; import javax.swing.*; import…
user1450466
  • 51
  • 1
  • 1
  • 2
5
votes
2 answers

How do I create this special menu bar with Java Swing?

I am trying to implement this type of menu using Swing. Is there any off-the-shelf solution (free and/or commercial) yet?
John Vu
  • 163
  • 1
  • 3
  • 7
5
votes
2 answers

Java JMenu - Selected and Deselected feature

I've inserted a JMenu (instance named: exitMenu) without any JMenuItem, so my intention is to make available a way to EXIT the program without access unnecessary menu items, since my program has just one JMenu object (Someone might says: WTF!!!…
LucDaher
  • 157
  • 2
  • 12
4
votes
1 answer

How to prevent JMenuItem from closing Menu upon clicking the JMenuItem

How do I prevent a JMenuItem from closing the menu when the JMenuItem is clicked? The JMenuItem is enabled. So this is the scenario, I have 3 JMenuItems: JMenuItem: A, B, C; C displays an integer X. A and B are used to increment or decrement X by a…
Philip Nguyen
  • 871
  • 2
  • 10
  • 29
4
votes
2 answers

Creating menus for JApplet

I am making a simple game where numbers fall from top to bottom and I have to type the number. (number is erased as I type the number) This is coordinated with a Zen.java which is a JApplet file. I am trying to make a menu for this game with a…
金允雄Oliver
  • 229
  • 2
  • 13
4
votes
1 answer

How to catch click on a JMenu element?

I'm developping a Java/Swing application with a menu using JMenuBar, JMenu and JMenuItem. System look and fell is applied to the UI. UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() ); I have several top level elements for my…
Sly
  • 2,105
  • 5
  • 22
  • 28
4
votes
2 answers

Why my ChangeListener reacts only for JMenu, and not for JMenuItem?

Now, I have a JMenu, and some JMenuItems in it. I want my program to perform some action when JMenu's and JMenuItem's state is changed to "selected". I don't use MouseLitener's MouseOver, because I want user to be able to navigate in menu using…
nicks
  • 2,161
  • 8
  • 49
  • 101
4
votes
1 answer

Enabling Swing Menus on OSX with Java7

I have a swing application in which I need to enable a JMenu from a different thread. I'm doing this on OSX and am using the native screen menu via apple.laf.useScreenMenuBar. Since switching to java 7 the initially disabled menus now never become…
Simon Andrews
  • 317
  • 1
  • 5
  • 10
4
votes
3 answers

Create multiple menubars with icons in Swing

I am working on a Swing application in which I have to create multiple menubars on clicking a menu. The other menubar either should be added or removed from the container. I have to use an icon above and below text in the menu, but I have not…
adesh kumar
  • 129
  • 3
  • 10
4
votes
2 answers

JMenu doesn't appear until I minimize or resize the JFrame

I have a GUI with a JMenuBar, the problem is that sometimes a JMenu doesn't appear until i resize or minimize the JFrame. Can someone help me?
4
votes
3 answers

Setting alignment of title text in a JMenu component

Simply put, JMenu.setHorizontalAligment(SwingConstants.CENTER) does nothing and the text is still left-aligned (using the Windows LAF). Is there any method of aligning the text in a menu header (not the JMenuItem - the JMenus themselves)? I'm using…
Gorbles
  • 1,169
  • 12
  • 27
4
votes
3 answers

JTattoo appears in JMenu dropdown

I used JTattoo in my java file successfully. But The "JTattoo" word appears in the drop down on JMenu. Is there any way to get rid of it? or Can i replace that Text?
Reynold
  • 41
  • 1
  • 2
3
votes
3 answers

scope of the mouse adapter

I am wonder what the scope of the MouseAdapter is in this case. class foo extends JPanel() { private JMenu edit = new JMenu(); public foo() { this.edit.getItem(0).addMouseListener(new MouseAdapter(){ @Override public…
Cong Hui
  • 633
  • 1
  • 13
  • 25
3
votes
2 answers

Add vertical text to JMenu

I want to add a vertical text into JMenu. As shown in the picture ("JTattoo"): I search Google but didn't find a way to do. Any information will be helpful to me. Thanks in advance.
Tapas Bose
  • 28,796
  • 74
  • 215
  • 331
3
votes
1 answer

Java: JMenuItem not working with ActionMap/AbstractAction

Generic code... For some reason my JMenuItem is not performing actions. I made a frame, a JMenuBar and a JMenuItem, everything is where it should be. I can click the JMenuItem just fine, it highlights and closes the menu properly but no action is…
Jeremy
  • 1,364
  • 1
  • 8
  • 16
1
2
3
24 25