当前位置: 首页>>代码示例>>Java>>正文


Java SynthConstants.ENABLED属性代码示例

本文整理汇总了Java中javax.swing.plaf.synth.SynthConstants.ENABLED属性的典型用法代码示例。如果您正苦于以下问题:Java SynthConstants.ENABLED属性的具体用法?Java SynthConstants.ENABLED怎么用?Java SynthConstants.ENABLED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.swing.plaf.synth.SynthConstants的用法示例。


在下文中一共展示了SynthConstants.ENABLED属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toString

private static String toString(int state) {
    StringBuffer buffer = new StringBuffer();
    if ((state & SynthConstants.DEFAULT) == SynthConstants.DEFAULT) {
        buffer.append("Default");
    }
    if ((state & SynthConstants.DISABLED) == SynthConstants.DISABLED) {
        if (buffer.length() > 0) buffer.append("+");
        buffer.append("Disabled");
    }
    if ((state & SynthConstants.ENABLED) == SynthConstants.ENABLED) {
        if (buffer.length() > 0) buffer.append("+");
        buffer.append("Enabled");
    }
    if ((state & SynthConstants.FOCUSED) == SynthConstants.FOCUSED) {
        if (buffer.length() > 0) buffer.append("+");
        buffer.append("Focused");
    }
    if ((state & SynthConstants.MOUSE_OVER) == SynthConstants.MOUSE_OVER) {
        if (buffer.length() > 0) buffer.append("+");
        buffer.append("MouseOver");
    }
    if ((state & SynthConstants.PRESSED) == SynthConstants.PRESSED) {
        if (buffer.length() > 0) buffer.append("+");
        buffer.append("Pressed");
    }
    if ((state & SynthConstants.SELECTED) == SynthConstants.SELECTED) {
        if (buffer.length() > 0) buffer.append("+");
        buffer.append("Selected");
    }
    return buffer.toString();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:State.java

示例2: toString

private static String toString(int state) {
    StringBuilder sb = new StringBuilder();
    if ((state & SynthConstants.DEFAULT) == SynthConstants.DEFAULT) {
        sb.append("Default");
    }
    if ((state & SynthConstants.DISABLED) == SynthConstants.DISABLED) {
        if (sb.length() > 0) sb.append("+");
        sb.append("Disabled");
    }
    if ((state & SynthConstants.ENABLED) == SynthConstants.ENABLED) {
        if (sb.length() > 0) sb.append("+");
        sb.append("Enabled");
    }
    if ((state & SynthConstants.FOCUSED) == SynthConstants.FOCUSED) {
        if (sb.length() > 0) sb.append("+");
        sb.append("Focused");
    }
    if ((state & SynthConstants.MOUSE_OVER) == SynthConstants.MOUSE_OVER) {
        if (sb.length() > 0) sb.append("+");
        sb.append("MouseOver");
    }
    if ((state & SynthConstants.PRESSED) == SynthConstants.PRESSED) {
        if (sb.length() > 0) sb.append("+");
        sb.append("Pressed");
    }
    if ((state & SynthConstants.SELECTED) == SynthConstants.SELECTED) {
        if (sb.length() > 0) sb.append("+");
        sb.append("Selected");
    }
    return sb.toString();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:State.java

示例3: testSynthIcon

private static void testSynthIcon() {

        if (!checkAndSetNimbusLookAndFeel()) {
            return;
        }

        JMenuItem menu = new JMenuItem();
        Icon subMenuIcon = UIManager.getIcon("Menu.arrowIcon");

        if (!(subMenuIcon instanceof SynthIcon)) {
            throw new RuntimeException("Icon is not a SynthIcon!");
        }

        Region region = SynthLookAndFeel.getRegion(menu);
        SynthStyle style = SynthLookAndFeel.getStyle(menu, region);
        SynthContext synthContext = new SynthContext(menu, region, style, SynthConstants.ENABLED);

        int width = SynthGraphicsUtils.getIconWidth(subMenuIcon, synthContext);
        int height = SynthGraphicsUtils.getIconHeight(subMenuIcon, synthContext);
        paintAndCheckIcon(subMenuIcon, synthContext, width, height);

        int newWidth = width * 17;
        int newHeight = height * 37;
        Icon centeredIcon = new CenteredSynthIcon((SynthIcon) subMenuIcon,
                newWidth, newHeight);
        paintAndCheckIcon(centeredIcon, synthContext, newWidth, newHeight);
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:bug8081411.java

示例4: getComponentState

public static int getComponentState(JComponent c) {
    if (c.isEnabled()) {
        if (c.isFocusOwner()) {
            return SynthConstants.ENABLED | SynthConstants.FOCUSED;
        }
        return SynthConstants.ENABLED;
    }
    return SynthConstants.DISABLED;
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:9,代码来源:SynthUtils.java

示例5: setSelectedUI

/**
 * Used by the renderers. For the most part the renderers are implemented as
 * Labels, which is problematic in so far as they are never selected. To
 * accomodate this SeaGlassLabelUI checks if the current UI matches that of
 * <code>selectedUI</code> (which this methods sets), if it does, then a
 * state as set by this method is set in the field {@code selectedUIState}.
 * This provides a way for labels to have a state other than selected.
 *
 * @param uix      a UI delegate.
 * @param selected is the component selected?
 * @param focused  is the component focused?
 * @param enabled  is the component enabled?
 * @param rollover is the component's rollover state enabled?
 */
public static void setSelectedUI(ComponentUI uix, boolean selected, boolean focused, boolean enabled, boolean rollover) {
    selectedUI      = uix;
    selectedUIState = 0;

    if (selected) {
        selectedUIState = SynthConstants.SELECTED;

        if (focused) {
            selectedUIState |= SynthConstants.FOCUSED;
        }
    } else if (rollover && enabled) {
        selectedUIState |= SynthConstants.MOUSE_OVER | SynthConstants.ENABLED;

        if (focused) {
            selectedUIState |= SynthConstants.FOCUSED;
        }
    } else {

        if (enabled) {
            selectedUIState |= SynthConstants.ENABLED;
            selectedUIState = SynthConstants.FOCUSED;
        } else {
            selectedUIState |= SynthConstants.DISABLED;
        }
    }
}
 
开发者ID:khuxtable,项目名称:seaglass,代码行数:40,代码来源:SeaGlassLookAndFeel.java

示例6: getComponentState

private int getComponentState(JComponent c) {
    int state = SeaGlassLookAndFeel.getComponentState(c);
    if (SeaGlassLookAndFeel.selectedUI == this && state == SynthConstants.ENABLED) {
        state = SeaGlassLookAndFeel.selectedUIState | SynthConstants.ENABLED;
    }
    return state;
}
 
开发者ID:khuxtable,项目名称:seaglass,代码行数:7,代码来源:SeaGlassLabelUI.java

示例7: updateTabContext

/**
 * Update the SynthContext for the tab area for a specified tab.
 *
 * @param index       the tab to update for.
 * @param selected    is the tab selected?
 * @param isMouseDown is the mouse down?
 * @param isMouseOver is the mouse over the tab?
 * @param hasFocus    do we have focus?
 */
private void updateTabContext(int index, boolean selected, boolean isMouseDown, boolean isMouseOver, boolean hasFocus) {
    int state = 0;

    if (!tabPane.isEnabled() || !tabPane.isEnabledAt(index)) {
        state |= SynthConstants.DISABLED;

        if (selected) {
            state |= SynthConstants.SELECTED;
        }
    } else if (selected) {
        state |= (SynthConstants.ENABLED | SynthConstants.SELECTED);

        if (isMouseOver && UIManager.getBoolean("TabbedPane.isTabRollover")) {
            state |= SynthConstants.MOUSE_OVER;
        }
    } else if (isMouseOver) {
        state |= (SynthConstants.ENABLED | SynthConstants.MOUSE_OVER);
    } else {
        state =  SeaGlassLookAndFeel.getComponentState(tabPane);
        state &= ~SynthConstants.FOCUSED; // Don't use tabbedpane focus state.
    }

    if (hasFocus && tabPane.hasFocus()) {
        state |= SynthConstants.FOCUSED; // individual tab has focus
    }

    if (isMouseDown) {
        state |= SynthConstants.PRESSED;
    }

    tabContext.setComponentState(state);
}
 
开发者ID:khuxtable,项目名称:seaglass,代码行数:41,代码来源:SeaGlassTabbedPaneUI.java

示例8: getTabInsets

private Insets getTabInsets() {
	Insets i = UIManager.getInsets("TabbedPane.tabInsets");
	if (i != null) {
		return i;
	} else {
		SynthStyle style = SynthLookAndFeel.getStyle(this, Region.TABBED_PANE_TAB);
		SynthContext context = new SynthContext(this, Region.TABBED_PANE_TAB, style, SynthConstants.ENABLED);
		return style.getInsets(context, null);
	}
}
 
开发者ID:zeromancer,项目名称:mangawatcher,代码行数:10,代码来源:GuiTabbedPane.java

示例9: getTabAreaInsets

private Insets getTabAreaInsets() {
	Insets i = UIManager.getInsets("TabbedPane.tabAreaInsets");
	if (i != null) {
		return i;
	} else {
		SynthStyle style = SynthLookAndFeel.getStyle(this, Region.TABBED_PANE_TAB_AREA);
		SynthContext context = new SynthContext(this, Region.TABBED_PANE_TAB_AREA, style, SynthConstants.ENABLED);
		return style.getInsets(context, null);
	}
}
 
开发者ID:zeromancer,项目名称:mangawatcher,代码行数:10,代码来源:GuiTabbedPane.java

示例10: getComponentState

/**
 * Returns the current state of the passed in <code>AbstractButton</code>.
 *
 * @param  c the button component.
 *
 * @return the button's state.
 */
private int getComponentState(JComponent c) {
    int state = ENABLED;

    if (!c.isEnabled()) {
        state = DISABLED;
    }

    if (SeaGlassLookAndFeel.selectedUI == this) {
        return SeaGlassLookAndFeel.selectedUIState | SynthConstants.ENABLED;
    }

    AbstractButton button = (AbstractButton) c;
    ButtonModel    model  = button.getModel();

    if (model.isPressed()) {
        if (model.isArmed()) {
            state = PRESSED;
        } else {
            state = MOUSE_OVER;
        }
    }

    if (model.isRollover()) {
        state |= MOUSE_OVER;
    }

    if (model.isSelected()) {
        state |= SELECTED;
    }

    if (c.isFocusOwner() && button.isFocusPainted()) {
        state |= FOCUSED;
    }

    if ((c instanceof JButton) && ((JButton) c).isDefaultButton()) {
        state |= DEFAULT;
    }
    
    return state;
}
 
开发者ID:khuxtable,项目名称:seaglass,代码行数:47,代码来源:SeaGlassButtonUI.java

示例11: toString

/**
 * DOCUMENT ME!
 *
 * @param  state DOCUMENT ME!
 *
 * @return DOCUMENT ME!
 */
private static String toString(int state) {
    StringBuffer buffer = new StringBuffer();

    if ((state & SynthConstants.DEFAULT) == SynthConstants.DEFAULT) {
        buffer.append("Default");
    }

    if ((state & SynthConstants.DISABLED) == SynthConstants.DISABLED) {

        if (buffer.length() > 0)
            buffer.append("+");

        buffer.append("Disabled");
    }

    if ((state & SynthConstants.ENABLED) == SynthConstants.ENABLED) {

        if (buffer.length() > 0)
            buffer.append("+");

        buffer.append("Enabled");
    }

    if ((state & SynthConstants.FOCUSED) == SynthConstants.FOCUSED) {

        if (buffer.length() > 0)
            buffer.append("+");

        buffer.append("Focused");
    }

    if ((state & SynthConstants.MOUSE_OVER) == SynthConstants.MOUSE_OVER) {

        if (buffer.length() > 0)
            buffer.append("+");

        buffer.append("MouseOver");
    }

    if ((state & SynthConstants.PRESSED) == SynthConstants.PRESSED) {

        if (buffer.length() > 0)
            buffer.append("+");

        buffer.append("Pressed");
    }

    if ((state & SynthConstants.SELECTED) == SynthConstants.SELECTED) {

        if (buffer.length() > 0)
            buffer.append("+");

        buffer.append("Selected");
    }

    return buffer.toString();
}
 
开发者ID:khuxtable,项目名称:seaglass,代码行数:64,代码来源:State.java


注:本文中的javax.swing.plaf.synth.SynthConstants.ENABLED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。