當前位置: 首頁>>代碼示例>>Java>>正文


Java WindowUtils.isParentWindowFocused方法代碼示例

本文整理匯總了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;
}
 
開發者ID:mathieulegoc,項目名稱:SmartTokens,代碼行數:22,代碼來源:ITunesTableHeaderRenderer.java

示例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);
}
 
開發者ID:mathieulegoc,項目名稱:SmartTokens,代碼行數:19,代碼來源:ActivePanel.java

示例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);
}
 
開發者ID:mathieulegoc,項目名稱:SmartTokens,代碼行數:23,代碼來源:FocusStatePainter.java

示例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;
}
 
開發者ID:mathieulegoc,項目名稱:SmartTokens,代碼行數:14,代碼來源:ScrollThumbImagePainter.java

示例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);
}
 
開發者ID:mathieulegoc,項目名稱:SmartTokens,代碼行數:5,代碼來源:HudWindow.java

示例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());
}
 
開發者ID:mathieulegoc,項目名稱:SmartTokens,代碼行數:72,代碼來源:PreferencesTabBarButtonUI.java

示例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;
}
 
開發者ID:mathieulegoc,項目名稱:SmartTokens,代碼行數:5,代碼來源:ITunesTableUI.java


注:本文中的com.explodingpixels.widgets.WindowUtils.isParentWindowFocused方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。