List of usage examples for javax.swing JInternalFrame getContentPane
public Container getContentPane()
From source file:Main.java
public static void main(String[] argv) throws Exception { boolean resizable = true; boolean closeable = true; boolean maximizable = true; boolean iconifiable = true; String title = "Frame Title"; JInternalFrame iframe = new JInternalFrame(title, resizable, closeable, maximizable, iconifiable); iframe.setSize(300, 300);/*from w w w . j a v a 2 s . c o m*/ iframe.setVisible(true); iframe.getContentPane().add(new JTextArea()); JDesktopPane desktop = new JDesktopPane(); desktop.add(iframe); JFrame frame = new JFrame(); frame.getContentPane().add(desktop, BorderLayout.CENTER); frame.setSize(300, 300); frame.setVisible(true); }
From source file:Main.java
public final static JEditorPane getSourceEditor(JInternalFrame iframe) { return (JEditorPane) getDescendantOfClass(JEditorPane.class, iframe.getContentPane(), true); }
From source file:ScrollDesktop.java
public Main() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JDesktopPane desk = new ScrollDesktop(); desk.setPreferredSize(new Dimension(1000, 1000)); getContentPane().add(new JScrollPane(desk), "Center"); JInternalFrame f1 = new JInternalFrame("Frame 1"); f1.getContentPane().add(new JLabel("This is frame f1")); f1.setResizable(true);//from ww w. j a va 2s .c o m f1.pack(); f1.setVisible(true); desk.add(f1, new Integer(10)); JInternalFrame f2 = new JInternalFrame("Frame 2"); f2.getContentPane().add(new JLabel("Content for f2")); f2.setResizable(true); f2.pack(); f2.setVisible(true); desk.add(f2, new Integer(20)); JInternalFrame f3 = new JInternalFrame("Frame 3"); f3.getContentPane().add(new JLabel("Content for f3")); f3.setResizable(true); f3.pack(); f3.setVisible(true); desk.add(f3, new Integer(20)); f3.toFront(); try { f3.setSelected(true); } catch (java.beans.PropertyVetoException ignored) { } pack(); setSize(300, 300); setVisible(true); }
From source file:Main.java
public Main() { JMenuBar bar = new JMenuBar(); JMenu addMenu = new JMenu("Add"); JMenuItem newFrame = new JMenuItem("Internal Frame"); addMenu.add(newFrame);//from w ww. ja v a2 s. c o m bar.add(addMenu); setJMenuBar(bar); final JDesktopPane theDesktop = new JDesktopPane(); getContentPane().add(theDesktop); newFrame.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JInternalFrame frame = new JInternalFrame("Internal Frame", true, true, true, true); Container c = frame.getContentPane(); MyJPanel panel = new MyJPanel(); c.add(panel, BorderLayout.CENTER); frame.setSize(200, 200); frame.setOpaque(true); theDesktop.add(frame); } }); setSize(500, 400); setVisible(true); }
From source file:Main.java
public Main() { JInternalFrame frame1 = new JInternalFrame("Frame 1", true, true, true, true); JInternalFrame frame2 = new JInternalFrame("Frame 2", true, true, true, true); frame1.getContentPane().add(new JLabel("Frame 1 contents...")); frame1.pack();//w w w .j av a 2s . com frame1.setVisible(true); frame2.getContentPane().add(new JLabel("Frame 2 contents...")); frame2.pack(); frame2.setVisible(true); int x2 = frame1.getX() + frame1.getWidth() + 10; int y2 = frame1.getY(); frame2.setLocation(x2, y2); desktopPane.add(frame1); desktopPane.add(frame2); this.add(desktopPane, BorderLayout.CENTER); this.setMinimumSize(new Dimension(300, 300)); }
From source file:org.jfree.chart.demo.InternalFrameDemo.java
/** * Creates an internal frame./* w w w. j a v a 2 s.c o m*/ * * @return An internal frame. */ private JInternalFrame createFrame2() { final XYDataset dataset1 = createDataset("Series 1", 100.0, new Minute(), 200); final JFreeChart chart = ChartFactory.createTimeSeriesChart("Time Series Chart", "Time of Day", "Value", dataset1, true, true, false); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new Dimension(200, 100)); final JInternalFrame frame = new JInternalFrame("Frame 2", true); frame.getContentPane().add(chartPanel); return frame; }
From source file:org.jfree.chart.demo.InternalFrameDemo.java
/** * Creates an internal frame.// w w w . j a v a 2 s . c om * * @return An internal frame. */ private JInternalFrame createFrame1() { final DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(34.0, "Series 1", "Category 1"); dataset.addValue(23.0, "Series 1", "Category 2"); dataset.addValue(54.0, "Series 1", "Category 3"); final JFreeChart chart = ChartFactory.createBarChart("Bar Chart", "Category", "Series", dataset, PlotOrientation.VERTICAL, true, true, false); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new Dimension(200, 100)); final JInternalFrame frame = new JInternalFrame("Frame 1", true); frame.getContentPane().add(chartPanel); return frame; }
From source file:MainClass.java
public MainClass() { super("Focus Example"); setDefaultCloseOperation(EXIT_ON_CLOSE); MyPanel mypanel = new MyPanel(); JButton button1 = new JButton("One"); JButton button2 = new JButton("Two"); JButton button3 = new JButton("Three"); JButton button4 = new JButton("Four"); JButton button5 = new MyButton("Five*"); JButton button6 = new MyButton("Six*"); JButton button7 = new JButton("Seven"); mypanel.add(button2);// w w w. j ava 2 s.com mypanel.add(button3); JInternalFrame frame1 = new JInternalFrame("Internal Frame 1", true, true, true, true); frame1.setBackground(Color.lightGray); frame1.getContentPane().setLayout(new GridLayout(2, 3)); frame1.setSize(300, 200); frame1.getContentPane().add(button1); frame1.getContentPane().add(mypanel); frame1.getContentPane().add(button4); frame1.getContentPane().add(button5); frame1.getContentPane().add(button6); frame1.getContentPane().add(button7); JDesktopPane desktop = new JDesktopPane(); desktop.add(frame1, new Integer(1)); desktop.setOpaque(true); // Now set up the user interface window. Container contentPane = getContentPane(); contentPane.add(desktop, BorderLayout.CENTER); setSize(new Dimension(400, 300)); frame1.setVisible(true); setVisible(true); }
From source file:Main.java
public Main() { super("Focus Example"); setDefaultCloseOperation(EXIT_ON_CLOSE); MyPanel mypanel = new MyPanel(); JButton button1 = new JButton("One"); JButton button2 = new JButton("Two"); JButton button3 = new JButton("Three"); JButton button4 = new JButton("Four"); JButton button5 = new MyButton("Five*"); JButton button6 = new MyButton("Six*"); JButton button7 = new JButton("Seven"); mypanel.add(button2);//from w w w. j av a 2s. co m mypanel.add(button3); JInternalFrame frame1 = new JInternalFrame("Internal Frame 1", true, true, true, true); frame1.setBackground(Color.lightGray); frame1.getContentPane().setLayout(new GridLayout(2, 3)); frame1.setSize(300, 200); frame1.getContentPane().add(button1); frame1.getContentPane().add(mypanel); frame1.getContentPane().add(button4); frame1.getContentPane().add(button5); frame1.getContentPane().add(button6); frame1.getContentPane().add(button7); JDesktopPane desktop = new JDesktopPane(); desktop.add(frame1, new Integer(1)); desktop.setOpaque(true); // Now set up the user interface window. Container contentPane = getContentPane(); contentPane.add(desktop, BorderLayout.CENTER); setSize(new Dimension(400, 300)); frame1.setVisible(true); setVisible(true); }
From source file:FocusExample.java
public FocusExample() { super("Focus Example"); setDefaultCloseOperation(EXIT_ON_CLOSE); MyPanel mypanel = new MyPanel(); JButton button1 = new JButton("One"); JButton button2 = new JButton("Two"); JButton button3 = new JButton("Three"); JButton button4 = new JButton("Four"); JButton button5 = new MyButton("Five*"); JButton button6 = new MyButton("Six*"); JButton button7 = new JButton("Seven"); mypanel.add(button2);/* www . j a v a 2 s . c o m*/ mypanel.add(button3); JInternalFrame frame1 = new JInternalFrame("Internal Frame 1", true, true, true, true); frame1.setBackground(Color.lightGray); frame1.getContentPane().setLayout(new GridLayout(2, 3)); frame1.setSize(300, 200); frame1.getContentPane().add(button1); frame1.getContentPane().add(mypanel); frame1.getContentPane().add(button4); frame1.getContentPane().add(button5); frame1.getContentPane().add(button6); frame1.getContentPane().add(button7); JDesktopPane desktop = new JDesktopPane(); desktop.add(frame1, new Integer(1)); desktop.setOpaque(true); // Now set up the user interface window. Container contentPane = getContentPane(); contentPane.add(desktop, BorderLayout.CENTER); setSize(new Dimension(400, 300)); frame1.setVisible(true); setVisible(true); }