在数据库中时间应该是date类型,所以你的代码应该是wbk.getDate()所以wbk中date应该是date类型,到这一步妮才能调用date类型
通常可以设置某个固定的切换时间,之后显示固定的或者是随机的显示某张图片,举例:importjava.awt.*importjava.awt.event.*importjavax.swing.*publicclassMousDemoextendsJFrame{MyJPanelmpintindexImageIcon[]imgs={newImageIcon("C:\\Users\\lenovo\\Desktop\\a.png"),newImageIcon("C:\\Users\\lenovo\\Desktop\\b.png")}publicMousDemo(){mp=newMyJPanel(false)this.add(mp)this.setSize(300,200)this.setDefaultCloseOperation(EXIT_ON_CLOSE)this.setTitle("鼠标窗口")this.setVisible(true)/***方式一,使用TImer来切换图片*Swing下的Timer组件,个人觉得非常适合*Timer(200,newActionListener())意思就是每200毫秒执行一次ActionListener里面的方法**/Timertimer=newTimer(200,newActionListener(){@OverridepublicvoidactionPerformed(ActionEvente){mp.flag=!mp.flagmp.repaint()}})timer.start()}publicstaticvoidmain(String[]args){newMousDemo()}classMyJPanelextendsJPanel{booleanflagpublicMyJPanel(booleanflag){this.flag=flag}@Overridepublicvoidpaint(Graphicsg){super.paint(g)if(flag==false){g.drawImage(imgs[0].getImage(),0,0,this)}else{g.drawImage(imgs[1].getImage(),0,0,this)}}}}欢迎分享,转载请注明来源:内存溢出
评论列表(0条)