• Post Reply Bookmark Topic Watch Topic
  • New Topic

display the total number of image file(.jpg) that been save in a folder

 
Norazanita Adnan
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi...can anyone help me..

im having a problem, how can i count the total number of picture file(.jpg) that ive place it in a folder and display in the JTextField.

can anyone give me ways to do it pls...
 
Phal Ach
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Create a class implementing FileFilter. Override its method: public boolean accept(File Pathname). Call that method and put it in your ArrayList and you can use it as you want.
 
Rob Spoor
Sheriff
Posts: 20819
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use File's listFiles method in combination with that FileFilter, and you'll have an array with the File objects. The array size is the number of files.
 
Norazanita Adnan
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Phalguni Bhatt and Rob Prime....
you guyz really help me a lot...
Thanks once again...
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is also discussed in this duplicate thread.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!