0
我想调用类StoreManager中名为test的方法。 我是从调用它的类名为桂来自不同类的多窗口应用程序调用方法
public class StoreManager extends JFrame
{
JFrame jf = new JFrame();
public void table()
{
JPanel p = new JPanel();
JButton b;
jf.setSize(200, 100);
jf.setTitle("test");
jf.setLayout(new FlowLayout());
jf.setLocationRelativeTo(null);
jf.setVisible(true);
b = new JButton("button");
b.setBounds(20, 20, 125, 25);
p.add(b);
}
而现在类桂,我调用类的我有
public class Gui
{
private StoreManager sm = new StoreManager(); //calling instance of the class with test window
//code to create its own window
//some button to call this table
sm.table(); //calling the method form StoreManager
当我编译从该表的方法商店经理我得到空白窗口。
有没有人有想法?
p.add(jf);窗口出现,但空白和错误java.lang.IllegalArgumentException – Alex 2014-11-24 23:16:15
有人可以帮助我呢? – Alex 2014-11-25 10:51:58