>>585
import javax.swing.*;
public class A {
private JLabel label = new JLabel();
public static void main(String[] args) {
B b = new B(new A().label);
try{Thread.sleep(3000);}catch(Exception e){}
b.changeText("もげ");
}
}
class B extends JFrame {
private JLabel label;
public B(JLabel label) {
this.label = label;
setDefaultCloseOperation(EXIT_ON_CLOSE);
label.setText("ほげ");
add(label);
pack();
setVisible(true);
}
public void changeText(String text) {
label.setText(text);
}
}