• Post Reply Bookmark Topic Watch Topic
  • New Topic

JMenu + JPanel Problem  RSS feed

Gordon Freeman
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, i know it might be a little strange what I'm trying to do but none the less I have to do it. So here is my problem:
I neeed to add a JPanel, containing several components, as a JMenuItem to a JMenu, and have it behave normally(allowing me to select options, check/uncheck boxes and any other similar activities).
I managed to get it to show up, but the form that apears in the JMenu is uselles. All components from inside the JPannel do not react the way they should. It's like the events are't even passed . Here is the code I have so far (any help is MOSTLY appreciated):

import java.awt.*;
import javax.swing.*;

public class Post {

static GridBagConstraints constraints = new GridBagConstraints();
static JFrame frame = new JFrame("Advanced Menu");
JPanel aditionalPane = new JPanel(new GridBagLayout());;
JCheckBox jco;
JCheckBox jct;

private JPanel advancedOpts(){

constraints.gridx = 0;
constraints.gridy = 0;
jco = new JCheckBox("JCheck One", true);

constraints.gridy = 1;
jct = new JCheckBox("Jcheck Two", true);

return this.aditionalPane;

private JMenuBar advAsMenu(){

JMenuBar menuBar = new JMenuBar();
JMenu menu = new JMenu("Advanced Menu");
JMenuItem item = new JMenuItem();

return menuBar;

public static void main(String[] args) {

Post am = new Post();

frame.setMaximumSize(new Dimension(500,500));
frame.setMinimumSize(new Dimension(500,500));
frame.setPreferredSize(new Dimension(500,500));
frame.pack( );

Thank you all in advance for all your time and support.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!