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[]) throws Exception { ChangeListener changeListener = new BoundedChangeListener(); JScrollBar anotherJScrollBar = new JScrollBar(JScrollBar.HORIZONTAL); BoundedRangeModel model = anotherJScrollBar.getModel(); model.addChangeListener(changeListener); model.setMaximum(10);/*from w w w.j a v a 2s . c o m*/ JFrame frame = new JFrame("ScrollBars R Us"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(anotherJScrollBar, BorderLayout.NORTH); frame.setSize(300, 200); frame.setVisible(true); }
From source file:HtmlToolTipDemo.java
public static void main(String[] a) { JFrame mainFrame = new JFrame(); JLabel label = new JLabel("label"); label.setToolTipText("<html>First line<br>Second Line</html>"); mainFrame.getContentPane().add(label); mainFrame.setSize(100, 100); mainFrame.setVisible(true);/*www. ja v a 2 s. c o m*/ }
From source file:FileTableDemo.java
public static void main(String[] args) { // Figure out what directory to display; File dir;/* ww w . j a va 2 s . c om*/ if (args.length > 0) dir = new File(args[0]); else dir = new File(System.getProperty("user.home")); // Create a TableModel object to represent the contents of the directory FileTableModel model = new FileTableModel(dir); // Create a JTable and tell it to display our model JTable table = new JTable(model); // Display it all in a scrolling window and make the window appear JFrame frame = new JFrame("FileTableDemo"); frame.getContentPane().add(new JScrollPane(table), "Center"); frame.setSize(600, 400); frame.setVisible(true); }
From source file:ColorFadingAnimation.java
public static void main(String[] args) { JFrame frame = new JFrame("Color fading aniamtion"); frame.add(new ColorFadingAnimation()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(250, 150); frame.setLocationRelativeTo(null);//from w ww . j av a2 s .c o m frame.setVisible(true); }
From source file:FileTreeDemo.java
public static void main(String[] args) { // Figure out where in the filesystem to start displaying File root;//from w w w.jav a2 s.co m if (args.length > 0) root = new File(args[0]); else root = new File(System.getProperty("user.home")); // Create a TreeModel object to represent our tree of files FileTreeModel model = new FileTreeModel(root); // Create a JTree and tell it to display our model JTree tree = new JTree(); tree.setModel(model); // The JTree can get big, so allow it to scroll. JScrollPane scrollpane = new JScrollPane(tree); // Display it all in a window and make the window appear JFrame frame = new JFrame("FileTreeDemo"); frame.getContentPane().add(scrollpane, "Center"); frame.setSize(400, 600); frame.setVisible(true); }
From source file:SwingScrollBarExample.java
public static void main(String s[]) { JFrame frame = new JFrame("Scroll Bar Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(new SwingScrollBarExample()); frame.setSize(200, 200); frame.setVisible(true);//from w w w.ja v a 2s. com }
From source file:MainClass.java
public static void main(final String args[]) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTextArea leftTextArea = new JTextArea(); frame.add(leftTextArea);//w ww . ja v a 2 s .co m leftTextArea.paste(); frame.setSize(250, 150); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { Color TRUE_COLOR = new Color(180, 200, 255); Color FALSE_COLOR = new Color(255, 100, 100); final MyBean panel = new MyBean(); panel.setTitle(true);/*from w w w . j a va 2 s . c om*/ panel.setBackground(TRUE_COLOR); panel.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { panel.setTitle(!panel.getTitle()); } }); panel.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals(MyBean.TITLE_PROP_NAME)) { panel.setBackground(panel.getTitle() ? TRUE_COLOR : FALSE_COLOR); } } }); JFrame frame = new JFrame(); frame.getContentPane().add(panel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400, 300); frame.setVisible(true); }
From source file:JNLPTest.java
public static void main(String args[]) { JFrame frame = new JFrame(); Container content = frame.getContentPane(); JLabel label = new JLabel("Hello, JNLP"); content.add(label, BorderLayout.CENTER); frame.setSize(200, 200); frame.show();/*www . j a v a 2s .c om*/ try { Thread.sleep(5000); } catch (InterruptedException ignored) { } finally { System.exit(0); } }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(new BlinkPane()); frame.setSize(200, 200); frame.setVisible(true);//from w ww . j av a2 s . c o m }