Best Approach for putting words on a JPanel (with special requirements) [2nd attempted post]



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

.



Relevant Pages

  • Re: java component focus lost event and tabbedPane design problem
    ... >> having trouble with the custom SingleSelectionModel. ... >> focus yield checks in the setSelectedIndex method. ... JPanel jPanel1 = new JPanel; ... JTextField jTextField1 = new JTextField; ...
    (comp.lang.java.programmer)
  • Re: JTEXTFIELD or JPASSWORDFIELD
    ... I think that you suggest me to put a jPasswordField and a jTextField as ... private JPanel jContentPane; ...
    (comp.lang.java.programmer)
  • Re: Cardlayout GUI
    ... JLabel and a JtextField by following examples on the net and in books ... JPanel cards, JTextField, textField1, JLabel, label1; ... public void addComponentToPane{ ...
    (comp.lang.java.programmer)
  • Re: How to detect focus lost on a JPanel
    ... The basic design is a Frame containing a menu and a JTabbedPanel. ... So far, I have tried to add a FocusListener to the JPanel descendents, ... focus enters a JTextField contained within the panel itself, ...
    (comp.lang.java.gui)
  • Re: No Focused View on DrawString
    ... >> I'm getting the following error on a drawString(). ... >>The code is drawing some text on a JPanel that is a part of a ... The only difference is you use a JPanel instead of a Canvas in ... I will try moving all my code into paintComponent() and see what ...
    (comp.lang.java.programmer)