javax.swing.JComponent.setBounds()方法的使用及代码示例

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

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

JComponent.setBounds介绍

暂无

代码示例

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

@Override
public void mouseReleased(MouseEvent e) {
  bDragged = false;
  if (j instanceof DialogManager) {
    return;
  }
  if (j != null && rec != null) {
    j.setBounds(rec);
  }
  oldRec = null;
  if (rec == null) {
    return;
  }
  if (rec.x < 0) {
    rec.x = 0;
    if (j != null) {
      j.setBounds(rec);
    }
  }
  if (rec.y < 0) {
    rec.y = 0;
    if (j != null) {
      j.setBounds(rec);
    }
  }
  j = null;
}

代码示例来源:origin: RaiMan/SikuliX2

super.setBounds(bounds);

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

@Override
public void mouseDragged(MouseEvent e) {
  if (bDragged) {
    dx = e.getX() - mx;
    dy = e.getY() - my;
    rec.x += dx;
    rec.y += dy;
    mx = e.getX();
    my = e.getY();
    if (oldRec == null) {
      oldRec = new Rectangle(rec);
    }
    int i = Math.abs(oldRec.x - rec.x) + Math.abs(oldRec.y - rec.y);
    if (i > 3) {
      oldRec = new Rectangle(rec);
      j.setBounds(oldRec);
    }
  }
}

代码示例来源:origin: nodebox/nodebox

private void addRow(String label, JComponent component) {
  JLabel l = new JLabel(label);
  l.setFont(Theme.SMALL_BOLD_FONT);
  l.setBounds(18, y, 400, 18);
  add(l);
  y += 18;
  int componentHeight = (int) component.getPreferredSize().getHeight();
  component.setBounds(16, y, 400, componentHeight);
  y += componentHeight;
  y += 2; // vertical gap
  add(component);
}

代码示例来源:origin: nodebox/nodebox

private void addRow(String label, JComponent component) {
  JLabel l = new JLabel(label);
  l.setFont(Theme.SMALL_BOLD_FONT);
  l.setBounds(18, y, 400, 18);
  add(l);
  y += 18;
  int componentHeight = (int) component.getPreferredSize().getHeight();
  component.setBounds(16, y, 400, componentHeight);
  y += componentHeight;
  y += 2; // vertical gap
  add(component);
}

代码示例来源:origin: RaiMan/SikuliX2

public void setActualBounds(Rectangle actualBounds) {
 this.actualBounds = (Rectangle) actualBounds.clone();
 Rectangle paintBounds = (Rectangle) actualBounds.clone();
 if (hasShadow()) {
  paintBounds.x -= (shadowSize - shadowOffset);
  paintBounds.y -= (shadowSize - shadowOffset);
  paintBounds.width += (2 * shadowSize);
  paintBounds.height += (2 * shadowSize);
 }
 super.setBounds(paintBounds);
 updateAllFollowers();
}

代码示例来源:origin: de.sciss/prefuse-core

/**
 * @see java.awt.Component#setBounds(int, int, int, int)
 */
public void setBounds(int x, int y, int w, int h) {
  m_offscreen = null;
  super.setBounds(x,y,w,h);
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

@SuppressWarnings("deprecation")
public void reshape(int x, int y, int w, int h) {
  if (inner != null) {
    inner.setBounds(0, 0, w, h);
  }
  super.reshape(x, y, w, h);
}

代码示例来源:origin: igvteam/igv

@Override
public void setBounds(int x, int y, int w, int h) {
  super.setBounds(x, y, w, h);
  updateAxisDimension(w, h);
}

代码示例来源:origin: org.swinglabs.swingx/swingx-core

@Override
public void setBounds(int x, int y, int w, int h) {
  super.setBounds(x,y,w,h);
  recalc();
}

代码示例来源:origin: beanshell/beanshell

public void setBounds( int x, int y, int width, int height ) {
  setPreferredSize( new Dimension(width, height) );
  setMinimumSize( new Dimension(width, height) );
  super.setBounds( x, y, width, height );
}

代码示例来源:origin: freeplane/freeplane

@Override
public void setBounds(int x, int y, int width, int height) {
  Rules rule = edgeColor.getRule();
  if(EdgeController.Rules.BY_PARENT != rule)
    edgeColor.resetCache();
  super.setBounds(x, y, width, height);
}

代码示例来源:origin: com.jidesoft/jide-oss

private void updateLocation() {
  JComponent[] components = getOverlayComponents();
  for (JComponent c : components) {
    if (c == null) {
      return;
    }
    Rectangle r = getOverlayComponentBounds(c);
    c.setBounds(r);
  }
}

代码示例来源:origin: mucommander/mucommander

private void updateLocation() {
  JComponent[] components = getOverlayComponents();
  for (JComponent c : components) {
    if (c == null) {
      return;
    }
    if (c.isVisible()) {
      Rectangle r = getOverlayComponentBounds(c);
      c.setBounds(r);
    }
  }
}

代码示例来源:origin: org.piccolo2d/piccolo2d-core

/**
 * Updates the bounds of the component and updates the camera accordingly.
 * 
 * @param x left of bounds
 * @param y top of bounds
 * @param width width of bounds
 * @param height height of bounds
 */
public void setBounds(final int x, final int y, final int width, final int height) {
  camera.setBounds(camera.getX(), camera.getY(), width, height);
  super.setBounds(x, y, width, height);
}

代码示例来源:origin: org.netbeans.api/org-netbeans-api-visual

@Override
public void setBounds (int x, int y, int width, int height) {
  super.setBounds (x, y, width, height);
  Rectangle bounds = scene.getBounds ();
  double zoomFactor = scene.getZoomFactor();
  if (bounds != null  &&  width == (int) (bounds.width * zoomFactor) && height == (int) (bounds.height * zoomFactor))
    return;
  scene.revalidate ();
  scene.validate ();
}

代码示例来源:origin: com.sikulix/sikulixapi

public void setActualBounds(Rectangle actualBounds) {
 this.actualBounds = (Rectangle) actualBounds.clone();
 Rectangle paintBounds = (Rectangle) actualBounds.clone();
 if (hasShadow()) {
  paintBounds.x -= (shadowSize - shadowOffset);
  paintBounds.y -= (shadowSize - shadowOffset);
  paintBounds.width += (2 * shadowSize);
  paintBounds.height += (2 * shadowSize);
 }
 super.setBounds(paintBounds);
 updateAllFollowers();
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

private final void installInner(JComponent c) {
  synchronized (getTreeLock()) {
    if (inner != null) {
      remove(inner);
    }
    inner = c;
    if (inner != null) {
      c.setBounds(0, 0, getWidth(), getHeight());
      add(c);
    }
  }
}

代码示例来源:origin: freeplane/freeplane

public void layoutContainer(final Container c) {
   final NodeView view = (NodeView) c;
   JComponent content = view.getContent();
  
  if(content == null)
    return;
  content.setVisible(view.isContentVisible());
  final int x = view.getSpaceAround();
  final int y = x;
  final Dimension contentProfSize = ContentSizeCalculator.INSTANCE.calculateContentSize(view);
  content.setBounds(x, y, contentProfSize.width, contentProfSize.height);
  placeChildren(view);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui

protected void paintComponent(Graphics g) {
  JTableHeader header = getHeader();
  setupHeader(header);
  TableCellRenderer renderer = header.getDefaultRenderer();
  JComponent component = (JComponent)renderer.getTableCellRendererComponent(
              getTable(), "", isSelected && isPressed, isFocusOwner(), -1, 0); // NOI18N
  
  int height = header.getPreferredSize().height;
  component.setBounds(0, 0, getWidth(), height);
  component.setOpaque(false);
  getPainter().paintComponent(g, component, null, 0, 0, getWidth(), height, false);
}

相关文章

JComponent类方法