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:SimpleFont.java
public static void main(String[] args) { JFrame f = new JFrame(); f.getContentPane().add(new SimpleFont()); f.setSize(350, 250); f.show();/*from w w w .j a va 2 s .c o m*/ }
From source file:TextLayoutLeft.java
public static void main(String[] a) { JFrame f = new JFrame(); f.setSize(300, 300); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(new TextLayoutLeft()); f.setVisible(true);//ww w .j av a 2 s. com }
From source file:TextLayoutRight.java
public static void main(String[] a) { JFrame f = new JFrame(); f.setSize(300, 300); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(new TextLayoutRight()); f.setVisible(true);//from w ww. j ava2 s. com }
From source file:TextLayoutCenter.java
public static void main(String[] a) { JFrame f = new JFrame(); f.setSize(300, 300); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(new TextLayoutCenter()); f.setVisible(true);/*ww w . j av a2 s.co m*/ }
From source file:MoveAdapter.java
public static void main(String[] args) { JFrame f = new JFrame(); f.addComponentListener(new MoveAdapter()); f.setSize(310, 200); f.setLocationRelativeTo(null);//from w ww. j a v a2s. co m f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); }
From source file:ButtonListener.java
public static void main(String[] args) { JPanel panel = new JPanel(); JButton close = new JButton("Close"); close.addActionListener(new ButtonListener()); JButton open = new JButton("Open"); open.addActionListener(new ButtonListener()); JButton find = new JButton("Find"); find.addActionListener(new ButtonListener()); JButton save = new JButton("Save"); save.addActionListener(new ButtonListener()); panel.add(close);/*from ww w . ja va 2s . com*/ panel.add(open); panel.add(find); panel.add(save); JFrame f = new JFrame(); f.add(panel); f.setSize(400, 300); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame("Window cannot be moved to hide part of it"); frame.setSize(300, 300); frame.addComponentListener(new Main()); frame.setVisible(true);//from w w w .j av a 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);/*from w w w .ja v a 2 s . c o m*/ label.setPreferredSize(new Dimension(150, 100)); f.add(label); f.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(200, 360); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label = new JLabel( "<html>Use HTML to create<br>" + "a multiline message." + "<br>One<br>Two<br>Three"); Border border = BorderFactory.createLineBorder(Color.BLACK); label.setBorder(border);//from w ww . ja v a2 s. co m f.add(label); f.setVisible(true); }
From source file:TextLayoutOne.java
public static void main(String[] args) { JFrame f = new JFrame(); f.getContentPane().add(new TextLayoutOne()); f.setSize(300, 200); f.setVisible(true);/*www. j a v a 2s . c om*/ }