Rectangle cc = new Rectangle(symbol.getBounds()); cc.grow(7, 0); circle = new SxCircle(new Element(cc));
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);
/** Recupera el rectángulo ocupado por el enlace para la carga del certificado. * @return Recuadro con el enlace. */ Rectangle getCertificateLinkBounds() { return this.propertiesLink.getBounds(); } }
public Rectangle getTextRect() { return _label.getBounds(); }
/** {@inheritDoc} */ @Override public Rectangle getBounds() { if (bounds == null) { bounds = new Rectangle(); } return super.getBounds(bounds); }
public void run() { expandRect = jlExpand.getBounds(); expandRect.x -= Math.abs(thisPanel.getBounds().x); } });
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(); } }
@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); }
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(); } } }
/** * 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); }
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(); } }
/** * 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()); }
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 } } }
public void setMessage3(final String message) { UIUtilities.invokeOnEventThread(() -> { messageBox3.setText(message); messageBox3.paintImmediately(messageBox2.getBounds()); }); }
public void setMessage2(final String message) { UIUtilities.invokeOnEventThread(() -> { messageBox2.setText(message); messageBox2.paintImmediately(messageBox2.getBounds()); }); }
/** * 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
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); }
@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); } }
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; }