Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT.FULL_SELECTION style, bug?
SWT.FULL_SELECTION style, bug? [message #466961] Fri, 20 January 2006 06:14 Go to next message
kevin is currently offline kevinFriend
Messages: 4
Registered: July 2009
Junior Member
hi,all
when i use the SWT.FULL_SELECTION, something was puzzled me 。

I create the JFace TreeView like this:

new TreeViewer(parent, SWT.FULL_SELECTION).

then i set the CustomLabelProvider.
the CustomLabelProvider declare like this :

>public class CustomLabelProvider implements ITableLabelProvider
,ITableColorProvider

as you see ,i implements the ITableColorProvider 。

> public Color getBackground(Object arg0, int arg1) {
> Color color = new Color(null, 255, 255, 255);//color is black
> return color;
> }

when i do that ,i thought the backgroundColor of all columns shoud be black.

but the fact is that :

columnindex ==0 the backgroundColor is black. (right )
columnindex >=0 (1.2.3...........) the backgroundColor is not black,it
seems that the backgroundColor is not setted
or reset some other color.

When i change the treeview style,for exmaple :
new TreeViewer(parent).// i use the default style

the everything is right ,the backgroundColor of all columns is
black。。。。。。

when i use “SWT.FULL_SELECTION”, what had happend ?

who will help me ?

Thank you very much !

from kevin
Re: SWT.FULL_SELECTION style, bug? [message #466980 is a reply to message #466961] Fri, 20 January 2006 15:30 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
Please note that you are leaking colors with the implementation you have
shown.

What platform are you running on and what version of Eclipse are you using?

The following works for me on Windows XP. It is straight SWT code (no
JFace). Does it work for you?

public static void main (String [] args) {
Display display = new Display ();
final Color red = display.getSystemColor(SWT.COLOR_RED);
final Color green = display.getSystemColor(SWT.COLOR_GREEN);
final Color blue = display.getSystemColor(SWT.COLOR_BLUE);
Shell shell = new Shell (display);
shell.setLayout(new FillLayout());
Tree tree = new Tree(shell, SWT.FULL_SELECTION);
tree.setHeaderVisible(true);
TreeColumn column0 = new TreeColumn(tree, SWT.LEFT);
TreeColumn column1 = new TreeColumn(tree, SWT.RIGHT);
TreeColumn column2 = new TreeColumn(tree, SWT.CENTER);
for (int i = 0; i < 4; i++) {
TreeItem item = new TreeItem(tree, SWT.NONE);
item.setText(new String[] {"qqqqq", "yyyy", "pppppppp"});
item.setBackground(0, red);
item.setBackground(1, green);
item.setBackground(2, blue);
for (int j = 0; j < 4; j++) {
TreeItem subItem = new TreeItem(item, SWT.NONE);
subItem.setText(new String[] {"qqqqq", "yyyy",
"pppppppp"});
subItem.setBackground(0, green);
subItem.setBackground(1, blue);
subItem.setBackground(2, red);
}
}
column0.pack();
column1.pack();
column2.pack();
shell.pack();
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}

"kevin" <send60@eyou.com> wrote in message
news:dqpv0k$5pt$1@utils.eclipse.org...
> hi,all
> when i use the SWT.FULL_SELECTION, something was puzzled me $B!#(B
>
> I create the JFace TreeView like this:
>
> new TreeViewer(parent, SWT.FULL_SELECTION).
>
> then i set the CustomLabelProvider.
> the CustomLabelProvider declare like this :
>
> >public class CustomLabelProvider implements ITableLabelProvider
> ,ITableColorProvider
>
> as you see ,i implements the ITableColorProvider $B!#(B
>
>> public Color getBackground(Object arg0, int arg1) {
>> Color color = new Color(null, 255, 255, 255);//color is black
>> return color;
>> }
>
> when i do that ,i thought the backgroundColor of all columns shoud be
> black.
>
> but the fact is that $B!'(B
>
> columnindex ==0 the backgroundColor is black. (right )
> columnindex >=0 (1.2.3...........) the backgroundColor is not black,it
> seems that the backgroundColor is not setted
> or reset some other color.
>
> When i change the treeview style,for exmaple :
> new TreeViewer(parent).// i use the default style
>
> the everything is right ,the backgroundColor of all columns is
> black$B!#!#!#!#!#!#(B
>
> when i use $B!H(BSWT.FULL_SELECTION$B!I!$(B what had happend ?
>
> who will help me ?
>
> Thank you very much !
>
> from kevin
>
Re: SWT.FULL_SELECTION style, bug? [message #466996 is a reply to message #466980] Fri, 20 January 2006 17:57 Go to previous messageGo to next message
Kevin is currently offline KevinFriend
Messages: 34
Registered: July 2009
Member
hi,Veronika Irvine
Thank you for your help !

this is my env:
Eclipse version: 3.1.1
OS: windows 2000 server

I had run your code ,but the setting of the color does not work for me.
(you could see the picture in the attachment)

when i create the tree not use SWT.FULL_SELECTION ,
the setting of color is right.

Is some constraint for the color setting?
Is version of my eclipse or OS wrong?

thank you !

from kevin

"Veronika Irvine" <veronika_irvine@oti.com> д
Re: SWT.FULL_SELECTION style, bug? [message #467023 is a reply to message #466996] Mon, 23 January 2006 05:19 Go to previous messageGo to next message
kevin is currently offline kevinFriend
Messages: 4
Registered: July 2009
Junior Member
I had run the code in Windows XP,but the leaking of the color is
still exist.

is there a plan that this will be fixed ?
thanks

"Kevin" <send60@eyou.com> wrote in message
news:dqr8d5$hgj$2@utils.eclipse.org...
> hi,Veronika Irvine
> Thank you for your help !
>
> this is my env:
> Eclipse version: 3.1.1
> OS: windows 2000 server
>
> I had run your code ,but the setting of the color does not work for me.
> (you could see the picture in the attachment)
>
> when i create the tree not use SWT.FULL_SELECTION ,
> the setting of color is right.
>
> Is some constraint for the color setting?
> Is version of my eclipse or OS wrong?
>
> thank you !
>
> from kevin
>
> "Veronika Irvine" <veronika_irvine@oti.com> >
news:dqqvo7$b2$1@utils.eclipse.org...
> > Please note that you are leaking colors with the implementation you have
> > shown.
> >
> > What platform are you running on and what version of Eclipse are you
> using?
> >
> > The following works for me on Windows XP. It is straight SWT code (no
> > JFace). Does it work for you?
> >
> > public static void main (String [] args) {
> > Display display = new Display ();
> > final Color red = display.getSystemColor(SWT.COLOR_RED);
> > final Color green = display.getSystemColor(SWT.COLOR_GREEN);
> > final Color blue = display.getSystemColor(SWT.COLOR_BLUE);
> > Shell shell = new Shell (display);
> > shell.setLayout(new FillLayout());
> > Tree tree = new Tree(shell, SWT.FULL_SELECTION);
> > tree.setHeaderVisible(true);
> > TreeColumn column0 = new TreeColumn(tree, SWT.LEFT);
> > TreeColumn column1 = new TreeColumn(tree, SWT.RIGHT);
> > TreeColumn column2 = new TreeColumn(tree, SWT.CENTER);
> > for (int i = 0; i < 4; i++) {
> > TreeItem item = new TreeItem(tree, SWT.NONE);
> > item.setText(new String[] {"qqqqq", "yyyy",
"pppppppp"});
> > item.setBackground(0, red);
> > item.setBackground(1, green);
> > item.setBackground(2, blue);
> > for (int j = 0; j < 4; j++) {
> > TreeItem subItem = new TreeItem(item, SWT.NONE);
> > subItem.setText(new String[] {"qqqqq", "yyyy",
> > "pppppppp"});
> > subItem.setBackground(0, green);
> > subItem.setBackground(1, blue);
> > subItem.setBackground(2, red);
> > }
> > }
> > column0.pack();
> > column1.pack();
> > column2.pack();
> > shell.pack();
> > shell.open ();
> > while (!shell.isDisposed ()) {
> > if (!display.readAndDispatch ()) display.sleep ();
> > }
> > display.dispose ();
> > }
> >
> > "kevin" <send60@eyou.com> wrote in message
> > news:dqpv0k$5pt$1@utils.eclipse.org...
> > > hi,all
> > > when i use the SWT.FULL_SELECTION, something was puzzled me 。
> > >
> > > I create the JFace TreeView like this:
> > >
> > > new TreeViewer(parent, SWT.FULL_SELECTION).
> > >
> > > then i set the CustomLabelProvider.
> > > the CustomLabelProvider declare like this :
> > >
> > > >public class CustomLabelProvider implements ITableLabelProvider
> > > ,ITableColorProvider
> > >
> > > as you see ,i implements the ITableColorProvider 。
> > >
> > >> public Color getBackground(Object arg0, int arg1) {
> > >> Color color = new Color(null, 255, 255, 255);//color is black
> > >> return color;
> > >> }
> > >
> > > when i do that ,i thought the backgroundColor of all columns shoud be
> > > black.
> > >
> > > but the fact is that :
> > >
> > > columnindex ==0 the backgroundColor is black. (right )
> > > columnindex >=0 (1.2.3...........) the backgroundColor is not
black,it
> > > seems that the backgroundColor is not setted
> > > or reset some other color.
> > >
> > > When i change the treeview style,for exmaple :
> > > new TreeViewer(parent).// i use the default style
> > >
> > > the everything is right ,the backgroundColor of all columns is
> > > black。。。。。。
> > >
> > > when i use “SWT.FULL_SELECTION”, what had happend ?
> > >
> > > who will help me ?
> > >
> > > Thank you very much !
> > >
> > > from kevin
> > >
> >
> >
>
>
>
Re: SWT.FULL_SELECTION style, bug? [message #467024 is a reply to message #467023] Mon, 23 January 2006 06:30 Go to previous message
kevin is currently offline kevinFriend
Messages: 4
Registered: July 2009
Junior Member
when i run that on Eclipse 3.2M4, the setting of color has been right.
:)

I think that has been fiexd .

thanks..



"kevin" <send60@eyou.com> wrote in message
news:dr1ouj$lum$1@utils.eclipse.org...
> I had run the code in Windows XP,but the leaking of the color is
> still exist.
>
> is there a plan that this will be fixed ?
> thanks
>
> "Kevin" <send60@eyou.com> wrote in message
> news:dqr8d5$hgj$2@utils.eclipse.org...
> > hi,Veronika Irvine
> > Thank you for your help !
> >
> > this is my env:
> > Eclipse version: 3.1.1
> > OS: windows 2000 server
> >
> > I had run your code ,but the setting of the color does not work for me.
> > (you could see the picture in the attachment)
> >
> > when i create the tree not use SWT.FULL_SELECTION ,
> > the setting of color is right.
> >
> > Is some constraint for the color setting?
> > Is version of my eclipse or OS wrong?
> >
> > thank you !
> >
> > from kevin
> >
> > "Veronika Irvine" <veronika_irvine@oti.com> >
> news:dqqvo7$b2$1@utils.eclipse.org...
> > > Please note that you are leaking colors with the implementation you
have
> > > shown.
> > >
> > > What platform are you running on and what version of Eclipse are you
> > using?
> > >
> > > The following works for me on Windows XP. It is straight SWT code
(no
> > > JFace). Does it work for you?
> > >
> > > public static void main (String [] args) {
> > > Display display = new Display ();
> > > final Color red = display.getSystemColor(SWT.COLOR_RED);
> > > final Color green = display.getSystemColor(SWT.COLOR_GREEN);
> > > final Color blue = display.getSystemColor(SWT.COLOR_BLUE);
> > > Shell shell = new Shell (display);
> > > shell.setLayout(new FillLayout());
> > > Tree tree = new Tree(shell, SWT.FULL_SELECTION);
> > > tree.setHeaderVisible(true);
> > > TreeColumn column0 = new TreeColumn(tree, SWT.LEFT);
> > > TreeColumn column1 = new TreeColumn(tree, SWT.RIGHT);
> > > TreeColumn column2 = new TreeColumn(tree, SWT.CENTER);
> > > for (int i = 0; i < 4; i++) {
> > > TreeItem item = new TreeItem(tree, SWT.NONE);
> > > item.setText(new String[] {"qqqqq", "yyyy",
> "pppppppp"});
> > > item.setBackground(0, red);
> > > item.setBackground(1, green);
> > > item.setBackground(2, blue);
> > > for (int j = 0; j < 4; j++) {
> > > TreeItem subItem = new TreeItem(item,
SWT.NONE);
> > > subItem.setText(new String[] {"qqqqq", "yyyy",
> > > "pppppppp"});
> > > subItem.setBackground(0, green);
> > > subItem.setBackground(1, blue);
> > > subItem.setBackground(2, red);
> > > }
> > > }
> > > column0.pack();
> > > column1.pack();
> > > column2.pack();
> > > shell.pack();
> > > shell.open ();
> > > while (!shell.isDisposed ()) {
> > > if (!display.readAndDispatch ()) display.sleep ();
> > > }
> > > display.dispose ();
> > > }
> > >
> > > "kevin" <send60@eyou.com> wrote in message
> > > news:dqpv0k$5pt$1@utils.eclipse.org...
> > > > hi,all
> > > > when i use the SWT.FULL_SELECTION, something was puzzled me 。
> > > >
> > > > I create the JFace TreeView like this:
> > > >
> > > > new TreeViewer(parent, SWT.FULL_SELECTION).
> > > >
> > > > then i set the CustomLabelProvider.
> > > > the CustomLabelProvider declare like this :
> > > >
> > > > >public class CustomLabelProvider implements ITableLabelProvider
> > > > ,ITableColorProvider
> > > >
> > > > as you see ,i implements the ITableColorProvider 。
> > > >
> > > >> public Color getBackground(Object arg0, int arg1) {
> > > >> Color color = new Color(null, 255, 255, 255);//color is
black
> > > >> return color;
> > > >> }
> > > >
> > > > when i do that ,i thought the backgroundColor of all columns shoud
be
> > > > black.
> > > >
> > > > but the fact is that :
> > > >
> > > > columnindex ==0 the backgroundColor is black. (right )
> > > > columnindex >=0 (1.2.3...........) the backgroundColor is not
> black,it
> > > > seems that the backgroundColor is not setted
> > > > or reset some other color.
> > > >
> > > > When i change the treeview style,for exmaple :
> > > > new TreeViewer(parent).// i use the default style
> > > >
> > > > the everything is right ,the backgroundColor of all columns is
> > > > black。。。。。。
> > > >
> > > > when i use “SWT.FULL_SELECTION”, what had happend ?
> > > >
> > > > who will help me ?
> > > >
> > > > Thank you very much !
> > > >
> > > > from kevin
> > > >
> > >
> > >
> >
> >
> >
>
Previous Topic:Running SWT on UNIX
Next Topic:Get a View's actual location
Goto Forum:
  


Current Time: Fri Mar 29 09:22:09 GMT 2024

Powered by FUDForum. Page generated in 0.05396 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top