List of usage examples for javax.swing JFrame setTitle
public void setTitle(String title)
From source file:CustomEventPanel.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("Customized Event"); frame.setSize(300, 80);//from w w w . j a va2s . co m frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); Container contentPane = frame.getContentPane(); contentPane.add(new CustomEventPanel()); frame.show(); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("Customized Event"); frame.setSize(300, 80);// w w w . j av a 2 s . c om frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); Container contentPane = frame.getContentPane(); contentPane.add(new Main()); frame.setVisible(true); }
From source file:ColorAction.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("SeparateGUITest"); frame.setSize(300, 200);//w w w . j av a 2s. co m frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); JPanel panel = new JPanel(); Action blueAction = new ColorAction("Blue", new ImageIcon("blue-ball.gif"), Color.blue, panel); Action yellowAction = new ColorAction("Yellow", new ImageIcon("yellow-ball.gif"), Color.yellow, panel); Action redAction = new ColorAction("Red", new ImageIcon("red-ball.gif"), Color.red, panel); panel.add(new JButton(yellowAction)); panel.add(new JButton(blueAction)); panel.add(new JButton(redAction)); panel.registerKeyboardAction(yellowAction, KeyStroke.getKeyStroke(KeyEvent.VK_Y, 0), JComponent.WHEN_IN_FOCUSED_WINDOW); panel.registerKeyboardAction(blueAction, KeyStroke.getKeyStroke(KeyEvent.VK_B, 0), JComponent.WHEN_IN_FOCUSED_WINDOW); panel.registerKeyboardAction(redAction, KeyStroke.getKeyStroke(KeyEvent.VK_R, 0), JComponent.WHEN_IN_FOCUSED_WINDOW); Container contentPane = frame.getContentPane(); contentPane.add(panel); JMenu m = new JMenu("Color"); m.add(yellowAction); m.add(blueAction); m.add(redAction); JMenuBar mbar = new JMenuBar(); mbar.add(m); frame.setJMenuBar(mbar); frame.show(); }
From source file:MouseDragActionPanel.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("MouseTest"); frame.setSize(300, 200);/*from ww w.j ava 2 s .co m*/ frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); Container contentPane = frame.getContentPane(); contentPane.add(new MouseDragActionPanel()); frame.show(); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setSize(300, 300);//from w ww . j a v a 2 s .c o m frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("System LAF Demo"); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } SwingUtilities.updateComponentTreeUI(frame); frame.setVisible(true); }
From source file:edu.gmu.isa681.client.Main.java
public static void main(String[] args) { log.info("Setting look and feel..."); try {/* w ww . j a v a 2 s. c o m*/ for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception ex1) { log.warn(ex1.getMessage(), ex1); log.warn("Nimbus is not available."); log.warn("Switching to system look and feel"); log.warn("Some GUI discrepancies may occur!"); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception ex2) { log.error(ex2.getMessage(), ex2); log.error("Could not setup a look and feel."); System.exit(1); } } log.info("Initializing GUI..."); final JFrame frame = new JFrame(); frame.setTitle("GoForward"); frame.setBackground(new Color(0, 100, 0)); UIManager.put("nimbusBase", new Color(0, 100, 0)); //UIManager.put("nimbusBlueGrey", new Color(0, 100, 0)); UIManager.put("control", new Color(0, 100, 0)); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { frame.setPreferredSize(frame.getSize()); } }); Dimension dim = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); if (dim.width < 1366) { frame.setPreferredSize(new Dimension(800, 600)); } else { frame.setPreferredSize(new Dimension(1200, 700)); } //frame.setResizable(false); frame.setLocationByPlatform(true); frame.pack(); Client client = new Client("localhost", Constants.SERVER_PORT); Controller controller = new Controller(client, frame); controller.applicationStarted(); frame.setLocationRelativeTo(null); frame.setVisible(true); log.info("Started"); }
From source file:de.alpharogroup.duplicate.files.panels.progressbar.ImagePanelTest.java
/** * The main method.//from w w w . j av a2 s . c o m * * @param args the arguments */ public static void main(String[] args) { final JFrame frame = new JFrame(); frame.addWindowListener(new CloseWindow()); frame.setTitle("ImagePanelTest"); ApplicationContext ctx = SpringApplicationContext.getInstance().getApplicationContext(); Resource resource = ctx.getResource("classpath:images/EngineHierarchy.PNG"); Resource log4jconfig = ctx.getResource("classpath:conf/log4j/log4jconfig.xml"); try { DOMConfigurator.configure(log4jconfig.getURL()); } catch (FactoryConfigurationError e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } File imageFile = null; try { imageFile = resource.getFile(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } BufferedImage image = null; try { image = javax.imageio.ImageIO.read(imageFile); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } ImagePanel pnlIconPanel = new ImagePanel(image); frame.add(pnlIconPanel); frame.setBounds(0, 0, 534, 336); frame.setVisible(true); }
From source file:com.jgoodies.validation.tutorial.formatted.NumberExample.java
public static void main(String[] args) { try {/*from w w w. j a v a 2s . co m*/ UIManager.setLookAndFeel("com.jgoodies.looks.plastic.PlasticXPLookAndFeel"); } catch (Exception e) { // Likely Plastic is not in the classpath; ignore it. } JFrame frame = new JFrame(); frame.setTitle("Formatted :: Numbers"); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); JComponent panel = new NumberExample().buildPanel(); frame.getContentPane().add(panel); frame.pack(); TutorialUtils.locateOnScreenCenter(frame); frame.setVisible(true); }
From source file:com.lcdfx.pipoint.PiPoint.java
public static void main(final String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { SwingUtilities.invokeLater(new Runnable() { public void run() { JFrame frame = new PiPoint(args); frame.setTitle(APPLICATION_NAME); frame.setIconImage(/* w w w .ja v a 2 s . c o m*/ new ImageIcon(PiPoint.class.getResource("/resources/pipoint_icon.png")).getImage()); frame.pack(); frame.setVisible(true); } }); }
From source file:com.jgoodies.validation.tutorial.formatted.DateExample.java
public static void main(String[] args) { try {/*w w w . j ava 2 s . c o m*/ UIManager.setLookAndFeel("com.jgoodies.looks.plastic.PlasticXPLookAndFeel"); } catch (Exception e) { // Likely Plastic is not in the classpath; ignore it. } JFrame frame = new JFrame(); frame.setTitle("Formatted :: Dates"); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); JComponent panel = new DateExample().buildPanel(); frame.getContentPane().add(panel); frame.pack(); TutorialUtils.locateOnScreenCenter(frame); frame.setVisible(true); }