Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to make SWT application appear in task bar on Windows XP
How to make SWT application appear in task bar on Windows XP [message #449331] Fri, 21 January 2005 21:15 Go to next message
Eclipse UserFriend
Originally posted by: daya.sharma.gmail.com

Hi All

I have developed a SWT application. When I run it I donot see it in the
Windows Task Bar, the only way I can see the application is using ALT-TAB
keys or if code specifically for a system tray item.

final Tray tray = Display.getDefault().getSystemTray();
trayItem = new TrayItem(tray, SWT.Show);


But using system tray item as the primary indicator for a running
application is just not feasible.

Can anyone please help me?

thanks

-daya
Re: How to make SWT application appear in task bar on Windows XP [message #449362 is a reply to message #449331] Mon, 24 January 2005 17:12 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Don't use the system tray. Do you have a small stand alone snippet that
shows the problem?

"Day" <daya.sharma@gmail.com> wrote in message
news:csrrdp$3uj$1@www.eclipse.org...
> Hi All
>
> I have developed a SWT application. When I run it I donot see it in the
> Windows Task Bar, the only way I can see the application is using ALT-TAB
> keys or if code specifically for a system tray item.
>
> final Tray tray = Display.getDefault().getSystemTray();
> trayItem = new TrayItem(tray, SWT.Show);
>
>
> But using system tray item as the primary indicator for a running
> application is just not feasible.
>
> Can anyone please help me?
>
> thanks
>
> -daya
>
>
Re: How to make SWT application appear in task bar on Windows XP [message #449442 is a reply to message #449362] Mon, 24 January 2005 17:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: daya.sharma.gmail.com

Hi Steve

My main class extends org.eclipse.jface.window.ApplicationWindow which
accepts a shell parameter in its constructor and doesn't give me much
control in terms of taskbar. Here is the code snippet...

public class BaseJFace extends ApplicationWindow {

public static void main(String[] args) {
final Display display = Display.getDefault();
shell = new Shell(display);
// I can add the TrayItem code here....
BaseJFace baseJFace = new BaseJFace(shell);
baseJFace.setBlockOnOpen(true);
baseJFace.open();
display.dispose();
}

public BaseJFace(Shell shell) {
super(shell);
}

..
..
..
}

However if I do something like this

Display display = new Display();

Image large = new Image(display, 32, 32);

gc = new GC(large);
gc.setBackground(display.getSystemColor(SWT.COLOR_RED));
gc.fillArc(0, 0, 32, 32, 45, 270);
gc.dispose();


Shell shell = new Shell(display);
shell.setText("Large icons");
shell.setImages(new Image[] {large});


shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}

I can see the shell in taskbar, the key difference here is shell.open().

So my understanding is that the ApplicationWindow creates a new instance
of shell somewhere and since the parent shell was never opened, it doesn't
show up in the taskbar.

Lemme know yor thoughts...

-daya


Steve Northover wrote:

> Don't use the system tray. Do you have a small stand alone snippet that
> shows the problem?

> "Day" <daya.sharma@gmail.com> wrote in message
> news:csrrdp$3uj$1@www.eclipse.org...
>> Hi All
>>
>> I have developed a SWT application. When I run it I donot see it in the
>> Windows Task Bar, the only way I can see the application is using ALT-TAB
>> keys or if code specifically for a system tray item.
>>
>> final Tray tray = Display.getDefault().getSystemTray();
>> trayItem = new TrayItem(tray, SWT.Show);
>>
>>
>> But using system tray item as the primary indicator for a running
>> application is just not feasible.
>>
>> Can anyone please help me?
>>
>> thanks
>>
>> -daya
>>
>>
Re: How to make SWT application appear in task bar on Windows XP [message #449508 is a reply to message #449442] Tue, 25 January 2005 15:10 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
The problem is that the shell in the first example is a dialog shell (a
shell whose parent is another shell). Dialog shells don't appear in the
task list.

"Daya Sharma" <daya.sharma@gmail.com> wrote in message
news:ct3b2h$77c$1@www.eclipse.org...
> Hi Steve
>
> My main class extends org.eclipse.jface.window.ApplicationWindow which
> accepts a shell parameter in its constructor and doesn't give me much
> control in terms of taskbar. Here is the code snippet...
>
> public class BaseJFace extends ApplicationWindow {
>
> public static void main(String[] args) {
> final Display display = Display.getDefault();
> shell = new Shell(display);
> // I can add the TrayItem code here....
> BaseJFace baseJFace = new BaseJFace(shell);
> baseJFace.setBlockOnOpen(true);
> baseJFace.open();
> display.dispose();
> }
>
> public BaseJFace(Shell shell) {
> super(shell);
> }
>
> .
> .
> .
> }
>
> However if I do something like this
>
> Display display = new Display();
>
> Image large = new Image(display, 32, 32);
>
> gc = new GC(large);
> gc.setBackground(display.getSystemColor(SWT.COLOR_RED));
> gc.fillArc(0, 0, 32, 32, 45, 270);
> gc.dispose();
>
>
> Shell shell = new Shell(display);
> shell.setText("Large icons");
> shell.setImages(new Image[] {large});
>
>
> shell.open();
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch())
> display.sleep();
> }
>
> I can see the shell in taskbar, the key difference here is shell.open().
>
> So my understanding is that the ApplicationWindow creates a new instance
> of shell somewhere and since the parent shell was never opened, it doesn't
> show up in the taskbar.
>
> Lemme know yor thoughts...
>
> -daya
>
>
> Steve Northover wrote:
>
> > Don't use the system tray. Do you have a small stand alone snippet that
> > shows the problem?
>
> > "Day" <daya.sharma@gmail.com> wrote in message
> > news:csrrdp$3uj$1@www.eclipse.org...
> >> Hi All
> >>
> >> I have developed a SWT application. When I run it I donot see it in the
> >> Windows Task Bar, the only way I can see the application is using
ALT-TAB
> >> keys or if code specifically for a system tray item.
> >>
> >> final Tray tray = Display.getDefault().getSystemTray();
> >> trayItem = new TrayItem(tray, SWT.Show);
> >>
> >>
> >> But using system tray item as the primary indicator for a running
> >> application is just not feasible.
> >>
> >> Can anyone please help me?
> >>
> >> thanks
> >>
> >> -daya
> >>
> >>
>
>
Re: How to make SWT application appear in task bar on Windows XP [message #449516 is a reply to message #449508] Tue, 25 January 2005 16:14 Go to previous message
Eclipse UserFriend
Originally posted by: daya.sharma.gmail.com

Thanks Steve

You are right, also I figured out that all I had to do was pass a null to
ApplicationWindow constructor, it would internally create a top level
shell for me if one is not already there.

this was a classic case of RTFM, sorry to bother you and thanks for all
your help.

-daya

Steve Northover wrote:

> The problem is that the shell in the first example is a dialog shell (a
> shell whose parent is another shell). Dialog shells don't appear in the
> task list.

> "Daya Sharma" <daya.sharma@gmail.com> wrote in message
> news:ct3b2h$77c$1@www.eclipse.org...
>> Hi Steve
>>
>> My main class extends org.eclipse.jface.window.ApplicationWindow which
>> accepts a shell parameter in its constructor and doesn't give me much
>> control in terms of taskbar. Here is the code snippet...
>>
>> public class BaseJFace extends ApplicationWindow {
>>
>> public static void main(String[] args) {
>> final Display display = Display.getDefault();
>> shell = new Shell(display);
>> // I can add the TrayItem code here....
>> BaseJFace baseJFace = new BaseJFace(shell);
>> baseJFace.setBlockOnOpen(true);
>> baseJFace.open();
>> display.dispose();
>> }
>>
>> public BaseJFace(Shell shell) {
>> super(shell);
>> }
>>
>> .
>> .
>> .
>> }
>>
>> However if I do something like this
>>
>> Display display = new Display();
>>
>> Image large = new Image(display, 32, 32);
>>
>> gc = new GC(large);
>> gc.setBackground(display.getSystemColor(SWT.COLOR_RED));
>> gc.fillArc(0, 0, 32, 32, 45, 270);
>> gc.dispose();
>>
>>
>> Shell shell = new Shell(display);
>> shell.setText("Large icons");
>> shell.setImages(new Image[] {large});
>>
>>
>> shell.open();
>> while (!shell.isDisposed()) {
>> if (!display.readAndDispatch())
>> display.sleep();
>> }
>>
>> I can see the shell in taskbar, the key difference here is shell.open().
>>
>> So my understanding is that the ApplicationWindow creates a new instance
>> of shell somewhere and since the parent shell was never opened, it doesn't
>> show up in the taskbar.
>>
>> Lemme know yor thoughts...
>>
>> -daya
>>
>>
>> Steve Northover wrote:
>>
>> > Don't use the system tray. Do you have a small stand alone snippet that
>> > shows the problem?
>>
>> > "Day" <daya.sharma@gmail.com> wrote in message
>> > news:csrrdp$3uj$1@www.eclipse.org...
>> >> Hi All
>> >>
>> >> I have developed a SWT application. When I run it I donot see it in the
>> >> Windows Task Bar, the only way I can see the application is using
> ALT-TAB
>> >> keys or if code specifically for a system tray item.
>> >>
>> >> final Tray tray = Display.getDefault().getSystemTray();
>> >> trayItem = new TrayItem(tray, SWT.Show);
>> >>
>> >>
>> >> But using system tray item as the primary indicator for a running
>> >> application is just not feasible.
>> >>
>> >> Can anyone please help me?
>> >>
>> >> thanks
>> >>
>> >> -daya
>> >>
>> >>
>>
>>
Previous Topic:disposing class attributes
Next Topic:Listening to events from a swing element embedded in an SWT composite
Goto Forum:
  


Current Time: Fri Nov 22 15:01:36 GMT 2019

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

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

Back to the top