需要在主窗口中弹出新窗口,主窗口在新窗口未关闭前不可操作。
public class ButtonExample extends JFrame{
private JButton countButton;
public ButtonExample(){
super( "Testing Buttons" ); //!!主窗口的名称是什么?
... }
public static void main( String args[] ){...}
private class ButtonHandler implements ActionListener {
public void actionPerformed( ActionEvent event ){
JDialog frame2=new JDialog();//怎么写它的参数?
... }
}
}
在弹出窗口时,需要给JDialog()函数给出它的owner,该怎么写他的
Frame/Dialog owner参数呢?
急求,谢谢帮忙了。
public class ButtonExample extends JFrame{
private JButton countButton;
public ButtonExample(){
super( "Testing Buttons" ); //!!主窗口的名称是什么?
... }
public static void main( String args[] ){...}
private class ButtonHandler implements ActionListener {
public void actionPerformed( ActionEvent event ){
JDialog frame2=new JDialog();//怎么写它的参数?
... }
}
}
在弹出窗口时,需要给JDialog()函数给出它的owner,该怎么写他的
Frame/Dialog owner参数呢?
急求,谢谢帮忙了。
private JButton countButton;
public ButtonExample(){
super( "Testing Buttons" ); //!!主窗口的名称是什么?
......
button.addActionListener(new ButtonHandler(this));//添加监听
... }
public static void main( String args[] ){...}
private class ButtonHandler implements ActionListener {
private JFrame jf;
public ButtonHandler(JFrame jf){
this.jf = jf;
}
public void actionPerformed( ActionEvent event ){
JDialog frame2=new JDialog(jf,true);//怎么写它的参数?
... }
}
}
谢谢了.
如果可以的话,麻烦解释一下this的用法。好吗?