一小段简短的java代码,super出现了多次,super之前看是指父类,请问指的是不是JFrame呢??是 or 不是
classMyKeyHandleextendsJFrameimplementsKeyListener{privateJTextAreatext=newJTextArea(...
class MyKeyHandle extends JFrame implements KeyListener{
private JTextArea text = new JTextArea() ;
public MyKeyHandle(){
super.setTitle("Welcome To MLDN") ;
JScrollPane scr = new JScrollPane(text) ;
scr.setBounds(5,5,300,200) ;
super.add(scr) ;
text.addKeyListener(this) ;
super.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(1) ;
}
}) ;
super.setSize(310,210) ;
super.setVisible(true) ;
}
} 展开
private JTextArea text = new JTextArea() ;
public MyKeyHandle(){
super.setTitle("Welcome To MLDN") ;
JScrollPane scr = new JScrollPane(text) ;
scr.setBounds(5,5,300,200) ;
super.add(scr) ;
text.addKeyListener(this) ;
super.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(1) ;
}
}) ;
super.setSize(310,210) ;
super.setVisible(true) ;
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询