[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: How to make SWT application appear in task bar on Windows XP

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@xxxxxxxxx> wrote in message
news:csrrdp$3uj$1@xxxxxxxxxxxxxxxxxx
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