|
-
September 24th, 2011, 09:22 PM
#14
Re: Help with ActionListener?
Alright I have an idea. Heres a small test program I just made, WITHOUT an action listener. If either of you could take it, then add the actionlistener so that the jTextField's text gets read and sent to the jTextArea, then post it back here so I can take a look at it. I feel like if I could see how the basics are done I will understand what I am doing wrong and I'll be able to fix my main program. I think this will solve my problem the easiest way. Thanks.
Code:
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class TestProgram {
public static void main(String[] args) {
new TestProgram();
}
public TestProgram(){
JFrame frame = new JFrame("Test");
JPanel pane = new JPanel(new BorderLayout());
frame.getContentPane().add(pane);
frame.setSize(200,200);
pane.setSize(200,200);
frame.setVisible(true);
javax.swing.JTextField jTextField1;
javax.swing.JTextArea textArea;
textArea = new JTextArea();
jTextField1 = new JTextField(10);
pane.add(jTextField1, BorderLayout.NORTH);
pane.add(textArea, BorderLayout.SOUTH);
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|