Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Overlaying GUI components with SWT

1,069 views
Skip to first unread message

chri...@googlemail.com

unread,
Feb 3, 2009, 9:26:38 AM2/3/09
to
Hi

I would like to overlay a text field on top of a button widget when
clicked but can't find out how to overlay SWT widgets. Does anyone
have any ideas?

Thanks in advance
Chris

John B. Matthews

unread,
Feb 3, 2009, 2:30:14 PM2/3/09
to
In article
<6003b143-1d6e-4846...@d36g2000prf.googlegroups.com>,
chri...@googlemail.com wrote:

> I would like to overlay a text field on top of a button widget when
> clicked but can't find out how to overlay SWT widgets. Does anyone
> have any ideas?

I don't understand "overlay" in this context.

Do you mean like a tooltip?

<http://www.java2s.com/Tutorial/Java/0280__SWT/Showatooltipinsidearectang
le.htm>

or perhaps a StackLayout?

http://www.java2s.com/Tutorial/Java/0280__SWT/2000__StackLayout.htm

--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>

chri...@googlemail.com

unread,
Feb 4, 2009, 1:10:57 PM2/4/09
to
On Feb 3, 7:30 pm, "John B. Matthews" <nos...@nospam.invalid> wrote:
> In article
> <6003b143-1d6e-4846-adee-540f2a733...@d36g2000prf.googlegroups.com>,

>
>  christ...@googlemail.com wrote:
> > I would like to overlay a text field on top of a button widget when
> > clicked but can't find out how to overlay SWT widgets. Does anyone
> > have any ideas?
>
> I don't understand "overlay" in this context.
>
> Do you mean like a tooltip?
>
> <http://www.java2s.com/Tutorial/Java/0280__SWT/Showatooltipinsidearectang
> le.htm>
>
> or perhaps a StackLayout?
>
> http://www.java2s.com/Tutorial/Java/0280__SWT/2000__StackLayout.htm
>
> --
> John B. Matthews
> trashgod at gmail dot com
> <http://sites.google.com/site/drjohnbmatthews>

Hi John

That's great. The StackLayout performed the desired functionality:
Which was basically just displaying a text field over a button when
clicked. Unfortunately in the end, due to the +ves and -ves I was
weighing up, I have chosen to go with SWING instead for this Sudoku
application. Will SWING's overlay layout perform the same required
functionality?

Thanks
p.s. Thankyou to John in particular for replying to a lot of my
questions I have had over the last few days, it hasn't gone unnoticed
John!

John B. Matthews

unread,
Feb 4, 2009, 4:24:00 PM2/4/09
to
In article
<ce89a5cf-bc4b-414c...@r41g2000prr.googlegroups.com>,
chri...@googlemail.com wrote:
[...]

> That's great. The StackLayout performed the desired functionality:
> Which was basically just displaying a text field over a button when
> clicked. Unfortunately in the end, due to the +ves and -ves I was
> weighing up, I have chosen to go with Swing instead for this Sudoku
> application. Will Swing's overlay layout perform the same required
> functionality?
[...]

I don't really know, but I've seen excellent performance using Swing
with only minor effort. Swing has no StackLayout as such; it depends on
the goal. For text overlay, I'd use tool tips; for a two state control,
I'd extend JToggleButton. You might also look at CardLayout and
JTabbedPane. The SwingSet2 application is inspiring and the Swing
tutorial has a trove of interesting examples.

0 new messages