Re: GUI inquiry
a wrote:
....
I'm new to JAVA GUI and hope you could help on 2 questions.
Note that two GUI questions are better placed
on two separate threads with two separate (and
meaningful) titles - most profitably posted to
comp.lang.java.gui.
1) No matter how I constrain textarea (e.g. set column, row), when it is fed
with a long string, the textarea just shows 2 rows and many columns. Is
there any trick to force the swapping of line? I've tried both textarea and
jtextarea.
I am unfamilir with those classes. Do you mean
(java.awt.)TextArea and (javax.swing.)JTextArea?
If so, please be specific and use the correct
capitalisation, as it helps avoid confusion.
Assuming you are referring to the J2SE core
GUI classes, decide whether this GUI is being
built using AWT or Swing and stick with it.
It is unwise to mix the two.
Assuming Swing.
<sscce>
import javax.swing.*;
class TestTextAreaSize {
public static void main(String[] args) {
JTextArea ta = new JTextArea(10,5);
ta.setLineWrap(true);
ta.setWrapStyleWord(true);
JScrollPane sp = new JScrollPane(ta);
JOptionPane.showMessageDialog(null, sp);
}
}
</sscce>
Andrew T.