- JMenu in the JDK7 Javadoc
Questions tagged [jmenu]
361 questions
0
votes
1 answer
How do I resize my JMenuItem to fit a JButton?
Here is the code I am using:
JMenu menu = new JMenu("Menu");
JMenuItem item = new JMenuItem("Add");
item.add(new JButton("SOMETHING A BIT WORDY"));
menu.add(item);
// ...
JMenuBar menuBar = new JMenuBar();
menuBar.addMenu(menu);
JFrame frame =…

sdasdadas
- 23,917
- 20
- 63
- 148
0
votes
2 answers
images in jmenu from jar file in java
Dear Stackoverflow Developers i have to load image as an icon to jmenu from jar.
I am using the following code . It is throwing the null pointer exception but when i am setting the icon with imageicon class in jframe, it is showing the icon in…

adesh kumar
- 129
- 3
- 10
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
1 answer
call actionperformed method on clicking jmenu
can i call actionperformed method with jmenu using swing
i am using the following code
JMenu menu1= new JMenu("File");
MenuBar mb= new MenuBar();
mb.add(menu1);
set JmenuBar(mb)
menu1.addActionListener(this);
public…

ADESH RAJPUT
- 131
- 1
- 5
- 10
0
votes
2 answers
JMenu submenu little arrow icon indicator
Does anyone know how to control the display of the tiny little arrow that appears on submenus of JMenu?
Can I change it?
Can I disable it?
Can I move it?
Also, I notice that this arrow doesn't appear on top level JMenus only when they are submenus…

springcorn
- 611
- 2
- 15
- 28
0
votes
1 answer
JMenuItem doesn't work to dynamically add components
I have a frame with a JMenuBar. When I press one of the JMenuItems I want to add a JLabel to the frame, and it doesn't work. I don't get it ... it's in the same class.
public class GuiMain {
private JLabel logo_headsup;
JFrame frame1 = new…

que1326
- 2,227
- 4
- 41
- 58
0
votes
2 answers
disable JMenu flowing
While making some small app in swing I have encountered a little issue. I have a JMenuBar with few JMenus, some of which have MenuListeners added and they act like normal buttons (menuSelected opens a dialog). The problem is, when I click on a…

joval
- 466
- 1
- 6
- 15
0
votes
1 answer
Jmenu Accordion
I am trying to make a menu that can have subclasses (looking like a webshop for ex) with the purpose of filtering some things in the GUI.!
So when you click on a menu item for example, it opens its submenus that can also be selected and when you…

RolandP
- 11
- 1
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
1 answer
Java JMenu open upwards instead of downwards
I need to display a Java JMenu opening upwards instead of downwards.
I am creating an application made of a series of JFames.
One of those JFrames hosts a JMenuBar, built by a series of JMenu instances, and given the size and the position of this…

Morriz
- 3
- 2
-1
votes
1 answer
Swing JMenu problem
Why I can't add JMenuBar to JToolBar, is it possible? Or I can only add menubar on frame?Tutorial says:
As the code shows, to set the menu bar for a JFrame, you use the setJMenuBar method. To add a JMenu to a JMenuBar, you use the add(JMenu)…

Martin
- 767
- 2
- 9
- 21
-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…

DaCastle
- 1
-1
votes
1 answer
How to have a class which contains all the UI elements for a JFrame?
so i've got two classes one which handels creating the JFrame and the other that would load the menu bar on the JFrame the code is like this:
import java.awt.Toolkit;
import javax.swing.JFrame;
import java.awt.Dimension;
import…

Icoder Game Dev
- 3
- 1
-1
votes
1 answer
Integrating a JMenu
This my Mainframe
public class MainFrame extends JFrame {
private ToolBar tb;
private JeuPanel panel;
MainFrame() {
super("TP1");
setLayout(new BorderLayout());
panel = new JeuPanel();
tb = new…
user10467557
-1
votes
1 answer
Error with JMenuBar (duplicates and overlaps)
I am making a window which contains, 1 JFrame and inside the JFrame contains a JMenuBar -> 3 JMenu -> Several JMenuItem in each JMenu ... inside the JFrame I also have several buttons and a JLabel.
Well the problem that happens to me is that I put…

Jorge1023
- 21
- 4