我的进程是public class mythread extends Thread { String s; static int is = 0; Frame1 frame = new Frame1(); public void run() { while (is < 10) { is++; System.out.println(is); frame.g.setText("计算机"); } } } frame代码是 public class Frame1 extends JFrame{ static int i=0; JPanel contentPane; JTextField f=new JTextField(20); 那么如何修改f的值?
我这样修改还是不行这是为什么? package three; class mythread extends Thread { static int is = 0; Frame1 frame = new Frame1(); public mythread(String m){ frame.f.setText(m); } public void run() { while (is < 10) { is++; System.out.println(is);
String s;
static int is = 0;
Frame1 frame = new Frame1();
public void run() {
while (is < 10) {
is++;
System.out.println(is);
frame.g.setText("计算机");
}
}
}
frame代码是
public class Frame1 extends JFrame{
static int i=0;
JPanel contentPane;
JTextField f=new JTextField(20);
那么如何修改f的值?
package three;
class mythread extends Thread {
static int is = 0;
Frame1 frame = new Frame1();
public mythread(String m){
frame.f.setText(m);
}
public void run() {
while (is < 10) {
is++;
System.out.println(is);
}
}
}