List of usage examples for javax.swing JFrame add
public Component add(Component comp)
From source file:MouseMoveScale.java
public static void main(String[] args) { JFrame frame = new JFrame("Moving and Scaling"); MouseMoveScale m = new MouseMoveScale(); m.setDoubleBuffered(true);//from w w w. j a va2 s . c om frame.add(m); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(300, 300); frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JFrame frame = new JFrame("DefaultButton"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Icon warnIcon = new ImageIcon("yourFile.gif"); JButton button2 = new JButton(warnIcon); frame.add(button2); frame.setSize(300, 200);//from w w w . j a v a 2 s . com frame.setVisible(true); }
From source file:Main.java
public static void main(String[] a) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel buttonPanel = new JPanel(new FlowLayout(), true); buttonPanel.add(new JButton("A")); frame.add(buttonPanel); frame.setSize(300, 200);/*from w w w.j av a 2 s . c om*/ frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); JPanel panel = new JPanel(new GridLayout(10, 10, 10, 10)); for (int i = 0; i < 100; i++) { panel.add(new JButton(String.valueOf(i))); }// w ww . j a v a 2 s . c om frame.add(panel); frame.setSize(600, 600); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override/*from ww w. jav a 2 s .c o m*/ public void run() { JFrame frame = new JFrame("Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(new JScrollPane(new MyTextArea())); frame.pack(); frame.setVisible(true); } }); }
From source file:Main.java
public static void main(String args[]) { JFrame f = new JFrame("Label Demo"); f.setLayout(new FlowLayout()); f.setSize(300, 200);// www . j a v a 2s . co m f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label = new JLabel("java2s.com"); f.add(label); f.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JFrame frame = new JFrame("Custom Tip Demo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Main list = new Main(); JScrollPane scrollPane = new JScrollPane(list); frame.add(scrollPane); frame.setSize(300, 300);/* w ww.jav a 2s . c om*/ frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JFrame frame = new JFrame("DefaultButton"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Icon warnIcon = new ImageIcon("Warn.gif"); JButton button3 = new JButton("Warning", warnIcon); frame.add(button3); frame.setSize(300, 200);/*from www . jav a2 s.co m*/ frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel progressBarPanel = new Main(); frame.add(progressBarPanel); frame.pack();/*from w w w .j av a2 s. co m*/ frame.setVisible(true); }
From source file:LoadingWebPageToJEditorPane.java
public static void main(String[] a) throws Exception { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JEditorPane editorPane = new JEditorPane(); editorPane.setPage(new URL("http://www.java2s.com")); frame.add(new JScrollPane(editorPane)); frame.setSize(300, 200);//from w w w . j a v a 2 s . c o m frame.setVisible(true); }