Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Menu Images Problem
Menu Images Problem [message #437199] Tue, 01 June 2004 00:34 Go to next message
Eclipse UserFriend
Originally posted by: raf_k.sympatico.ca

Menu Images set using the setImage() method aren't rendered correctly with
respect to transparency. I'm using a gif "save_edit.gif" from the icon
directory of the Eclipse release, so it should work.

I'm running Windows XP, and I have tried everything from manually setting
the transparency by defining the transparent pixel's RGB. I've been
pulling my hairs out all day trying to figure it out.

Thank you for any suggestions in advance.

-Raf
Re: Menu Images Problem [message #437236 is a reply to message #437199] Tue, 01 June 2004 14:18 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
WORKSFORME.

public static void main (String [] args) {
Display display = new Display ();
Image image = new Image (display, _Scrapbook.class.getResourceAsStream
("save_edit.gif"));
Shell shell = new Shell (display);
Menu menuBar = new Menu (shell, SWT.BAR);
shell.setMenuBar (menuBar);
MenuItem fileItem = new MenuItem (menuBar, SWT.CASCADE);
fileItem.setText ("File");
Menu fileMenu = new Menu (shell, SWT.DROP_DOWN);
fileItem.setMenu (fileMenu);
MenuItem saveItem = new MenuItem (fileMenu, SWT.PUSH);
saveItem.setText ("Save");
saveItem.setImage (image);
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
image.dispose ();
display.dispose ();
}

"Raf Kaplon" <raf_k@sympatico.ca> wrote in message
news:c9giuh$71v$1@eclipse.org...
>
> Menu Images set using the setImage() method aren't rendered correctly with
> respect to transparency. I'm using a gif "save_edit.gif" from the icon
> directory of the Eclipse release, so it should work.
>
> I'm running Windows XP, and I have tried everything from manually setting
> the transparency by defining the transparent pixel's RGB. I've been
> pulling my hairs out all day trying to figure it out.
>
> Thank you for any suggestions in advance.
>
> -Raf
>
Re: Menu Images Problem [message #437242 is a reply to message #437236] Tue, 01 June 2004 18:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: raf_k.sympatico.ca

Hi Steve,

I tried your exact code and still wasn't able to get transparency to work.
Could it be a project setup issue? I'm running windows XP, I have no idea
if that would be a factor either.



Steve Northover wrote:

> WORKSFORME.

> public static void main (String [] args) {
> Display display = new Display ();
> Image image = new Image (display, _Scrapbook.class.getResourceAsStream
> ("save_edit.gif"));
> Shell shell = new Shell (display);
> Menu menuBar = new Menu (shell, SWT.BAR);
> shell.setMenuBar (menuBar);
> MenuItem fileItem = new MenuItem (menuBar, SWT.CASCADE);
> fileItem.setText ("File");
> Menu fileMenu = new Menu (shell, SWT.DROP_DOWN);
> fileItem.setMenu (fileMenu);
> MenuItem saveItem = new MenuItem (fileMenu, SWT.PUSH);
> saveItem.setText ("Save");
> saveItem.setImage (image);
> shell.open ();
> while (!shell.isDisposed ()) {
> if (!display.readAndDispatch ()) display.sleep ();
> }
> image.dispose ();
> display.dispose ();
> }

> "Raf Kaplon" <raf_k@sympatico.ca> wrote in message
> news:c9giuh$71v$1@eclipse.org...
> >
> > Menu Images set using the setImage() method aren't rendered correctly with
> > respect to transparency. I'm using a gif "save_edit.gif" from the icon
> > directory of the Eclipse release, so it should work.
> >
> > I'm running Windows XP, and I have tried everything from manually setting
> > the transparency by defining the transparent pixel's RGB. I've been
> > pulling my hairs out all day trying to figure it out.
> >
> > Thank you for any suggestions in advance.
> >
> > -Raf
> >
Re: Menu Images Problem [message #437365 is a reply to message #437242] Thu, 03 June 2004 12:45 Go to previous message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Can you post a screen shot of what you are seeing?

"Raf Kaplon" <raf_k@sympatico.ca> wrote in message
news:c9igus$dvo$1@eclipse.org...
> Hi Steve,
>
> I tried your exact code and still wasn't able to get transparency to work.
> Could it be a project setup issue? I'm running windows XP, I have no idea
> if that would be a factor either.
>
>
>
> Steve Northover wrote:
>
> > WORKSFORME.
>
> > public static void main (String [] args) {
> > Display display = new Display ();
> > Image image = new Image (display, _Scrapbook.class.getResourceAsStream
> > ("save_edit.gif"));
> > Shell shell = new Shell (display);
> > Menu menuBar = new Menu (shell, SWT.BAR);
> > shell.setMenuBar (menuBar);
> > MenuItem fileItem = new MenuItem (menuBar, SWT.CASCADE);
> > fileItem.setText ("File");
> > Menu fileMenu = new Menu (shell, SWT.DROP_DOWN);
> > fileItem.setMenu (fileMenu);
> > MenuItem saveItem = new MenuItem (fileMenu, SWT.PUSH);
> > saveItem.setText ("Save");
> > saveItem.setImage (image);
> > shell.open ();
> > while (!shell.isDisposed ()) {
> > if (!display.readAndDispatch ()) display.sleep ();
> > }
> > image.dispose ();
> > display.dispose ();
> > }
>
> > "Raf Kaplon" <raf_k@sympatico.ca> wrote in message
> > news:c9giuh$71v$1@eclipse.org...
> > >
> > > Menu Images set using the setImage() method aren't rendered correctly
with
> > > respect to transparency. I'm using a gif "save_edit.gif" from the icon
> > > directory of the Eclipse release, so it should work.
> > >
> > > I'm running Windows XP, and I have tried everything from manually
setting
> > > the transparency by defining the transparent pixel's RGB. I've been
> > > pulling my hairs out all day trying to figure it out.
> > >
> > > Thank you for any suggestions in advance.
> > >
> > > -Raf
> > >
>
>
Previous Topic:where are settings for plugins stored
Next Topic:How to prevent a multiline text to accept tabs?
Goto Forum:
  


Current Time: Fri Apr 26 05:52:05 GMT 2024

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

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

Back to the top