Esempio n. 1
0
  public Component add(JInternalFrame frame) {
    JInternalFrame[] array = getAllFrames();
    Point p;
    int w;
    int h;

    Component retval = super.add(frame);
    checkDesktopSize();
    if (array.length > 0) {
      p = array[0].getLocation();
      p.x = p.x + FRAME_OFFSET;
      p.y = p.y + FRAME_OFFSET;
    } else {
      p = new Point(0, 0);
    }
    frame.setLocation(p.x, p.y);
    if (frame.isResizable()) {
      w = getWidth() - (getWidth() / 3);
      h = getHeight() - (getHeight() / 3);
      if (w < frame.getMinimumSize().getWidth()) w = (int) frame.getMinimumSize().getWidth();
      if (h < frame.getMinimumSize().getHeight()) h = (int) frame.getMinimumSize().getHeight();
      frame.setSize(w, h);
    }
    moveToFront(frame);
    frame.setVisible(true);
    try {
      frame.setSelected(true);
    } catch (PropertyVetoException e) {
      frame.toBack();
    }
    return retval;
  }
Esempio n. 2
0
 public boolean isResizable() {
   if (f != null) {
     return f.isResizable();
   } else if (d != null) {
     return d.isResizable();
   } else if (jif != null) {
     return jif.isResizable();
   } else {
     throw new IllegalStateException();
   }
 }
Esempio n. 3
0
 public boolean isResizable(Component c) {
   boolean resizable = true;
   if (c instanceof JDialog) {
     JDialog dialog = (JDialog) c;
     resizable = dialog.isResizable();
   } else if (c instanceof JInternalFrame) {
     JInternalFrame frame = (JInternalFrame) c;
     resizable = frame.isResizable();
   } else if (c instanceof JRootPane) {
     JRootPane jp = (JRootPane) c;
     if (jp.getParent() instanceof JFrame) {
       JFrame frame = (JFrame) c.getParent();
       resizable = frame.isResizable();
     } else if (jp.getParent() instanceof JDialog) {
       JDialog dialog = (JDialog) c.getParent();
       resizable = dialog.isResizable();
     }
   }
   return resizable;
 }