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:PanelWithComponents.java
public static void main(String[] a) { JPanel panel = new JPanel(); JButton okButton = new JButton("OK"); panel.add(okButton);// w w w . ja v a2 s . c om JButton cancelButton = new JButton("Cancel"); panel.add(cancelButton); JFrame frame = new JFrame("Oval Sample"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(panel); frame.setSize(300, 200); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) throws Exception { String url = "http://www.yahoo.com"; JEditorPane editor = new JEditorPane(url); editor.setEditable(false);/* ww w . ja v a 2s. co m*/ JScrollPane pane = new JScrollPane(editor); JFrame f = new JFrame("HTML Demo"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(pane); f.setSize(800, 600); f.setVisible(true); }
From source file:ShadowText.java
public static void main(String[] args) throws IOException { JFrame f = new JFrame(); f.add(new ShadowText()); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(450, 150); f.setVisible(true);//from www .j av a 2s . co m }
From source file:AboutDialog.java
public static void main(String[] args) { JMenuBar menubar = new JMenuBar(); JMenu file = new JMenu("File"); file.setMnemonic(KeyEvent.VK_F); JMenu help = new JMenu("Help"); help.setMnemonic(KeyEvent.VK_H); JMenuItem about = new JMenuItem("About"); help.add(about);/*from w w w. j av a 2 s . c om*/ about.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { AboutDialog ad = new AboutDialog(); ad.setVisible(true); } }); menubar.add(file); menubar.add(help); JFrame f = new JFrame(); f.setJMenuBar(menubar); f.setSize(300, 200); f.setLocationRelativeTo(null); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); }
From source file:DragImage.java
public static void main(String[] args) { String imageFile = "A.jpg"; // Turn off double buffering RepaintManager.currentManager(null).setDoubleBufferingEnabled(false); Image image = Toolkit.getDefaultToolkit().getImage(DragImage.class.getResource(imageFile)); image = image.getScaledInstance(imageWidth, imageHeight, Image.SCALE_DEFAULT); JFrame frame = new JFrame("DragImage"); frame.getContentPane().add(new DragImage(image)); frame.setSize(300, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true);//from w w w . java 2s .c om }
From source file:Main.java
public static void main(String[] args) { JComboBox<Object> combo = new JComboBox<>(); URL url = new Main().getClass().getResource("animated.gif"); combo.setModel(new DefaultComboBoxModel(new Object[] { makeImageIcon(url, combo, 0) })); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(combo);//www. ja va 2 s . c o m f.setSize(320, 240); f.setVisible(true); }
From source file:Highlights.java
public static void main(String[] args) { JFrame f = new JFrame(); f.getContentPane().add(new Highlights()); f.setSize(850, 250); f.show();//w ww.ja v a 2s .co m }
From source file:Main.java
public static void main(String args[]) { JWindow window = new JWindow(); window.getContentPane().add(new JLabel("Loading", SwingConstants.CENTER)); window.setBounds(500, 150, 300, 200); window.setVisible(true);//w w w. j a v a 2s . c o m try { Thread.sleep(5000); } catch (InterruptedException e) { } window.setVisible(false); JFrame frame = new JFrame(); frame.add(new JLabel("Welcome Swing application...")); frame.setVisible(true); frame.setSize(300, 200); window.dispose(); }
From source file:MainClass.java
public static void main(String[] unused) { JFrame f = new JFrame("FrameIcon"); Image im = Toolkit.getDefaultToolkit().getImage("FrameIcon.gif"); f.setIconImage(im);/*from w ww . j a va2 s .c o m*/ f.setSize(100, 100); f.setLocation(200, 200); f.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JFrame frame = new JFrame("Oval Sample"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new Main()); frame.setSize(300, 200); frame.setVisible(true);/*from ww w . j a va 2 s .c o m*/ }