Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » inconsistest setImage(null) on Label control
inconsistest setImage(null) on Label control [message #1743100] Mon, 12 September 2016 05:49 Go to next message
Eclipse UserFriend
call to setImage(null), clear the label text, below the snippet:

        final Display display = NUiSwtApplicationSession.get().getDisplay();
        Shell shell = new Shell(display);

        Label l = new Label(shell, SWT.NONE);
        l.setText("hello");
        l.setImage(null);
        l.pack();

        shell.pack();
        shell.open();



With the snippet above, you get a label with no text and no image.

With the sequence:
        l.setImage(null);
        l.setText("hello");


the text is shown correctly


Re: inconsistest setImage(null) on Label control [message #1743388 is a reply to message #1743100] Wed, 14 September 2016 15:20 Go to previous messageGo to next message
Eclipse UserFriend
A label displays a string OR an image. Not both. Use a CLabel to have both an image AND a string.
Re: inconsistest setImage(null) on Label control [message #1743581 is a reply to message #1743388] Fri, 16 September 2016 10:41 Go to previous message
Eclipse UserFriend
I don't want display image and text.

I want to display text or image, but I mean that calling setImage(null) null = no image
after the text, does the wrong result.

In fact, the result is that the label has no image and no text.
Previous Topic:How to get the innerHTML of object on mouseover with SWT browser
Next Topic:Embedded SWT Browser behaving differently then outside or in debug mode..
Goto Forum:
  


Current Time: Sat Aug 30 20:19:14 EDT 2025

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

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

Back to the top