Hey guys, I need help adding a textbox for users to input text onto my JFRame. Also how come theis getting an error under the "add".frame.add(o);
Main method class:
import javax.swing.JFrame; public class main { public static void main(String[] args) { JFrame frame = new JFrame(); bot o = new bot(); frame.add(o); frame.setVisible(true); frame.setDefaultCloseOperation(3); frame.setSize(300, 400); frame.setTitle("Chitter"); } }
Other class (this is where I want the textbox to be)
import javax.swing.JTextArea; import javax.swing.JTextField; public class bot { int x; int y; JTextField f = new JTextField(); JTextArea a = new JTextArea(30, 50); }
Thanks!
- Ab