本文整理汇总了Java中java.awt.Graphics.hitClip方法的典型用法代码示例。如果您正苦于以下问题:Java Graphics.hitClip方法的具体用法?Java Graphics.hitClip怎么用?Java Graphics.hitClip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Graphics
的用法示例。
在下文中一共展示了Graphics.hitClip方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paint
import java.awt.Graphics; //导入方法依赖的package包/类
/**
*
*/
public void paint(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
Stroke stroke = g2.getStroke();
g2.setStroke(getSelectionStroke());
g.setColor(getSelectionColor());
Point last = state.getAbsolutePoint(0).getPoint();
for (int i = 1; i < state.getAbsolutePointCount(); i++) {
Point current = state.getAbsolutePoint(i).getPoint();
Line2D line = new Line2D.Float(last.x, last.y, current.x, current.y);
Rectangle bounds = g2.getStroke().createStrokedShape(line).getBounds();
if (g.hitClip(bounds.x, bounds.y, bounds.width, bounds.height)) {
g2.draw(line);
}
last = current;
}
g2.setStroke(stroke);
super.paint(g);
}
示例2: paint
import java.awt.Graphics; //导入方法依赖的package包/类
/**
*
*/
public void paint(Graphics g)
{
Rectangle bounds = getState().getRectangle();
if (g.hitClip(bounds.x, bounds.y, bounds.width, bounds.height))
{
Graphics2D g2 = (Graphics2D) g;
Stroke stroke = g2.getStroke();
g2.setStroke(getSelectionStroke());
g.setColor(getSelectionColor());
g.drawRect(bounds.x, bounds.y, bounds.width, bounds.height);
g2.setStroke(stroke);
}
super.paint(g);
}
示例3: paint
import java.awt.Graphics; //导入方法依赖的package包/类
/**
* Paints the visible handles of this handler.
*/
public void paint(Graphics g)
{
if (handles != null && isHandlesVisible())
{
for (int i = 0; i < handles.length; i++)
{
if (isHandleVisible(i)
&& g.hitClip(handles[i].x, handles[i].y,
handles[i].width, handles[i].height))
{
g.setColor(getHandleFillColor(i));
g.fillRect(handles[i].x, handles[i].y, handles[i].width,
handles[i].height);
g.setColor(getHandleBorderColor(i));
g.drawRect(handles[i].x, handles[i].y,
handles[i].width - 1, handles[i].height - 1);
}
}
}
}
示例4: paint
import java.awt.Graphics; //导入方法依赖的package包/类
/**
*
*/
public void paint(Graphics g) {
Rectangle bounds = getState().getRectangle();
if (g.hitClip(bounds.x, bounds.y, bounds.width, bounds.height)) {
Graphics2D g2 = (Graphics2D) g;
Stroke stroke = g2.getStroke();
g2.setStroke(getSelectionStroke());
g.setColor(getSelectionColor());
g.drawRect(bounds.x, bounds.y, bounds.width, bounds.height);
g2.setStroke(stroke);
}
super.paint(g);
}
示例5: paintMargin
import java.awt.Graphics; //导入方法依赖的package包/类
/** Paint the outside margin where the spinners for expandable
* sets are. This should be derived from the standard control
* color. This method will overpaint the grid lines in this
* area. */
private void paintMargin(Graphics g) {
//Don't paint the margin for sorted modes
//fill the outer column with the set renderer color, per UI spec
g.setColor(PropUtils.getSetRendererColor());
int w = PropUtils.getMarginWidth();
int h = getHeight();
if (g.hitClip(0, 0, w, h)) {
g.fillRect(0, 0, w, h);
}
}
示例6: paint
import java.awt.Graphics; //导入方法依赖的package包/类
public void paint(Graphics g) {
if (isShowing()) {
super.paint(g);
} else {
getLayout().layoutContainer(this);
Component[] c = getComponents();
Color col = g.getColor();
try {
g.setColor(getBackground());
g.fillRect(0, 0, getWidth(), getHeight());
for (int i = 0; i < c.length; i++) {
Rectangle r = c[i].getBounds();
if (g.hitClip(r.x, r.y, r.width, r.height)) {
Graphics g2 = g.create(r.x, r.y, r.width, r.height);
try {
c[i].paint(g2);
} finally {
g2.dispose();
}
}
}
if (getBorder() != null) {
super.paintBorder(g);
}
} finally {
g.setColor(col);
}
}
}
示例7: paint
import java.awt.Graphics; //导入方法依赖的package包/类
/** Overridden to draw "no properties" if necessary */
public void paint(Graphics g, JComponent c) {
Component view = ((JViewport) c).getView();
if (view != null) {
lastKnownSize = view.getSize();
}
if (stringWidth == -1) {
calcStringSizes(c.getFont(), g);
}
//Update will have set paintNoProps to the correct value
if (shouldPaintEmptyMessage()) {
//We need to paint centered "<No Properties>" text
g.setFont(c.getFont());
g.setColor(c.getForeground());
Rectangle r = getEmptyMessageBounds();
//See if we really need to do any painting
if (g.hitClip(r.x, r.y, r.width, r.height)) {
//Paint the string
g.drawString(emptyString, r.x, r.y + ascent);
}
}
}
示例8: paint
import java.awt.Graphics; //导入方法依赖的package包/类
@Override
public void paint(Graphics g, JComponent c) {
ColorUtil.setupAntialiasing(g);
TabData tabData;
int x, y, width, height;
String text;
paintDisplayerBackground( g, c );
for (int i = 0; i < dataModel.size(); i++) {
// gather data
tabData = dataModel.getTab(i);
x = layoutModel.getX(i);
y = layoutModel.getY(i);
width = layoutModel.getW(i);
height = layoutModel.getH(i);
text = tabData.getText();
// perform paint
if (g.hitClip(x, y, width, height)) {
paintTabBackground(g, i, x, y, width, height);
paintTabContent(g, i, text, x, y, width, height);
paintTabBorder(g, i, x, y, width, height);
}
}
}
示例9: paint
import java.awt.Graphics; //导入方法依赖的package包/类
/**
*
*/
public void paint(Graphics g)
{
Graphics2D g2 = (Graphics2D) g;
Stroke stroke = g2.getStroke();
g2.setStroke(getSelectionStroke());
g.setColor(getSelectionColor());
Point last = state.getAbsolutePoint(0).getPoint();
for (int i = 1; i < state.getAbsolutePointCount(); i++)
{
Point current = state.getAbsolutePoint(i).getPoint();
Line2D line = new Line2D.Float(last.x, last.y, current.x, current.y);
Rectangle bounds = g2.getStroke().createStrokedShape(line)
.getBounds();
if (g.hitClip(bounds.x, bounds.y, bounds.width, bounds.height))
{
g2.draw(line);
}
last = current;
}
g2.setStroke(stroke);
super.paint(g);
}
示例10: paint
import java.awt.Graphics; //导入方法依赖的package包/类
/**
* Paints the visible handles of this handler.
*/
public void paint(Graphics g) {
if (handles != null && isHandlesVisible()) {
for (int i = 0; i < handles.length; i++) {
if (isHandleVisible(i)
&& g.hitClip(handles[i].x, handles[i].y, handles[i].width, handles[i].height)) {
g.setColor(getHandleFillColor(i));
g.fillRect(handles[i].x, handles[i].y, handles[i].width, handles[i].height);
g.setColor(getHandleBorderColor(i));
g.drawRect(handles[i].x, handles[i].y, handles[i].width - 1, handles[i].height - 1);
}
}
}
}
示例11: paintExpandableSets
import java.awt.Graphics; //导入方法依赖的package包/类
/** Paint the expandable sets. These are painted double width,
* across the entire width of the table. */
private void paintExpandableSets(Graphics g) {
int start = 0;
int end = getRowCount();
Insets ins = getInsets();
boolean canBeSelected = isKnownComponent(
KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner()
);
for (int i = 0; i < end; i++) {
int idx = start + i;
Object value = getValueAt(idx, 0);
if (value instanceof PropertySet) {
Rectangle r = getCellRect(idx, 0, false);
r.x = ins.left;
r.width = getWidth() - (ins.left + ins.right);
if (g.hitClip(r.x, r.y, r.width, r.height)) {
PropertySet ps = (PropertySet) value;
String txt = ps.getHtmlDisplayName();
boolean isHtml = txt != null;
if (!isHtml) {
txt = ps.getDisplayName();
}
if (htmlrenderer == null) {
htmlrenderer = HtmlRenderer.createRenderer();
}
JComponent painter = (JComponent) htmlrenderer.getTableCellRendererComponent(
this, txt, false, false, idx, 0
);
htmlrenderer.setHtml(isHtml);
htmlrenderer.setParentFocused(true);
htmlrenderer.setIconTextGap(2);
htmlrenderer.setIcon(
getPropertySetModel().isExpanded(ps) ? PropUtils.getExpandedIcon() : PropUtils.getCollapsedIcon()
);
boolean selected = canBeSelected && (getSelectedRow() == idx);
if (!selected) {
painter.setBackground(PropUtils.getSetRendererColor());
painter.setForeground(PropUtils.getSetForegroundColor());
} else {
painter.setBackground(PropUtils.getSelectedSetRendererColor());
painter.setForeground(PropUtils.getSelectedSetForegroundColor());
}
if( PropUtils.isAqua ) {
painter.setOpaque(false);
Graphics2D g2d = (Graphics2D) g;
Paint oldPaint = g2d.getPaint();
g2d.setPaint( new GradientPaint(r.x,r.y, Color.white, r.x, r.y+r.height/2, painter.getBackground()) );
g2d.fillRect(r.x, r.y, r.width, r.height);
g2d.setPaint(oldPaint);
} else {
painter.setOpaque(true);
}
paintComponent(g, painter, r.x, r.y, r.width, r.height);
}
}
}
}