List of usage examples for javax.swing JFrame setTitle
public void setTitle(String title)
From source file:FillPolyPanel.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("FillPoly"); frame.setSize(300, 200);/* w ww .j a v a 2 s. c o m*/ frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); Container contentPane = frame.getContentPane(); contentPane.add(new FillPolyPanel()); frame.show(); }
From source file:FontPanel.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("NotHelloWorld2"); frame.setSize(350, 200);/*from w ww . j a va 2s .c om*/ frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); Container contentPane = frame.getContentPane(); contentPane.add(new FontPanel()); frame.show(); }
From source file:MulticastEvent.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("MulticastTest"); frame.setSize(300, 200);/*from ww w. j a v a 2 s .c om*/ frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); Container contentPane = frame.getContentPane(); contentPane.add(new MulticastEvent()); frame.show(); }
From source file:WindowsLookAndFeelDemo.java
public static void main(String[] args) { try {//from w w w .j av a 2 s . c o m UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception e) { e.printStackTrace(); } JLabel label = new JLabel("Label"); JTextField field = new JTextField("www.java2s.com!"); JList list = new JList(new String[] { "A", "B", "C" }); JScrollPane listPane = new JScrollPane(list); listPane.setPreferredSize(new Dimension(250, 100)); JScrollPane treePane = new JScrollPane(new JTree()); treePane.setPreferredSize(new Dimension(250, 100)); JButton button = new JButton("Click me"); JPanel cp = new JPanel(); cp.add(label); cp.add(field); cp.add(listPane); cp.add(treePane); cp.add(button); JFrame frame = new JFrame(); frame.setTitle("Windows Look and Feel Demo"); frame.setPreferredSize(new Dimension(280, 300)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(cp); frame.pack(); frame.setVisible(true); }
From source file:GTKLookAndFeelDemo.java
public static void main(String[] args) { try {//w ww . j a v a 2 s.c o m UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); } catch (Exception e) { e.printStackTrace(); } JLabel label = new JLabel("Label"); JTextField field = new JTextField("www.java2s.com!"); JList list = new JList(new String[] { "A", "B", "C" }); JScrollPane listPane = new JScrollPane(list); listPane.setPreferredSize(new Dimension(250, 100)); JScrollPane treePane = new JScrollPane(new JTree()); treePane.setPreferredSize(new Dimension(250, 100)); JButton button = new JButton("Click me"); JPanel cp = new JPanel(); cp.add(label); cp.add(field); cp.add(listPane); cp.add(treePane); cp.add(button); JFrame frame = new JFrame(); frame.setTitle("Windows Look and Feel Demo"); frame.setPreferredSize(new Dimension(280, 300)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(cp); frame.pack(); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("Sketch"); frame.setSize(300, 200);//from ww w. ja va2s . co m frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container contentPane = frame.getContentPane(); contentPane.add(new Main()); frame.setVisible(true); }
From source file:SketchPanel.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("Sketch"); frame.setSize(300, 200);/*w w w. j a v a 2 s. c o m*/ frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); Container contentPane = frame.getContentPane(); contentPane.add(new SketchPanel()); frame.show(); }
From source file:Main.java
public static void main(String[] args) { JFrame f = new JFrame(); f.setTitle("Example2"); f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); JPanel p1 = new JPanel(new FlowLayout(FlowLayout.CENTER)); p1.setBorder(new TitledBorder(new LineBorder(Color.BLACK), "JPanel 1")); for (int i = 0; i < NB1; i++) p1.add(new JButton("Button " + i)); JPanel p2 = new JPanel(new FlowLayout(FlowLayout.CENTER)); p2.setBorder(new TitledBorder(new LineBorder(Color.BLACK), "JPanel 2")); for (int i = NB1; i < NB2; i++) p2.add(new JButton("Button " + i)); JPanel p3 = new JPanel(new FlowLayout(FlowLayout.CENTER)); p3.setBorder(new TitledBorder(new LineBorder(Color.BLACK), "JPanel 3")); for (int i = NB2; i < NB3; i++) p3.add(new JButton("Button " + i)); JPanel global = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; // added gbc.weightx = 1.0f; // added gbc.gridy = 0;// w ww . j a v a 2 s . com global.add(p1, gbc); gbc.gridy++; global.add(p2, gbc); gbc.gridy++; global.add(p3, gbc); f.add(global); f.pack(); f.setVisible(true); }
From source file:EventQueuePanel.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("EventQueueTest"); frame.setSize(300, 200);//from w w w .ja va 2 s . c o m frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); Container contentPane = frame.getContentPane(); contentPane.add(new EventQueuePanel()); frame.show(); }
From source file:JPasswordFieldTest.java
public static void main(String[] args) { JFrame.setDefaultLookAndFeelDecorated(true); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("JTextField Test"); frame.setLayout(new GridLayout(2, 2)); JLabel label = new JLabel("User Name:", SwingConstants.RIGHT); JLabel label2 = new JLabel("Password:", SwingConstants.RIGHT); JTextField userNameField = new JTextField(20); JPasswordField passwordField = new JPasswordField(); frame.add(label);//from w ww . java 2s .c o m frame.add(userNameField); frame.add(label2); frame.add(passwordField); frame.setSize(200, 70); frame.setVisible(true); }