有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何在使用文本字段键入的jframe上显示信息?

这是我的密码

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);

共 (0) 个答案