I seem to have discovered a bug in how ULCTextArea.append() works.
Specifically, text added this way is lost when the focus returns to a
ULCTextArea component.
I have included a class below that you can use to verify this, followed by a
Swing class that is fuctionally identical but works as expected.
To test:
1) Run the class and type "Hello" into the textarea.
2) Click the "append" button and you will see the contents of the text area
get appended.
3) Click back in the textarea and the appended text will vanish.
Please let me know if you can replicate this and whether you have any
resolutions or workarounds that I can employ.
Thanks.
-Stuart Booth (Abacus Research)
public class BugsFrameApp extends AbstractApplication {
static int count = 0;
public void start() {
new BugsFrame().setVisible(true);
}
public static void main(String[] args) {
DevelopmentRunner.setApplicationClass(BugsFrameApp.class);
DevelopmentRunner.run();
}
class BugsFrame extends ULCFrame {
public BugsFrame() {
super("Bugs");
setDefaultCloseOperation(ULCFrame.TERMINATE_ON_CLOSE);
setSize(800, 900);
addComponents();
}
private void addComponents() {
setContentPane(new ULCBorderLayoutPane(10, 10));
setBorder(new ULCEmptyBorder(10, 10, 10, 10));
final ULCTextArea text = new ULCTextArea();
ULCButton button = new ULCButton("Append");
add(text, ULCBorderLayoutPane.CENTER);
add(button, ULCBorderLayoutPane.SOUTH);
button.addActionListener(new IActionListener() {
public void actionPerformed(ActionEvent event) {
text.append("Appended " + count++);
}
});
}
}
}
Here is the Swing app running as expected:
public class BugsFrameApp extends JFrame {
static int count = 0;
public static void main(String[] args) {
new BugsFrameApp().setVisible(true);
}
public BugsFrameApp() {
super("Bugs");
setDefaultCloseOperation(ULCFrame.TERMINATE_ON_CLOSE);
setSize(800, 900);
addComponents();
}
private void addComponents() {
getContentPane().setLayout(new BorderLayout(10, 10));
((JPanel)getContentPane()).setBorder(new EmptyBorder(10, 10, 10,
10));
final JTextArea text = new JTextArea();
JButton button = new JButton("Append");
add(text, BorderLayout.CENTER);
add(button, BorderLayout.SOUTH);
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
text.append("Appended " + count++);
}
});
}
}
_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer