Java Code Examples for com.sun.swingset3.utilities.Utilities#getHTMLColorString()
The following examples show how to use
com.sun.swingset3.utilities.Utilities#getHTMLColorString() .
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: CodeViewer.java From littleluck with Apache License 2.0 | 6 votes |
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 2
Source File: CodeViewer.java From beautyeye with Apache License 2.0 | 6 votes |
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 3
Source File: CodeViewer.java From Darcula with Apache License 2.0 | 6 votes |
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; }