Code
textArea.addFocusListener(new FocusAdapter() {
@Override public void focusLost(FocusEvent e) {
String text = textArea.getText();
label.setText(text.isEmpty() ? " " : text);
cardLayout.show(cp, "TextField");
}
});
label.addFocusListener(new FocusAdapter() {
@Override public void focusGained(FocusEvent e) {
cardLayout.show(cp, "TextArea");
textArea.requestFocusInWindow();
}
});
No comments:
Post a Comment