@Override protected void installDefaults(JXHeader h) { // this.descriptionPane = new SubstanceDescriptionPane(); // this.descriptionPane.setLineWrap(true); // this.descriptionPane.setOpaque(false); super.installDefaults(h); SubstanceLookAndFeel.setDecorationType(h, DecorationAreaType.HEADER); }
private JMenu createThemeMenu() { JMenu menu = new JMenu("Theme"); ButtonGroup group = new ButtonGroup(); for (final Map.Entry<String, SkinInfo> entry : SubstanceLookAndFeel.getAllSkins().entrySet()) { Action setLnF = new AbstractAction(entry.getValue().getDisplayName()) { @Override public void actionPerformed(ActionEvent event) { try { SubstanceLookAndFeel.setSkin(entry.getValue().getClassName()); } catch (Exception e) { setStatus("red", "Failed to load skin {}.", entry.getValue().getDisplayName()); } } }; AbstractButton button = new JCheckBoxMenuItem(setLnF); group.add(button); menu.add(button); } return menu; }
public void paint(JComponent component, Graphics2D graphics, boolean paintSeparator) { BackgroundPaintingUtils.updateIfOpaque(graphics, component); if (paintSeparator) { SubstanceSkin skin = SubstanceLookAndFeel.getCurrentSkin(component); DecorationAreaType decorationAreaType = SubstanceLookAndFeel .getDecorationType(component); List<SubstanceOverlayPainter> overlayPainters = skin .getOverlayPainters(decorationAreaType); // only if there are no overlays specified on this decoration area // type in the skin if (overlayPainters.size() == 0) { // paint the separator on top. SeparatorPainterUtils.paintSeparator(component, graphics, component.getWidth(), 0, JSeparator.HORIZONTAL, false, 0); } } } }
/** * Sets the {@link InputMapSet} to be used with Substance family. If the * specified set is <code>null</code>, the default will be reset. This * method does not require Substance to be the current look-and-feel, and * will cause Substance to be set as the current application look-and-feel. * * @param inputMapSet * The {@link InputMapSet} to be used with Substance family, or * <code>null</code> to reset to the default * * @see #getInputMapSet() * @see SubstanceLookAndFeel#SUBSTANCE_INPUT_MAP_SET_KEY */ public static void setInputMapSet(InputMapSet inputMapSet) { UIManager.put(SUBSTANCE_INPUT_MAP_SET_KEY, inputMapSet); SubstanceLookAndFeel.setSkin(SubstanceLookAndFeel.getCurrentSkin()); }
/** * Looks up the correct control font and sets it for all controls. * * @param table * The UI defaults table. */ private void initFontDefaults(UIDefaults table) { FontSet substanceFontSet = getFontPolicy() .getFontSet("Substance", null); initFontDefaults(table, substanceFontSet); }
@Override public void run() { if (!SubstanceLookAndFeel.isCurrentLookAndFeel()) return; if (textArea == null) return; Color foregr = textArea.getForeground(); if ((foregr == null) || (foregr instanceof UIResource)) { textArea .setForeground(SubstanceColorUtilities .getForegroundColor(SubstanceLookAndFeel .getCurrentSkin(textArea) .getEnabledColorScheme( SubstanceLookAndFeel .getDecorationType(textArea)))); } } });
/** * Paints the decoration background on the specified component. The * decoration background is not painted when the <code>force</code> * parameter is <code>false</code> and at least one of the following * conditions holds: * <ul> * <li>The component is in a cell renderer.</li> * <li>The component is not showing on the screen.</li> * <li>The component is in the preview mode.</li> * </ul> * * @param g * Graphics context. * @param c * Component. * @param force * If <code>true</code>, the painting of decoration background is * enforced. */ public static void paintDecorationBackground(Graphics g, Component c, boolean force) { DecorationAreaType decorationType = SubstanceLookAndFeel .getDecorationType(c); paintDecorationBackground(g, c, decorationType, force); }
didYouKnow.setTitle(UIManagerExt.getString( "TipOfTheDay.didYouKnowText", tipPane.getLocale())); SubstanceLookAndFeel.setDecorationType(didYouKnow, DecorationAreaType.GENERAL); Icon infoIcon = SubstanceLookAndFeel.isToUseConstantThemesOnDialogs() ? SubstanceCoreUtilities .getIcon("resource/22/dialog-information.png") : SubstanceCoreUtilities.getThemedIcon(this.tipPane,
initFontDefaults(lafDefaults, SubstanceLookAndFeel .getFontPolicy().getFontSet("Substance", null)); newSkin.addCustomEntriesToTable(lafDefaults); SubstanceLookAndFeel.componentPlugins SubstanceLookAndFeel.getLabelBundle() }) { Enumeration<String> keyEn = bundle.getKeys();
/** * Sets image watermark kind. * * @param kind * Image watermark kind. */ public void setKind(ImageWatermarkKind kind) { if (kind == null) { throw new IllegalArgumentException( "Can't pass null to SubstanceImageWatermark.setKind()"); } this.kind = kind; this.updateWatermarkImage(SubstanceLookAndFeel.getCurrentSkin(null)); }
/** * Gets the current control font size. * * @return Control font size. */ public static int getControlFontSize() { if (controlFontSize > 0) return controlFontSize; FontPolicy fPolicy = SubstanceLookAndFeel.getFontPolicy(); FontSet fSet = fPolicy.getFontSet("Substance", null); controlFontSize = fSet.getControlFont().getSize(); return controlFontSize; }
/** * Sets the specified skin. If the current look-and-feel is not Substance, * this method will create a new Substance look-and-feel based on the * specified skin and set it on {@link UIManager}. This method does not * require Substance to be the current look-and-feel. Calling this method * will call {@link SwingUtilities#updateComponentTreeUI(Component)} on all * open top-level windows. * * @param newSkin * Skin to set. * @return <code>true</code> if the specified skin has been set * successfully, <code>false</code> otherwise. * @throws IllegalStateException * When called outside the Event Dispatch Thread. * @see #registerSkinChangeListener(SkinChangeListener) * @see #unregisterSkinChangeListener(SkinChangeListener) * @see SubstanceSkin#isValid() */ public static boolean setSkin(SubstanceSkin newSkin) { return setSkin(newSkin, true); }
if (!SubstanceLookAndFeel.isCurrentLookAndFeel()) return null; return SubstanceLookAndFeel.getCurrentSkin(); return (SubstanceSkin) skinProp; return SubstanceLookAndFeel.getCurrentSkin();
/** * Returns the color scheme for the icon of option panes with the specified * message type. * * @param messageType * Option pane message type. * @param mainScheme * Main color scheme. * @return Color scheme for the icon of option panes with the specified * message type. */ public static SubstanceColorScheme getOptionPaneColorScheme( int messageType, SubstanceColorScheme mainScheme) { if (!SubstanceLookAndFeel.isToUseConstantThemesOnDialogs()) return mainScheme; switch (messageType) { case JOptionPane.INFORMATION_MESSAGE: return new BottleGreenColorScheme(); case JOptionPane.QUESTION_MESSAGE: return new LightAquaColorScheme(); case JOptionPane.WARNING_MESSAGE: return new SunsetColorScheme(); case JOptionPane.ERROR_MESSAGE: return new SunfireRedColorScheme(); } return null; }
.getBackgroundColorScheme(DecorationAreaType.PRIMARY_TITLE_PANE); Component titlePaneComp = SubstanceLookAndFeel .getTitlePaneComponent(SwingUtilities.windowForComponent(c)); SubstanceColorScheme borderScheme = skin.getColorScheme(titlePaneComp, ColorSchemeAssociationKind.BORDER, ComponentState.ENABLED);
.getAllTabCloseListeners(this.tabPane)) { if (listener instanceof VetoableMultipleTabCloseListener) { VetoableMultipleTabCloseListener vetoableListener = (VetoableMultipleTabCloseListener) listener; .getAllTabCloseListeners(this.tabPane)) { if (listener instanceof MultipleTabCloseListener) ((MultipleTabCloseListener) listener).tabsClosing(this.tabPane, .getAllTabCloseListeners(this.tabPane)) { if (listener instanceof MultipleTabCloseListener) ((MultipleTabCloseListener) listener).tabsClosed(this.tabPane,
/** * Returns the resource bundle for the specified component. * * @param jcomp * Component. * @return Resource bundle for the specified component. */ public static ResourceBundle getResourceBundle(JComponent jcomp) { if (LafWidgetUtilities.toIgnoreGlobalLocale(jcomp)) { return SubstanceLookAndFeel.getLabelBundle(jcomp.getLocale()); } else { return SubstanceLookAndFeel.getLabelBundle(); } }
/** * Paints the decoration background on the specified component. The * decoration background is not painted when the <code>force</code> * parameter is <code>false</code> and at least one of the following * conditions holds: * <ul> * <li>The component is in a cell renderer.</li> * <li>The component is not showing on the screen.</li> * <li>The component is in the preview mode.</li> * </ul> * * @param g * Graphics context. * @param c * Component. * @param force * If <code>true</code>, the painting of decoration background is * enforced. */ public static void paintDecorationBackground(Graphics g, Component c, boolean force) { DecorationAreaType decorationType = SubstanceLookAndFeel .getDecorationType(c); paintDecorationBackground(g, c, decorationType, force); }
@Override public void run() { if (!SubstanceLookAndFeel.isCurrentLookAndFeel()) return; if (textArea == null) return; Color foregr = textArea.getForeground(); if ((foregr == null) || (foregr instanceof UIResource)) { textArea .setForeground(SubstanceColorUtilities .getForegroundColor(SubstanceLookAndFeel .getCurrentSkin(textArea) .getEnabledColorScheme( SubstanceLookAndFeel .getDecorationType(textArea)))); } } });
/** * Sets the {@link FontPolicy} to be used with Substance family. If the * specified policy is <code>null</code>, the default will be reset. This * method does not require Substance to be the current look-and-feel, and * will cause Substance to be set as the current application look-and-feel. * * @param fontPolicy * The {@link FontPolicy} to be used with Substance family, or * <code>null</code> to reset to the default * * @see #getFontPolicy() * @see SubstanceLookAndFeel#SUBSTANCE_FONT_POLICY_KEY */ public static void setFontPolicy(FontPolicy fontPolicy) { UIManager.put(SUBSTANCE_FONT_POLICY_KEY, fontPolicy); SubstanceSizeUtils.setControlFontSize(-1); SubstanceSizeUtils.resetPointsToPixelsRatio(fontPolicy); SubstanceLookAndFeel.setSkin(SubstanceLookAndFeel.getCurrentSkin()); }