Java Code Examples for org.pushingpixels.substance.api.SubstanceSkin#getColorScheme()
The following examples show how to use
org.pushingpixels.substance.api.SubstanceSkin#getColorScheme() .
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: SubstanceColorSchemeUtilities.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * 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 2
Source File: SubstanceColorSchemeUtilities.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * 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 3
Source File: SubstanceColorSchemeUtilities.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * 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 4
Source File: ThreadPanel.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
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 5
Source File: ThreadListPanel.java From radiance with BSD 3-Clause "New" or "Revised" License | 4 votes |
public ThreadListPanel() { this.setLayout(new VerticalStackLayout()); SubstanceSkin currentSkin = SubstanceCortex.GlobalScope.getCurrentSkin(); SubstanceCortex.ComponentOrParentChainScope.setDecorationType(this, VisorMail.THREADS); this.setRightLineColor(currentSkin.getColorScheme(VisorMail.THREADS, ColorSchemeAssociationKind.FILL, ComponentState.ENABLED).getDarkColor()); // Get the color schemes for colorizing the icons. SubstanceColorScheme fillScheme = currentSkin.getColorScheme(VisorMail.THREADS, ColorSchemeAssociationKind.FILL, ComponentState.ENABLED); Color mainSelectorIconColor = fillScheme.getForegroundColor(); ResizableIcon editIcon = NeonCortex.colorizeIcon( ic_mode_edit_black_24px.factory(), mainSelectorIconColor, 0.8f); editIcon.setDimension(new Dimension(14, 14)); this.add(getTitlePanel(editIcon)); ResizableIcon mailIcon = NeonCortex.colorizeIcon( ic_mail_outline_black_24px.factory(), mainSelectorIconColor); mailIcon.setDimension(new Dimension(12, 12)); this.add(getInboxLabel("Inbox", mailIcon, fillScheme.getLightColor())); JList<ThreadInfo> threadList = new JList<>(new ThreadListModel( new ThreadInfo("Bob Macpearson", "5:50pm", "Welcome Natalie", "Everybody please welcome our new team member", 3), new ThreadInfo("Eve Stephens", "5:35pm", "All hands rescheduled", "We will send another update shortly", -1), new ThreadInfo("Randy White", "5:33pm", "Revenue target 'Q4", "See the attached spreadsheet for the latest", 5), new ThreadInfo("Reception desk", "4:15pm", "Keys found", "If you lost your keys stop by the reception desk", 2), new ThreadInfo("Amanda Pinewood", "4:00pm", "Samantha's baby!!!", "It's a girl! And now the first photos", 12), new ThreadInfo("Jackson Grady", "11:58am", "Lunch meeting", "Apologies for last minute reschedule", 1), new ThreadInfo("Robert Malone", "11:30am", "Project status update", "Based on what we were talking about yesterday", -1), new ThreadInfo("Reception desk", "10:02am", "Car alarm", "If you have a white Accord, its alarm is on", 2), new ThreadInfo("Jessica Fletcher", "10:01am", "Your flight", "There has been a slight change to your flight", 2), new ThreadInfo("Josh Mandin", "9:29am", "Printer broken", "We are aware of the issue with the main office printer", -1))); threadList.setCellRenderer(new ThreadRenderer()); threadList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); threadList.setSelectedIndex(3); JScrollPane summaryScrollPane = new JScrollPane(threadList); this.add(summaryScrollPane); this.setPreferredSize(new Dimension(300, 0)); }
Example 6
Source File: SubstancePaneBorder.java From radiance with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { SubstanceSkin skin = SubstanceCoreUtilities.getSkin(c); if (skin == null) { return; } SubstanceColorScheme scheme = skin .getBackgroundColorScheme(DecorationAreaType.PRIMARY_TITLE_PANE); Component titlePaneComp = SubstanceCoreUtilities .getTitlePaneComponent(SwingUtilities.windowForComponent(c)); SubstanceColorScheme borderScheme = skin.getColorScheme(titlePaneComp, ColorSchemeAssociationKind.BORDER, ComponentState.ENABLED); Graphics2D graphics = (Graphics2D) g.create(); double scaleFactor = NeonCortex.getScaleFactor(); float strokeWidth = (scaleFactor <= 2.0f) ? 0.5f + (float) scaleFactor / 2.0f : (float) scaleFactor; graphics.setStroke(new BasicStroke(strokeWidth, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER)); // bottom and right in ultra dark graphics.setColor(borderScheme.getUltraDarkColor()); graphics.drawLine(x, y + h - 1, x + w - 1, y + h - 1); graphics.drawLine(x + w - 1, y, x + w - 1, y + h - 1); // top and left graphics.setColor(borderScheme.getDarkColor()); graphics.drawLine(x, y, x + w - 2, y); graphics.drawLine(x, y, x, y + h - 2); // inner bottom and right graphics.setColor(scheme.getMidColor()); graphics.drawLine(x + 1, y + h - 2, x + w - 2, y + h - 2); graphics.drawLine(x + w - 2, y + 1, x + w - 2, y + h - 2); // inner top and left graphics.setColor(scheme.getMidColor()); graphics.drawLine(x + 1, y + 1, x + w - 3, y + 1); graphics.drawLine(x + 1, y + 1, x + 1, y + h - 3); // inner 2 and 3 graphics.setColor(scheme.getLightColor()); graphics.drawRect(x + 2, y + 2, w - 5, h - 5); graphics.drawRect(x + 3, y + 3, w - 7, h - 7); graphics.dispose(); }