javax.swing.JInternalFrame.getParent()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(109)

本文整理了Java中javax.swing.JInternalFrame.getParent()方法的一些代码示例,展示了JInternalFrame.getParent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JInternalFrame.getParent()方法的具体详情如下:
包路径:javax.swing.JInternalFrame
类名称:JInternalFrame
方法名:getParent

JInternalFrame.getParent介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

JInternalFrame iframe = ...
Container c = iframe.getContentPane();
Rectangle r = c.getBounds();
r = SwingUtilities.convertRectangle(c.getParent(), r, iframe.getParent());

代码示例来源:origin: com.numdata/numdata-swing

/**
 * Center the specified internal frame on it's container (don't modify
 * size).
 *
 * @param window Target window.
 */
public static void center( @NotNull final JInternalFrame window )
{
  final Container parent = window.getParent();
  if ( parent != null )
  {
    final Insets parentInsets = parent.getInsets();
    final int x = parentInsets.left + ( parent.getWidth() - parentInsets.left - parentInsets.right - window.getWidth() ) / 2;
    final int y = parentInsets.top + ( parent.getHeight() - parentInsets.top - parentInsets.bottom - window.getHeight() ) / 2;
    window.setLocation( x, y );
  }
}

代码示例来源:origin: com.fifesoft.rtext/fife.common

/**
 * This will activate <b>f</b> moving it to the front.
 * @param f the <code>JInternalFrame</code> to be activated
 */
@Override
public void activateFrame(JInternalFrame f) {
  Container p = f.getParent();
  IconDesktopPane d = (IconDesktopPane)f.getDesktopPane();
  // fix for bug: 4162443
  if(p == null)
    return;
  if (d != null)
    d.addSelectedFrame(f);
  f.moveToFront();
}

代码示例来源:origin: khuxtable/seaglass

public void maximizeFrame(JInternalFrame f) {
  if (f.isIcon()) {
    try {
      f.setIcon(false);
    } catch (PropertyVetoException e2) {
    }
  } else {
    f.setNormalBounds(f.getBounds());
    Component desktop = f.getParent();
    setBoundsForFrame(f, 0, 0, desktop.getWidth(), desktop.getHeight() - taskBar.getHeight());
  }
  try {
    f.setSelected(true);
  } catch (PropertyVetoException e2) {
  }
}

代码示例来源:origin: stackoverflow.com

inf.setMaximum(!inf.isMaximum());
    if (inf.isMaximum()) {
      ((JLayeredPane)inf.getParent()).setLayer(inf, 0);
    } else {
      ((JLayeredPane)inf.getParent()).setLayer(inf, 10);
@Override
public void actionPerformed(ActionEvent ae) {
  Container parent = inf.getParent();
  inf.dispose();
  parent.remove(inf);

代码示例来源:origin: net.sourceforge.mydoggy/mydoggy-plaf

Container c = f.getParent();
if (c == null) {
  c = f.getDesktopIcon().getParent();

代码示例来源:origin: realXuJiang/bigtable-sql

if (cs == null && child.getParent() != null)
  cs = child.getParent().getSize();

代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql

if (cs == null && child.getParent() != null)
  cs = child.getParent().getSize();

代码示例来源:origin: net.sourceforge.mydoggy/mydoggy-plaf

public void maximizeFrame(JInternalFrame f) {
  if (f.isIcon()) {
    try {
      // In turn calls deiconifyFrame in the desktop manager.
      // That method will handle the maximization of the frame.
      f.setIcon(false);
    } catch (PropertyVetoException e2) {
    }
  } else {
    f.setNormalBounds(f.getBounds());
    Rectangle desktopBounds = f.getParent().getBounds();
    setBoundsForFrame(f, 0, 0,
             desktopBounds.width, desktopBounds.height);
  }
  // Set the maximized frame as selected.
  try {
    f.setSelected(true);
  } catch (PropertyVetoException e2) {
  }
}

代码示例来源:origin: khuxtable/seaglass

public void iconifyFrame(JInternalFrame f) {
  Container c = f.getParent();
  boolean findNext = f.isSelected();
  if (c == null) {
    return;
  }
  if (!f.isMaximum()) {
    f.setNormalBounds(f.getBounds());
  }
  c.remove(f);
  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) {
    for (Component comp : c.getComponents()) {
      if (comp instanceof JInternalFrame) {
        try {
          ((JInternalFrame) comp).setSelected(true);
        } catch (PropertyVetoException e2) {
        }
        ((JInternalFrame) comp).moveToFront();
        return;
      }
    }
  }
}

代码示例来源:origin: com.fifesoft.rtext/fife.common

/**
 * Removes the frame, and, if necessary, the
 * <code>desktopIcon</code>, from its parent.  This method is overridden so
 * that the "next internal frame" isn't selected after this one is closed.
 * @param f the <code>JInternalFrame</code> to be removed
 */
@Override
public void closeFrame(JInternalFrame f) {
  Container c = f.getParent();
  if (f.isSelected()) {
    try {
      f.setSelected(false);
    } catch (PropertyVetoException e2) {
      // Do nothing
    }
  }
  if(c != null) {
    c.remove(f);
    c.repaint(f.getX(), f.getY(), f.getWidth(), f.getHeight());
  }
  removeIconFor(f);
  if(f.getNormalBounds() != null)
    f.setNormalBounds(null);
  if(wasIcon(f))
    setWasIcon(f, null);
}

代码示例来源:origin: net.sourceforge.mydoggy/mydoggy-plaf

public void closeFrame(JInternalFrame f) {
  boolean findNext = f.isSelected();
  Container c = f.getParent();
  if (findNext)
    try {
      f.setSelected(false);
    } catch (PropertyVetoException e2) {
    }
  if (c != null) {
    c.remove(f);
    c.repaint(f.getX(), f.getY(), f.getWidth(), f.getHeight());
  }
  removeIconFor(f);
  if (f.getNormalBounds() != null)
    f.setNormalBounds(null);
  if (wasIcon(f))
    setWasIcon(f, null);
  if (findNext) activateNextFrame(c);
}

代码示例来源:origin: stackoverflow.com

Container parent = f.getParent();
if (parent != null) parent.remove(f);

代码示例来源:origin: net.sourceforge.mydoggy/mydoggy-plaf

public void activateFrame(JInternalFrame f) {
  Container p = f.getParent();
  JDesktopPane d = f.getDesktopPane();
  JInternalFrame currentlyActiveFrame = (d == null) ? null : d.getSelectedFrame();
  // fix for bug: 4162443
  if (p == null) {
    // If the frame is not in parent, its icon maybe, check it
    p = f.getDesktopIcon().getParent();
    if (p == null)
      return;
  }
  // we only need to keep track of the currentActive InternalFrame, if any
  if (currentlyActiveFrame == null) {
    if (d != null) {
      d.setSelectedFrame(f);
    }
  } else if (currentlyActiveFrame != f) {
    // if not the same frame as the current active
    // we deactivate the current
    if (currentlyActiveFrame.isSelected()) {
      try {
        currentlyActiveFrame.setSelected(false);
      }
      catch (PropertyVetoException e2) {
      }
    }
    d.setSelectedFrame(f);
  }
  f.moveToFront();
}

代码示例来源:origin: net.sourceforge.mydoggy/mydoggy-plaf

public void iconifyFrame(JInternalFrame f) {
  JInternalFrame.JDesktopIcon desktopIcon;
  Container c = f.getParent();
  boolean findNext = f.isSelected();

相关文章

JInternalFrame类方法