I'm trying to use the JButton count to count the number of characters entered into the JTextField t. I'm new to Java and GUIs but here's my code:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class GUI1 extends Frame implements ActionListener{
    TextField t; 
    Button count;
    int a;
    Choice choice;
    public GUI1(){
        this.t = new TextField("", 30);
        this.count = new Button("count");
        this.count.addActionListener(this);
        JTextField x = new JTextField();
        x.setEditable(false);
        this.setTitle("Character count");
        this.setLayout(new FlowLayout());
        this.add(x);
        this.add(t);
        this.add(count);
        this.pack();
        this.setVisible(true);
    }
    public void actionPerformed(ActionEvent e) {
        if(e.getSource()== this.count) 
       t.setText(choice.getSelectedItem()+ " " +a);
    }
I'm also trying to enter the value in another uneditable JTextField x. Any help is appreciated.
 
     
     
     
     
    