List of usage examples for javax.swing JFrame setSize
public void setSize(int width, int height)
The width and height values are automatically enlarged if either is less than the minimum size as specified by previous call to setMinimumSize .
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame("Composition"); frame.add(new CompositingDST_ATOP()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400, 120); frame.setVisible(true);//from w ww. jav a 2 s . c o m }
From source file:MyButtonUI.java
public static void main(String argv[]) { JFrame f = new JFrame(); f.setSize(400, 300); f.getContentPane().setLayout(new FlowLayout()); JPanel p = new JPanel(); JButton bt1 = new JButton("Click Me"); bt1.setUI(new MyButtonUI()); p.add(bt1);/* www.j av a 2s. c o m*/ f.getContentPane().add(p); WindowListener wndCloser = new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }; f.addWindowListener(wndCloser); f.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JPanel panel = new JPanel(new BorderLayout()); JLabel label = new JLabel("Name: "); label.setDisplayedMnemonic(KeyEvent.VK_N); JTextField textField = new JTextField(); textField.setHorizontalAlignment(JTextField.CENTER); label.setLabelFor(textField);/*from w w w . ja v a2 s . c o m*/ panel.add(label, BorderLayout.WEST); panel.add(textField, BorderLayout.CENTER); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(panel, BorderLayout.NORTH); frame.setSize(250, 150); frame.setVisible(true); }
From source file:TabComponent.java
public static void main(String[] args) { JTabbedPane pane = new JTabbedPane(); String title = "Tab"; pane.add(title, new JLabel(title)); pane.setTabComponentAt(0, new TabComponent(title, pane)); JFrame frame = new JFrame("Tab Component Demo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(pane);//from ww w .jav a 2 s .co m frame.setSize(500, 200); frame.setVisible(true); }
From source file:TransformScale.java
public static void main(String[] a) { JFrame f = new JFrame(); f.getContentPane().add(new TransformScale()); f.setSize(650, 550); f.show();//from w w w . ja v a 2 s .c o m }
From source file:Main.java
public static void main(String args[]) { final JTextField textField = new JTextField(15); JButton buttonCut = new JButton("Cut"); JButton buttonPaste = new JButton("Paste"); JButton buttonCopy = new JButton("Copy"); JFrame jfrm = new JFrame("Cut, Copy, and Paste"); jfrm.setLayout(new FlowLayout()); jfrm.setSize(230, 150); jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); buttonCut.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent le) { textField.cut();/*from w ww . j a va 2s. c o m*/ } }); buttonPaste.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent le) { textField.paste(); } }); buttonCopy.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent le) { textField.copy(); } }); textField.addCaretListener(new CaretListener() { public void caretUpdate(CaretEvent ce) { System.out.println("All text: " + textField.getText()); if (textField.getSelectedText() != null) System.out.println("Selected text: " + textField.getSelectedText()); else System.out.println("Selected text: "); } }); jfrm.add(textField); jfrm.add(buttonCut); jfrm.add(buttonPaste); jfrm.add(buttonCopy); jfrm.setVisible(true); }
From source file:TextAttributesSize.java
public static void main(String[] args) { JFrame frame = new JFrame("Text attributes"); frame.add(new TextAttributesSize()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(620, 190); frame.setLocationRelativeTo(null);/*from ww w. j a va2s . c o m*/ frame.setVisible(true); }
From source file:Main.java
public static void main(String argv[]) { Main pane = new Main(); for (int n = 1; n <= 4; n += 1) { pane.appendNaive(Color.black, String.valueOf(n) + ' '); }//from w ww . ja v a2 s . co m JFrame f = new JFrame("ColorPane example"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setContentPane(new JScrollPane(pane)); f.setSize(600, 400); f.setVisible(true); }
From source file:GradientsVertical.java
public static void main(String[] args) { JFrame frame = new JFrame("GradientsVertical"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new GradientsVertical()); frame.setSize(350, 350); frame.setLocationRelativeTo(null);/* w ww.j a v a 2s. c om*/ frame.setVisible(true); }
From source file:Colors.java
public static void main(String[] args) { JFrame frame = new JFrame("Colors"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new Colors()); frame.setSize(360, 300); frame.setLocationRelativeTo(null);//w ww.j a v a 2 s. c o m frame.setVisible(true); }