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

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

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

JInternalFrame.getHeight介绍

暂无

代码示例

代码示例来源:origin: magefree/mage

@Override
public void deiconifyFrame(JInternalFrame f) {
  super.deiconifyFrame(f);
  if (f instanceof CardInfoWindowDialog) {
    JInternalFrame.JDesktopIcon icon = f.getDesktopIcon();
    f.setBounds(icon.getX() + (DESKTOP_ICON_WIDTH - f.getWidth()), icon.getY(), f.getWidth(), f.getHeight());
  }
}

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu

protected void sortFramesByHeight(JInternalFrame[] _frames) {
 sortFramesByTitle(_frames);
 JInternalFrame tmp;
 int i, l;
 l = _frames.length;
 for (i = 0; i + 1 < l; i++)
  if (_frames[i].getHeight() > _frames[i + 1].getHeight()) {
   tmp = _frames[i];
   _frames[i] = _frames[i + 1];
   _frames[i + 1] = tmp;
   i--;
   if (i >= 0) i--;
  }
}

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

public static Point getPointForCentering(JInternalFrame window) {
   try {
     //assert window != null;
     Point mousePoint = MouseInfo.getPointerInfo().getLocation();
     GraphicsDevice[] devices = GraphicsEnvironment
         .getLocalGraphicsEnvironment().getScreenDevices();
     for (GraphicsDevice device : devices) {
       Rectangle bounds = device.getDefaultConfiguration().
         getBounds();
         //check to see if the mouse cursor is within these bounds
       if (mousePoint.x >= bounds.x && mousePoint.y >= bounds.y &&
         mousePoint.x <= (bounds.x + bounds.width) && mousePoint.y 
         <= (bounds.y + bounds.height)) {
         int screenWidth = bounds.width;//this is it
         int screenHeight = bounds.height;
         int width = window.getWidth();
         int height = window.getHeight();
         return new Point(((screenWidth - width) / 2) + bounds.x,
           ((screenHeight - height) / 2) + bounds.y);
       }
     }
   } catch (Exception e) {
     LOG.log(Level.FINE, e.getLocalizedMessage() + 
       " - this can occur do to a Security exception in sandboxed apps");
   }
   return new Point(0, 0);
 }

代码示例来源: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: org.swinglabs.swingx/swingx-all

int screenHeight = usableBounds.height;
int width = window.getWidth();
int height = window.getHeight();

代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-common

int screenHeight = usableBounds.height;
int width = window.getWidth();
int height = window.getHeight();

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu

public void mouseDragged(MouseEvent _evt)
 {
  if(frame_!=null)
   getManager(frame_).resizeFrame
    (frame_,frame_.getX(),frame_.getY(),
     frame_.getWidth ()+_evt.getX()-resizeCorner_.getWidth(),
     frame_.getHeight()+_evt.getY()-resizeCorner_.getHeight());
 }
}

代码示例来源:origin: net.sf.nimrod/nimrod-laf

void dodo( MouseEvent ev) {
  if ( ev.getComponent() instanceof NimRODInternalFrameTitlePane ) {
   if ( frame.getDesktopPane() != null ) {
    frame.getDesktopPane().updateUI();
   }
  }
  else {
   int x = ev.getX();
   int w = frame.getWidth();
   int y = ev.getY();
   int h = frame.getHeight();
   
   if ( ( x <= 5 ) || ( x >= w - ins.right) || ( y >= h - ins.bottom ) ) {
    if ( frame.getDesktopPane() != null ) {
     frame.getDesktopPane().updateUI();
    }
   }
  }
 }
}

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

x = allFrames[i].getX() + allFrames[i].getWidth();
if (allFrames[i].getY() + allFrames[i].getHeight() > y) {
  y = allFrames[i].getY() + allFrames[i].getHeight();

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

/**
 * Calculate the required size of this desktop pane so that
 * all visible intenal frames will be fully shown.
 *
 * @return <TT>Dimension</TT> required size.
 */
public Dimension getRequiredSize()
{
  JInternalFrame[] frames = getAllFrames();
  int maxX = 0;
  int maxY = 0;
  for (int i = 0; i < frames.length; ++i)
  {
    if (frames[i].isVisible())
    {
      JInternalFrame frame = frames[i];
      int x = frame.getX() + frame.getWidth();
      if (x > maxX)
      {
        maxX = x;
      }
      int y = frame.getY() + frame.getHeight();
      if (y > maxY)
      {
        maxY = y;
      }
    }
  }
  return new Dimension(maxX, maxY);
}

代码示例来源:origin: org.scijava/scijava-ui-swing

x = allFrames[i].getX() + allFrames[i].getWidth();
if (allFrames[i].getY() + allFrames[i].getHeight() > y) {
  y = allFrames[i].getY() + allFrames[i].getHeight();

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

public void deiconifyFrame(JInternalFrame f) {
  JInternalFrame.JDesktopIcon desktopIcon = f.getDesktopIcon();
  Container c = desktopIcon.getParent();
  if (c != null) {
    c = c.getParent();
    if (c != null) {
      c.add(f);
      if (f.isMaximum()) {
        int w = c.getWidth();
        int h = c.getHeight() - taskBar.getHeight();
        if (f.getWidth() != w || f.getHeight() != h) {
          setBoundsForFrame(f, 0, 0, w, h);
        }
      }
      if (f.isSelected()) {
        f.moveToFront();
      } else {
        try {
          f.setSelected(true);
        } catch (PropertyVetoException e2) {
        }
      }
    }
  }
}

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

/**
 * Organizes the icons nicely in the visible screen space.
 */
public void refresh() {
  // Resize so that our width is that of the viewport in the scrollpane.
  // Remember there's spacing at the front too.
  Dimension size = getVisibleRect().getSize();
  int defaultWidth = (SPACING+DEFAULT_ICON_WIDTH)*DEFAULT_ROW_SIZE;
  int width = size.width<defaultWidth ? defaultWidth : size.width;
  int x = SPACING;
  int y = SPACING;
  JInternalFrame[] frames = getAllFrames();
  int num = frames==null ? 0 : frames.length;
  for (int i=0; i<num; i++) {
    frames[i].setLocation(x,y);
    x += DEFAULT_ICON_WIDTH + SPACING;
    if (x+DEFAULT_ICON_WIDTH>width) {
      x = SPACING;
      y += frames[i].getHeight() + SPACING;
    }
  }
  size.height = y+DEFAULT_ICON_WIDTH;
  setPreferredSize(size);
  setSize(size);            // Causes the scroll pane to revalidate.
}

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu

public/* synchronized */void tile() {
 if (isTabbed()) return;
 JInternalFrame[] frames = getNormalFrames();
 int i, l, x, y, h, wd/* ,hd */;
 l = frames.length;
 if (l > 0) {
  sortFramesByHeight(frames);
  wd = getWidth(); // getSize().width;
  // hd=getHeight(); // getSize().height;
  wd = (wd < 200 ? 200 : wd);
  // hd=(hd<200 ? 200 : hd-60);
  x = 0;
  y = 0;
  h = 0;
  for (i = 0; i < l; i++) {
   int wf = frames[i].getWidth(); // Size().width;
   int hf = frames[i].getHeight(); // Size().height;
   if (x + wf > wd) {
    x = 0;
    y += h;
    h = 0;
   }
   frames[i].setLocation(x, y);
   x += wf;
   h = Math.max(h, hf);
   moveToFront(frames[i]);
   checkInternalFrame(frames[i]);
  }
 }
}

代码示例来源:origin: cytoscape/application

private void setDesktopStates() throws JAXBException {
  DesktopSize dSize = factory.createDesktopSize();
  NetworkFrames frames = factory.createNetworkFrames();
  Component[] networkFrames = Cytoscape.getDesktop().getNetworkViewManager().getDesktopPane()
                     .getComponents();
  for (int i = 0; i < networkFrames.length; i++) {
    if(networkFrames[i] instanceof JInternalFrame) {
      JInternalFrame networkFrame = (JInternalFrame) networkFrames[i];
      NetworkFrame frame = factory.createNetworkFrame();
      frame.setFrameID(networkFrame.getTitle());
      frame.setWidth(BigInteger.valueOf(networkFrame.getWidth()));
      frame.setHeight(BigInteger.valueOf(networkFrame.getHeight()));
      frame.setX(BigInteger.valueOf(networkFrame.getX()));
      frame.setY(BigInteger.valueOf(networkFrame.getY()));
      frames.getNetworkFrame().add(frame);
    }
  }
  dSize.setHeight(BigInteger.valueOf(Cytoscape.getDesktop().getSize().height));
  dSize.setWidth(BigInteger.valueOf(Cytoscape.getDesktop().getSize().width));
  Desktop desktop = factory.createDesktop();
  desktop.setDesktopSize(dSize);
  desktop.setNetworkFrames(frames);
  sState.setDesktop(desktop);
}

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

public void deiconifyFrame(JInternalFrame f) {
  JInternalFrame.JDesktopIcon desktopIcon = f.getDesktopIcon();
  Container c = desktopIcon.getParent();
  if (c != null) {
    c.add(f);
    // 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) {
      }
    }
  }
}

代码示例来源: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: 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: Geomatys/geotoolkit

/**
 * Creates and shows a new internal frame for the given image.
 */
final void addImage(final RenderedImage image, final String title) {
  final JInternalFrame internal = new JInternalFrame(title, true, true);
  internal.add(new ImagePanel(image));
  internal.pack();
  internal.show();
  desktop.add(internal);
  if (location > min(desktop.getWidth()  - internal.getWidth(),
            desktop.getHeight() - internal.getHeight()))
  {
    location = 0;
  }
  internal.setLocation(location, location);
  location += 30;
  internal.toFront();
}

代码示例来源:origin: apache/sis

/**
 * Creates and shows a new internal frame for the given image.
 */
private void addImage(final RenderedImage image, final String title) {
  final JInternalFrame internal = new JInternalFrame(title, true, true);
  internal.add(new ImagePanel(image));
  internal.pack();
  internal.show();
  desktop.add(internal);
  if (location > min(desktop.getWidth()  - internal.getWidth(),
            desktop.getHeight() - internal.getHeight()))
  {
    location = 0;
  }
  internal.setLocation(location, location);
  location += 30;
  internal.toFront();
}

相关文章

JInternalFrame类方法