日期:2014-05-18 浏览次数:20794 次
package com.test;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class T4 extends JFrame {
private JPanel mainPanel;
JButton btn;
public JTextField name;
public T3 t3;
public T4() {
super("标题");
this.setPreferredSize(new Dimension(660, 320));
this.setBounds(0, 0, 660, 320);
mainPanel = new JPanel();
this.setContentPane(mainPanel);
name = new JTextField(15);
mainPanel.add(name);
btn = new JButton("按我");
mainPanel.add(btn);
btn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
t3.show();
}
});
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[] args) {
T4 t4 = new T4();
T3 t3 = new T3(t4);
t4.t3=t3;