Java Code Examples for org.pushingpixels.substance.api.ComponentState

The following examples show how to use org.pushingpixels.substance.api.ComponentState. These examples are extracted from open source projects. 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
/**
 * Creates an arrow icon.
 * 
 * @param component
 *            Arrow button.
 * @param orientation
 *            Arrow icon orientation.
 */
public ArrowButtonTransitionAwareIcon(
		final JComponent component,
		TransitionAwareIcon.TransitionAwareUIDelegate transitionAwareUIDelegate,
		final int orientation) {
	this.component = component;
	this.transitionAwareUIDelegate = transitionAwareUIDelegate;
	this.orientation = orientation;
	this.delegate = (SubstanceColorScheme scheme) -> {
		int fontSize = SubstanceSizeUtils.getComponentFontSize(component);
		return SubstanceImageCreator.getArrowIcon(fontSize, orientation, scheme);
	};

	Icon enabledIcon = this.delegate.getColorSchemeIcon(
			SubstanceColorSchemeUtilities.getColorScheme(component,
					ComponentState.ENABLED));
	this.iconWidth = enabledIcon.getIconWidth();
	this.iconHeight = enabledIcon.getIconHeight();
}
 
Example 2
/**
 * Main method for testing.
 *
 * @param args Ignored.
 */
public static void main(String... args) {
    SwingUtilities.invokeLater(() -> {
        JFrame.setDefaultLookAndFeelDecorated(true);
        SubstanceCortex.GlobalScope.setSkin(new BusinessSkin());

        JTreeAdapterBreadCrumbTest test = new JTreeAdapterBreadCrumbTest();
        test.setIconImage(RadianceLogo.getLogoImage(
                SubstanceCortex.GlobalScope.getCurrentSkin().getColorScheme(
                        SubstanceSlices.DecorationAreaType.PRIMARY_TITLE_PANE,
                        SubstanceSlices.ColorSchemeAssociationKind.FILL,
                        ComponentState.ENABLED)));
        test.setSize(700, 400);
        test.setLocation(300, 100);
        test.setVisible(true);
        test.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    });
}
 
Example 3
/**
 * Returns the color scheme of the specified component.
 *
 * @param component      Component.
 * @param componentState Component state.
 * @return Component color scheme.
 */
public static SubstanceColorScheme getColorScheme(Component component,
        ComponentState componentState) {
    Component orig = component;
    // special case - if the component is marked as flat and
    // it is in the default state, or it is a button
    // that is never painting its background - get the color scheme of the
    // parent
    boolean isButtonThatIsNeverPainted = ((component instanceof AbstractButton)
            && SubstanceCoreUtilities.isButtonNeverPainted((AbstractButton) component));
    if (isButtonThatIsNeverPainted
            || (SubstanceCoreUtilities.hasFlatAppearance(component, false)
            && (componentState == ComponentState.ENABLED))) {
        component = component.getParent();
    }

    SubstanceSkin skin = SubstanceCoreUtilities.getSkin(component);
    if (skin == null) {
        SubstanceCoreUtilities.traceSubstanceApiUsage(component,
                "Substance delegate used when Substance is not the current LAF");
    }
    SubstanceColorScheme nonColorized = skin.getColorScheme(component, componentState);

    return getColorizedScheme(orig, nonColorized, !componentState.isDisabled());
}
 
Example 4
/**
 * Returns the current state for the specified cell.
 *
 * @param cellIndex         Cell index.
 * @param rendererComponent Renderer component for the specified cell index.
 * @return The current state for the specified cell.
 */
public ComponentState getCellState(int cellIndex, Component rendererComponent) {
    boolean isEnabled = this.list.isEnabled();
    if (rendererComponent != null) {
        isEnabled = isEnabled && rendererComponent.isEnabled();
    }
    StateTransitionTracker tracker = this.stateTransitionMultiTracker.getTracker(cellIndex);
    if (tracker == null) {
        boolean isRollover = (rolledOverIndex >= 0) && (rolledOverIndex == cellIndex);
        boolean isSelected = selectedIndices.containsKey(cellIndex);
        return ComponentState.getState(isEnabled, isRollover, isSelected);
    } else {
        ComponentState fromTracker = tracker.getModelStateInfo().getCurrModelState();
        return ComponentState.getState(isEnabled,
                fromTracker.isFacetActive(ComponentStateFacet.ROLLOVER),
                fromTracker.isFacetActive(ComponentStateFacet.SELECTION));
    }
}
 
Example 5
/**
 * Main method for testing.
 *
 * @param args Ignored.
 */
public static void main(String... args) {
    SwingUtilities.invokeLater(() -> {
        JFrame.setDefaultLookAndFeelDecorated(true);
        SubstanceCortex.GlobalScope.setSkin(new BusinessSkin());

        BreadCrumbTest test = new BreadCrumbTest();
        test.setIconImage(RadianceLogo.getLogoImage(
                SubstanceCortex.GlobalScope.getCurrentSkin().getColorScheme(
                        SubstanceSlices.DecorationAreaType.PRIMARY_TITLE_PANE,
                        SubstanceSlices.ColorSchemeAssociationKind.FILL,
                        ComponentState.ENABLED)));
        test.setSize(550, 385);
        test.setLocationRelativeTo(null);
        test.setVisible(true);
        test.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    });
}
 
Example 6
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
	SubstanceColorScheme borderScheme = SubstanceColorSchemeUtilities.getColorScheme(c,
			ColorSchemeAssociationKind.BORDER, ComponentState.ENABLED);

	Graphics2D g2d = (Graphics2D) g.create();
	float borderThickness = SubstanceSizeUtils.getBorderStrokeWidth();
	float borderDelta = borderThickness / 2.0f;
	g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
	g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
	g2d.setStroke(
			new BasicStroke(borderThickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND));
	g2d.translate(x, y);
	SubstanceBorderPainter borderPainter = SubstanceCoreUtilities.getBorderPainter(c);
	Color outline = borderPainter.getRepresentativeColor(borderScheme);
	g2d.setColor(outline);
	g2d.draw(new Rectangle2D.Float(borderDelta, borderDelta, width - borderThickness,
			height - borderThickness));
	g2d.dispose();
}
 
Example 7
/**
 * Main method for testing.
 *
 * @param args Ignored.
 */
public static void main(String[] args) {
    SwingUtilities.invokeLater(() -> {
        JFrame.setDefaultLookAndFeelDecorated(true);
        SubstanceCortex.GlobalScope.setSkin(new BusinessSkin());

        JFrame frame = new JFrame("Testing command button fonts");
        frame.setSize(800, 600);
        frame.setIconImage(RadianceLogo.getLogoImage(
                SubstanceCortex.GlobalScope.getCurrentSkin().getColorScheme(
                        SubstanceSlices.DecorationAreaType.PRIMARY_TITLE_PANE,
                        SubstanceSlices.ColorSchemeAssociationKind.FILL,
                        ComponentState.ENABLED)));

        frame.add(new TestCommandButtonsSizing());
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    });
}
 
Example 8
/**
 * Main method for testing.
 *
 * @param args Ignored.
 */
public static void main(String... args) {
    SwingUtilities.invokeLater(() -> {
        JFrame.setDefaultLookAndFeelDecorated(true);
        SubstanceCortex.GlobalScope.setSkin(new BusinessSkin());

        FileExplorerStates test = new FileExplorerStates();
        test.setIconImage(RadianceLogo.getLogoImage(
                SubstanceCortex.GlobalScope.getCurrentSkin().getColorScheme(
                        SubstanceSlices.DecorationAreaType.PRIMARY_TITLE_PANE,
                        SubstanceSlices.ColorSchemeAssociationKind.FILL,
                        ComponentState.ENABLED)));
        test.setSize(500, 400);
        test.setLocationRelativeTo(null);
        test.setVisible(true);
        test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    });
}
 
Example 9
/**
 * Returns the color scheme of the component.
 *
 * @param component       Component.
 * @param associationKind Association kind.
 * @param componentState  Component state.
 * @return Component color scheme.
 */
public static SubstanceColorScheme getColorScheme(Component component,
        ColorSchemeAssociationKind associationKind, ComponentState componentState) {
    // special case - if the component is marked as flat and
    // it is in the default state, get the color scheme of the parent.
    // However, flat toolbars should be ignored, since they are
    // the "top" level decoration area.
    if (!(component instanceof JToolBar)
            && SubstanceCoreUtilities.hasFlatAppearance(component, false)
            && (componentState == ComponentState.ENABLED)) {
        component = component.getParent();
    }

    SubstanceSkin skin = SubstanceCoreUtilities.getSkin(component);
    if (skin == null) {
        return null;
    }
    SubstanceColorScheme nonColorized = skin.getColorScheme(component, associationKind,
            componentState);
    return getColorizedScheme(component, nonColorized, !componentState.isDisabled());
}
 
Example 10
@Override
public void paintComponent(Graphics g) {
    super.paintComponent(g);

    if (SubstanceCortex.ComponentScope.getCurrentSkin(this)
            .getOverlayPainters(DecorationAreaType.PRIMARY_TITLE_PANE).isEmpty()) {
        Graphics2D g2d = (Graphics2D) g.create();
        SubstanceColorScheme compScheme = SubstanceColorSchemeUtilities.getColorScheme(this,
                ColorSchemeAssociationKind.SEPARATOR, ComponentState.ENABLED);
        Color sepColor = compScheme.isDark()
                ? SeparatorPainterUtils.getSeparatorShadowColor(compScheme)
                : SeparatorPainterUtils.getSeparatorDarkColor(compScheme);
        g2d.setColor(sepColor);
        float separatorThickness = SubstanceSizeUtils.getBorderStrokeWidth();
        float separatorY = getHeight() - separatorThickness;
        g2d.setStroke(new BasicStroke(separatorThickness, BasicStroke.CAP_BUTT,
                BasicStroke.JOIN_ROUND));
        g2d.draw(new Line2D.Double(0, separatorY, getWidth(), separatorY));
        g2d.dispose();
    }
}
 
Example 11
@Override
protected void paintRolloverIndication(Graphics g) {
    int w = this.colorSelectorComponent.getWidth();
    int h = this.colorSelectorComponent.getHeight();
    Graphics2D g2d = (Graphics2D) g.create();

    float borderThickness = SubstanceSizeUtils.getBorderStrokeWidth();

    g2d.setComposite(AlphaComposite.SrcOver.derive(this.rollover));
    SubstanceColorScheme highlightBorderScheme = SubstanceColorSchemeUtilities.getColorScheme(
            this.colorSelectorComponent, ColorSchemeAssociationKind.HIGHLIGHT_BORDER,
            ComponentState.ROLLOVER_UNSELECTED);
    g2d.setColor(highlightBorderScheme.getMidColor());
    g2d.draw(new Rectangle2D.Double(0, 0, w - borderThickness, h - borderThickness));
    g2d.setColor(highlightBorderScheme.getUltraDarkColor());
    g2d.draw(new Rectangle2D.Double(borderThickness, borderThickness, w - 3 * borderThickness,
            h - 3 * borderThickness));

    g2d.dispose();
}
 
Example 12
/**
 * Returns the grid color for the table header.
 * 
 * @param header
 *            Table header.
 * @return Grid color.
 */
protected static Color getGridColor(JTableHeader header) {
    boolean isEnabled = header.isEnabled();
    if (header.getTable() != null) {
        // fix for issue 472 - handle standalone table headers
        isEnabled = isEnabled && header.getTable().isEnabled();
    }
    ComponentState currState = isEnabled ? ComponentState.ENABLED
            : ComponentState.DISABLED_UNSELECTED;
    Color gridColor = SubstanceCoreUtilities.getSkin(header).getOverlayColor(
            SubstanceSlices.ColorOverlayType.LINE,
            DecorationPainterUtils.getDecorationType(header), currState);
    if (gridColor == null) {
        gridColor = SubstanceColorSchemeUtilities.getColorScheme(
                header, ColorSchemeAssociationKind.BORDER, currState).getLineColor();
    }
    return gridColor;
}
 
Example 13
private SubstanceColorScheme getColorSchemeForState(JList list, SubstanceListUI ui,
        ComponentState state) {
    UpdateOptimizationInfo updateOptimizationInfo = ui.getUpdateOptimizationInfo();
    if (state == ComponentState.ENABLED) {
        if (updateOptimizationInfo == null) {
            return SubstanceColorSchemeUtilities.getColorScheme(list, state);
        } else {
            return updateOptimizationInfo.getDefaultScheme();
        }
    } else {
        if (updateOptimizationInfo == null) {
            return SubstanceColorSchemeUtilities.getColorScheme(list,
                    ColorSchemeAssociationKind.HIGHLIGHT, state);
        } else {
            return updateOptimizationInfo.getHighlightColorScheme(state);
        }
    }
}
 
Example 14
private SubstanceColorScheme getColorSchemeForState(JList list, int index,
        SubstanceListUI listUI, ComponentState state) {
    boolean toUseHighlightKindForCurrState = (index >= 0)
            && (state.isFacetActive(ComponentStateFacet.ROLLOVER) || state
            .isFacetActive(ComponentStateFacet.SELECTION));
    UpdateOptimizationInfo updateOptimizationInfo = listUI
            .getUpdateOptimizationInfo();
    if (toUseHighlightKindForCurrState) {
        if (updateOptimizationInfo == null) {
            return SubstanceColorSchemeUtilities.getColorScheme(list,
                    ColorSchemeAssociationKind.HIGHLIGHT, state);
        } else {
            return updateOptimizationInfo.getHighlightColorScheme(state);
        }
    } else {
        if (updateOptimizationInfo == null) {
            return SubstanceColorSchemeUtilities
                    .getColorScheme(list, state);
        } else {
            return updateOptimizationInfo.getDefaultScheme();
        }
    }
}
 
Example 15
private SubstanceColorScheme getColorSchemeForState(JList list, SubstanceListUI ui,
        ComponentState state) {
    UpdateOptimizationInfo updateOptimizationInfo = ui.getUpdateOptimizationInfo();
    if (state == ComponentState.ENABLED) {
        if (updateOptimizationInfo == null) {
            return SubstanceColorSchemeUtilities.getColorScheme(list, state);
        } else {
            return updateOptimizationInfo.getDefaultScheme();
        }
    } else {
        if (updateOptimizationInfo == null) {
            return SubstanceColorSchemeUtilities.getColorScheme(list,
                    SubstanceSlices.ColorSchemeAssociationKind.HIGHLIGHT, state);
        } else {
            return updateOptimizationInfo.getHighlightColorScheme(state);
        }
    }
}
 
Example 16
private SubstanceColorScheme getColorSchemeForState(JTable table,
        SubstanceTableUI ui, ComponentState state) {
    UpdateOptimizationInfo updateOptimizationInfo = ui.getUpdateOptimizationInfo();
    if (state == ComponentState.ENABLED) {
        if (updateOptimizationInfo == null) {
            return SubstanceColorSchemeUtilities.getColorScheme(table, state);
        } else {
            return updateOptimizationInfo.getDefaultScheme();
        }
    } else {
        if (updateOptimizationInfo == null) {
            return SubstanceColorSchemeUtilities.getColorScheme(table,
                    ColorSchemeAssociationKind.HIGHLIGHT, state);
        } else {
            return updateOptimizationInfo.getHighlightColorScheme(state);
        }
    }
}
 
Example 17
Source Project: radiance   Source File: GeminiSkin.java    License: BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private static void applyHighlightAsFill(SubstanceColorSchemeBundle schemeBundle,
		SubstanceColorScheme highlightScheme, SubstanceColorScheme highlightBorderScheme) {
	// use for borders on rollover controls
	schemeBundle.registerColorScheme(highlightBorderScheme, ColorSchemeAssociationKind.BORDER,
			ComponentState.ROLLOVER_ARMED, ComponentState.ROLLOVER_SELECTED,
			ComponentState.ROLLOVER_UNSELECTED);

	// use for fill of selected controls
	schemeBundle.registerColorScheme(highlightScheme, ColorSchemeAssociationKind.FILL,
			ComponentState.SELECTED, ComponentState.ROLLOVER_SELECTED);

	// use for borders of highlights
	schemeBundle.registerColorScheme(highlightScheme,
			ColorSchemeAssociationKind.HIGHLIGHT_BORDER, ComponentState.getActiveStates());

	// use for text highlight
	schemeBundle.registerColorScheme(highlightScheme, ColorSchemeAssociationKind.HIGHLIGHT_TEXT,
			ComponentState.SELECTED, ComponentState.ROLLOVER_SELECTED);

	// use for armed controls
	schemeBundle.registerColorScheme(highlightScheme, ComponentState.ARMED,
			ComponentState.ROLLOVER_ARMED);
}
 
Example 18
/**
 * Creates a new <code>Graphite Sunset</code> skin.
 */
public GraphiteSunsetSkin() {
	super(new AccentBuilder()
			.withAccentResource("org/pushingpixels/substance/api/skin/graphite.colorschemes")
			.withActiveControlsAccent(new SunsetColorScheme())
			.withHighlightsAccent(new SunsetColorScheme()));

	// Sunset needs tweaks for the enabled / disabled visuals of checkbox and radio button marks
	// for better contrast
	defaultSchemeBundle.registerColorScheme(this.getActiveControlsAccent(),
			ColorSchemeAssociationKind.MARK,
			ComponentState.SELECTED);
	defaultSchemeBundle.registerAlpha(0.7f, ComponentState.DISABLED_SELECTED);
	defaultSchemeBundle.registerColorScheme(this.getActiveControlsAccent().shade(0.4),
			ColorSchemeAssociationKind.MARK,
			ComponentState.DISABLED_SELECTED);
}
 
Example 19
/**
 * Returns the current state for the specified path.
 * 
 * @param pathId
 *            Path index.
 * @return The current state for the specified path.
 */
public ComponentState getPathState(TreePathId pathId) {
	boolean isEnabled = this.tree.isEnabled();
	StateTransitionTracker tracker = this.stateTransitionMultiTracker.getTracker(pathId);
	if (tracker == null) {
		int rowIndex = this.tree.getRowForPath(pathId.path);
		boolean isRollover = (this.currRolloverPathId != null)
				&& pathId.equals(this.currRolloverPathId);
		boolean isSelected = this.tree.isRowSelected(rowIndex);
		return ComponentState.getState(isEnabled, isRollover, isSelected);
	} else {
		ComponentState fromTracker = tracker.getModelStateInfo().getCurrModelState();
		return ComponentState.getState(isEnabled,
				fromTracker.isFacetActive(ComponentStateFacet.ROLLOVER),
				fromTracker.isFacetActive(ComponentStateFacet.SELECTION));
	}
}
 
Example 20
/**
 * Returns the color scheme of the specified tabbed pane tab.
 *
 * @param jtp            Tabbed pane.
 * @param tabIndex       Tab index.
 * @param componentState Tab component state.
 * @return The color scheme of the specified tabbed pane tab.
 */
public static SubstanceColorScheme getColorScheme(final JTabbedPane jtp, final int tabIndex,
        ColorSchemeAssociationKind associationKind, ComponentState componentState) {
    SubstanceSkin skin = SubstanceCoreUtilities.getSkin(jtp);
    if (skin == null) {
        SubstanceCoreUtilities.traceSubstanceApiUsage(jtp,
                "Substance delegate used when Substance is not the current LAF");
    }
    SubstanceColorScheme nonColorized = skin.getColorScheme(jtp, associationKind,
            componentState);
    if (tabIndex >= 0) {
        Component component = jtp.getComponentAt(tabIndex);
        SubstanceColorScheme colorized = getColorizedScheme(component, nonColorized,
                jtp.getForegroundAt(tabIndex), jtp.getBackgroundAt(tabIndex),
                !componentState.isDisabled());
        return colorized;
    } else {
        return getColorizedScheme(jtp, nonColorized, !componentState.isDisabled());
    }
}
 
Example 21
Source Project: radiance   Source File: SampleFrame.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected void synchronize() {
    SwingUtilities.invokeLater(() -> {
        if (UIManager.getLookAndFeel() instanceof SubstanceLookAndFeel) {
            SampleFrame.this
                    .setIconImage(RadianceLogo.getLogoImage(SubstanceCortex.ComponentScope
                            .getCurrentSkin(SampleFrame.this.getRootPane())
                            .getColorScheme(DecorationAreaType.PRIMARY_TITLE_PANE,
                                    ColorSchemeAssociationKind.FILL, ComponentState.ENABLED)));
        }
    });
}
 
Example 22
Source Project: radiance   Source File: ListPanel.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public Component getListCellRendererComponent(JList list, Object value,
        int index, boolean isSelected, boolean cellHasFocus) {
    JLabel result = (JLabel) super.getListCellRendererComponent(list, value,
            index, isSelected, cellHasFocus);
    result.setForeground(list.getForeground());

    int comp = 156 + 10 * (index % 9);
    int blue = 255 - (255 - comp) / 2;
    this.setBackground(
            isSelected ? list.getSelectionBackground() : new Color(comp, comp, blue));

    ModelEntry entry = (ModelEntry) value;

    // mark every fifth row as disabled
    if ((index % 5) == 0) {
        result.setEnabled(false);
        ComponentState state = isSelected ? ComponentState.DISABLED_SELECTED
                : ComponentState.DISABLED_UNSELECTED;
        result.setForeground(SubstanceCortex.ComponentScope.getCurrentSkin(list)
                .getColorScheme(list, state).getForegroundColor());
        result.setBackground(new Color(255, 196, 196));
        result.setText(entry.text + " [disabled by renderer]");
    } else {
        result.setEnabled(true);
        result.setText(entry.text);
    }
    if (showIcons) {
        result.setIcon(entry.icon);
    } else {
        result.setIcon(null);
    }

    return result;
}
 
Example 23
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    // Paint the original border
    this.originalBorder.paintBorder(c, g, x, y, width, height);

    // Only paint the icon when the component is focused and the caps-lock is on
    if (!c.isFocusOwner()) {
        return;
    }

    try {
        if (!Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK)) {
            return;
        }
    } catch (UnsupportedOperationException e) {
        return;
    }

    Icon capsLockIcon = SubstanceImageCreator.getCapsLockIcon(
            SubstanceColorSchemeUtilities.getColorScheme(c, ComponentState.ENABLED), c);

    int iconY = y + (height - capsLockIcon.getIconHeight()) / 2;
    if (c.getComponentOrientation().isLeftToRight()) {
        capsLockIcon.paintIcon(c, g, x + width - capsLockIcon.getIconWidth() - 4, iconY);
    } else {
        // support for RTL
        capsLockIcon.paintIcon(c, g, x + 4, iconY);
    }
}
 
Example 24
Source Project: radiance   Source File: TestFrame.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public TestFrame() {
    super("Substance skeleton");

    if (UIManager.getLookAndFeel() instanceof SubstanceLookAndFeel) {
        setIconImage(RadianceLogo
                .getLogoImage(SubstanceCortex.ComponentScope.getCurrentSkin(this.getRootPane())
                        .getColorScheme(DecorationAreaType.PRIMARY_TITLE_PANE,
                                ColorSchemeAssociationKind.FILL, ComponentState.ENABLED)));
    }
    SubstanceCortex.GlobalScope.registerSkinChangeListener(() -> SwingUtilities.invokeLater(
            () -> setIconImage(RadianceLogo.getLogoImage(SubstanceCortex.ComponentScope
                    .getCurrentSkin(TestFrame.this.getRootPane())
                    .getColorScheme(DecorationAreaType.PRIMARY_TITLE_PANE,
                            ColorSchemeAssociationKind.FILL, ComponentState.ENABLED)))));

    setLayout(new BorderLayout());
    toolbar = Check.getToolbar("", 22, false);
    this.add(toolbar, BorderLayout.NORTH);

    JPanel statusBar = getStatusBar();
    this.add(statusBar, BorderLayout.SOUTH);

    setPreferredSize(new Dimension(400, 400));
    this.setSize(getPreferredSize());
    setMinimumSize(getPreferredSize());

    // sample menu bar
    JMenuBar jmb = new JMenuBar();
    jmb.add(new JMenu("File"));
    jmb.add(new JMenu("Edit"));
    jmb.add(new JMenu("Source"));
    jmb.add(new JMenu("Refactor"));
    jmb.add(new JMenu("Navigate"));
    jmb.add(new JMenu("Search"));
    jmb.add(new JMenu("Project"));

    setJMenuBar(jmb);

}
 
Example 25
Source Project: radiance   Source File: ThreadPanel.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public ThreadPanel() {
    this.setLayout(new VerticalStackLayout());

    SubstanceSkin currentSkin = SubstanceCortex.GlobalScope.getCurrentSkin();
    SubstanceColorScheme fillScheme = currentSkin.getColorScheme(DecorationAreaType.NONE,
            ColorSchemeAssociationKind.FILL, ComponentState.ENABLED);
    Color iconColor = fillScheme.getForegroundColor();
    Color backgroundColor = fillScheme.getLightColor();
    Color innerBackgroundColor = fillScheme.getUltraLightColor();

    this.add(getHeaderActionsPanel(iconColor, backgroundColor));
    this.add(getMessageTitlePanel("Keys found", backgroundColor));

    this.add(getCollapsedMessagePanel("Reception desk",
            "If you lost your keys stop by the reception desk", "10:25am", innerBackgroundColor,
            backgroundColor));
    this.add(getCollapsedMessagePanel("Bryce Dunwood", "I think those might be Grayson's",
            "10:28am", innerBackgroundColor, backgroundColor));
    this.add(getFullMessagePanel("Reception desk", "Today, 4:15pm",
            "Bryce Dunwood, Grayson Flay",
            "Thanks, Bryce.\n\nGrayson, can you check if you still have your keys?\n\n"
                    + "It's a silver keychain with five keys and a small elephant. "
                    + "If these are yours, please stop by. We'll be here until six today.\n\n"
                    + "Morgan from reception.",
            innerBackgroundColor, backgroundColor, iconColor));

    this.add(getFooterActionsPanel(backgroundColor, iconColor));

    this.setBackground(backgroundColor);

    this.setPreferredSize(new Dimension(400, 0));
}
 
Example 26
public DestinationsPanel(Window window) {
    SubstanceSkin currentSkin = SubstanceCortex.GlobalScope.getCurrentSkin();

    ComponentOrParentChainScope.setDecorationType(this, VisorMail.DESTINATIONS);
    this.setRightLineColor(currentSkin.getColorScheme(VisorMail.DESTINATIONS,
            ColorSchemeAssociationKind.FILL, ComponentState.ENABLED).getDarkColor());
    this.setLayout(new VerticalStackLayout());

    // Get the color schemes for colorizing the icons.
    Color mainSelectorIconTitleColor = currentSkin
            .getColorScheme(VisorMail.DESTINATIONS,
                    ColorSchemeAssociationKind.FILL, ComponentState.ENABLED)
            .getForegroundColor();

    ResizableIcon refreshIcon = NeonCortex.colorizeIcon(
            ic_refresh_black_24px.factory(), mainSelectorIconTitleColor);
    refreshIcon.setDimension(new Dimension(12, 12));
    this.add(getRefreshAction(window, refreshIcon));
    this.add(getMainLabel("MAIL"));

    JList<DestinationInfo> destinationList = new JList<>(
            new DestinationListModel(
                    new DestinationInfo(ic_inbox_black_24px.factory(), "Inbox", 6),
                    new DestinationInfo(ic_send_black_24px.factory(), "Sent", 3),
                    new DestinationInfo(ic_watch_later_black_24px.factory(), "Send later", 5),
                    new DestinationInfo(ic_drafts_black_24px.factory(), "Drafts", -1),
                    new DestinationInfo(ic_star_border_black_24px.factory(), "Starred", -1),
                    new DestinationInfo(ic_delete_black_24px.factory(), "Trash", -1)));
    destinationList.setCellRenderer(new DestinationRenderer());

    destinationList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    destinationList.setSelectedIndex(0);

    JScrollPane destinationScrollPane = new JScrollPane(destinationList);
    this.add(destinationScrollPane);

    this.setPreferredSize(new Dimension(200, 0));
}
 
Example 27
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    this.originalBorder.paintBorder(c, g, x, y, width, height);
    Icon lockIcon = SubstanceImageCreator.getSmallLockIcon(
            SubstanceColorSchemeUtilities.getColorScheme(c, ComponentState.ENABLED), c);

    int offsetY = 1;
    if (c.getParent() instanceof JViewport) {
        // enhancement 9 - show the lock icon of components
        // in JScrollPane so that it is visible in the bottom
        // corner of the scroll pane
        JViewport viewport = (JViewport) c.getParent();
        // have to set to simple scroll mode since the default (blit)
        // results in visual artifacts due to optimized buffer-copy
        // painting.
        if (viewport.getScrollMode() != JViewport.SIMPLE_SCROLL_MODE) {
            viewport.setScrollMode(JViewport.SIMPLE_SCROLL_MODE);
        }
        Rectangle viewRect = viewport.getViewRect();
        offsetY = c.getHeight() - viewRect.y - viewRect.height;
    }

    int iconY = y + height - lockIcon.getIconHeight() - offsetY;
    if (c.getComponentOrientation().isLeftToRight()) {
        lockIcon.paintIcon(c, g, x + width - lockIcon.getIconWidth(), iconY);
    } else {
        // support for RTL
        lockIcon.paintIcon(c, g, x, iconY);
    }
}
 
Example 28
private ComponentState getProgressState() {
    if (progressBar.isIndeterminate()) {
        return progressBar.isEnabled() ? INDETERMINATE_SELECTED
                : INDETERMINATE_SELECTED_DISABLED;
    } else {
        return progressBar.isEnabled() ? DETERMINATE_SELECTED : DETERMINATE_SELECTED_DISABLED;
    }
}
 
Example 29
private static Color getControlColor() {
    if (Configuration.useRibbonInterface.get()) {
        return SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.GENERAL, ColorSchemeAssociationKind.FILL, ComponentState.ENABLED).getBackgroundFillColor();
    } else {
        return SystemColor.control;
    }
}
 
Example 30
@Override
protected Color getSelectionBackground() {
    ComponentState fillState = getFillState();

    SubstanceColorScheme scheme = SubstanceColorSchemeUtilities.getColorScheme(progressBar,
            fillState);
    return SubstanceColorUtilities.getForegroundColor(scheme);
}