Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-12-2008, 06:58 AM
Member
 
Join Date: Jun 2008
Posts: 6
norazanita is on a distinguished road
help..on Next n Previous Button
hi..can anyone help me...on the "Next" and " previous" button...
whe i click next or previous, i can view the next n previous picture...

my picture name is not is sequence(some of the filename missing)...

now i kept it in a masterList array the filename..so that when i can call it..
the file name been keept as
0001.gif
0002.gif
0010.gif
2004.gif


now im the actionPerforme, i need to code where when i click the button next or previous, it able to view...

this is the code that i try but i dont have any idea how to view the image..

Code:
else if (e.getSource() == jbtNext) { // for loop to read the picture location for(int c=1; c<masterList.length; c++) { File f = new File ("D:/nita/eclipse workspace/bufferedReader/image" + c + ".gif"); //load try { BufferedImage bufferImage1 =ImageIO.read(f); //display //currentIndex = (currentIndex + 1) % totalNumImage; //check the non-negative //jlblImageViewer1.setIcon(imageIcon1[currentIndex]); //JLabel label = new JLabel(new ImageIcon(image_or_url)); //imageIcon1 = ImageIO.read(new File("D:/nita/eclipse workspace/bufferedReader/image" + c + ".gif")); } catch (IOException eee) { }
this code for the masterList[]

Code:
// null value been assign to masterList for (int a=0; a<masterList.length; a++) { masterList[a] = null; } //2nd array list -- listOfFiles File folder = new File("D:/nita/eclipse workspace/bufferedReader/image"); File[] listOfFiles = folder.listFiles(); for (int u=0; u<listOfFiles.length; u++) { //for the listOfFiles get the filename String aaa = listOfFiles[u].getName(); char[] bbb = aaa.toCharArray(); // turn the name to char //assign 0-3 index char first = bbb[0]; char second = bbb[1]; char third = bbb[2]; char fourth = bbb[3]; //convert form char to string String s1=String.valueOf(first); String s2=String.valueOf(second); String s3=String.valueOf(third); String s4=String.valueOf(fourth); //put all the value of s1-s4 in xxx String y = new String (s1 + s2 + s3 + s4 ); //validation for the first letter (only digit allow) if (Character.isLetter(first)) { } else { int yInt = Integer.parseInt(y); //convert to integer // the int will be your index for the list masterList[yInt] = aaa; } }//end of FOR loop //put everything back to masterList ... did not display the null value... for (int h=0; h<masterList.length; h++) { if (masterList[h] != null) { System.out.println(masterList[h]); } }

hope someone can help me
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Next and Previous Buttons JavaNewb New To Java 1 05-09-2008 02:23 AM
Go back to previous page using session in JSP page gopikarikati009 JavaServer Pages (JSP) and JSTL 0 04-27-2008 05:38 AM
SWT Button JavaForums Java Blogs 0 12-31-2007 05:53 PM
Preventing inserted text from becoming colored from previous style jkhoa AWT / Swing 2 08-10-2007 01:36 AM
Using previous with CardLayout uncopywritable New To Java 2 08-05-2007 10:43 PM


All times are GMT +3. The time now is 05:41 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org