Its just that the selection background color is white instead of blue. But
when i write out getSelectionBackground() it gives me (0,0,128) ..

I have the same thing in a list i use in the same program. 
In the cell renderer i write :


            String s = (String) value;
            StringBuffer buf = new StringBuffer(" ");
            buf.append(s);
            setText(buf.toString());
                setEnabled(list.isEnabled());
                //setFont(list.getFont());

                if (isSelected) {
                setBackground(list.getSelectionBackground());
                    setForeground(list.getSelectionForeground());
            }
            else {
                    setBackground(list.getBackground());
                    setForeground(list.getForeground());
              }

But instead of blue (which is the list's default selectionBackground) i get
a white background with white text...
(the foreground is also white for selection!)


Greetings
Sofie

-----Original Message-----
From: Dmitry Beransky [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 16, 2002 11:13 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Highlight/selection in text component


Do you mean that you lose the selection with every move of the caret 
resulted from an arrow keypress?  Could you provide a link to a example of 
what you are trying to do (a small applet, a collection of screenshots, or 
a jar file of a sample application)?

Regards
Dmitry

At 04:24 AM 1/16/2002, Ravyts, Sofie wrote:
>I have another problem with highlighting in a textcomponent( a JTextPane)
>
>I catch the caretupdate event to select parts of my text when the user
>selects a character (the text contains of collections of characters instead
>of separate characters... So if a character is selected i want to select
all
>the characters in the collection of the selected character.)
>The problem is that i can get it to work with the mouse, but not with the
>arrows on the keyboard. The background selection color with the arrows
turns
>white instead of the blue i set it to (with setSelectionColor()).
>When i do the same thing with the mouse, it works fine (a blue background
>color!)...

_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to