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:edu.mit.fss.tutorial.part4.ElementGUI.java
/** * The main method./*from ww w . java 2s. co m*/ * * @param args the arguments * @throws RTIexception the RTI exception */ public static void main(String[] args) throws RTIexception { // Configure the logger and set it to display info messages. BasicConfigurator.configure(); logger.setLevel(Level.INFO); // Use an input dialog to request the element's name. String name = null; while (name == null || name.isEmpty()) { name = JOptionPane.showInputDialog("Enter element name:"); } // Create a MobileElement object instance. The "final" keyword allows // it to be referenced in the GUI thread below. final MobileElement element = new MobileElement(name, new Vector3D(0, 0, 0)); // Create an OnlineTutorialFederate object instance. The "final" // keyword allows it to be referenced in the GUI thread below. final OnlineTutorialFederate fed = new OnlineTutorialFederate(element); // Create the graphical user interface using the Event Dispatch Thread. try { SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { // Create a new ControlPanel object instance. ControlPanel controlPanel = new ControlPanel(); // Bind it to the element above. controlPanel.setBoundElement(element); // Add the control panel as an object change listener. fed.addObjectChangeListener(controlPanel); // Create a new frame to display the panel. Add the panel // as the content, pack it, and make it visible. JFrame frame = new JFrame(); frame.setContentPane(controlPanel); frame.pack(); frame.setVisible(true); // Add a new WindowAdapter object instance to exit the // federate when the window is closing. frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { fed.exit(); } }); } }); } catch (InvocationTargetException | InterruptedException e) { logger.error(e); } // Execute the federate. fed.execute(0, Long.MAX_VALUE, 1000); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); JLabel label = new JLabel(new ElliptIcon(380, 260, Color.red)); label.setLayout(new GridLayout(2, 2)); frame.setContentPane(label); for (int i = 0; i < 4; i++) { label.add(new JLabel(new ElliptIcon(100, 60, Color.blue))); }/*from www . j a va 2 s .c om*/ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); }
From source file:Main.java
public static void main(String s[]) { JFrame frame = new JFrame("Popup Menu Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(new Main()); frame.setSize(300, 300);/*from w w w.j a v a 2s .c om*/ frame.setVisible(true); }
From source file:MainClass.java
public static void main(String s[]) { JFrame frame = new JFrame("Popup Menu Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(new MainClass()); frame.setSize(300, 300);//from ww w . j av a2 s . c om frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame("MoveButton"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(250, 200);/*from w w w .j a v a 2s . c o m*/ frame.setLocation(200, 200); frame.setContentPane(new Main()); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame("Main"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(225, 150);//from w w w .j a v a2 s.c o m frame.setLocation(200, 200); frame.setContentPane(new Main()); frame.setVisible(true); }
From source file:GridBag1.java
public static void main(String[] args) { JFrame frame = new JFrame("GridBag1"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(225, 150);// w w w . jav a 2s .com frame.setLocation(200, 200); frame.setContentPane(new GridBag1()); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame("GridBag1"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(225, 150);//from www . j a v a 2s . c om frame.setLocation(200, 200); frame.setContentPane(new Main()); frame.setVisible(true); }
From source file:MainClass.java
public static void main(String[] args) { JFrame frame = new JFrame("GridBag1"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(225, 150);// w w w .jav a 2 s . c om frame.setLocation(200, 200); frame.setContentPane(new MainClass()); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame("Main"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(200, 200);// ww w .j ava 2 s .co m frame.setLocation(200, 200); frame.setContentPane(new Main()); frame.setVisible(true); }