能不能具体点代码?谢谢
追答public class FrameWork extends JFrame{
FrameWork1 fw = new FrameWork1();
public FrameWork() {
this.setName("Log Tools");
this.setSize(295, 260);
final Container con = getContentPane();
con.setLayout(null);
final JButton addstylebut = new JButton("11");
addstylebut.setBounds(0, 15, 100, 20);
addstylebut.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
fw.setLabel(addstylebut.getLabel());
}
});
this.add(addstylebut);
this.setVisible(true);
this.repaint();
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String args[]) {
FrameWork fw = new FrameWork();
}
}
public class FrameWork1 extends JFrame{
JButton addstylebut = new JButton("Fr");
public FrameWork1() {
this.setName("Log Tools");
this.setSize(295, 260);
final Container con = getContentPane();
con.setLayout(null);
//final JButton addstylebut = new JButton("22");
addstylebut.setBounds(0, 15, 100, 20);
this.add(addstylebut);
this.setVisible(true);
this.repaint();
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void setLabel(String label){
addstylebut.setLabel(label);
this.repaint();
}
}