这是我的代码...
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.util.Scanner;
public class gui extends JFrame
{
public gui()
{
// creates a frame with thee buttons if i choose the register one it will lead me to the next frame
super ("Property Tax Management System");
JFrame gui = new JFrame("PCMS user interface ");
JButton Register = new JButton("Register",register);
JButton View = new JButton("View",view);
JButton Management = new JButton("Management query's",management)
JButton Exit = new JButton("Exit",exit);
gui.setLayout(new FlowLayout());
Register.setToolTipText("Click if you would like to register");
View.setToolTipText("Click if you would like to view your property file");
Management.setToolTipText("Click if you would like to view statistics")
View.setToolTipText("Click if you would like to exit the programm")
Registeroption one = new Registeroption();
Viewoption two = new Viewoption();
Managementoption three = new Managementoption();
Exitoption four = new Exitoption();
Register.addActionListener(one);
View.addActionListener(two);
Management.addActionListener(two);
Exit.addActionListener(two);
gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
gui.setSize(350,110);
gui.setVisible(true);
gui.add(Register);
gui.add(View);
gui.add(Management);
gui.add(Exit);
}
// I input my information i want to be displayed
private class Registeroption implements ActionListener{
public void actionPerformed(ActionEvent register){
JFrame gui = new JFrame("Register");
JButton Enter = new JButton("View",view);
JTextField Name = new JTextField("Please enter your full name here");
JTextField Address = new JTextField("Please enter your address");
JTextField PPR = new JTextField("Please if you are the principle private residant?yes\no")
JTextField PEV = new JTextField("Please enter your estimated property value");
JTextField Location = new JTextField("Please enter your location ");
JTextField Paid = new JTextField("Please enter if your ta is paid");
Enteroption one = new Enteroption();
Enter.addActionListener(one);
gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
gui.setSize(350,110);
gui.setVisible(true);
gui.add(Enter);
gui.add(Name);
gui.add(Address);
gui.add(PVR);
gui.add(Location);
gui.add(PEV);
gui.add(Paid);
}
}
我想显示我在另一个框架中输入的信息并插入一个方法。这就是我开始的:
private class Enteroption{
public void actionPerformed(ActionEvent enter){
JFrame gui = new JFrame("property details");
JLabel label = new JLabel("");
frame.add(label);