/** *********************************************************************** */ private static void createAndShowGUI() { JFrame.setDefaultLookAndFeelDecorated(true); // give JFrame nice decorations JFrame frame = new JFrame("Java GUI"); // create the JFrame frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE); // set up the JFrame to end the program when it closes Container c = frame.getContentPane(); c.setLayout(new BorderLayout()); ColorBars drawingPanel = new ColorBars(); // set up the panel to draw in drawingPanel.setBackground(Color.BLACK); // the the background to black drawingPanel.btnDraw = new JButton("Click me"); // instantiate a swing button drawingPanel.btnDraw.addActionListener(drawingPanel); // register the panel with the button drawingPanel.btnClear = new JButton("Clear Screen"); drawingPanel.btnClear.addActionListener(drawingPanel); Panel buttonPanel = new Panel(); // instantiate the panel for buttons buttonPanel.add(drawingPanel.btnDraw); // add the swing button the the button panel buttonPanel.add(drawingPanel.btnClear); c.add( drawingPanel, BorderLayout.CENTER); // add the drawing panel to the frame (take up the entire frame) c.add(buttonPanel, BorderLayout.SOUTH); // add the button panel to the bottom of the frame frame.setExtendedState(JFrame.MAXIMIZED_BOTH); // set the window to maximized frame.setSize(600, 400); // set the frame size (in case user un-maximizes frame.setVisible(true); // display the frame }
private static void createAndShowMain() { JFrame.setDefaultLookAndFeelDecorated(true); JFrame frame = new JFrame("RT Prune Algorithm Simulator"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); Main newContentPane = new Main(frame); newContentPane.setOpaque(true); frame.setContentPane(newContentPane); frame.pack(); frame.setExtendedState(Frame.MAXIMIZED_BOTH); frame.setVisible(true); }
/** @see pong.ApplicationState#init() */ @Override public void init() { JFrame.setDefaultLookAndFeelDecorated(false); // Set background scene. backgroundScene = new PhysicsScene(CollidableMap.getMainMenuMap(), null, null, .0f, new RandomBallStrategy()); // Create GUI. mainFrame = new PongFrame("Pong Adventures -Main menu-", backgroundScene, false, null, false); mainFrame.addWindowListener(this); mainFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); mainFrame.setResizable(false); // Setting frame to center of screen. Point center = GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint(); mainFrame.setBounds( center.x - Global.windowSize.width / 2, center.y - Global.windowSize.height / 2, Global.windowSize.width, Global.windowSize.height); newGameButton = new JButton("New Game"); newGameButton.setAlignmentX(Component.CENTER_ALIGNMENT); newGameButton.addActionListener(this); settingsButton = new JButton("Settings"); settingsButton.setAlignmentX(Component.CENTER_ALIGNMENT); settingsButton.addActionListener(this); exitButton = new JButton("Exit"); exitButton.setAlignmentX(Component.CENTER_ALIGNMENT); exitButton.addActionListener(this); Container content = mainFrame.getContentPane(); content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS)); content.add(Box.createGlue()); content.add(Box.createGlue()); content.add(newGameButton); content.add(Box.createGlue()); content.add(settingsButton); content.add(Box.createGlue()); content.add(exitButton); content.add(Box.createGlue()); content.add(Box.createGlue()); mainFrame.setVisible(true); Debugger.debugWriteln("Initializing main menu.", this.getClass()); }
public static void main(String[] args) { sccolorlight demo = new sccolorlight(); // JFrame.setDefaultLookAndFeelDecorated(true); JFrame frame = new JFrame("sccolorlight"); frame.setSize(500, 500); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(demo.drawable); frame.setVisible(true); demo.drawable.requestFocusInWindow(); }
// --------------------------------createAndShowGUI----------------------------- public static void createAndShowGUI() { Game thisGame = new Game(); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } JFrame.setDefaultLookAndFeelDecorated(true); thisGame.frame = new JFrame("Tactics"); thisGame.oConn = new SocketManager(); thisGame.scrBounds = thisGame.frame.getGraphicsConfiguration().getBounds(); thisGame.frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); thisGame.frame.setDefaultLookAndFeelDecorated(true); thisGame.frame.addWindowListener(thisGame); thisGame.frame.setVisible(true); }
public static void createAndShowGUI() { // Make sure we have nice window decorations. try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception e) { JFrame.setDefaultLookAndFeelDecorated(true); } // JFrame.setDefaultLookAndFeelDecorated(true); // Create and set up the window. DnDTestWindow frame = new DnDTestWindow(); // Display the window. frame.setVisible(true); }
/** * <br> * 方法说明:主方法 <br> * 输入参数: <br> * 返回类型: */ public static void main(String[] args) { JFrame.setDefaultLookAndFeelDecorated(true); // 创建窗体 JFrame frame = new JFrame("ColorChooserDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // 创建面板容器 JComponent newContentPane = new ColorChooserDemo(); newContentPane.setOpaque(true); frame.setContentPane(newContentPane); // 显示窗体 frame.pack(); frame.setVisible(true); }
/** * Create the GUI and show it. For thread safety, this method should be invoked from the * event-dispatching thread. */ private static void createAndShowGUI() { // Make sure we have nice window decorations. JFrame.setDefaultLookAndFeelDecorated(true); // Create and set up the window. JFrame frame = new JFrame("CustomIconDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Set up the content pane. JComponent newContentPane = new CustomIconDemo(); newContentPane.setOpaque(true); // content panes must be opaque frame.setContentPane(newContentPane); // Display the window. frame.pack(); frame.setVisible(true); }
public serverdown() { super(); JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception ex) { // System.out.println("Failed loading L&F: "); // System.out.println(ex); } initializeComponent(); // // TODO: Add any constructor code after initializeComponent call // this.setVisible(true); }
public static void main(String args[]) { // defualt to 5 elevators int num = 5; if (args.length > 0) { Integer num_elevators = new Integer(args[0]); num = num_elevators.intValue(); } Toolkit kit = Toolkit.getDefaultToolkit(); Dimension screenSize = kit.getScreenSize(); int screenWidth = screenSize.width; int screenHeight = screenSize.height; JFrame.setDefaultLookAndFeelDecorated(true); LiftSimFrame frame = new LiftSimFrame(num); frame.setLocation(screenWidth / 3, screenHeight / 4); frame.setDefaultLookAndFeelDecorated(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.show(); }
public void createControls() { // Create all Swing components here JFrame.setDefaultLookAndFeelDecorated(true); controlFrame = new JFrame("Control"); controlFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); controlFrame.setSize(new Dimension(100, 80)); controlPanel = new JPanel(new GridLayout(1, 2)); menuBar = new JMenuBar(); menu = new JMenu("DJ Control"); startMenuItem = new JMenuItem("Start"); menu.add(startMenuItem); startMenuItem.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { controller.start(); // disableStartMenuItem(); // enableStopMenuItem(); } }); stopMenuItem = new JMenuItem("Stop"); menu.add(stopMenuItem); stopMenuItem.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { controller.stop(); // enableStartMenuItem(); // disableStopMenuItem(); } }); JMenuItem exit = new JMenuItem("Quit"); exit.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { System.exit(0); } }); menu.add(exit); menuBar.add(menu); controlFrame.setJMenuBar(menuBar); bpmTextField = new JTextField(2); bpmLabel = new JLabel("Enter BPM:", SwingConstants.RIGHT); setBPMButton = new JButton("Set"); setBPMButton.setSize(new Dimension(10, 40)); increaseBPMButton = new JButton(">>"); decreaseBPMButton = new JButton("<<"); setBPMButton.addActionListener(this); increaseBPMButton.addActionListener(this); decreaseBPMButton.addActionListener(this); JPanel buttonPanel = new JPanel(new GridLayout(1, 2)); buttonPanel.add(decreaseBPMButton); buttonPanel.add(increaseBPMButton); JPanel enterPanel = new JPanel(new GridLayout(1, 2)); enterPanel.add(bpmLabel); enterPanel.add(bpmTextField); JPanel insideControlPanel = new JPanel(new GridLayout(3, 1)); insideControlPanel.add(enterPanel); insideControlPanel.add(setBPMButton); insideControlPanel.add(buttonPanel); controlPanel.add(insideControlPanel); bpmLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); bpmOutputLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); controlFrame.getRootPane().setDefaultButton(setBPMButton); controlFrame.getContentPane().add(controlPanel, BorderLayout.CENTER); controlFrame.pack(); controlFrame.setVisible(true); }
public static void main(String[] args) { JFrame.setDefaultLookAndFeelDecorated(true); new MainMenu().setVisible(true); }
private void runGUI() { JFrame.setDefaultLookAndFeelDecorated(true); GUISafetyQues que = new GUISafetyQues(); }
private void runGUI(String bookName, String author, String genre, int avg, int pop) { JFrame.setDefaultLookAndFeelDecorated(true); GUIBookRating rate = new GUIBookRating(bookName, author, genre, avg, pop); }