[Thinlet-development] thinlet/src/thinlet Thinlet.java,1.18,1.19
Brought to you by:
bajzat
From: <ab...@us...> - 2003-05-12 14:01:52
|
Update of /cvsroot/thinlet/thinlet/src/thinlet In directory sc8-pr-cvs1:/tmp/cvs-serv13278 Modified Files: Thinlet.java Log Message: Replace setForeground/setBackground with setColor. Workaround for yet another NPE. The source of these problems is somewhere in the layout code, and remains to be fixed. The symptoms occur when many components are quickly added. Index: Thinlet.java =================================================================== RCS file: /cvsroot/thinlet/thinlet/src/thinlet/Thinlet.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- Thinlet.java 9 May 2003 16:51:52 -0000 1.18 +++ Thinlet.java 12 May 2003 14:01:47 -0000 1.19 @@ -179,28 +179,20 @@ } /** - * Set custom foreground color (text color) on a component - * - * @param component component to use the custom foreground - * @param color custom color to use, or null to reset component to use default foreground - */ - public void setForeground(Object component, Color color) { - if (component != null) set(component, "foreground", color); - } - - /** - * Set custom background color on a component. - * <p>Note: on gradient-filled + * Set custom color on a component. + * <p>Notes: For "foreground" key, this sets the text color. + * For "background" key, on gradient-filled * components (such as tabs, buttons etc) this will result in a * component filled with solid background color, and not a new gradient. * Also, Color.brighter() will be used for highlight, and Color.darker() * will be used for pressed or not selected. * - * @param component component to use the custom background - * @param color custom color to use, or null to reset component to use default background + * @param component component to use for custom color + * @param key currently "background" and "foreground" are supported + * @param color custom color to use, or null to reset component to use default color */ - public void setBackground(Object component, Color color) { - if (component != null) set(component, "background", color); + public void setColor(Object component, String key, Color color) { + if (component != null) set(component, key, color); } /** @@ -1834,6 +1826,10 @@ // paint selected tab and its content if (selectedtab != null) { Rectangle r = getRectangle(selectedtab, "bounds"); + if (r == null) { + r = new Rectangle(); + set(selectedtab, "bounds", r); + } // paint tabbedpane border if (stacked) { g.setColor(enabled ? c_border : c_disable); |