Java Code Examples for com.sun.swingset3.utilities.Utilities

The following examples show how to use com.sun.swingset3.utilities.Utilities. 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
Source Project: littleluck   Source File: DemoPanel.java    License: Apache License 2.0 6 votes vote down vote up
public void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D g2 = (Graphics2D) g.create();
    Dimension size = getSize();

    Color textColor = Utilities.deriveColorHSB(getBackground(), 0, 0, -.3f);
    Color dotColor = Utilities.deriveColorHSB(textColor, 0, .2f, -.08f);
    g2.setColor(textColor);
    g2.setFont(UIManager.getFont("Label.font").deriveFont(32f));
    FontMetrics metrics = g2.getFontMetrics();
    Rectangle2D rect = metrics.getStringBounds(message, g2);
    Rectangle2D dotRect = metrics.getStringBounds(".", g2);
    float x = (float) (size.width - (rect.getWidth() + 3 * dotRect.getWidth())) / 2;
    float y = (float) (size.height - rect.getHeight()) / 2;
    g2.drawString(message, x, y);
    int tri = getTriState();
    float dx = 0;
    for (int i = 0; i < 3; i++) {
        g2.setColor(animator.isRunning() && i == tri ?
                dotColor :
                textColor);
        g2.drawString(".", x + (float) (rect.getWidth() + dx), y);
        dx += dotRect.getWidth();
    }
}
 
Example 2
Source Project: littleluck   Source File: DemoPanel.java    License: Apache License 2.0 6 votes vote down vote up
private void applyDefaults() {
    setBorder(new RoundedTitleBorder(demoName,
            UIManager.getColor(SwingSet3.TITLE_GRADIENT_COLOR1_KEY),
            UIManager.getColor(SwingSet3.TITLE_GRADIENT_COLOR2_KEY)));

    setFont(UIManager.getFont(SwingSet3.TITLE_FONT_KEY));
    Color bg = Utilities.deriveColorHSB(
            UIManager.getColor("Panel.background"), 0, 0, -.06f);
    setBackground(bg);
    setForeground(UIManager.getColor(SwingSet3.TITLE_FOREGROUND_KEY));
    if (demoPanel != null) {
        demoPanel.setBackground(Utilities.deriveColorHSB(bg, 0, 0, .04f));
    }
    if (descriptionArea != null) {
        descriptionArea.setBackground(bg);
    }
}
 
Example 3
Source Project: littleluck   Source File: CodeViewer.java    License: Apache License 2.0 6 votes vote down vote up
protected void applyDefaults() {
    if (noCodeLabel != null) {
        noCodeLabel.setOpaque(false);
        noCodeLabel.setFont(UIManager.getFont("Label.font").deriveFont(24f));
        noCodeLabel.setForeground(
                Utilities.deriveColorAlpha(UIManager.getColor("Label.foreground"), 110));
    }
    if (codePanel != null) {
        Color base = UIManager.getColor("Panel.background");
        codePanel.setBackground(Utilities.deriveColorHSB(base, 0, 0, -.06f));
    }
    if (snippetComboBox != null) {
        // Now that the look and feel has changed, we need to wrap the new delegate
        snippetComboBox.setRenderer(new SnippetCellRenderer(
                new JComboBox().getRenderer()));
    }
    if (currentCodeFilesInfo != null) {
        Collection<CodeFileInfo> codeFiles = currentCodeFilesInfo.values();
        for(CodeFileInfo cfi : codeFiles) {
            makeSelectionTransparent(cfi.textPane, 180);
        }
    }
}
 
Example 4
Source Project: littleluck   Source File: CodeViewer.java    License: Apache License 2.0 6 votes vote down vote up
public Component getListCellRendererComponent(JList list,
        Object value,
        int index,
        boolean isSelected,
        boolean cellHasFocus) {
    
    JLabel renderer = (JLabel)((ListCellRenderer)delegate).getListCellRendererComponent(list,
            value, index, isSelected, cellHasFocus);
    
    int count = snippetMap.getSnippetCountForSet((String)value);
    
    Color foreground = renderer.getForeground();
    Color countForeground = Utilities.deriveColorHSB(foreground, 
            0, 0, isSelected? .5f : .4f);
    
    String text = "<html><font color=\"" +
            Utilities.getHTMLColorString(foreground) + "\">" + value + 
            "</font>" +
            "<font color=\"" +
            Utilities.getHTMLColorString(countForeground) + "\">" +
            (count > 0? " (" + count + (count > 1? " snippets)" : " snippet)") : "") +
            "</font></html>";

    renderer.setText(text);
    return renderer;
}
 
Example 5
Source Project: beautyeye   Source File: DemoPanel.java    License: Apache License 2.0 6 votes vote down vote up
public void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D g2 = (Graphics2D) g.create();
    Dimension size = getSize();

    Color textColor = Utilities.deriveColorHSB(getBackground(), 0, 0, -.3f);
    Color dotColor = Utilities.deriveColorHSB(textColor, 0, .2f, -.08f);
    g2.setColor(textColor);
    g2.setFont(UIManager.getFont("Label.font").deriveFont(32f));
    FontMetrics metrics = g2.getFontMetrics();
    Rectangle2D rect = metrics.getStringBounds(message, g2);
    Rectangle2D dotRect = metrics.getStringBounds(".", g2);
    float x = (float) (size.width - (rect.getWidth() + 3 * dotRect.getWidth())) / 2;
    float y = (float) (size.height - rect.getHeight()) / 2;
    g2.drawString(message, x, y);
    int tri = getTriState();
    float dx = 0;
    for (int i = 0; i < 3; i++) {
        g2.setColor(animator.isRunning() && i == tri ?
                dotColor :
                textColor);
        g2.drawString(".", x + (float) (rect.getWidth() + dx), y);
        dx += dotRect.getWidth();
    }
}
 
Example 6
Source Project: beautyeye   Source File: DemoPanel.java    License: Apache License 2.0 6 votes vote down vote up
private void applyDefaults() {
    setBorder(new RoundedTitleBorder(demoName,
            UIManager.getColor(SwingSet3.TITLE_GRADIENT_COLOR1_KEY),
            UIManager.getColor(SwingSet3.TITLE_GRADIENT_COLOR2_KEY)));

    setFont(UIManager.getFont(SwingSet3.TITLE_FONT_KEY));
    Color bg = Utilities.deriveColorHSB(
            UIManager.getColor("Panel.background"), 0, 0, -.06f);
    setBackground(bg);
    setForeground(UIManager.getColor(SwingSet3.TITLE_FOREGROUND_KEY));
    if (demoPanel != null) {
        demoPanel.setBackground(Utilities.deriveColorHSB(bg, 0, 0, .04f));
    }
    if (descriptionArea != null) {
        descriptionArea.setBackground(bg);
    }
}
 
Example 7
Source Project: beautyeye   Source File: CodeViewer.java    License: Apache License 2.0 6 votes vote down vote up
protected void applyDefaults() {
    if (noCodeLabel != null) {
        noCodeLabel.setOpaque(false);
        noCodeLabel.setFont(UIManager.getFont("Label.font").deriveFont(24f));
        noCodeLabel.setForeground(
                Utilities.deriveColorAlpha(UIManager.getColor("Label.foreground"), 110));
    }
    if (codePanel != null) {
        Color base = UIManager.getColor("Panel.background");
        codePanel.setBackground(Utilities.deriveColorHSB(base, 0, 0, -.06f));
    }
    if (snippetComboBox != null) {
        // Now that the look and feel has changed, we need to wrap the new delegate
        snippetComboBox.setRenderer(new SnippetCellRenderer(
                new JComboBox().getRenderer()));
    }
    if (currentCodeFilesInfo != null) {
        Collection<CodeFileInfo> codeFiles = currentCodeFilesInfo.values();
        for(CodeFileInfo cfi : codeFiles) {
            makeSelectionTransparent(cfi.textPane, 180);
        }
    }
}
 
Example 8
Source Project: beautyeye   Source File: CodeViewer.java    License: Apache License 2.0 6 votes vote down vote up
public Component getListCellRendererComponent(JList list,
        Object value,
        int index,
        boolean isSelected,
        boolean cellHasFocus) {
    
    JLabel renderer = (JLabel)((ListCellRenderer)delegate).getListCellRendererComponent(list,
            value, index, isSelected, cellHasFocus);
    
    int count = snippetMap.getSnippetCountForSet((String)value);
    
    Color foreground = renderer.getForeground();
    Color countForeground = Utilities.deriveColorHSB(foreground, 
            0, 0, isSelected? .5f : .4f);
    
    String text = "<html><font color=\"" +
            Utilities.getHTMLColorString(foreground) + "\">" + value + 
            "</font>" +
            "<font color=\"" +
            Utilities.getHTMLColorString(countForeground) + "\">" +
            (count > 0? " (" + count + (count > 1? " snippets)" : " snippet)") : "") +
            "</font></html>";

    renderer.setText(text);
    return renderer;
}
 
Example 9
Source Project: Darcula   Source File: CodeViewer.java    License: Apache License 2.0 6 votes vote down vote up
protected void applyDefaults() {
    if (noCodeLabel != null) {
        noCodeLabel.setOpaque(false);
        noCodeLabel.setFont(UIManager.getFont("Label.font").deriveFont(24f));
        noCodeLabel.setForeground(
                Utilities.deriveColorAlpha(UIManager.getColor("Label.foreground"), 110));
    }
    if (codePanel != null) {
        Color base = UIManager.getColor("Panel.background");
        codePanel.setBackground(Utilities.deriveColorHSB(base, 0, 0, -.06f));
    }
    if (snippetComboBox != null) {
        // Now that the look and feel has changed, we need to wrap the new delegate
        snippetComboBox.setRenderer(new SnippetCellRenderer(
                new JComboBox().getRenderer()));
    }
    if (currentCodeFilesInfo != null) {
        Collection<CodeFileInfo> codeFiles = currentCodeFilesInfo.values();
        for(CodeFileInfo cfi : codeFiles) {
            makeSelectionTransparent(cfi.textPane, 180);
        }
    }
}
 
Example 10
Source Project: Darcula   Source File: CodeViewer.java    License: Apache License 2.0 6 votes vote down vote up
public Component getListCellRendererComponent(JList list,
        Object value,
        int index,
        boolean isSelected,
        boolean cellHasFocus) {
    
    JLabel renderer = (JLabel)((ListCellRenderer)delegate).getListCellRendererComponent(list,
            value, index, isSelected, cellHasFocus);
    
    int count = snippetMap.getSnippetCountForSet((String)value);
    
    Color foreground = renderer.getForeground();
    Color countForeground = Utilities.deriveColorHSB(foreground, 
            0, 0, isSelected? .5f : .4f);
    
    String text = "<html><font color=\"" +
            Utilities.getHTMLColorString(foreground) + "\">" + value + 
            "</font>" +
            "<font color=\"" +
            Utilities.getHTMLColorString(countForeground) + "\">" +
            (count > 0? " (" + count + (count > 1? " snippets)" : " snippet)") : "") +
            "</font></html>";

    renderer.setText(text);
    return renderer;
}
 
Example 11
Source Project: littleluck   Source File: DemoPanel.java    License: Apache License 2.0 5 votes vote down vote up
public LoadAnimationPanel() {
    super(10);
    setBorder(roundedBorder);
    setBackground(Utilities.deriveColorHSB(
            UIManager.getColor("Panel.background"), 0, 0, -.06f));

    // remind(aim): get from resource map
    message = "demo loading";

    PropertySetter rotator = new PropertySetter(this, "triState", 0, 3);
    animator = new Animator(500, Animator.INFINITE,
            Animator.RepeatBehavior.LOOP, rotator);
    // Don't animate gears if loading is quick
    animator.setStartDelay(200);
}
 
Example 12
Source Project: littleluck   Source File: CodeViewer.java    License: Apache License 2.0 5 votes vote down vote up
private void createCodeFileTab(CodeFileInfo codeFileInfo) {
    JLayeredPane layeredPane = JLayeredPane.getLayeredPaneAbove(codeFileInfo.textPane);
    JScrollPane scrollPane = new JScrollPane(layeredPane);
    scrollPane.setBorder(null);
    JPanel tabPanel = new JPanel();
    tabPanel.setLayout(new BorderLayout());
    
    tabPanel.add(scrollPane, BorderLayout.CENTER);
    
    codeTabbedPane.addTab(Utilities.getURLFileName(codeFileInfo.url), tabPanel);
}
 
Example 13
Source Project: littleluck   Source File: SwingSet3.java    License: Apache License 2.0 5 votes vote down vote up
protected void displayErrorMessage(String message, Exception ex) {
    JPanel messagePanel = new JPanel(new BorderLayout());       
    JLabel label = new JLabel(message);
    messagePanel.add(label);
    if (ex != null) {
        RoundedPanel panel = new RoundedPanel(new BorderLayout());
        panel.setBorder(new RoundedBorder());
        
        // remind(aim): provide way to allow user to see exception only if desired
        StringWriter writer = new StringWriter();
        ex.printStackTrace(new PrintWriter(writer));
        JTextArea exceptionText = new JTextArea();
        exceptionText.setText("Cause of error:\n" +
                writer.getBuffer().toString());
        exceptionText.setBorder(new RoundedBorder());
        exceptionText.setOpaque(false);
        exceptionText.setBackground(
                Utilities.deriveColorHSB(UIManager.getColor("Panel.background"),
                0, 0, -.2f));
        JScrollPane scrollpane = new LuckScrollPane(exceptionText);
        scrollpane.setBorder(EMPTY_BORDER);
        scrollpane.setPreferredSize(new Dimension(600,240));
        panel.add(scrollpane);
        messagePanel.add(panel, BorderLayout.SOUTH);            
    }
    JOptionPane.showMessageDialog(getMainFrame(), messagePanel, 
            resourceMap.getString("error.title"),
            JOptionPane.ERROR_MESSAGE);
            
}
 
Example 14
Source Project: littleluck   Source File: DemoSelectorPanel.java    License: Apache License 2.0 5 votes vote down vote up
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    AbstractButton b = (AbstractButton)c;
    if (b.isSelected()) {
        Color color = c.getBackground();
        g.setColor(Utilities.deriveColorHSB(color, 0, 0, -.20f));
        g.drawLine(x, y, x + width, y);
        g.setColor(Utilities.deriveColorHSB(color, 0, 0, -.10f));
        g.drawLine(x, y + 1, x + width, y + 1);
        g.drawLine(x, y + 2, x, y + height - 2);
        g.setColor(Utilities.deriveColorHSB(color, 0, 0, .24f));
        g.drawLine(x, y + height - 1, x + width, y + height-1);
    }
}
 
Example 15
Source Project: littleluck   Source File: DemoSelectorPanel.java    License: Apache License 2.0 5 votes vote down vote up
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    Color color = c.getBackground();
    // render highlight at top
    g.setColor(Utilities.deriveColorHSB(color, 0, 0, .2f));
    g.drawLine(x, y, x + width, y);
    // render shadow on bottom
    g.setColor(Utilities.deriveColorHSB(color, 0, 0, -.2f));
    g.drawLine(x, y + height - 1, x + width, y + height - 1);
}
 
Example 16
Source Project: beautyeye   Source File: DemoPanel.java    License: Apache License 2.0 5 votes vote down vote up
public LoadAnimationPanel() {
    super(10);
    setBorder(roundedBorder);
    setBackground(Utilities.deriveColorHSB(
            UIManager.getColor("Panel.background"), 0, 0, -.06f));

    // remind(aim): get from resource map
    message = "demo loading";

    PropertySetter rotator = new PropertySetter(this, "triState", 0, 3);
    animator = new Animator(500, Animator.INFINITE,
            Animator.RepeatBehavior.LOOP, rotator);
    // Don't animate gears if loading is quick
    animator.setStartDelay(200);
}
 
Example 17
Source Project: beautyeye   Source File: CodeViewer.java    License: Apache License 2.0 5 votes vote down vote up
private void createCodeFileTab(CodeFileInfo codeFileInfo) {
    JLayeredPane layeredPane = JLayeredPane.getLayeredPaneAbove(codeFileInfo.textPane);
    JScrollPane scrollPane = new JScrollPane(layeredPane);
    scrollPane.setBorder(null);
    JPanel tabPanel = new JPanel();
    tabPanel.setLayout(new BorderLayout());
    
    tabPanel.add(scrollPane, BorderLayout.CENTER);
    
    codeTabbedPane.addTab(Utilities.getURLFileName(codeFileInfo.url), tabPanel);
}
 
Example 18
Source Project: beautyeye   Source File: SwingSet3.java    License: Apache License 2.0 5 votes vote down vote up
protected void displayErrorMessage(String message, Exception ex) {
    JPanel messagePanel = new JPanel(new BorderLayout());       
    JLabel label = new JLabel(message);
    messagePanel.add(label);
    if (ex != null) {
        RoundedPanel panel = new RoundedPanel(new BorderLayout());
        panel.setBorder(new RoundedBorder());
        
        // remind(aim): provide way to allow user to see exception only if desired
        StringWriter writer = new StringWriter();
        ex.printStackTrace(new PrintWriter(writer));
        JTextArea exceptionText = new JTextArea();
        exceptionText.setText("Cause of error:\n" +
                writer.getBuffer().toString());
        exceptionText.setBorder(new RoundedBorder());
        exceptionText.setOpaque(false);
        exceptionText.setBackground(
                Utilities.deriveColorHSB(UIManager.getColor("Panel.background"),
                0, 0, -.2f));
        JScrollPane scrollpane = new JScrollPane(exceptionText);
        scrollpane.setBorder(EMPTY_BORDER);
        scrollpane.setPreferredSize(new Dimension(600,240));
        panel.add(scrollpane);
        messagePanel.add(panel, BorderLayout.SOUTH);            
    }
    JOptionPane.showMessageDialog(getMainFrame(), messagePanel, 
            resourceMap.getString("error.title"),
            JOptionPane.ERROR_MESSAGE);
            
}
 
Example 19
Source Project: beautyeye   Source File: DemoSelectorPanel.java    License: Apache License 2.0 5 votes vote down vote up
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    AbstractButton b = (AbstractButton)c;
    if (b.isSelected()) {
        Color color = c.getBackground();
        g.setColor(Utilities.deriveColorHSB(color, 0, 0, -.20f));
        g.drawLine(x, y, x + width, y);
        g.setColor(Utilities.deriveColorHSB(color, 0, 0, -.10f));
        g.drawLine(x, y + 1, x + width, y + 1);
        g.drawLine(x, y + 2, x, y + height - 2);
        g.setColor(Utilities.deriveColorHSB(color, 0, 0, .24f));
        g.drawLine(x, y + height - 1, x + width, y + height-1);
    }
}
 
Example 20
Source Project: beautyeye   Source File: DemoSelectorPanel.java    License: Apache License 2.0 5 votes vote down vote up
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    Color color = c.getBackground();
    // render highlight at top
    g.setColor(Utilities.deriveColorHSB(color, 0, 0, .2f));
    g.drawLine(x, y, x + width, y);
    // render shadow on bottom
    g.setColor(Utilities.deriveColorHSB(color, 0, 0, -.2f));
    g.drawLine(x, y + height - 1, x + width, y + height - 1);
}
 
Example 21
Source Project: Darcula   Source File: CodeViewer.java    License: Apache License 2.0 5 votes vote down vote up
private void createCodeFileTab(CodeFileInfo codeFileInfo) {
    JLayeredPane layeredPane = JLayeredPane.getLayeredPaneAbove(codeFileInfo.textPane);
    JScrollPane scrollPane = new JScrollPane(layeredPane);
    scrollPane.setBorder(null);
    JPanel tabPanel = new JPanel();
    tabPanel.setLayout(new BorderLayout());
    
    tabPanel.add(scrollPane, BorderLayout.CENTER);
    
    codeTabbedPane.addTab(Utilities.getURLFileName(codeFileInfo.url), tabPanel);
}
 
Example 22
Source Project: Darcula   Source File: SwingSet3.java    License: Apache License 2.0 5 votes vote down vote up
protected void displayErrorMessage(String message, Exception ex) {
    JPanel messagePanel = new JPanel(new BorderLayout());       
    JLabel label = new JLabel(message);
    messagePanel.add(label);
    if (ex != null) {
        RoundedPanel panel = new RoundedPanel(new BorderLayout());
        panel.setBorder(new RoundedBorder());
        
        // remind(aim): provide way to allow user to see exception only if desired
        StringWriter writer = new StringWriter();
        ex.printStackTrace(new PrintWriter(writer));
        JTextArea exceptionText = new JTextArea();
        exceptionText.setText("Cause of error:\n" +
                writer.getBuffer().toString());
        exceptionText.setBorder(new RoundedBorder());
        exceptionText.setOpaque(false);
        exceptionText.setBackground(
                Utilities.deriveColorHSB(UIManager.getColor("Panel.background"),
                0, 0, -.2f));
        JScrollPane scrollpane = new JScrollPane(exceptionText);
        scrollpane.setBorder(EMPTY_BORDER);
        scrollpane.setPreferredSize(new Dimension(600,240));
        panel.add(scrollpane);
        messagePanel.add(panel, BorderLayout.SOUTH);            
    }
    JOptionPane.showMessageDialog(getMainFrame(), messagePanel, 
            resourceMap.getString("error.title"),
            JOptionPane.ERROR_MESSAGE);
            
}
 
Example 23
Source Project: Darcula   Source File: DemoSelectorPanel.java    License: Apache License 2.0 5 votes vote down vote up
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    AbstractButton b = (AbstractButton)c;
    if (b.isSelected()) {
        Color color = c.getBackground();
        g.setColor(Utilities.deriveColorHSB(color, 0, 0, -.20f));
        g.drawLine(x, y, x + width, y);
        g.setColor(Utilities.deriveColorHSB(color, 0, 0, -.10f));
        g.drawLine(x, y + 1, x + width, y + 1);
        g.drawLine(x, y + 2, x, y + height - 2);
        g.setColor(Utilities.deriveColorHSB(color, 0, 0, .24f));
        g.drawLine(x, y + height - 1, x + width, y + height-1);
    }
}
 
Example 24
Source Project: Darcula   Source File: DemoSelectorPanel.java    License: Apache License 2.0 5 votes vote down vote up
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    Color color = c.getBackground();
    // render highlight at top
    g.setColor(Utilities.deriveColorHSB(color, 0, 0, .2f));
    g.drawLine(x, y, x + width, y);
    // render shadow on bottom
    g.setColor(Utilities.deriveColorHSB(color, 0, 0, -.2f));
    g.drawLine(x, y + height - 1, x + width, y + height - 1);
}
 
Example 25
Source Project: littleluck   Source File: SwingSet3.java    License: Apache License 2.0 4 votes vote down vote up
private void configureDefaults() {
       
       // Color palette algorithm courtesy of Jasper Potts
       Color controlColor = UIManager.getColor("control");
       
UIManager.put(CONTROL_VERY_LIGHT_SHADOW_KEY, 
               Utilities.deriveColorHSB(controlColor, 0, 0, -0.02f));
       UIManager.put(CONTROL_LIGHT_SHADOW_KEY, 
               Utilities.deriveColorHSB(controlColor, 0, 0, -0.06f));
       UIManager.put(CONTROL_MID_SHADOW_KEY, 
               Utilities.deriveColorHSB(controlColor, 0, 0, -0.16f));
       UIManager.put(CONTROL_VERY_DARK_SHADOW_KEY, 
               Utilities.deriveColorHSB(controlColor, 0, 0, -0.5f));
       UIManager.put(CONTROL_DARK_SHADOW_KEY, 
               Utilities.deriveColorHSB(controlColor, 0, 0, -0.32f));
       
       // Calculate gradient colors for title panels
       Color titleColor = UIManager.getColor(usingNimbus()? "nimbusBase" : "activeCaption");

       // Some LAFs (e.g. GTK) don't contain "activeCaption" 
       if (titleColor == null) {
           titleColor = controlColor;
       }
       float hsb[] = Color.RGBtoHSB(
               titleColor.getRed(), titleColor.getGreen(), titleColor.getBlue(), null);
       UIManager.put(TITLE_GRADIENT_COLOR1_KEY, 
               Color.getHSBColor(hsb[0]-.013f, .15f, .85f));
       UIManager.put(TITLE_GRADIENT_COLOR2_KEY, 
               Color.getHSBColor(hsb[0]-.005f, .24f, .80f));
       UIManager.put(TITLE_FOREGROUND_KEY, 
               Color.getHSBColor(hsb[0], .54f, .40f));
       
       // Calculate highlight color for code pane
       UIManager.put(CODE_HIGHLIGHT_KEY,
               Color.getHSBColor(hsb[0]-.005f, .20f, .95f));
      
       Font labelFont = UIManager.getFont("Label.font");
       UIManager.put(TITLE_FONT_KEY, labelFont.deriveFont(Font.BOLD, labelFont.getSize()+4f));        

       Color panelColor = UIManager.getColor("Panel.background");
       UIManager.put(SUB_PANEL_BACKGROUND_KEY, 
               Utilities.deriveColorHSB(panelColor, 0, 0, -.06f));
       
       applyDefaults();
       
   }
 
Example 26
Source Project: beautyeye   Source File: SwingSet3.java    License: Apache License 2.0 4 votes vote down vote up
private void configureDefaults() {
       
       // Color palette algorithm courtesy of Jasper Potts
       Color controlColor = UIManager.getColor("control");
       
UIManager.put(CONTROL_VERY_LIGHT_SHADOW_KEY, 
               Utilities.deriveColorHSB(controlColor, 0, 0, -0.02f));
       UIManager.put(CONTROL_LIGHT_SHADOW_KEY, 
               Utilities.deriveColorHSB(controlColor, 0, 0, -0.06f));
       UIManager.put(CONTROL_MID_SHADOW_KEY, 
               Utilities.deriveColorHSB(controlColor, 0, 0, -0.16f));
       UIManager.put(CONTROL_VERY_DARK_SHADOW_KEY, 
               Utilities.deriveColorHSB(controlColor, 0, 0, -0.5f));
       UIManager.put(CONTROL_DARK_SHADOW_KEY, 
               Utilities.deriveColorHSB(controlColor, 0, 0, -0.32f));
       
       // Calculate gradient colors for title panels
       Color titleColor = UIManager.getColor(usingNimbus()? "nimbusBase" : "activeCaption");

       // Some LAFs (e.g. GTK) don't contain "activeCaption" 
       if (titleColor == null) {
           titleColor = controlColor;
       }
       float hsb[] = Color.RGBtoHSB(
               titleColor.getRed(), titleColor.getGreen(), titleColor.getBlue(), null);
       UIManager.put(TITLE_GRADIENT_COLOR1_KEY, 
               Color.getHSBColor(hsb[0]-.013f, .15f, .85f));
       UIManager.put(TITLE_GRADIENT_COLOR2_KEY, 
               Color.getHSBColor(hsb[0]-.005f, .24f, .80f));
       UIManager.put(TITLE_FOREGROUND_KEY, 
               Color.getHSBColor(hsb[0], .54f, .40f));
       
       // Calculate highlight color for code pane
       UIManager.put(CODE_HIGHLIGHT_KEY,
               Color.getHSBColor(hsb[0]-.005f, .20f, .95f));
      
       Font labelFont = UIManager.getFont("Label.font");
       UIManager.put(TITLE_FONT_KEY, labelFont.deriveFont(Font.BOLD, labelFont.getSize()+4f));        

       Color panelColor = UIManager.getColor("Panel.background");
       UIManager.put(SUB_PANEL_BACKGROUND_KEY, 
               Utilities.deriveColorHSB(panelColor, 0, 0, -.06f));
       
       applyDefaults();
       
   }
 
Example 27
Source Project: Darcula   Source File: SwingSet3.java    License: Apache License 2.0 4 votes vote down vote up
private void configureDefaults() {
       
       // Color palette algorithm courtesy of Jasper Potts
       Color controlColor = UIManager.getColor("control");
       
UIManager.put(CONTROL_VERY_LIGHT_SHADOW_KEY, 
               Utilities.deriveColorHSB(controlColor, 0, 0, -0.02f));
       UIManager.put(CONTROL_LIGHT_SHADOW_KEY, 
               Utilities.deriveColorHSB(controlColor, 0, 0, -0.06f));
       UIManager.put(CONTROL_MID_SHADOW_KEY, 
               Utilities.deriveColorHSB(controlColor, 0, 0, -0.16f));
       UIManager.put(CONTROL_VERY_DARK_SHADOW_KEY, 
               Utilities.deriveColorHSB(controlColor, 0, 0, -0.5f));
       UIManager.put(CONTROL_DARK_SHADOW_KEY, 
               Utilities.deriveColorHSB(controlColor, 0, 0, -0.32f));
       
       // Calculate gradient colors for title panels
       Color titleColor = UIManager.getColor(usingNimbus()? "nimbusBase" : "activeCaption");

       // Some LAFs (e.g. GTK) don't contain "activeCaption" 
       if (titleColor == null) {
           titleColor = controlColor;
       }
       float hsb[] = Color.RGBtoHSB(
               titleColor.getRed(), titleColor.getGreen(), titleColor.getBlue(), null);
       UIManager.put(TITLE_GRADIENT_COLOR1_KEY, 
               new DoubleColor(Color.getHSBColor(hsb[0]-.013f, .15f, .85f), new Color(0, 79, 114)));
       UIManager.put(TITLE_GRADIENT_COLOR2_KEY, 
               new DoubleColor(Color.getHSBColor(hsb[0]-.005f, .24f, .80f), new Color(49, 113, 164)));
       UIManager.put(TITLE_FOREGROUND_KEY, 
               new DoubleColor(Color.getHSBColor(hsb[0], .54f, .40f), new Color(0xbbbbbb)));
       
       // Calculate highlight color for code pane
       UIManager.put(CODE_HIGHLIGHT_KEY,
               Color.getHSBColor(hsb[0]-.005f, .20f, .95f));
      
       Font labelFont = UIManager.getFont("Label.font");
       UIManager.put(TITLE_FONT_KEY, labelFont.deriveFont(Font.BOLD, labelFont.getSize()+4f));        

       Color panelColor = UIManager.getColor("Panel.background");
       UIManager.put(SUB_PANEL_BACKGROUND_KEY, 
               Utilities.deriveColorHSB(panelColor, 0, 0, -.06f));
       
       applyDefaults();
       
   }