-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
8u211
-
x86_64
-
windows_10
ADDITIONAL SYSTEM INFORMATION :
win10, java 1.8.211
A DESCRIPTION OF THE PROBLEM :
JTextarea text disappears when you erase the text in a JTextfield, both in the same Jpanel
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1.) run the code
2.) resize the window (not fullscreen)
3.) hit send
repeate:
- clear the text
- write some new text
- resize the window(not fullscreen)
- hit send
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
when you earse the text in the JTextfield, the JTextarea should not be changed
ACTUAL -
last text you send to the JTextarea disapears
---------- BEGIN SOURCE ----------
public class BugTester {
public static void main(String[] args) {
MainFrame frame = new MainFrame();
}
public static class MainFrame extends JFrame implements ActionListener {
private JTextField textField;
private JTextArea textArea;
public MainFrame() throws HeadlessException {
super();
this.setSize(800, 800);
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
this.setLocationRelativeTo(null);
init();
this.pack();
this.setVisible(true);
}
private void init() {
JPanel panel = new JPanel();
panel.setLayout(new GridLayout(3, 3));
textField = new JTextField("hello");
panel.add(textField);
panel.setSize(new Dimension(300, 300));
panel.setMinimumSize(new Dimension(300, 300));
panel.setMaximumSize(new Dimension(300, 300));
JButton button = new JButton("send");
button.setSize(100, 50);
button.addActionListener(this);
button.setActionCommand("send");
panel.add(button);
textArea = new JTextArea();
textArea.setSize(200, 200);
panel.add(textArea);
this.add(panel);
}
@Override
public void actionPerformed(ActionEvent e) {
String command = e.getActionCommand();
if (command.equals("send")) {
String message = textField.getText();
textArea.append(message+ " ");
}
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
revalidate;
repaint;
FREQUENCY : often
win10, java 1.8.211
A DESCRIPTION OF THE PROBLEM :
JTextarea text disappears when you erase the text in a JTextfield, both in the same Jpanel
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1.) run the code
2.) resize the window (not fullscreen)
3.) hit send
repeate:
- clear the text
- write some new text
- resize the window(not fullscreen)
- hit send
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
when you earse the text in the JTextfield, the JTextarea should not be changed
ACTUAL -
last text you send to the JTextarea disapears
---------- BEGIN SOURCE ----------
public class BugTester {
public static void main(String[] args) {
MainFrame frame = new MainFrame();
}
public static class MainFrame extends JFrame implements ActionListener {
private JTextField textField;
private JTextArea textArea;
public MainFrame() throws HeadlessException {
super();
this.setSize(800, 800);
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
this.setLocationRelativeTo(null);
init();
this.pack();
this.setVisible(true);
}
private void init() {
JPanel panel = new JPanel();
panel.setLayout(new GridLayout(3, 3));
textField = new JTextField("hello");
panel.add(textField);
panel.setSize(new Dimension(300, 300));
panel.setMinimumSize(new Dimension(300, 300));
panel.setMaximumSize(new Dimension(300, 300));
JButton button = new JButton("send");
button.setSize(100, 50);
button.addActionListener(this);
button.setActionCommand("send");
panel.add(button);
textArea = new JTextArea();
textArea.setSize(200, 200);
panel.add(textArea);
this.add(panel);
}
@Override
public void actionPerformed(ActionEvent e) {
String command = e.getActionCommand();
if (command.equals("send")) {
String message = textField.getText();
textArea.append(message+ " ");
}
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
revalidate;
repaint;
FREQUENCY : often