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) { JToolBar toolbar = new JToolBar(JToolBar.VERTICAL); JButton selectb = new JButton(new ImageIcon("select.gif")); JButton freehandb = new JButton(new ImageIcon("freehand.gif")); JButton shapeedb = new JButton(new ImageIcon("shapeed.gif")); JButton penb = new JButton(new ImageIcon("pen.gif")); toolbar.add(selectb);/*w w w . jav a2 s. c o m*/ toolbar.add(freehandb); toolbar.add(shapeedb); toolbar.add(penb); JFrame f = new JFrame(); f.add(toolbar, BorderLayout.WEST); f.setSize(250, 350); f.setLocationRelativeTo(null); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame f = new Main("JRadioButtonDemo"); f.setSize(300, 200); f.setVisible(true);/*from ww w.j a v a2 s .co m*/ }
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); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label = new JLabel("java2s.com"); Border border = BorderFactory.createLineBorder(Color.BLACK); label.setBorder(border);/*from w w w.ja va2 s.c o m*/ label.setPreferredSize(new Dimension(150, 100)); label.setText("Centered"); label.setHorizontalAlignment(JLabel.CENTER); label.setVerticalAlignment(JLabel.CENTER); f.add(label); f.setVisible(true); }
From source file:Main.java
License:asdf
public static void main(String args[]) { JFrame f = new JFrame("Label Demo"); f.setLayout(new FlowLayout()); f.setSize(200, 360); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label = new JLabel("asdf"); Border border = BorderFactory.createLineBorder(Color.BLACK); label.setBorder(border);//from www . j a v a 2 s . co m label.setPreferredSize(new Dimension(150, 100)); label.setText("Centered"); label.setHorizontalAlignment(JLabel.CENTER); label.setVerticalAlignment(JLabel.CENTER); f.add(label); f.setVisible(true); }
From source file:DrawPolyPanel.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("DrawPoly"); frame.setSize(350, 250); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0);// ww w .j ava2s . c o m } }); Container contentPane = frame.getContentPane(); contentPane.add(new DrawPolyPanel()); frame.show(); }
From source file:Main.java
public static void main(String[] args) { JFrame aWindow = new Main(); aWindow.setSize(200, 200); aWindow.setVisible(true);/*from ww w . ja va2s . co m*/ }
From source file:IteratorUnderStrike.java
public static void main(String[] args) { JFrame f = new JFrame(); f.getContentPane().add(new IteratorUnderStrike()); f.setSize(850, 250); f.show();/*from w ww. j a v a 2s . co m*/ }
From source file:TransparentText.java
public static void main(String[] args) { JFrame f = new JFrame(); f.getContentPane().add(new TransparentText()); f.setSize(800, 250); f.show();/*w w w . java 2 s . co m*/ }
From source file:IteratorTest.java
public static void main(String[] args) { JFrame f = new JFrame(); f.getContentPane().add(new IteratorTest()); f.setSize(850, 250); f.show();/*w w w . j a va 2 s . c o m*/ }
From source file:Main.java
License:asdf
public static void main(String args[]) { JFrame f = new JFrame("Label Demo"); f.setLayout(new FlowLayout()); f.setSize(200, 360); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label = new JLabel("asdf"); Border border = BorderFactory.createLineBorder(Color.BLACK); label.setBorder(border);// w w w .j a va 2 s . c o m label.setPreferredSize(new Dimension(150, 100)); label.setText("Top Left"); label.setHorizontalAlignment(JLabel.LEFT); label.setVerticalAlignment(JLabel.TOP); f.add(label); f.setVisible(true); }