[英]Call the JFrame from another class
i have simple JFRAME (create by Netbeans) and i want to call frame.setState(Frame.NORMAL) from another class. 我有一个简单的JFRAME(由Netbeans创建),我想从另一个类调用frame.setState(Frame.NORMAL) 。 How to do call? 怎么打?
public class Myclass{
public void Frame_normal{
...?
???frame.setState(Frame.NORMAL);
}
}
Basicaly you create an attribute in your class and you give it the reference to your JFrame. 基本上,您可以在类中创建一个属性,并为其提供对JFrame的引用。
public class Myclass{
JFrame frame;
public MyClass(JFrame aFrame){
this.frame = aFrame;
}
public void Frame_normal{
frame.setState(Frame.NORMAL);
}
}
MyClass class = new Myclass(theJFrame);
class.Frame_normal();
You can do the following 您可以执行以下操作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.