04 2023 档案
摘要:Timer timer =new Timer(t,testTimer); timer.start(); t是以毫秒为单位的时间, testTimer是实现了ActionListener接口类的对象,其需要实现或者重写actionPerformed方法,也就是定时器不断重复调用的程序 timer.st
阅读全文
摘要:使用方式: 在继承JPanel的类里面重写paintComponet(Graphics g)方法 protected void paintComponent(Graghics g){ //清屏 super.paintComponent(g); //ImageIcon对象.paintIcon(面板对象
阅读全文
摘要:JFrame jf; Container container; void init(){ //初始化框架 jf = new JFrame(); jf.setSize(400, 500); //将容器放在框架上 获得容纳面板 container = jf.getContentPane(); //做其他
阅读全文
摘要:监听事件 jf.add(textField); textField.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { //因为e.getSource返回值类型
阅读全文