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

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

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

JInternalFrame.getSize介绍

暂无

代码示例

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

public Dimension getSize() {
  return internalFrame.getSize();
}

代码示例来源:origin: antlr/antlrworks

public Dimension getSize() {
  if(useDesktop) {
    return jInternalFrame.getSize();
  } else {
    return jFrame.getSize();
  }
}

代码示例来源:origin: bcdev/beam

private void ensureMinWidthAndHight(JInternalFrame frame, int minWidth, int minHeight) {
  final Dimension frameSize = frame.getSize();
  final int correctedWidth = Math.max(frameSize.width, minWidth);
  final int correctedHeight = Math.max(frameSize.height, minHeight);
  frame.setSize(new Dimension(correctedWidth, correctedHeight));
}

代码示例来源:origin: antlr/antlrworks

public void center() {
  if(useDesktop) {
    Dimension s = desktopFrame.getSize();
    Dimension id = jInternalFrame.getSize();
    jInternalFrame.setLocation(s.width/2 - id.width/2, s.height/2 - id.height/2);
  } else {
    jFrame.setLocationRelativeTo(null);
  }
}

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

public void moveFrame()
{
 JInternalFrame selectedFrame = desktopPane.getSelectedFrame();
 Dimension currentSize = selectedFrame.getSize();
 try
 {
  selectedFrame.setMaximum(false);
 }
 catch (PropertyVetoException ex)
 {
  ex.printStackTrace();
 }
 selectedFrame.setSize(currentSize);

 desktopPane.remove(selectedFrame);
 desktopPane.repaint();
 secondFrame.addInternalFrame(selectedFrame);
}

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

public void setSize(int width, int height) {
  Dimension old = internalFrame.getSize();
  Dimension size = new Dimension(width, height);
  if (old.equals(size))
    return;
  internalFrame.setSize(size);
  firePropertyChangeEvent("size", old, size);
}

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

JDesktopPane mainPanel;
JInternalFrame jif_test = new JInternalFrame();

public void centerJIF(JInternalFrame jif) {
  Dimension desktopSize = mainPanel.getSize();
  Dimension jInternalFrameSize = jif.getSize();
  int width = (desktopSize.width - jInternalFrameSize.width) / 2;
  int height = (desktopSize.height - jInternalFrameSize.height) / 2;
  jif.setLocation(width, height);
  jif.setVisible(true);
}

代码示例来源:origin: net.java.linoleum/application

void select(final JInternalFrame frame) {
  frame.setVisible(true);
  try {
    if (frame.isIcon()) {
      frame.setIcon(false);
    } else {
      frame.setSelected(true);
    }
  } catch (final PropertyVetoException ex) {
    ex.printStackTrace();
  }
  final Dimension size = getDesktopPane().getSize();
  final Dimension s = frame.getSize();
  final Point p = frame.getLocation();
  final int x = Math.max(Math.min(p.x - (p.x + s.width - size.width), p.x), 0);
  final int y = Math.max(Math.min(p.y - (p.y + s.height - size.height), p.y), 0);
  if (x != p.x || y != p.y) {
    frame.setLocation(x, y);
  }
  final int width = Math.min(s.width, size.width);
  final int height = Math.min(s.height, size.height);
  if (width < s.width || height < s.height) {
    frame.setSize(width, height);
  }
}

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

public void run() {
  Container cp = getParent();
  if ((cp instanceof JViewport) && (_f != null) && _f.isShowing()) {
   JViewport vp = (JViewport) cp;
   Point vo = vp.getViewPosition();
   Dimension es = vp.getExtentSize();
   Dimension vs = vp.getViewSize();
   Point fo = _f.getLocation();
   Dimension fs = _f.getSize();
   if (fo.x < vo.x) vo.x = fo.x;
   if (fo.y < vo.y) vo.y = fo.y;
   if (fo.x + fs.width > vo.x + es.width) vo.x = Math.min(fo.x, vs.width - es.width);
   if (fo.y + fs.height > vo.y + es.height) vo.y = Math.min(fo.y, vs.height - es.height);
   vp.setViewPosition(vo);
  }
 }
};

代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2

JInternalFrame frame = (JInternalFrame) obj;
Rectangle visible = OVTK2Desktop.getInstance().getDesktopPane().getVisibleRect();
Dimension size = frame.getSize();
frame.setLocation((visible.width / 2) - (size.width / 2), (visible.height / 2) - (size.height / 2));
if (size.height > visible.height)

代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2

Dimension size = internal.getSize();
internal.setLocation((visible.width / 2) - (size.width / 2), (visible.height / 2) - (size.height / 2));
Dimension size = internal.getSize();
internal.setLocation(0, visible.height - size.height);
Dimension size = internal.getSize();
internal.setLocation(visible.width - size.width, (int) max.getY());
Dimension size = internal.getSize();
internal.setLocation(visible.width - size.width, visible.height - size.height);

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

private void rangerInternalFrames() {
 final JInternalFrame[] ifs = getAllInternalFrames();
 boolean done = false;
 final JComponent pn = getMainPanel().getMiddleComponent();
 final Dimension pnDim = (pn instanceof JScrollPane) ? ((JScrollPane) pn).getViewport().getExtentSize() : pn
   .getSize();
 if (ifs != null) {
  for (int i = ifs.length - 1; i >= 0; i--) {
   if (!BuLib.isPalette(ifs[i])) {
    final Dimension d = ifs[i].getSize();
    final Point loc = ifs[i].getLocation();
    if (((loc.x + d.width) > pnDim.width) || ((loc.y + d.height) > pnDim.height)) {
     d.width = Math.min(d.width, pnDim.width);
     d.height = Math.min(d.height, pnDim.height);
     loc.x = 0;
     loc.y = 0;
     ifs[i].setSize(d);
     ifs[i].setLocation(loc);
     done = true;
    }
   }
  }
 }
 if (done) {
  getMainPanel().arrangePalettes();
 }
}

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

public void checkInternalFrame(JInternalFrame _f) {
 if (!SwingUtilities.isEventDispatchThread()) throw new RuntimeException("Not in swing thread.");
 Dimension dd = getSize();
 Point pf = _f.getLocation();
 Dimension df = _f.getSize();
 if (_f.isResizable()) {
  if (df.width > dd.width) df.width = dd.width;
  if (df.height > dd.height) df.height = dd.height;
  if (!df.equals(getSize())) _f.setSize(df);
 }
 if (pf.x + df.width > dd.width) pf.x = dd.width - df.width;
 if (pf.y + df.height > dd.height) pf.y = dd.height - df.height;
 if (pf.x < 0) pf.x = 0;
 if (pf.y < 0) pf.y = 0;
 if (isTabbed() && isPalette(_f) && (pf.x < LEFT_MARGIN + 4)) pf.x = LEFT_MARGIN + 4;
 if (!pf.equals(getLocation())) _f.setLocation(pf);
 adjustSize();
}

代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2

/**
 * Adds a given JInternalFrame to the desktop and centers it.
 * 
 * @param internal
 *            JInternalFrame to be displayed centered
 */
protected void displayCentered(JInternalFrame internal) {
  // do the location calculation
  Rectangle visible = this.getDesktopPane().getVisibleRect();
  Dimension size = internal.getSize();
  internal.setLocation((visible.width / 2) - (size.width / 2), (visible.height / 2) - (size.height / 2));
  // add to desktop and show
  this.getDesktopPane().add(internal);
  internal.setVisible(true);
  internal.toFront();
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

internalFrame.pack();
formSize = new Dimension(internalFrame.getSize().width - windowDecorSize.width, internalFrame.getSize().height - windowDecorSize.height);
if (formLocation != null && !locationByPlatform) {
  internalFrame.setLocation(formLocation);

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

if (cp instanceof JViewport) {
 Rectangle vr = ((JViewport) cp).getViewRect();
 Dimension df = _f.getSize();

代码示例来源:origin: com.jtattoo/JTattoo

th = frame.getSize().height - frame.getRootPane().getSize().height - fh - 1;
if (frame.getJMenuBar() != null) {
  th -= frame.getJMenuBar().getSize().height;

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

Dimension cs = dti.getSize();

代码示例来源:origin: robo-code/robocode

Dimension size = internalFrame.getSize();

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

frames[i].setLocation(p);
Dimension d = frames[i].getSize();
if (p.x + d.width > r.width) r.width = p.x + d.width;
if (p.y + d.height > r.height) r.height = p.y + d.height;

相关文章

JInternalFrame类方法