Search in sources :

Example 16 with ColorUIResource

use of javax.swing.plaf.ColorUIResource in project Botnak by Gocnak.

the class NoireDefaultTheme method setUpColor.

public void setUpColor() {
    super.setUpColor();
    // Defaults for NoireLookAndFeel
    textShadow = true;
    foregroundColor = white;
    disabledForegroundColor = gray;
    disabledBackgroundColor = new ColorUIResource(48, 48, 48);
    backgroundColor = new ColorUIResource(24, 26, 28);
    backgroundColorLight = new ColorUIResource(24, 26, 28);
    backgroundColorDark = new ColorUIResource(4, 5, 6);
    alterBackgroundColor = new ColorUIResource(78, 84, 90);
    selectionForegroundColor = new ColorUIResource(255, 220, 120);
    selectionBackgroundColor = black;
    frameColor = black;
    gridColor = black;
    focusCellColor = orange;
    inputBackgroundColor = new ColorUIResource(52, 55, 59);
    inputForegroundColor = foregroundColor;
    rolloverColor = new ColorUIResource(240, 168, 0);
    rolloverColorLight = new ColorUIResource(240, 168, 0);
    rolloverColorDark = new ColorUIResource(196, 137, 0);
    buttonForegroundColor = black;
    buttonBackgroundColor = new ColorUIResource(120, 129, 148);
    buttonColorLight = new ColorUIResource(232, 238, 244);
    buttonColorDark = new ColorUIResource(196, 200, 208);
    controlForegroundColor = foregroundColor;
    // netbeans use this for selected tab in the toolbar
    controlBackgroundColor = new ColorUIResource(52, 55, 59);
    controlColorLight = new ColorUIResource(44, 47, 50);
    controlColorDark = new ColorUIResource(16, 18, 20);
    controlHighlightColor = new ColorUIResource(96, 96, 96);
    controlShadowColor = new ColorUIResource(32, 32, 32);
    controlDarkShadowColor = black;
    windowTitleForegroundColor = foregroundColor;
    windowTitleBackgroundColor = new ColorUIResource(144, 148, 149);
    windowTitleColorLight = new ColorUIResource(64, 67, 60);
    windowTitleColorDark = black;
    windowBorderColor = black;
    windowIconColor = lightGray;
    windowIconShadowColor = black;
    windowIconRolloverColor = orange;
    windowInactiveTitleForegroundColor = new ColorUIResource(196, 196, 196);
    windowInactiveTitleBackgroundColor = new ColorUIResource(64, 64, 64);
    windowInactiveTitleColorLight = new ColorUIResource(64, 64, 64);
    windowInactiveTitleColorDark = new ColorUIResource(32, 32, 32);
    windowInactiveBorderColor = black;
    menuForegroundColor = white;
    menuBackgroundColor = new ColorUIResource(24, 26, 28);
    menuSelectionForegroundColor = black;
    menuSelectionBackgroundColor = new ColorUIResource(196, 137, 0);
    menuColorLight = new ColorUIResource(96, 96, 96);
    menuColorDark = new ColorUIResource(32, 32, 32);
    toolbarBackgroundColor = new ColorUIResource(24, 26, 28);
    toolbarColorLight = new ColorUIResource(96, 96, 96);
    toolbarColorDark = new ColorUIResource(32, 32, 32);
    tabAreaBackgroundColor = backgroundColor;
    desktopColor = new ColorUIResource(52, 55, 59);
    tooltipForegroundColor = white;
    // new ColorUIResource(16, 16, 16);
    tooltipBackgroundColor = black;
    controlFont = new FontUIResource("Dialog", Font.BOLD, 12);
    systemFont = new FontUIResource("Dialog", Font.BOLD, 12);
    userFont = new FontUIResource("Dialog", Font.BOLD, 12);
    menuFont = new FontUIResource("Dialog", Font.BOLD, 12);
    windowTitleFont = new FontUIResource("Dialog", Font.BOLD, 12);
    smallFont = new FontUIResource("Dialog", Font.PLAIN, 10);
}
Also used : FontUIResource(javax.swing.plaf.FontUIResource) ColorUIResource(javax.swing.plaf.ColorUIResource)

Example 17 with ColorUIResource

use of javax.swing.plaf.ColorUIResource in project java-swing-tips by aterai.

the class TablePopupMenu method updateUI.

@Override
public void updateUI() {
    // Changing to Nimbus LAF and back doesn't reset look and feel of JTable completely
    // https://bugs.openjdk.java.net/browse/JDK-6788475
    // Set a temporary ColorUIResource
    setSelectionForeground(new ColorUIResource(Color.RED));
    setSelectionBackground(new ColorUIResource(Color.RED));
    super.updateUI();
    updateRenderer();
    remakeBooleanEditor();
}
Also used : ColorUIResource(javax.swing.plaf.ColorUIResource)

Example 18 with ColorUIResource

use of javax.swing.plaf.ColorUIResource in project java-swing-tips by aterai.

the class LookAndFeelUtil method createAndShowGui.

private static void createAndShowGui() {
    // BasicLookAndFeel, WidowsLookAndFeel
    UIManager.put("InternalFrame.activeTitleForeground", Color.RED);
    UIManager.put("InternalFrame.inactiveTitleForeground", Color.WHITE);
    // MetalLookAndFeel
    MetalLookAndFeel.setCurrentTheme(new OceanTheme() {

        @Override
        public ColorUIResource getWindowTitleForeground() {
            // getBlack();
            return new ColorUIResource(Color.RED.brighter());
        }

        @Override
        public ColorUIResource getWindowTitleInactiveForeground() {
            // getBlack();
            return new ColorUIResource(Color.ORANGE.darker());
        }
    });
    JFrame frame = new JFrame("@title@");
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frame.getContentPane().add(new MainPanel());
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
}
Also used : OceanTheme(javax.swing.plaf.metal.OceanTheme) ColorUIResource(javax.swing.plaf.ColorUIResource)

Example 19 with ColorUIResource

use of javax.swing.plaf.ColorUIResource in project intellij-community by JetBrains.

the class NotificationsManagerImpl method createButtons.

@Nullable
private static JPanel createButtons(@NotNull Notification notification, @NotNull final JPanel content, @Nullable HyperlinkListener listener) {
    if (notification instanceof NotificationActionProvider) {
        JPanel buttons = new JPanel(new HorizontalLayout(5));
        buttons.setOpaque(false);
        content.add(BorderLayout.SOUTH, buttons);
        final Ref<JButton> defaultButton = new Ref<>();
        NotificationActionProvider provider = (NotificationActionProvider) notification;
        for (NotificationActionProvider.Action action : provider.getActions(listener)) {
            JButton button = new JButton(action) {

                @Override
                public void setUI(ButtonUI ui) {
                    boolean isDarcula = ui instanceof DarculaButtonUI && UIUtil.isUnderDarcula();
                    if (isDarcula) {
                        ui = new DarculaButtonUI() {

                            @Override
                            protected Color getButtonColor1() {
                                return new ColorUIResource(0x464b4c);
                            }

                            @Override
                            protected Color getButtonColor2() {
                                return new ColorUIResource(0x383c3d);
                            }
                        };
                    }
                    super.setUI(ui);
                    if (isDarcula) {
                        setBorder(new DarculaButtonPainter() {

                            @Override
                            protected Color getBorderColor() {
                                return new ColorUIResource(0x616263);
                            }
                        });
                    }
                }
            };
            button.setOpaque(false);
            if (action.isDefaultAction()) {
                defaultButton.setIfNull(button);
            }
            buttons.add(HorizontalLayout.RIGHT, button);
        }
        if (!defaultButton.isNull()) {
            UIUtil.addParentChangeListener(content, new PropertyChangeListener() {

                @Override
                public void propertyChange(PropertyChangeEvent event) {
                    if (event.getOldValue() == null && event.getNewValue() != null) {
                        UIUtil.removeParentChangeListener(content, this);
                        JRootPane rootPane = UIUtil.getRootPane(content);
                        if (rootPane != null) {
                            rootPane.setDefaultButton(defaultButton.get());
                        }
                    }
                }
            });
        }
        return buttons;
    }
    return null;
}
Also used : PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyChangeListener(java.beans.PropertyChangeListener) DarculaButtonPainter(com.intellij.ide.ui.laf.darcula.ui.DarculaButtonPainter) ButtonUI(javax.swing.plaf.ButtonUI) DarculaButtonUI(com.intellij.ide.ui.laf.darcula.ui.DarculaButtonUI) ColorUIResource(javax.swing.plaf.ColorUIResource) HorizontalLayout(com.intellij.ui.components.panels.HorizontalLayout) Ref(com.intellij.openapi.util.Ref) DarculaButtonUI(com.intellij.ide.ui.laf.darcula.ui.DarculaButtonUI) Nullable(org.jetbrains.annotations.Nullable)

Example 20 with ColorUIResource

use of javax.swing.plaf.ColorUIResource in project intellij-community by JetBrains.

the class UiInspectorAction method fromObject.

/** @noinspection UseJBColor*/
private static Object fromObject(Object o, Class<?> type) {
    if (o == null)
        return null;
    if (type.isAssignableFrom(o.getClass()))
        return o;
    if ("null".equals(o))
        return null;
    String value = String.valueOf(o).trim();
    if (type == int.class)
        return Integer.parseInt(value);
    if (type == boolean.class)
        return "yes".equalsIgnoreCase(value) || "true".equalsIgnoreCase(value);
    if (type == byte.class)
        return Byte.parseByte(value);
    if (type == short.class)
        return Short.parseShort(value);
    if (type == double.class)
        return Double.parseDouble(value);
    if (type == float.class)
        return Float.parseFloat(value);
    String[] s = value.split("(?i)\\s*(?:[x@:]|[a-z]+:)\\s*", 6);
    if (type == Dimension.class) {
        if (s.length == 2)
            return new Dimension(Integer.parseInt(s[0]), Integer.parseInt(s[1]));
    } else if (type == Point.class) {
        if (s.length == 2)
            return new Point(Integer.parseInt(s[0]), Integer.parseInt(s[1]));
    } else if (type == Rectangle.class) {
        if (s.length >= 5)
            return new Rectangle(Integer.parseInt(s[3]), Integer.parseInt(s[4]), Integer.parseInt(s[1]), Integer.parseInt(s[2]));
    } else if (type == Insets.class) {
        if (s.length >= 5)
            return new Insets(Integer.parseInt(s[1]), Integer.parseInt(s[2]), Integer.parseInt(s[4]), Integer.parseInt(s[4]));
    } else if (type == Color.class) {
        if (s.length >= 5)
            return new ColorUIResource(new Color(Integer.parseInt(s[1]), Integer.parseInt(s[2]), Integer.parseInt(s[3]), Integer.parseInt(s[4])));
    }
    throw new UnsupportedOperationException(type.toString());
}
Also used : ColorUIResource(javax.swing.plaf.ColorUIResource)

Aggregations

ColorUIResource (javax.swing.plaf.ColorUIResource)36 Color (java.awt.Color)9 FontUIResource (javax.swing.plaf.FontUIResource)4 Dimension (java.awt.Dimension)3 UIDefaults (javax.swing.UIDefaults)3 BorderLayout (java.awt.BorderLayout)2 Insets (java.awt.Insets)2 MouseEvent (java.awt.event.MouseEvent)2 IOException (java.io.IOException)2 StringTokenizer (java.util.StringTokenizer)2 ImageIcon (javax.swing.ImageIcon)2 JScrollPane (javax.swing.JScrollPane)2 Border (javax.swing.border.Border)2 InsetsUIResource (javax.swing.plaf.InsetsUIResource)2 TableCellRenderer (javax.swing.table.TableCellRenderer)2 ALayoutConstraint (org.compiere.apps.ALayoutConstraint)2 ColumnInfo (org.compiere.minigrid.ColumnInfo)2 DarculaButtonPainter (com.intellij.ide.ui.laf.darcula.ui.DarculaButtonPainter)1 DarculaButtonUI (com.intellij.ide.ui.laf.darcula.ui.DarculaButtonUI)1 AnAction (com.intellij.openapi.actionSystem.AnAction)1