作者MotoKen (EatCat)
看板java
标题Re: JMenuBar使用的问题?
时间Thu Nov 16 12:31:22 2006
※ 引述《[email protected] (小永)》之铭言:
: 请问一下,我想用JMenuBar有个选单来改变ContertPane的内容
: 程式可以正常执行。
: 但是为什麽我的写法不能成功?
: 是我的写法哪边有问题吗,还是说有可以有其它的方法?
: 以下是完整的程式码
: =====================================
.
.
. //以上恕删
: public void actionPerformed(ActionEvent evt)
: { if ( evt.getSource() == change2Apanel ) {
c.removeAll();
: c.add(aPanel); /*注解的地方想在这边执行*/
aPanel.updateUI();
: System.out.println("切换到Apanel!!"); }
: if ( evt.getSource() == change2Bpanel ) {
c.removeAll();
: c.add(bPanel);
bPanel.updateUI();
: System.out.println("切换到Bpanel!!"); }
: }
: public static void main(String[] args)
: {
: test app = new test();
: app.addWindowListener(new WindowAdapter()
: { public void windowClosing(WindowEvent evt)
: { System.exit(0); }
: });
: app.setVisible(true);
: }
: }
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.115.218.242