Java - How to get Next Image By Button press -
i've managed add image jpanel in netbeans , display it.i wonder how next one,by pressing button.
i've added image using code:
private void jbutton1actionperformed(java.awt.event.actionevent evt){ // todo add handling code here: jfilechooser filechooser = new jfilechooser(); int result = filechooser.showopendialog(null); if ( result == jfilechooser.approve_option ){ string ruta = filechooser.getselectedfile().getabsolutepath(); jtextfield1.settext(ruta); icon icon = new imageicon(ruta); jlabel2.seticon(icon); joptionpane.showmessagedialog(this,"you chose open file: " + filechooser.getselectedfile().getname()); } } and when press button called "jbutton2" next image,without manually selecting again folder.
for example:
private void jbutton2actionperformed(java.awt.event.actionevent evt){ // todo add handling code here: } thank much.
you have enumerate images in directory browsing in. when user selects file, should keep list of images directory in order retrieve them when user click next button. can file list whenever user clicks next button.
Comments
Post a Comment