Java Code Examples for javax.swing.JInternalFrame#setBounds()

The following examples show how to use javax.swing.JInternalFrame#setBounds() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Test6505027.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public Test6505027(JFrame main) {
    Container container = main;
    if (INTERNAL) {
        JInternalFrame frame = new JInternalFrame();
        frame.setBounds(OFFSET, OFFSET, WIDTH, HEIGHT);
        frame.setVisible(true);

        JDesktopPane desktop = new JDesktopPane();
        desktop.add(frame, new Integer(1));

        container.add(desktop);
        container = frame;
    }
    if (TERMINATE) {
        this.table.putClientProperty(KEY, Boolean.TRUE);
    }
    TableColumn column = this.table.getColumn(COLUMNS[1]);
    column.setCellEditor(new DefaultCellEditor(new JComboBox(ITEMS)));

    container.add(BorderLayout.NORTH, new JTextField());
    container.add(BorderLayout.CENTER, new JScrollPane(this.table));
}
 
Example 2
Source File: Test6505027.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public Test6505027(JFrame main) {
    Container container = main;
    if (INTERNAL) {
        JInternalFrame frame = new JInternalFrame();
        frame.setBounds(OFFSET, OFFSET, WIDTH, HEIGHT);
        frame.setVisible(true);

        JDesktopPane desktop = new JDesktopPane();
        desktop.add(frame, new Integer(1));

        container.add(desktop);
        container = frame;
    }
    if (TERMINATE) {
        this.table.putClientProperty(KEY, Boolean.TRUE);
    }
    TableColumn column = this.table.getColumn(COLUMNS[1]);
    column.setCellEditor(new DefaultCellEditor(new JComboBox(ITEMS)));

    container.add(BorderLayout.NORTH, new JTextField());
    container.add(BorderLayout.CENTER, new JScrollPane(this.table));
}
 
Example 3
Source File: Test6505027.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public Test6505027(JFrame main) {
    Container container = main;
    if (INTERNAL) {
        JInternalFrame frame = new JInternalFrame();
        frame.setBounds(OFFSET, OFFSET, WIDTH, HEIGHT);
        frame.setVisible(true);

        JDesktopPane desktop = new JDesktopPane();
        desktop.add(frame, new Integer(1));

        container.add(desktop);
        container = frame;
    }
    if (TERMINATE) {
        this.table.putClientProperty(KEY, Boolean.TRUE);
    }
    TableColumn column = this.table.getColumn(COLUMNS[1]);
    column.setCellEditor(new DefaultCellEditor(new JComboBox(ITEMS)));

    container.add(BorderLayout.NORTH, new JTextField());
    container.add(BorderLayout.CENTER, new JScrollPane(this.table));
}
 
Example 4
Source File: Test6505027.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public Test6505027(JFrame main) {
    Container container = main;
    if (INTERNAL) {
        JInternalFrame frame = new JInternalFrame();
        frame.setBounds(OFFSET, OFFSET, WIDTH, HEIGHT);
        frame.setVisible(true);

        JDesktopPane desktop = new JDesktopPane();
        desktop.add(frame, new Integer(1));

        container.add(desktop);
        container = frame;
    }
    if (TERMINATE) {
        this.table.putClientProperty(KEY, Boolean.TRUE);
    }
    TableColumn column = this.table.getColumn(COLUMNS[1]);
    column.setCellEditor(new DefaultCellEditor(new JComboBox(ITEMS)));

    container.add(BorderLayout.NORTH, new JTextField());
    container.add(BorderLayout.CENTER, new JScrollPane(this.table));
}
 
Example 5
Source File: Test6505027.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public Test6505027(JFrame main) {
    Container container = main;
    if (INTERNAL) {
        JInternalFrame frame = new JInternalFrame();
        frame.setBounds(OFFSET, OFFSET, WIDTH, HEIGHT);
        frame.setVisible(true);

        JDesktopPane desktop = new JDesktopPane();
        desktop.add(frame, new Integer(1));

        container.add(desktop);
        container = frame;
    }
    if (TERMINATE) {
        this.table.putClientProperty(KEY, Boolean.TRUE);
    }
    TableColumn column = this.table.getColumn(COLUMNS[1]);
    column.setCellEditor(new DefaultCellEditor(new JComboBox(ITEMS)));

    container.add(BorderLayout.NORTH, new JTextField());
    container.add(BorderLayout.CENTER, new JScrollPane(this.table));
}
 
Example 6
Source File: Test6505027.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public Test6505027(JFrame main) {
    Container container = main;
    if (INTERNAL) {
        JInternalFrame frame = new JInternalFrame();
        frame.setBounds(OFFSET, OFFSET, WIDTH, HEIGHT);
        frame.setVisible(true);

        JDesktopPane desktop = new JDesktopPane();
        desktop.add(frame, new Integer(1));

        container.add(desktop);
        container = frame;
    }
    if (TERMINATE) {
        this.table.putClientProperty(KEY, Boolean.TRUE);
    }
    TableColumn column = this.table.getColumn(COLUMNS[1]);
    column.setCellEditor(new DefaultCellEditor(new JComboBox(ITEMS)));

    container.add(BorderLayout.NORTH, new JTextField());
    container.add(BorderLayout.CENTER, new JScrollPane(this.table));
}
 
Example 7
Source File: Test6505027.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public Test6505027(JFrame main) {
    Container container = main;
    if (INTERNAL) {
        JInternalFrame frame = new JInternalFrame();
        frame.setBounds(OFFSET, OFFSET, WIDTH, HEIGHT);
        frame.setVisible(true);

        JDesktopPane desktop = new JDesktopPane();
        desktop.add(frame, new Integer(1));

        container.add(desktop);
        container = frame;
    }
    if (TERMINATE) {
        this.table.putClientProperty(KEY, Boolean.TRUE);
    }
    TableColumn column = this.table.getColumn(COLUMNS[1]);
    column.setCellEditor(new DefaultCellEditor(new JComboBox(ITEMS)));

    container.add(BorderLayout.NORTH, new JTextField());
    container.add(BorderLayout.CENTER, new JScrollPane(this.table));
}
 
Example 8
Source File: Test6505027.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public Test6505027(JFrame main) {
    Container container = main;
    if (INTERNAL) {
        JInternalFrame frame = new JInternalFrame();
        frame.setBounds(OFFSET, OFFSET, WIDTH, HEIGHT);
        frame.setVisible(true);

        JDesktopPane desktop = new JDesktopPane();
        desktop.add(frame, new Integer(1));

        container.add(desktop);
        container = frame;
    }
    if (TERMINATE) {
        this.table.putClientProperty(KEY, Boolean.TRUE);
    }
    TableColumn column = this.table.getColumn(COLUMNS[1]);
    column.setCellEditor(new DefaultCellEditor(new JComboBox(ITEMS)));

    container.add(BorderLayout.NORTH, new JTextField());
    container.add(BorderLayout.CENTER, new JScrollPane(this.table));
}
 
Example 9
Source File: Test6325652.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static JInternalFrame create(int index) {
    String text = "test" + index; // NON-NLS: frame identification
    index = index * 3 + 1;

    JInternalFrame internal = new JInternalFrame(text, true, true, true, true);
    internal.getContentPane().add(new JTextArea(text));
    internal.setBounds(10 * index, 10 * index, WIDTH, HEIGHT);
    internal.setVisible(true);
    return internal;
}
 
Example 10
Source File: Test6325652.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static JInternalFrame create(int index) {
    String text = "test" + index; // NON-NLS: frame identification
    index = index * 3 + 1;

    JInternalFrame internal = new JInternalFrame(text, true, true, true, true);
    internal.getContentPane().add(new JTextArea(text));
    internal.setBounds(10 * index, 10 * index, WIDTH, HEIGHT);
    internal.setVisible(true);
    return internal;
}
 
Example 11
Source File: Test6325652.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static JInternalFrame create(int index) {
    String text = "test" + index; // NON-NLS: frame identification
    index = index * 3 + 1;

    JInternalFrame internal = new JInternalFrame(text, true, true, true, true);
    internal.getContentPane().add(new JTextArea(text));
    internal.setBounds(10 * index, 10 * index, WIDTH, HEIGHT);
    internal.setVisible(true);
    return internal;
}
 
Example 12
Source File: OOODesktopManager.java    From noa-libre with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void deiconifyFrame(JInternalFrame f) {
  JInternalFrame.JDesktopIcon desktopIcon = f.getDesktopIcon();
  Container c = desktopIcon.getParent();
  if (c != null) {
    f.setBounds(oldBounds.remove(f)); //XXX
    //c.add(f); //XXX

    // If the frame is to be restored to a maximized state make
    // sure it still fills the whole desktop.
    if (f.isMaximum()) {
      Rectangle desktopBounds = c.getBounds();
      if (f.getWidth() != desktopBounds.width || f.getHeight() != desktopBounds.height) {
        setBoundsForFrame(f, 0, 0, desktopBounds.width, desktopBounds.height);
      }
    }
    removeIconFor(f);
    if (f.isSelected()) {
      f.moveToFront();
    }
    else {
      try {
        f.setSelected(true);
      }
      catch (PropertyVetoException e2) {
      }
    }
  }
}
 
Example 13
Source File: Test6325652.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static JInternalFrame create(int index) {
    String text = "test" + index; // NON-NLS: frame identification
    index = index * 3 + 1;

    JInternalFrame internal = new JInternalFrame(text, true, true, true, true);
    internal.getContentPane().add(new JTextArea(text));
    internal.setBounds(10 * index, 10 * index, WIDTH, HEIGHT);
    internal.setVisible(true);
    return internal;
}
 
Example 14
Source File: Test6325652.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static JInternalFrame create(int index) {
    String text = "test" + index; // NON-NLS: frame identification
    index = index * 3 + 1;

    JInternalFrame internal = new JInternalFrame(text, true, true, true, true);
    internal.getContentPane().add(new JTextArea(text));
    internal.setBounds(10 * index, 10 * index, WIDTH, HEIGHT);
    internal.setVisible(true);
    return internal;
}
 
Example 15
Source File: Test6325652.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static JInternalFrame create(int index) {
    String text = "test" + index; // NON-NLS: frame identification
    index = index * 3 + 1;

    JInternalFrame internal = new JInternalFrame(text, true, true, true, true);
    internal.getContentPane().add(new JTextArea(text));
    internal.setBounds(10 * index, 10 * index, WIDTH, HEIGHT);
    internal.setVisible(true);
    return internal;
}
 
Example 16
Source File: InternalFrameDemo.java    From beautyeye with Apache License 2.0 5 votes vote down vote up
/**
    * InternalFrameDemo Constructor.
    *
    * @param swingset the swingset
    */
   public InternalFrameDemo(SwingSet2 swingset) {
super(swingset, "InternalFrameDemo"
		, "toolbar/JDesktop.gif");

// preload all the icons we need for this demo
icon1 = createImageIcon("ImageClub/misc/fish.gif", getString("InternalFrameDemo.fish"));
icon2 = createImageIcon("ImageClub/misc/moon.gif", getString("InternalFrameDemo.moon"));
icon3 = createImageIcon("ImageClub/misc/sun.gif",  getString("InternalFrameDemo.sun"));
icon4 = createImageIcon("ImageClub/misc/cab.gif",  getString("InternalFrameDemo.cab"));

smIcon1 = createImageIcon("ImageClub/misc/fish_small.gif", getString("InternalFrameDemo.fish"));
smIcon2 = createImageIcon("ImageClub/misc/moon_small.gif", getString("InternalFrameDemo.moon"));
smIcon3 = createImageIcon("ImageClub/misc/sun_small.gif",  getString("InternalFrameDemo.sun"));
smIcon4 = createImageIcon("ImageClub/misc/cab_small.gif",  getString("InternalFrameDemo.cab"));

// Create the desktop pane
desktop = new JDesktopPane();
getDemoPanel().add(desktop, BorderLayout.CENTER);

// Create the "frame maker" palette
createInternalFramePalette();

// Create an initial internal frame to show
JInternalFrame frame1 = createInternalFrame(icon1, FIRST_FRAME_LAYER, 1, 1);
frame1.setBounds(FRAME0_X, FRAME0_Y, FRAME0_WIDTH, FRAME0_HEIGHT);

// Create four more starter windows
createInternalFrame(icon1, DEMO_FRAME_LAYER, FRAME_WIDTH, FRAME_HEIGHT);
createInternalFrame(icon3, DEMO_FRAME_LAYER, FRAME_WIDTH, FRAME_HEIGHT);
createInternalFrame(icon4, DEMO_FRAME_LAYER, FRAME_WIDTH, FRAME_HEIGHT);
createInternalFrame(icon2, DEMO_FRAME_LAYER, FRAME_WIDTH, FRAME_HEIGHT);
   }
 
Example 17
Source File: Test6325652.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static JInternalFrame create(int index) {
    String text = "test" + index; // NON-NLS: frame identification
    index = index * 3 + 1;

    JInternalFrame internal = new JInternalFrame(text, true, true, true, true);
    internal.getContentPane().add(new JTextArea(text));
    internal.setBounds(10 * index, 10 * index, WIDTH, HEIGHT);
    internal.setVisible(true);
    return internal;
}
 
Example 18
Source File: Test6325652.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static JInternalFrame create(int index) {
    String text = "test" + index; // NON-NLS: frame identification
    index = index * 3 + 1;

    JInternalFrame internal = new JInternalFrame(text, true, true, true, true);
    internal.getContentPane().add(new JTextArea(text));
    internal.setBounds(10 * index, 10 * index, WIDTH, HEIGHT);
    internal.setVisible(true);
    return internal;
}
 
Example 19
Source File: Test6325652.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static JInternalFrame create(int index) {
    String text = "test" + index; // NON-NLS: frame identification
    index = index * 3 + 1;

    JInternalFrame internal = new JInternalFrame(text, true, true, true, true);
    internal.getContentPane().add(new JTextArea(text));
    internal.setBounds(10 * index, 10 * index, WIDTH, HEIGHT);
    internal.setVisible(true);
    return internal;
}
 
Example 20
Source File: OOODesktopManager.java    From noa-libre with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void iconifyFrame(JInternalFrame f) {
  JInternalFrame.JDesktopIcon desktopIcon;
  Container c = f.getParent();
  JDesktopPane d = f.getDesktopPane();
  boolean findNext = f.isSelected();

  desktopIcon = f.getDesktopIcon();
  if (!wasIcon(f)) {
    Rectangle r = getBoundsForIconOf(f);
    desktopIcon.setBounds(r.x, r.y, r.width, r.height);
    setWasIcon(f, Boolean.TRUE);
  }

  if (c == null) {
    return;
  }

  if (c instanceof JLayeredPane) {
    JLayeredPane lp = (JLayeredPane) c;
    int layer = JLayeredPane.getLayer(f);
    JLayeredPane.putLayer(desktopIcon, layer);
  }

  // If we are maximized we already have the normal bounds recorded
  // don't try to re-record them, otherwise we incorrectly set the
  // normal bounds to maximized state.
  if (!f.isMaximum()) {
    f.setNormalBounds(f.getBounds());
  }
  //c.remove(f); XXX
  oldBounds.put(f, f.getBounds()); //XXX
  f.setBounds(0, 0, 0, 0); //XXX

  c.add(desktopIcon);
  c.repaint(f.getX(), f.getY(), f.getWidth(), f.getHeight());
  try {
    f.setSelected(false);
  }
  catch (PropertyVetoException e2) {
  }

  // Get topmost of the remaining frames
  if (findNext) {
    activateNextFrame(c);
  }
}