Search in sources :

Example 36 with ColorUIResource

use of javax.swing.plaf.ColorUIResource in project omegat by omegat-org.

the class UIDesignManager method ensureTitlebarReadability.

private static void ensureTitlebarReadability() {
    // to ensure DockViewTitleBar title readability
    Color textColor = UIManager.getColor("InternalFrame.inactiveTitleForeground");
    Color backColor = UIManager.getColor("Panel.background");
    if (textColor != null && backColor != null) {
        // One of these could be null
        if (textColor.equals(backColor)) {
            float[] hsb = Color.RGBtoHSB(textColor.getRed(), textColor.getGreen(), textColor.getBlue(), null);
            // darkest 0.0f <--> 1.0f brightest
            float brightness = hsb[2];
            if (brightness >= 0.5f) {
                // to darker
                brightness -= 0.5f;
            } else {
                // to brighter
                brightness += 0.5f;
            }
            int rgb = Color.HSBtoRGB(hsb[0], hsb[1], brightness);
            ColorUIResource res = new ColorUIResource(rgb);
            UIManager.put("InternalFrame.inactiveTitleForeground", res);
        }
    }
    UIManager.put("DockingDesktop.notificationBlinkCount", 2);
    UIManager.put("DockingDesktop.notificationColor", Styles.EditorColor.COLOR_NOTIFICATION_MAX.getColor());
}
Also used : Color(java.awt.Color) 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