Java Code Examples for javax.swing.plaf.synth.SynthConstants#FOCUSED

The following examples show how to use javax.swing.plaf.synth.SynthConstants#FOCUSED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: bug7143614.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void validate() throws Exception {
    Method getSelectedUIMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUI");

    getSelectedUIMethod.setAccessible(true);

    Method getSelectedUIStateMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUIState");

    getSelectedUIStateMethod.setAccessible(true);

    if (getSelectedUIMethod.invoke(null) != componentUI) {
        throw new RuntimeException("getSelectedUI returns invalid value");
    }
    if (((Integer) getSelectedUIStateMethod.invoke(null)).intValue() !=
            (SynthConstants.SELECTED | SynthConstants.FOCUSED)) {
        throw new RuntimeException("getSelectedUIState returns invalid value");
    }

}
 
Example 2
Source File: bug7143614.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static void validate() throws Exception {
    Method getSelectedUIMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUI");

    getSelectedUIMethod.setAccessible(true);

    Method getSelectedUIStateMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUIState");

    getSelectedUIStateMethod.setAccessible(true);

    if (getSelectedUIMethod.invoke(null) != componentUI) {
        throw new RuntimeException("getSelectedUI returns invalid value");
    }
    if (((Integer) getSelectedUIStateMethod.invoke(null)).intValue() !=
            (SynthConstants.SELECTED | SynthConstants.FOCUSED)) {
        throw new RuntimeException("getSelectedUIState returns invalid value");
    }

}
 
Example 3
Source File: bug7143614.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void validate() throws Exception {
    Method getSelectedUIMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUI");

    getSelectedUIMethod.setAccessible(true);

    Method getSelectedUIStateMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUIState");

    getSelectedUIStateMethod.setAccessible(true);

    if (getSelectedUIMethod.invoke(null) != componentUI) {
        throw new RuntimeException("getSelectedUI returns invalid value");
    }
    if (((Integer) getSelectedUIStateMethod.invoke(null)).intValue() !=
            (SynthConstants.SELECTED | SynthConstants.FOCUSED)) {
        throw new RuntimeException("getSelectedUIState returns invalid value");
    }

}
 
Example 4
Source File: bug7143614.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private static void validate() throws Exception {
    Method getSelectedUIMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUI");

    getSelectedUIMethod.setAccessible(true);

    Method getSelectedUIStateMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUIState");

    getSelectedUIStateMethod.setAccessible(true);

    if (getSelectedUIMethod.invoke(null) != componentUI) {
        throw new RuntimeException("getSelectedUI returns invalid value");
    }
    if (((Integer) getSelectedUIStateMethod.invoke(null)).intValue() !=
            (SynthConstants.SELECTED | SynthConstants.FOCUSED)) {
        throw new RuntimeException("getSelectedUIState returns invalid value");
    }

}
 
Example 5
Source File: bug7143614.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void validate() throws Exception {
    Method getSelectedUIMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUI");

    getSelectedUIMethod.setAccessible(true);

    Method getSelectedUIStateMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUIState");

    getSelectedUIStateMethod.setAccessible(true);

    if (getSelectedUIMethod.invoke(null) != componentUI) {
        throw new RuntimeException("getSelectedUI returns invalid value");
    }
    if (((Integer) getSelectedUIStateMethod.invoke(null)).intValue() !=
            (SynthConstants.SELECTED | SynthConstants.FOCUSED)) {
        throw new RuntimeException("getSelectedUIState returns invalid value");
    }

}
 
Example 6
Source File: GtkEditorTabCellRenderer.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void paintInterior(Graphics g, Component c) {
    GtkEditorTabCellRenderer ren = (GtkEditorTabCellRenderer) c;
    Polygon p = getInteriorPolygon(c);
    int state = ren.isSelected() ? ren.isActive() ? SynthConstants.FOCUSED 
            : SynthConstants.SELECTED : SynthConstants.DEFAULT;
    Rectangle bounds = p.getBounds();
    int yDiff = getHeightDifference(ren);
    paintTabBackground(g, 0, state, bounds.x, bounds.y + yDiff, 
            bounds.width, bounds.height - yDiff);
    
    if (!supportsCloseButton((JComponent)c)) {
        return;
    }
    
    paintCloseButton( g, (JComponent)c );
}
 
Example 7
Source File: bug7143614.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private static void validate() throws Exception {
    Method getSelectedUIMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUI");

    getSelectedUIMethod.setAccessible(true);

    Method getSelectedUIStateMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUIState");

    getSelectedUIStateMethod.setAccessible(true);

    if (getSelectedUIMethod.invoke(null) != componentUI) {
        throw new RuntimeException("getSelectedUI returns invalid value");
    }
    if (((Integer) getSelectedUIStateMethod.invoke(null)).intValue() !=
            (SynthConstants.SELECTED | SynthConstants.FOCUSED)) {
        throw new RuntimeException("getSelectedUIState returns invalid value");
    }

}
 
Example 8
Source File: bug7143614.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void validate() throws Exception {
    Method getSelectedUIMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUI");

    getSelectedUIMethod.setAccessible(true);

    Method getSelectedUIStateMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUIState");

    getSelectedUIStateMethod.setAccessible(true);

    if (getSelectedUIMethod.invoke(null) != componentUI) {
        throw new RuntimeException("getSelectedUI returns invalid value");
    }
    if (((Integer) getSelectedUIStateMethod.invoke(null)).intValue() !=
            (SynthConstants.SELECTED | SynthConstants.FOCUSED)) {
        throw new RuntimeException("getSelectedUIState returns invalid value");
    }

}
 
Example 9
Source File: bug7143614.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void validate() throws Exception {
    Method getSelectedUIMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUI");

    getSelectedUIMethod.setAccessible(true);

    Method getSelectedUIStateMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUIState");

    getSelectedUIStateMethod.setAccessible(true);

    if (getSelectedUIMethod.invoke(null) != componentUI) {
        throw new RuntimeException("getSelectedUI returns invalid value");
    }
    if (((Integer) getSelectedUIStateMethod.invoke(null)).intValue() !=
            (SynthConstants.SELECTED | SynthConstants.FOCUSED)) {
        throw new RuntimeException("getSelectedUIState returns invalid value");
    }

}
 
Example 10
Source File: bug7143614.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void validate() throws Exception {
    Method getSelectedUIMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUI");

    getSelectedUIMethod.setAccessible(true);

    Method getSelectedUIStateMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUIState");

    getSelectedUIStateMethod.setAccessible(true);

    if (getSelectedUIMethod.invoke(null) != componentUI) {
        throw new RuntimeException("getSelectedUI returns invalid value");
    }
    if (((Integer) getSelectedUIStateMethod.invoke(null)).intValue() !=
            (SynthConstants.SELECTED | SynthConstants.FOCUSED)) {
        throw new RuntimeException("getSelectedUIState returns invalid value");
    }

}
 
Example 11
Source File: bug7143614.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void validate() throws Exception {
    Method getSelectedUIMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUI");

    getSelectedUIMethod.setAccessible(true);

    Method getSelectedUIStateMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUIState");

    getSelectedUIStateMethod.setAccessible(true);

    if (getSelectedUIMethod.invoke(null) != componentUI) {
        throw new RuntimeException("getSelectedUI returns invalid value");
    }
    if (((Integer) getSelectedUIStateMethod.invoke(null)).intValue() !=
            (SynthConstants.SELECTED | SynthConstants.FOCUSED)) {
        throw new RuntimeException("getSelectedUIState returns invalid value");
    }

}
 
Example 12
Source File: State.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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();
}
 
Example 13
Source File: SeaGlassTabbedPaneUI.java    From seaglass with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 14
Source File: GtkEditorTabCellRenderer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void paintInterior(Graphics g, Component c) {
    GtkEditorTabCellRenderer ren = (GtkEditorTabCellRenderer) c;
    Polygon p = getInteriorPolygon(c);
    int state = ren.isSelected() ? ren.isActive() ? SynthConstants.FOCUSED 
            : SynthConstants.SELECTED : SynthConstants.DEFAULT;
    Rectangle bounds = p.getBounds();
    int yDiff = getHeightDifference(ren);
    paintTabBackground(g, 0, state, bounds.x, bounds.y + yDiff, 
            bounds.width, bounds.height - yDiff);
}
 
Example 15
Source File: State.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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();
}
 
Example 16
Source File: State.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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();
}
 
Example 17
Source File: State.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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();
}
 
Example 18
Source File: State.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
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();
}
 
Example 19
Source File: State.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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();
}
 
Example 20
Source File: State.java    From seaglass with Apache License 2.0 2 votes vote down vote up
/**
 * 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();
}