I am trying to write the beginnings of a GUI, but when I run what I have so far it does nothing??
/>/> Here is my code so far:
but like I said, it doesn't do anything....
I know it is because I am not properly calling my swing components somehow, but I cannot see it from where I am sitting, PLEASE HELP ME HERE!!!!
/>/>
import java.awt.event.*;
import java.awt.*;
import java.util.*;
import java.io.*;
import javax.swing.*;
public class Interface implements ActionListener{
JFrame frame = new JFrame("Interface program");
JTextField txt1 = new JTextField(24);
JTextArea txt2 = new JTextArea(24, 24);
JButton b1, b2, b3;
public void creata(){
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
frame.add(b1);
frame.add(b2);
frame.add(b3);
frame.add(txt1);
frame.add(txt2);
frame.setLocationRelativeTo(null);
frame.setTitle("Week 3 Interface");
frame.setSize(72,72);
frame.setVisible(true);
}
public static void main(String[] args) {
Interface intr = new Interface();
intr.frame.setVisible(true);
}
public void actionPerformed(ActionEvent ae) {
throw new UnsupportedOperationException("Not supported yet.");
}
}
but like I said, it doesn't do anything....
I know it is because I am not properly calling my swing components somehow, but I cannot see it from where I am sitting, PLEASE HELP ME HERE!!!!