/** * Creates a new GraphicUI with the given title. * * @param title the title of the JFrame. */ public GraphicUI(String title) { JFrame.setDefaultLookAndFeelDecorated(true); f = new JFrame("BackgroundBorderExample"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final Container cp = f.getContentPane(); final JPanel p = new JPanel(); p.setLayout(new BorderLayout()); BufferedImage im = ResourceLoader.getResourceLoader().getBufferedImage(Values.MenuImages + "backsmall.jpg"); Dimension size = new Dimension(im.getWidth(null), im.getHeight(null)); f.setPreferredSize(size); f.setMinimumSize(size); f.setMaximumSize(size); f.setSize(size); final Border bkgrnd = new CentredBackgroundBorder(im); Runnable r = new Runnable() { public void run() { p.setBorder(bkgrnd); cp.repaint(); } }; SwingUtilities.invokeLater(r); readFile(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); p.add(createResolution(), BorderLayout.CENTER); p.add(createStartButton(), BorderLayout.SOUTH); cp.add(p); f.setLocationRelativeTo(null); f.pack(); f.setVisible(true); }
/** *********************************************************************** */ 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 }
public static void start() { JFrame.setDefaultLookAndFeelDecorated(true); MenuFrame frame = new MenuFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); }
public static void main(String[] args) throws Exception { System.setProperty("sun.java2d.ddscale", "true"); UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel"); JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); SwingUtilities.invokeLater( new Runnable() { public void run() { frame = new TTBFrame(); GV.setCurrFrame(frame); GV.initGV(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle(GV.MAIN_TTBFRAME_TITLE); frame.setIconImage(frame.getToolkit().getImage(GV.getImageUrl("windowicon.jpg"))); try { final MainPanel mainPanel = new TTBPanel(frame); frame.add(mainPanel, BorderLayout.CENTER); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) {} }); } catch (Exception e1) { GV.showMessageDialog(null, "初始化应用程序出错。"); e1.printStackTrace(); } frame.pack(); frame.setExtendedState(JFrame.MAXIMIZED_BOTH); frame.setVisible(true); } }); }
/** Creates new form FormularioEdad */ public FormularioEdad() { javax.swing.JFrame.setDefaultLookAndFeelDecorated(true); initComponents(); setTitle("MIS EXCEPTIONES"); setLocationRelativeTo(this); }
public void setupFrame() { JFrame.setDefaultLookAndFeelDecorated(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new GridLayout(3, 2)); frame.pack(); frame.setVisible(true); }
private static void createAndShowGUI(String firstColumnName, List<String> statNames) { try { String lookAndFeel = UIManager.getSystemLookAndFeelClassName(); UIManager.setLookAndFeel(lookAndFeel); JFrame.setDefaultLookAndFeelDecorated(true); } catch (SOAPFaultException sfe) { printSoapFaultException(sfe); } catch (Exception e) { e.printStackTrace(); } JFrame frame = new JFrame("VITop"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); String[] columnNamesArray = new String[statNames.size() + 1]; columnNamesArray[0] = firstColumnName; for (int i = 0; i < statNames.size(); i++) { columnNamesArray[i + 1] = statNames.get(i); } statsTable = new StatsTable(columnNamesArray); statsTable.setOpaque(true); frame.setContentPane(statsTable); frame.pack(); frame.setVisible(true); }
public static void main(String[] args) { JFrame.setDefaultLookAndFeelDecorated(true); SwingUtilities.invokeLater( new Runnable() { public void run() { new GridBagLayoutDemo().setVisible(true); } }); }
/** * The main method for <code>this</code> sample. The arguments are ignored. * * @param args Ignored. */ public static void main(String[] args) { JFrame.setDefaultLookAndFeelDecorated(true); SwingUtilities.invokeLater( new Runnable() { public void run() { SubstanceLookAndFeel.setSkin(new BusinessBlackSteelSkin()); new CornerRadius().setVisible(true); } }); }
public static void setLAF() { JFrame.setDefaultLookAndFeelDecorated(true); Toolkit.getDefaultToolkit().setDynamicLayout(true); System.setProperty("sun.awt.noerasebackground", "true"); try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception e) { System.err.println("Failed to set LookAndFeel"); } }
/** TODO . */ public static void setSkin() { JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); UIManager.put(SHOW_EXTRA_WIDGETS, FALSE); UIManager.put(WATERMARK_VISIBLE, TRUE); UIManager.put(WINDOW_ROUNDED_CORNERS, FALSE); SubstanceLookAndFeel.setSkin(new InsubstantialColorSkin()); }
// As before, we create the frame and add the created content pane. private void createAndShowGUI() { JFrame.setDefaultLookAndFeelDecorated(true); JFrame frame = new JFrame("[=] Calculator [=]"); // Set the content pane. frame.setContentPane(createContentPane()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); }
public static void main(String[] args) { JFrame.setDefaultLookAndFeelDecorated(true); JFrame frame = new JFrame(); frame.setTitle("Ini Title"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label = new JLabel("welcome"); frame.add(label); frame.pack(); frame.setVisible(true); }
/** * The main method for <code>this</code> sample. The arguments are ignored. * * @param args Ignored. */ public static void main(String[] args) { JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); SwingUtilities.invokeLater( new Runnable() { public void run() { SubstanceLookAndFeel.setSkin(new BusinessBlackSteelSkin()); new RegisterTabCloseChangeListener_SpecificMultipleVetoable().setVisible(true); } }); }
/** @param args */ public static void main(String[] args) { JFrame dialog = new JFrame(); JFrame.setDefaultLookAndFeelDecorated(true); dialog.setBounds(0, 0, 500, 180); dialog.setLayout(null); dialog.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); dialog.setResizable(false); // Label de processamento JLabel label = new JLabel("BUSCAR DADOS DE MANUTENÇÕES REALIZADAS PELO UNIFER"); label.setBounds(10, 10, 470, 40); dialog.add(label); label.setVisible(true); // Meeter dialog.add(jProgressBar); jProgressBar.setBounds(10, 70, 470, 40); jProgressBar.setMinimum(0); jProgressBar.setStringPainted(true); jProgressBar.setString("PARADO"); jProgressBar.setVisible(true); // Butoes JButton jbut = new JButton("Iniciar"); jbut.setBounds(170, 130, 70, 20); jbut.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { Thread queryThread = new Thread() { public void run() { BuscaManutencoes.start(); } }; queryThread.start(); } }); dialog.add(jbut); JButton jbut2 = new JButton("Sair"); jbut2.setBounds(250, 130, 70, 20); jbut2.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { System.exit(UNDEFINED_CONDITION); } }); dialog.add(jbut2); dialog.setVisible(true); centraliza(dialog); }
public static void main(String[] args) { JDialog.setDefaultLookAndFeelDecorated(true); JFrame.setDefaultLookAndFeelDecorated(true); SwingUtilities.invokeLater( new Runnable() { public void run() { SubstanceLookAndFeel.setSkin(new BusinessSkin()); new JitterbugEditor().setVisible(true); } }); }
public static void main(String[] args) { JFrame.setDefaultLookAndFeelDecorated(true); SwingUtilities.invokeLater( new Runnable() { @Override public void run() { SubstanceLookAndFeel.setSkin(new OfficeSilver2007Skin()); new TestCommandButtonSizes().setVisible(true); } }); }
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); }
private static void createAndShowGUI() { JFrame.setDefaultLookAndFeelDecorated(true); JFrame frame = new JFrame("HelloWorldString"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label = new JLabel("Hello World"); frame.getContentPane().add(label); frame.pack(); frame.setVisible(true); }
public static void main(String[] args) { texgen demo = new texgen(); JFrame.setDefaultLookAndFeelDecorated(true); JFrame frame = new JFrame("texgen"); frame.setSize(400, 400); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(demo.drawable); frame.setVisible(true); demo.drawable.requestFocusInWindow(); }
@Override public UIDefaults getDefaults() { try { final Method superMethod = BasicLookAndFeel.class.getDeclaredMethod("getDefaults"); superMethod.setAccessible(true); final UIDefaults metalDefaults = (UIDefaults) superMethod.invoke(new MetalLookAndFeel()); final UIDefaults defaults = (UIDefaults) superMethod.invoke(base); if (SystemInfo.isLinux) { if (!Registry.is("darcula.use.native.fonts.on.linux")) { Font font = findFont("DejaVu Sans"); if (font != null) { for (Object key : defaults.keySet()) { if (key instanceof String && ((String) key).endsWith(".font")) { defaults.put(key, new FontUIResource(font.deriveFont(13f))); } } } } else if (Arrays.asList("CN", "JP", "KR", "TW") .contains(Locale.getDefault().getCountry())) { for (Object key : defaults.keySet()) { if (key instanceof String && ((String) key).endsWith(".font")) { final Font font = defaults.getFont(key); if (font != null) { defaults.put(key, new FontUIResource("Dialog", font.getStyle(), font.getSize())); } } } } } LafManagerImpl.initInputMapDefaults(defaults); initIdeaDefaults(defaults); patchStyledEditorKit(defaults); patchComboBox(metalDefaults, defaults); defaults.remove("Spinner.arrowButtonBorder"); defaults.put("Spinner.arrowButtonSize", JBUI.size(16, 5).asUIResource()); MetalLookAndFeel.setCurrentTheme(createMetalTheme()); if (SystemInfo.isWindows && Registry.is("ide.win.frame.decoration")) { JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); } if (SystemInfo.isLinux && JBUI.isHiDPI()) { applySystemFonts(defaults); } defaults.put("EditorPane.font", defaults.getFont("TextField.font")); return defaults; } catch (Exception e) { log(e); } return super.getDefaults(); }
/** * ������ѡ���� * * @param cp ����Ҫ�ı�Ŀؼ� * @param style ���ܽ����±� * @return ���سɹ�������� */ public static boolean setUI(Component cp, int style) { try { switch (style) { case 0: UIManager.setLookAndFeel("com.sun.java.swing.plaf." + "windows.WindowsLookAndFeel"); break; case 1: UIManager.setLookAndFeel("javax.swing.plaf." + "metal.MetalLookAndFeel"); break; case 2: UIManager.setLookAndFeel("com.sun.java.swing.plaf." + "motif.MotifLookAndFeel"); break; case 3: UIManager.setLookAndFeel( "com.sun.java.swing.plaf." + "windows.WindowsClassicLookAndFeel"); break; case 4: UIManager.setLookAndFeel("com.incors.plaf." + "alloy.AlloyLookAndFeel"); break; case 5: UIManager.setLookAndFeel("soft.wes.feels." + "GlassThemeAlloyLookAndFeel"); break; case 6: UIManager.setLookAndFeel("soft.wes.feels." + "AcidThemeAlloyLookAndFeel"); break; case 7: UIManager.setLookAndFeel("soft.wes.feels." + "BedouinThemeAlloyLookAndFeel"); break; case 8: UIManager.setLookAndFeel("soft.wes.feels." + "DefaultThemeAlloyLookAndFeel"); break; case 9: UIManager.put("swing.boldMetal", Boolean.FALSE); // �����öԻ������ JDialog.setDefaultLookAndFeelDecorated(true); // ���������ô������ JFrame.setDefaultLookAndFeelDecorated(true); Toolkit.getDefaultToolkit().setDynamicLayout(true); System.setProperty("sun.awt.noerasebackground", "true"); UIManager.setLookAndFeel(new MetalLookAndFeel()); break; } } catch (Exception ex) { JOptionPane.showMessageDialog(null, "����ʧ��,��ԭ�����ʾ"); return false; } SwingUtilities.updateComponentTreeUI(cp); cp.repaint(); return 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()); }
private static void createAndShowGUI() { JFrame.setDefaultLookAndFeelDecorated(true); JFrame frame = new JFrame("[=] BoxLayout Demonstration! [=]"); // Create and set up the content pane. BoxLayoutExample demo = new BoxLayoutExample(); frame.setContentPane(demo.createContentPane()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); }
public static void setSubstanceLaF(SubstanceLookAndFeel laf) { JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); UIManager.put(SHOW_EXTRA_WIDGETS, FALSE); UIManager.put(WATERMARK_VISIBLE, FALSE); UIManager.put(WINDOW_ROUNDED_CORNERS, FALSE); try { UIManager.setLookAndFeel(laf); } catch (Exception e) { e.printStackTrace(); } }
// --------------------------------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); }
/** * 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("GridLayoutDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Set up the content pane. addComponentsToPane(frame.getContentPane()); // Display the window. frame.pack(); frame.setVisible(true); }
public static void main(String[] args) { JFrame.setDefaultLookAndFeelDecorated(true); SwingUtilities.invokeLater( new Runnable() { public void run() { try { UIManager.setLookAndFeel(new SubstanceGraphiteLookAndFeel()); } catch (Exception e) { System.out.println("Substance Raven Graphite failed to initialize"); } Walkthrough w = new Walkthrough(); w.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("SelectionDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Set up the content pane. SelectionDemo controller = new SelectionDemo(); controller.buildUI(frame.getContentPane()); // Display the window. frame.setSize(400, 400); frame.setLocationRelativeTo(null); 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); }