All pastes #183738 Raw Edit

Miscellany

public text v1 · immutable
#183738 ·published 2006-09-27 05:16 UTC
rendered paste body
    public void createTopMenu(String menuName) {
    	JFrame frame = new JFrame();
    	frame.setTitle("Create a new menu");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(new Dimension(200,200));
        
        
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension frameSize = frame.getSize();
        frame.setLocation((screenSize.width - frameSize.width) / 2,(screenSize.height - frameSize.height) /2 );

        //Create and set up the content pane.
        TopMenu contentPane = new TopMenu(frame, menuName);
        contentPane.setOpaque(true); //content panes must be opaque
        frame.setContentPane(contentPane);

        //Display the window.
        frame.pack();
        frame.setVisible(true);	
    }