List of usage examples for javax.swing JFrame setContentPane
@BeanProperty(bound = false, hidden = true, description = "The client area of the frame where child components are normally inserted.") public void setContentPane(Container contentPane)
contentPane
property. From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(new Main()); frame.validate();//from w w w . j a va 2 s . c o m frame.pack(); frame.setVisible(true); }
From source file:VerticalBoxLayoutManagerContainerTest.java
public static void main(String[] args) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container pane = new BoxPanel(); f.setContentPane(pane); BoxLayout bl = new BoxLayout(pane, BoxLayout.Y_AXIS); pane.setLayout(bl);/*from w w w. j a va2 s .co m*/ for (float align = 0.0f; align <= 1.0f; align += 0.25f) { JButton button = new JButton("X Alignment = " + align); button.setAlignmentX(align); pane.add(button); pane.add(Box.createRigidArea(new Dimension(0, 15))); } f.setSize(400, 300); f.setVisible(true); }
From source file:MainClass.java
public static void main(String argv[]) { ColorPane pane = new ColorPane(); for (int n = 1; n <= 400; n += 1) { if (isPrime(n)) { pane.append(Color.red, String.valueOf(n) + ' '); } else if (isPerfectSquare(n)) { pane.append(Color.blue, String.valueOf(n) + ' '); } else {//from w w w. j av a 2 s . c om pane.append(Color.black, String.valueOf(n) + ' '); } } 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:SelectionMonitor.java
public static void main(String s[]) { JFrame frame = new JFrame("Selection Monitor"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(new SelectionMonitor()); frame.pack();/*from w w w.jav a 2 s .com*/ frame.setVisible(true); }
From source file:SwingProgressBarExample.java
public static void main(String args[]) { final SwingProgressBarExample it = new SwingProgressBarExample(); JFrame frame = new JFrame("Progress Bar Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(it); frame.pack();/*w ww. j ava 2 s . c o m*/ frame.setVisible(true); for (int i = MY_MINIMUM; i <= MY_MAXIMUM; i++) { final int percent = i; try { SwingUtilities.invokeLater(new Runnable() { public void run() { it.updateBar(percent); } }); java.lang.Thread.sleep(100); } catch (InterruptedException e) { ; } } }
From source file:Main.java
public static void main(String[] argv) throws Exception { final String title = "Testing: \u30CD"; JFrame frame = new JFrame(title); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); JLabel label = new JLabel(title); label.setSize(200, 100);// w w w .j a va 2 s .c o m frame.setContentPane(label); frame.pack(); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JTextPane text = new JTextPane() { @Override//from ww w . j ava 2s . c om public String getToolTipText() { return ((JComponent) getParent()).getToolTipText(); } @Override public String getToolTipText(MouseEvent event) { return ((JComponent) getParent()).getToolTipText(event); } }; text.setText("Lorem ipsum dolor sit"); ToolTipManager.sharedInstance().registerComponent(text); JFrame frame = new JFrame("Testing"); JPanel panel = new JPanel(new BorderLayout()); panel.setToolTipText("tooltip from parent"); frame.setContentPane(panel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(text); frame.pack(); frame.setVisible(true); }
From source file:MainClass.java
public static void main(String[] args) { JFrame frame = new JFrame("MoveButton"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(250, 200);//from ww w . j a v a 2s . c om frame.setLocation(200, 200); frame.setContentPane(new MainClass()); frame.setVisible(true); }
From source file:BevelExample.java
public static void main(String s[]) { JFrame frame = new JFrame("Bevel Border"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400, 100);/*from w w w . j a va 2 s . c o m*/ frame.setContentPane(new BevelExample()); frame.setVisible(true); }
From source file:MainClass.java
public static void main(String s[]) { JFrame frame = new JFrame("Menu Element Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(new MainClass()); frame.setSize(300, 300);/*w ww . ja v a 2s . co m*/ frame.setVisible(true); }