Results 1 to 2 of 2
- 02-11-2014, 11:16 PM #1Member
- Join Date
- Feb 2014
- Rep Power
How to change the location of a JTextArea at run-time?
I am using Swing, I have a JPanel and in it there is a JTextArea and a JButton. I want the JTextArea to move when the button is clicked on. I'm Not really sure how to do the action listener for the button. at the moment the JTextArea only moves once when the button is clicked on, but i want it to move every time the button is clicked on.
this is what i have so far:
moveButton = new JButton("MOVE");
moveButton.setBounds(20, 140, 70, 40);
text = new JTextArea("hello");
text.setBounds(x, 50, 40, 20);
In the actionPerformed method this is what it does:
text.setBounds(x + 50, 50, 40, 20);
any help is greatly appreciated.
- 02-12-2014, 04:27 PM #2
- By skania in forum New To JavaReplies: 6Last Post: 06-19-2013, 05:36 PM
- By nithyajann in forum AWT / SwingReplies: 1Last Post: 03-18-2012, 12:57 PM
- By valdeEdius in forum AWT / SwingReplies: 5Last Post: 03-18-2012, 04:09 AM
- By blackbird in forum AWT / SwingReplies: 11Last Post: 07-11-2011, 05:58 PM
- By sayan751 in forum JDBCReplies: 3Last Post: 03-19-2009, 03:42 PM