本文整理匯總了Java中com.explodingpixels.widgets.WindowUtils.isParentWindowFocused方法的典型用法代碼示例。如果您正苦於以下問題:Java WindowUtils.isParentWindowFocused方法的具體用法?Java WindowUtils.isParentWindowFocused怎麽用?Java WindowUtils.isParentWindowFocused使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.explodingpixels.widgets.WindowUtils
的用法示例。
在下文中一共展示了WindowUtils.isParentWindowFocused方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getBackgroundPainter
import com.explodingpixels.widgets.WindowUtils; //導入方法依賴的package包/類
private MacWidgetsPainter<Component> getBackgroundPainter() {
MacWidgetsPainter<Component> retVal;
boolean windowHasFocus = WindowUtils.isParentWindowFocused(fTable);
boolean isColumnSelected = isColumnBeingPaintedSelected();
boolean isColumnPressed = isColumnBeingPaintedPressed();
// TODO cleanup this logic.
if (!fTable.isEnabled()) {
retVal = MacPainterFactory.createIAppUnpressedUnselectedHeaderPainter();
} else if (windowHasFocus && isColumnPressed && isColumnSelected) {
retVal = MacPainterFactory.createIAppPressedSelectedHeaderPainter();
} else if (windowHasFocus && isColumnPressed) {
retVal = MacPainterFactory.createIAppPressedUnselectedHeaderPainter();
} else if (windowHasFocus && isColumnSelected) {
retVal = MacPainterFactory.createIAppUnpressedSelectedHeaderPainter();
} else {
retVal = MacPainterFactory.createIAppUnpressedUnselectedHeaderPainter();
}
return retVal;
}
示例2: paint
import com.explodingpixels.widgets.WindowUtils; //導入方法依賴的package包/類
public void paint(Graphics g)
{
boolean containedInActiveWindow = WindowUtils.isParentWindowFocused(this);
Color color = containedInActiveWindow
? colorScheme.getActiveBackgroundColor() : colorScheme.getInactiveBackgroundColor();
this.setBackground(color);
int w = getWidth();
int h = getHeight();
Graphics2D g2 = (Graphics2D)g;
g2.setColor(color);
g2.fillRect(0, 0, w, h);
paintChildren(g2);
}
示例3: paint
import com.explodingpixels.widgets.WindowUtils; //導入方法依賴的package包/類
public void paint(Graphics2D g, Component component, int width, int height) {
MacWidgetsPainter<Component> painterToUse;
Window activeAncestor = null;
Window active = KeyboardFocusManager.getCurrentKeyboardFocusManager()
.getActiveWindow();
if (active != null) {
activeAncestor = SwingUtilities.getWindowAncestor(active);
}
Window componentAncestor = SwingUtilities.getWindowAncestor(component);
if (component.hasFocus() || componentAncestor.equals(activeAncestor)) {
painterToUse = fComponentFocusedPainter;
} else if (WindowUtils.isParentWindowFocused(component)
|| componentAncestor.equals(activeAncestor)) {
painterToUse = fWindowFocusedPainter;
} else {
painterToUse = fWindowUnfocusedPainter;
}
painterToUse.paint(g, component, width, height);
}
示例4: getImageSet
import com.explodingpixels.widgets.WindowUtils; //導入方法依賴的package包/類
private ImageSet getImageSet(Component objectToPaint) {
ImageSet retVal;
if (!objectToPaint.isEnabled()) {
retVal = fDisabledImageSet;
} else if (WindowUtils.isParentWindowFocused(objectToPaint)) {
retVal = fActiveImageSet;
} else {
retVal = fInactiveImageSet;
}
return retVal;
}
示例5: updateFocusState
import com.explodingpixels.widgets.WindowUtils; //導入方法依賴的package包/類
private void updateFocusState() {
Boolean focused = WindowUtils.isParentWindowFocused(this);
fLabel.setForeground(focused == null || focused ? FONT_COLOR : UNFOCUSED_FONT_COLOR);
}
示例6: paintSelectedButtonBackground
import com.explodingpixels.widgets.WindowUtils; //導入方法依賴的package包/類
private static void paintSelectedButtonBackground(AbstractButton button,
Graphics2D graphics) {
// determine if the containing window has focus.
boolean isButtonsWindowFocused =
WindowUtils.isParentWindowFocused(button);
// get center graident colors, based on the focus state of the
// containing window.
Color centerColor = isButtonsWindowFocused
? FOCUSED_BACKGROUND_CENTER_COLOR
: UNFOCUSED_BACKGROUND_CENTER_COLOR;
Color innerBorderColor = isButtonsWindowFocused
? FOCUSED_INNER_BORDER_COLOR
: UNFOCUSED_INNER_BORDER_COLOR;
Color outterBorderColor = isButtonsWindowFocused
? FOCUSED_OUTER_BORDER_COLOR
: UNFOCUSED_OUTER_BORDER_COLOR;
// calculate the first gradient's stop y position, and the second
// gradient's start y position. thesve values, shouldn't overlap, as
// transparent colors are addative, and would thus result in
// bleed-through.
int topMiddleY = button.getHeight()/2;
int bottomMiddleY = button.getHeight()/2+1;
// create the top and bottom fill paint.
Paint topCenterPaint = new GradientPaint(
0f,0f,TRANSPARENT_COLOR,1f,topMiddleY,centerColor);
Paint bottomCenterPaint = new GradientPaint(
0f,bottomMiddleY,centerColor,1f,button.getHeight(),TRANSPARENT_COLOR);
// draw the selection background gradient. note that we don't want to
// draw where the border is as tranparent colors will bleed together.
graphics.setPaint(topCenterPaint);
int borderWidth = 2;
int fillWidth = button.getWidth() - borderWidth * 2;
graphics.fillRect(borderWidth,0,fillWidth,topMiddleY);
graphics.setPaint(bottomCenterPaint);
graphics.fillRect(borderWidth,topMiddleY,fillWidth,button.getHeight());
// create the outter border top and bottom paint.
Paint topOuterBorderPaint = new GradientPaint(
0f,0f,TRANSPARENT_COLOR,1f,topMiddleY,outterBorderColor);
Paint bottomOuterBorderPaint = new GradientPaint(
0f,bottomMiddleY,outterBorderColor,1f,button.getHeight(),TRANSPARENT_COLOR);
// draw the outter border line.
graphics.setPaint(topOuterBorderPaint);
int outterLeftBorderX = 0;
int outterRightBorderX = button.getWidth() - 1;
graphics.drawLine(outterLeftBorderX,0,outterLeftBorderX,topMiddleY);
graphics.drawLine(outterRightBorderX,0,outterRightBorderX,topMiddleY);
graphics.setPaint(bottomOuterBorderPaint);
graphics.drawLine(outterLeftBorderX,bottomMiddleY,outterLeftBorderX,button.getHeight());
graphics.drawLine(outterRightBorderX,bottomMiddleY,outterRightBorderX,button.getHeight());
// create the inner border top and bottom paint.
Paint topInnerBorderPaint = new GradientPaint(
0f,0f,TRANSPARENT_COLOR,1f,topMiddleY,innerBorderColor);
Paint bottomInnerBorderPaint = new GradientPaint(
0f,bottomMiddleY,innerBorderColor,1f,button.getHeight(),TRANSPARENT_COLOR);
// draw the inner border line.
graphics.setPaint(topInnerBorderPaint);
int innerLeftBorderX = 1;
int innerRightBorderX = button.getWidth() - 2;
graphics.drawLine(innerLeftBorderX,0,innerLeftBorderX,topMiddleY);
graphics.drawLine(innerRightBorderX,0,innerRightBorderX,topMiddleY);
graphics.setPaint(bottomInnerBorderPaint);
graphics.drawLine(innerLeftBorderX,bottomMiddleY,innerLeftBorderX,button.getHeight());
graphics.drawLine(innerRightBorderX,bottomMiddleY,innerRightBorderX,button.getHeight());
}
示例7: getSelectedRowBottomHighlight
import com.explodingpixels.widgets.WindowUtils; //導入方法依賴的package包/類
private Color getSelectedRowBottomHighlight() {
return WindowUtils.isParentWindowFocused(table) ? SELECTION_ACTIVE_BOTTOM_BORDER_COLOR
: SELECTION_INACTIVE_BOTTOM_BORDER_COLOR;
}