本文整理了Java中org.netbeans.api.visual.widget.Widget.calculateClientArea()
方法的一些代码示例,展示了Widget.calculateClientArea()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Widget.calculateClientArea()
方法的具体详情如下:
包路径:org.netbeans.api.visual.widget.Widget
类名称:Widget
方法名:calculateClientArea
[英]Called to calculate the client area required by the widget without the children widgets.
[中]调用以计算不带子窗口小部件的窗口小部件所需的客户端区域。
代码示例来源:origin: org.netbeans.api/org-netbeans-api-visual
/**
* Calculates a client area of the image
* @return the calculated client area
*/
protected Rectangle calculateClientArea () {
if (image != null)
return new Rectangle (0, 0, width, height);
return super.calculateClientArea ();
}
代码示例来源:origin: in.jlibs/org-netbeans-api-visual
/**
* Calculates a client area of the image
* @return the calculated client area
*/
protected Rectangle calculateClientArea () {
if (image != null)
return new Rectangle (0, 0, width, height);
return super.calculateClientArea ();
}
代码示例来源:origin: org.netbeans.api/org-netbeans-api-visual
/**
* Calculates a client area for the label.
* @return the client area
*/
protected Rectangle calculateClientArea () {
if (label == null)
return super.calculateClientArea ();
Rectangle rectangle;
if (useGlyphVector) {
assureGlyphVector ();
rectangle = GeomUtil.roundRectangle (cacheGlyphVector.getVisualBounds ());
rectangle.grow (1, 1); // WORKAROUND - even text antialiasing is included into the boundary
} else {
Graphics2D gr = getGraphics ();
if (gr == null) { // #192529
return super.calculateClientArea();
}
FontMetrics fontMetrics = gr.getFontMetrics (getFont ());
Rectangle2D stringBounds = fontMetrics.getStringBounds (label, gr);
rectangle = GeomUtil.roundRectangle (stringBounds);
}
switch (orientation) {
case NORMAL:
return rectangle;
case ROTATE_90:
return new Rectangle (rectangle.y, - rectangle.x - rectangle.width, rectangle.height, rectangle.width);
default:
throw new IllegalStateException ();
}
}
代码示例来源:origin: in.jlibs/org-netbeans-api-visual
/**
* Calculates a client area for the label.
* @return the client area
*/
protected Rectangle calculateClientArea () {
if (label == null)
return super.calculateClientArea ();
Rectangle rectangle;
if (useGlyphVector) {
assureGlyphVector ();
rectangle = GeomUtil.roundRectangle (cacheGlyphVector.getVisualBounds ());
rectangle.grow (1, 1); // WORKAROUND - even text antialiasing is included into the boundary
} else {
Graphics2D gr = getGraphics ();
FontMetrics fontMetrics = gr.getFontMetrics (getFont ());
Rectangle2D stringBounds = fontMetrics.getStringBounds (label, gr);
rectangle = GeomUtil.roundRectangle (stringBounds);
}
switch (orientation) {
case NORMAL:
return rectangle;
case ROTATE_90:
return new Rectangle (rectangle.y, - rectangle.x - rectangle.width, rectangle.height, rectangle.width);
default:
throw new IllegalStateException ();
}
}
代码示例来源:origin: in.jlibs/org-netbeans-api-visual
private Rectangle calculatePreferredBounds () {
Insets insets = border.getInsets ();
Rectangle clientArea = calculateClientArea ();
for (Widget child : children) {
if (! child.isVisible ())
continue;
Point location = child.getLocation ();
Rectangle bounds = child.getBounds ();
bounds.translate (location.x, location.y);
clientArea.add (bounds);
}
clientArea.x -= insets.left;
clientArea.y -= insets.top;
clientArea.width += insets.left + insets.right;
clientArea.height += insets.top + insets.bottom;
return clientArea;
}
代码示例来源:origin: org.netbeans.api/org-netbeans-api-visual
private Rectangle calculatePreferredBounds () {
Insets insets = border.getInsets ();
Rectangle clientArea = calculateClientArea ();
for (Widget child : children) {
if (! child.isVisible ())
continue;
Point location = child.getLocation ();
Rectangle bounds = child.getBounds ();
bounds.translate (location.x, location.y);
clientArea.add (bounds);
}
clientArea.x -= insets.left;
clientArea.y -= insets.top;
clientArea.width += insets.left + insets.right;
clientArea.height += insets.top + insets.bottom;
return clientArea;
}
代码示例来源:origin: nl.cloudfarming.client/cloudfarming-client-geoviewer-jxmap
@Override
protected void paintWidget() {
//
// get the renderer for the geometry in the layer object and render the geometry
//
GeometryRenderer renderer = GeometryRendererFactory.getRenderer(layerObject.getGeometry());
getGraphics().setColor(getForeground());
if (!layer.isInterActive()) {
getGraphics().setColor(this.layer.getPalette().getColorForValue(layerObject.getKeyAttributeValue()));
}
Rectangle clientArea = renderer.paint(layerObject.getGeometry(), this.mapViewer, getGraphics(), getState().isSelected());
clientArea = (clientArea != null) ? clientArea : super.calculateClientArea();
setPreferredBounds(clientArea);
}
内容来源于网络,如有侵权,请联系作者删除!