Best Approach for putting words on a JPanel (with special requirements) [2nd attempted post]
- From: "PaulSchrum" <paul.schrum@xxxxxxxxx>
- Date: 28 Dec 2005 09:09:15 -0800
I am a newbie to Swing and I am trying to do something that is over my
head. This is a "how do I . . ." question or maybe a "what is the best
way to . . . " question.
Can anyone advise me on my approach? That is, am I on the right track
but just need to call such-and-such? Or am I totally up the wrong tree
and need to use class JWhatever instead. Here is my little story:
I want to place text on a JPanel (which is a member of a JScrollPane).
I want each word to be discrete entity, and I want to have absolute
control over the font, size, etc of the text, along with absolute
control of the position of the text on the JPanel.
My first attempt was just to .drawString the words on the JPanel and I
got that to work fine. But now I need each word to be aware of
mouseOvers and mouseClicks, stuff like that. Using .drawString they
are not.
So I amy now trying to implmenent the drawing and placing of each word
using JTextField. I put my text in the JTextField, set the font, and
size it so that it is large enough to contain all of the text (Using a
TextLayout instance). I then add the JTextField to the JPanel and
setVisible(true).
The problem is that I do not see anything via this JTextField
implementation.
Thanks in advance for your help.
- Paul Schrum
.
- Follow-Ups:
- Prev by Date: Re: Draggable window only works in MS JVM, and not Sun?
- Next by Date: Dragging non-selected cell in JTree
- Previous by thread: color pallet
- Next by thread: Re: Best Approach for putting words on a JPanel (with special requirements) [2nd attempted post]
- Index(es):
Relevant Pages
|
|