Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT table flickering
| |
Re: SWT table flickering [message #466152 is a reply to message #466151] |
Tue, 03 January 2006 22:08 |
Aleksandr Kravets Messages: 55 Registered: July 2009 |
Member |
|
|
This is my code:
private void layoutData(Vector data,String sql) {
Label resultLabel = new Label(this, SWT.LEFT | SWT.BORDER);
table = new Table(this, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION
| SWT.VIRTUAL);
final GridData gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 2;
table.setLayoutData(gd);
table.setHeaderVisible(true);
table.setLinesVisible(true);
table.setItemCount(data.size());
table.addListener(SWT.SetData, new CallbackListener());
setLayout(new GridLayout(2,false));
GridData resultData = new GridData(GridData.FILL_BOTH);
resultData.horizontalSpan = 2;
resultData.verticalSpan = 1;
table.setLayoutData(resultData);
//table.setLayoutData (new RowData (200, 200));
GridData labelData = new GridData(GridData.FILL_HORIZONTAL);
resultLabel.setLayoutData(labelData);
RGB color = new RGB(255,204,51);
resultLabel.setBackground(new Color(getDisplay(),color));
FontRegistry fontRegistry = new FontRegistry(getDisplay());
fontRegistry.put("code", new FontData[]{new FontData("System",
7, SWT.BOLD)});
resultLabel.setFont(fontRegistry.get("code"));
resultLabel.setText(sql);
String columnNames[] = (String[])data.elementAt(0);
for(int cols = 0; cols < columnNames.length; cols++){
TableColumn column = new TableColumn(table,SWT.NONE);
column.setText(columnNames[cols]);
column.setWidth(200);
}
}
class CallbackListener implements Listener {
public void handleEvent(Event event) {
TableItem item = (TableItem)event.item;
int tableIndex = table.indexOf(item);
item.setText((String[])data.elementAt(tableIndex));
item.setBackground(tableIndex % 2 == 0 ?
getDisplay().getSystemColor(SWT.COLOR_WHITE) :
getDisplay().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));
}
}
My data contains 61,675 and 20 columns. When I select only one column,
there is some flickering. However, with 20, I get a lot flickering when
using scroller to scroll the table.
thanks,
Alex
Veronika Irvine wrote:
> The snippet you have referenced shows how to stop flickering in an embedded
> JTable using
> System.setProperty("sun.awt.noerasebackground","true"). It is not meant to
> suggest that this is the only way to have a table that does not flicker.
>
> Please give more information about how many items you have in the table and
> how you have created the table. When does the flicker occur? Does the
> following example with a one million items flicker for you?
>
> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet144.java?rev=HEAD& amp;content-type=text/vnd.viewcvs-markup
>
> "Aleksandr Kravets" <akravets@klgerweiss.com> wrote in message
> news:dpeq6q$rs5$1@utils.eclipse.org...
>
>>Hi,
>>
>>I have an application using SWT tables. There is a substantial flickering
>>going on when I have lot's of data. Searching on this I found:
>> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet154.java?rev=HEAD& amp;content-type=text/vnd.viewcvs-markup
>>which suggests using JTable in SWT to reduce flickering. But this means I
>>can't use TableViewer and other good stuff (?) if I use JTable. And, why
>>does flickering happen in SWT and not in Swing (I did not try this yet).
>>
>>thanks,
>>Alex
>
>
>
|
|
|
Re: SWT table flickering [message #466153 is a reply to message #466152] |
Tue, 03 January 2006 22:11 |
Aleksandr Kravets Messages: 55 Registered: July 2009 |
Member |
|
|
Also,
In Snippet144 there is some white flickering present when using the
vertical srollbar, same thing I have when scrolling table with one column.
Alex
Aleksandr Kravets wrote:
> This is my code:
>
> private void layoutData(Vector data,String sql) {
> Label resultLabel = new Label(this, SWT.LEFT | SWT.BORDER);
> table = new Table(this, SWT.BORDER | SWT.MULTI |
> SWT.FULL_SELECTION | SWT.VIRTUAL);
> final GridData gd = new GridData(GridData.FILL_BOTH);
> gd.horizontalSpan = 2;
> table.setLayoutData(gd);
> table.setHeaderVisible(true);
> table.setLinesVisible(true);
>
> table.setItemCount(data.size());
> table.addListener(SWT.SetData, new CallbackListener());
>
> setLayout(new GridLayout(2,false));
>
> GridData resultData = new GridData(GridData.FILL_BOTH);
> resultData.horizontalSpan = 2;
> resultData.verticalSpan = 1;
> table.setLayoutData(resultData);
> //table.setLayoutData (new RowData (200, 200));
>
> GridData labelData = new GridData(GridData.FILL_HORIZONTAL);
> resultLabel.setLayoutData(labelData);
>
> RGB color = new RGB(255,204,51);
> resultLabel.setBackground(new Color(getDisplay(),color));
>
> FontRegistry fontRegistry = new FontRegistry(getDisplay());
> fontRegistry.put("code", new FontData[]{new FontData("System",
> 7, SWT.BOLD)});
> resultLabel.setFont(fontRegistry.get("code"));
>
> resultLabel.setText(sql);
>
> String columnNames[] = (String[])data.elementAt(0);
> for(int cols = 0; cols < columnNames.length; cols++){
> TableColumn column = new TableColumn(table,SWT.NONE);
> column.setText(columnNames[cols]);
> column.setWidth(200);
> }
> }
>
> class CallbackListener implements Listener {
> public void handleEvent(Event event) {
> TableItem item = (TableItem)event.item;
> int tableIndex = table.indexOf(item);
> item.setText((String[])data.elementAt(tableIndex));
> item.setBackground(tableIndex % 2 == 0 ?
> getDisplay().getSystemColor(SWT.COLOR_WHITE) :
> getDisplay().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));
> }
> }
>
> My data contains 61,675 and 20 columns. When I select only one column,
> there is some flickering. However, with 20, I get a lot flickering when
> using scroller to scroll the table.
>
> thanks,
> Alex
>
> Veronika Irvine wrote:
>
>> The snippet you have referenced shows how to stop flickering in an
>> embedded JTable using
>> System.setProperty("sun.awt.noerasebackground","true"). It is not
>> meant to suggest that this is the only way to have a table that does
>> not flicker.
>>
>> Please give more information about how many items you have in the
>> table and how you have created the table. When does the flicker
>> occur? Does the following example with a one million items flicker
>> for you?
>>
>> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet144.java?rev=HEAD& amp;content-type=text/vnd.viewcvs-markup
>>
>>
>> "Aleksandr Kravets" <akravets@klgerweiss.com> wrote in message
>> news:dpeq6q$rs5$1@utils.eclipse.org...
>>
>>> Hi,
>>>
>>> I have an application using SWT tables. There is a substantial
>>> flickering going on when I have lot's of data. Searching on this I
>>> found:
>>> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet154.java?rev=HEAD& amp;content-type=text/vnd.viewcvs-markup
>>> which suggests using JTable in SWT to reduce flickering. But this
>>> means I can't use TableViewer and other good stuff (?) if I use
>>> JTable. And, why does flickering happen in SWT and not in Swing (I
>>> did not try this yet).
>>>
>>> thanks,
>>> Alex
>>
>>
>>
>>
|
|
|
Re: SWT table flickering [message #466793 is a reply to message #466153] |
Tue, 17 January 2006 18:17 |
Steve Northover Messages: 1636 Registered: July 2009 |
Senior Member |
|
|
I you run with the Windows XP manifest file, the flickering in Snippet144
goes away (we worked around it on XP). Otherwise, the flickering that you
see is just the operating system drawing the table as you scroll. You can
see this on Windows 2000 in the Explorer when scrolling.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=116776
"Aleksandr Kravets" <akravets@klgerweiss.com> wrote in message
news:dpesra$vqm$2@utils.eclipse.org...
> Also,
>
> In Snippet144 there is some white flickering present when using the
> vertical srollbar, same thing I have when scrolling table with one column.
>
> Alex
>
> Aleksandr Kravets wrote:
> > This is my code:
> >
> > private void layoutData(Vector data,String sql) {
> > Label resultLabel = new Label(this, SWT.LEFT | SWT.BORDER);
> > table = new Table(this, SWT.BORDER | SWT.MULTI |
> > SWT.FULL_SELECTION | SWT.VIRTUAL);
> > final GridData gd = new GridData(GridData.FILL_BOTH);
> > gd.horizontalSpan = 2;
> > table.setLayoutData(gd);
> > table.setHeaderVisible(true);
> > table.setLinesVisible(true);
> >
> > table.setItemCount(data.size());
> > table.addListener(SWT.SetData, new CallbackListener());
> >
> > setLayout(new GridLayout(2,false));
> >
> > GridData resultData = new GridData(GridData.FILL_BOTH);
> > resultData.horizontalSpan = 2;
> > resultData.verticalSpan = 1;
> > table.setLayoutData(resultData);
> > //table.setLayoutData (new RowData (200, 200));
> >
> > GridData labelData = new GridData(GridData.FILL_HORIZONTAL);
> > resultLabel.setLayoutData(labelData);
> >
> > RGB color = new RGB(255,204,51);
> > resultLabel.setBackground(new Color(getDisplay(),color));
> >
> > FontRegistry fontRegistry = new FontRegistry(getDisplay());
> > fontRegistry.put("code", new FontData[]{new FontData("System",
> > 7, SWT.BOLD)});
> > resultLabel.setFont(fontRegistry.get("code"));
> >
> > resultLabel.setText(sql);
> >
> > String columnNames[] = (String[])data.elementAt(0);
> > for(int cols = 0; cols < columnNames.length; cols++){
> > TableColumn column = new TableColumn(table,SWT.NONE);
> > column.setText(columnNames[cols]);
> > column.setWidth(200);
> > }
> > }
> >
> > class CallbackListener implements Listener {
> > public void handleEvent(Event event) {
> > TableItem item = (TableItem)event.item;
> > int tableIndex = table.indexOf(item);
> > item.setText((String[])data.elementAt(tableIndex));
> > item.setBackground(tableIndex % 2 == 0 ?
> > getDisplay().getSystemColor(SWT.COLOR_WHITE) :
> > getDisplay().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));
> > }
> > }
> >
> > My data contains 61,675 and 20 columns. When I select only one column,
> > there is some flickering. However, with 20, I get a lot flickering when
> > using scroller to scroll the table.
> >
> > thanks,
> > Alex
> >
> > Veronika Irvine wrote:
> >
> >> The snippet you have referenced shows how to stop flickering in an
> >> embedded JTable using
> >> System.setProperty("sun.awt.noerasebackground","true"). It is not
> >> meant to suggest that this is the only way to have a table that does
> >> not flicker.
> >>
> >> Please give more information about how many items you have in the
> >> table and how you have created the table. When does the flicker
> >> occur? Does the following example with a one million items flicker
> >> for you?
> >>
> >>
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet144.java?rev=HEAD& amp;content-type=text/vnd.viewcvs-markup
> >>
> >>
> >> "Aleksandr Kravets" <akravets@klgerweiss.com> wrote in message
> >> news:dpeq6q$rs5$1@utils.eclipse.org...
> >>
> >>> Hi,
> >>>
> >>> I have an application using SWT tables. There is a substantial
> >>> flickering going on when I have lot's of data. Searching on this I
> >>> found:
> >>>
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet154.java?rev=HEAD& amp;content-type=text/vnd.viewcvs-markup
> >>> which suggests using JTable in SWT to reduce flickering. But this
> >>> means I can't use TableViewer and other good stuff (?) if I use
> >>> JTable. And, why does flickering happen in SWT and not in Swing (I
> >>> did not try this yet).
> >>>
> >>> thanks,
> >>> Alex
> >>
> >>
> >>
> >>
|
|
|
Goto Forum:
Current Time: Sat Dec 14 14:37:22 GMT 2024
Powered by FUDForum. Page generated in 0.04032 seconds
|