javax.swing.JLabel.getBounds()方法的使用及代码示例

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

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

JLabel.getBounds介绍

暂无

代码示例

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

Rectangle cc = new Rectangle(symbol.getBounds());
cc.grow(7, 0);
circle = new SxCircle(new Element(cc));

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

JLabel labelInPane = //... reference lookup
Rectangle bounds = labelInPane.getBounds();
// You may need to convert the point to meet the requirements of the parent container...
// bounds.setLocation(SwingUtilities.convertPoint(labelInPane, bounds.getPoint(), topLevelParentPaneInScrollPane));

scrollPane.getViewport().scrollRectToVisible(bounds);

代码示例来源:origin: es.gob.afirma/afirma-ui-core-jse-keystores

/** Recupera el rectángulo ocupado por el enlace para la carga del certificado.
   * @return Recuadro con el enlace. */
  Rectangle getCertificateLinkBounds() {
    return this.propertiesLink.getBounds();
  }
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

public Rectangle getTextRect()
{
 return _label.getBounds();
}

代码示例来源:origin: net.sf.kerner-utils/kerner-utils

/** {@inheritDoc} */
@Override
public Rectangle getBounds() {
  if (bounds == null) {
    bounds = new Rectangle();
  }
  return super.getBounds(bounds);
}

代码示例来源:origin: net.sf.taverna.t2.ui-exts/perspective-biocatalogue

public void run() {
  expandRect = jlExpand.getBounds();
  expandRect.x -= Math.abs(thisPanel.getBounds().x);
 }
});

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

public boolean intersects(JLabel testa, JLabel testb){
  Area areaA = new Area(testa.getBounds());
  Area areaB = new Area(testb.getBounds());

  return areaA.intersects(areaB.getBounds2D());
}

代码示例来源:origin: com.threerings/nenya-tools

public void mousePressed (MouseEvent event)
{
  // if the click was in the bounds of the source image, grab the
  // pixel color and use that to set the "source" color
  int x = event.getX(), y = event.getY();
  Rectangle ibounds = _oldImage.getBounds();
  if (ibounds.contains(x, y)) {
    int argb = _image.getRGB(x - ibounds.x, y - ibounds.y);
    String cstr = Integer.toString(argb & 0xFFFFFF, 16);
    _source.setText(cstr.toUpperCase());
    _colorLabel.setBackground(new Color(argb));
    _colorLabel.repaint();
  }
}

代码示例来源:origin: com.github.insubstantial/substance-swingx

@Override
protected void paintFocus(Graphics g, Color paintColor, int x, int y,
    int width, int height) {
  SubstanceCoreUtilities.paintFocus(g, group, group,
      SubstanceTaskPaneUI.this, new Rectangle(x, y, width - 1,
          height - 1), label.getBounds(), 1.0f, 0);
}

代码示例来源:origin: edu.stanford.protege/ca.uvic.cs.chisel.cajun

public void setStatus(String msg, boolean error) {
  statusLabel.setText(msg);
  statusLabel.setToolTipText(msg);
  statusLabel.setForeground(error ? Color.red : Color.black);
  
  // force a repaint
  if (SwingUtilities.isEventDispatchThread()) {
    long diff = System.currentTimeMillis() - lastStatusPaint;
    if (diff > MIN_REPAINT) {
      statusLabel.paintImmediately(statusLabel.getBounds());
      lastStatusPaint = System.currentTimeMillis();
    }
  }
}

代码示例来源:origin: com.github.lgooddatepicker/LGoodDatePicker

/**
 * getMonthOrYearMenuLocation, This calculates the position should be used to set the location
 * of the month or the year popup menus, relative to their source labels. These menus are used
 * to change the current month or current year from within the calendar panel.
 */
private Point getMonthOrYearMenuLocation(JLabel sourceLabel, JPopupMenu filledPopupMenu) {
  Rectangle labelBounds = sourceLabel.getBounds();
  int menuHeight = filledPopupMenu.getPreferredSize().height;
  int popupX = labelBounds.x + labelBounds.width + 1;
  int popupY = labelBounds.y + (labelBounds.height / 2) - (menuHeight / 2);
  return new Point(popupX, popupY);
}

代码示例来源:origin: threerings/nenya

public void mousePressed (MouseEvent event)
{
  // if the click was in the bounds of the source image, grab the
  // pixel color and use that to set the "source" color
  int x = event.getX(), y = event.getY();
  Rectangle ibounds = _oldImage.getBounds();
  if (ibounds.contains(x, y)) {
    int argb = _image.getRGB(x - ibounds.x, y - ibounds.y);
    String cstr = Integer.toString(argb & 0xFFFFFF, 16);
    _source.setText(cstr.toUpperCase());
    _colorLabel.setBackground(new Color(argb));
    _colorLabel.repaint();
  }
}

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

/**
 * Setter function for message in the status bar.
 *
 * @param newMessage The new message to display.
 * @see #getStatusMessage
 */
public void setStatusMessage(String newMessage) {
  statusMessage.setText(newMessage);
  // We paint immediately for components like
  // org.fife.ui.FindInFilesDialog.
  statusMessage.paintImmediately(statusMessage.getBounds());
}

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

public void setMessage(final String message) {
  UIUtilities.invokeOnEventThread(() -> {
    messageBox.setText(message);
    messageBox.paintImmediately(messageBox.getBounds());
  });
  if (!SwingUtilities.isEventDispatchThread()) {
    try {
      Thread.currentThread().sleep(10);
    } catch (InterruptedException e) {
      // ignore
    }
  }
}

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

public void setMessage3(final String message) {
  UIUtilities.invokeOnEventThread(() -> {
    messageBox3.setText(message);
    messageBox3.paintImmediately(messageBox2.getBounds());
  });
}

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

public void setMessage2(final String message) {
  UIUtilities.invokeOnEventThread(() -> {
    messageBox2.setText(message);
    messageBox2.paintImmediately(messageBox2.getBounds());
  });
}

代码示例来源:origin: org.orbisgis/orbisgis-view

/**
 * Return true if the position provided is on the 
 * @param position
 * @return 
 */
public boolean isPositionOnCancelImage(JobListItem jobItem, Point position) {
    JLabel jobCancelLabel = jobItem.getItemPanel().getJobCancelLabel();
    if(jobCancelLabel!=null) {
        return jobCancelLabel.getBounds().contains(position);
    } else {
        return false;
    }
}
@Override

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

public boolean intersects(JLabel testa, JLabel testb){
  Rectangle rectB = testb.getBounds();

  Rectangle result = SwingUtilities.computeIntersection(testa.getX(), testa.getY(), testa.getWidth(), testa.getHeight(), rectB);

  return (result.getWidth() > 0 && result.getHeight() > 0);
}

代码示例来源:origin: com.github.insubstantial/flamingo

@Override
public void paint(Graphics g, JComponent c) {
  Color bg = this.colorSelectorPanel.getBackground();
  g.setColor(bg);
  int w = c.getWidth();
  int h = c.getHeight();
  g.fillRect(0, 0, w, h);
  Rectangle captionBackground = this.captionLabel.getBounds();
  this.paintCaptionBackground(g, 0, 0, w, captionBackground.height + 2
      * getLayoutGap());
  if (this.colorSelectorPanel.isLastPanel()) {
    paintBottomDivider(g, 0, 0, w, h);
  }
}

代码示例来源:origin: org.ihtsdo/wb-api

public Image getDragImage() {
  JLabel dragLabel = TermLabelMaker.makeLabel(getText());
  dragLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
  Image dragImage = createImage(dragLabel.getWidth(), dragLabel.getHeight());
  dragLabel.setVisible(true);
  Graphics og = dragImage.getGraphics();
  og.setClip(dragLabel.getBounds());
  dragLabel.paint(og);
  og.dispose();
  FilteredImageSource fis = new FilteredImageSource(dragImage.getSource(),
      TermLabelMaker.getTransparentFilter());
  dragImage = Toolkit.getDefaultToolkit().createImage(fis);
  return dragImage;
}

相关文章

JLabel类方法