Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » problem in table selection color
problem in table selection color [message #441760] Tue, 24 August 2004 02:06 Go to next message
Eclipse UserFriend
Originally posted by: david_danie.hotmail.com

Hi Friends,
I want to set the background color for each table's rows. So i used
setBackround(Color.gray) method in TableItem and i am not doing anything
for selection color. So i am expecting the default selection color(blue)
in the selected row.but whenever i select the row the selection color is
not changed it always shows with gray color.

any solution?

Thanks,
David Danie.
Re: problem in table selection color [message #441825 is a reply to message #441760] Wed, 25 August 2004 15:26 Go to previous messageGo to next message
Eclipse UserFriend
The following example works for me. Note that when the table does not have
focus, the selection is not shown in blue but in a light gray (on Windows
2000). Alternatively you can create a table with SWT.HIDE_SELECTION to not
show the selection at all when the table does not have focus.

public static void main (String [] args) {
Display display = new Display ();
Color gray = display.getSystemColor(SWT.COLOR_GRAY);
Shell shell = new Shell (display);
shell.setLayout(new FillLayout());
Table table = new Table(shell, SWT.BORDER);
//Table table = new Table(shell, SWT.BORDER | SWT.HIDE_SELECTION);
for (int i = 0; i < 10; i++) {
TableItem item = new TableItem(table, SWT.NONE);
item.setText("item "+i);
item.setBackground(gray);
}
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}


"David Danie" <david_danie@hotmail.com> wrote in message
news:cgelo7$rgt$1@eclipse.org...
> Hi Friends,
> I want to set the background color for each table's rows. So i used
> setBackround(Color.gray) method in TableItem and i am not doing anything
> for selection color. So i am expecting the default selection color(blue)
> in the selected row.but whenever i select the row the selection color is
> not changed it always shows with gray color.
>
> any solution?
>
> Thanks,
> David Danie.
>
Re: problem in table selection color [message #441859 is a reply to message #441825] Thu, 26 August 2004 06:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: david_danie.hotmail.com

Yes. You are correct.
The selection shown in blue only if table have the focus.
But if i edit the column in the table the selection shown in gray not in
blue.

Thanks,
David Danie.

Veronika Irvine wrote:
> The following example works for me. Note that when the table does not have
> focus, the selection is not shown in blue but in a light gray (on Windows
> 2000). Alternatively you can create a table with SWT.HIDE_SELECTION to not
> show the selection at all when the table does not have focus.
>
> public static void main (String [] args) {
> Display display = new Display ();
> Color gray = display.getSystemColor(SWT.COLOR_GRAY);
> Shell shell = new Shell (display);
> shell.setLayout(new FillLayout());
> Table table = new Table(shell, SWT.BORDER);
> //Table table = new Table(shell, SWT.BORDER | SWT.HIDE_SELECTION);
> for (int i = 0; i < 10; i++) {
> TableItem item = new TableItem(table, SWT.NONE);
> item.setText("item "+i);
> item.setBackground(gray);
> }
> shell.open ();
> while (!shell.isDisposed ()) {
> if (!display.readAndDispatch ()) display.sleep ();
> }
> display.dispose ();
> }
>
>
> "David Danie" <david_danie@hotmail.com> wrote in message
> news:cgelo7$rgt$1@eclipse.org...
>
>>Hi Friends,
>> I want to set the background color for each table's rows. So i used
>>setBackround(Color.gray) method in TableItem and i am not doing anything
>>for selection color. So i am expecting the default selection color(blue)
>>in the selected row.but whenever i select the row the selection color is
>>not changed it always shows with gray color.
>>
>>any solution?
>>
>>Thanks,
>>David Danie.
>>
>
>
>
Re: problem in table selection color [message #441860 is a reply to message #441825] Thu, 26 August 2004 06:39 Go to previous message
Eclipse UserFriend
Originally posted by: david_danie.hotmail.com

Yes. You are correct.
The selection shown in blue only if table have the focus.
But if i edit the column in the table the selection shown in gray not in
blue.

Thanks,
David Danie.


Veronika Irvine wrote:
> The following example works for me. Note that when the table does not have
> focus, the selection is not shown in blue but in a light gray (on Windows
> 2000). Alternatively you can create a table with SWT.HIDE_SELECTION to not
> show the selection at all when the table does not have focus.
>
> public static void main (String [] args) {
> Display display = new Display ();
> Color gray = display.getSystemColor(SWT.COLOR_GRAY);
> Shell shell = new Shell (display);
> shell.setLayout(new FillLayout());
> Table table = new Table(shell, SWT.BORDER);
> //Table table = new Table(shell, SWT.BORDER | SWT.HIDE_SELECTION);
> for (int i = 0; i < 10; i++) {
> TableItem item = new TableItem(table, SWT.NONE);
> item.setText("item "+i);
> item.setBackground(gray);
> }
> shell.open ();
> while (!shell.isDisposed ()) {
> if (!display.readAndDispatch ()) display.sleep ();
> }
> display.dispose ();
> }
>
>
> "David Danie" <david_danie@hotmail.com> wrote in message
> news:cgelo7$rgt$1@eclipse.org...
>
>>Hi Friends,
>> I want to set the background color for each table's rows. So i used
>>setBackround(Color.gray) method in TableItem and i am not doing anything
>>for selection color. So i am expecting the default selection color(blue)
>>in the selected row.but whenever i select the row the selection color is
>>not changed it always shows with gray color.
>>
>>any solution?
>>
>>Thanks,
>>David Danie.
>>
>
>
>
Previous Topic:[ANN] v2.1 - SWT Designer, Swing Designer & WindowBuilder
Next Topic:SWT Browser (Eclipse 3.0) gets stuck in Eclipse 3.0 Runtime Workbench
Goto Forum:
  


Current Time: Sat Jul 05 06:39:34 EDT 2025

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

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

Back to the top