Win a copy of Kotlin in Action this week in the Kotlin forum!
    Bookmark Topic Watch Topic
  • New Topic

display t/ read the total num of pic file that been save in a folder  RSS feed

 
Norazanita Adnan
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Report post to moderator
hi..

can someone help me,

i need to displayat the "JTextField" the total number of image file(.jpg) that been save in a folder.

how can i do that..i dont have any idea what function shall i use and where to start..

hope someone able to help me..

thanks
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Report post to moderator
Is the problem in determining the number of image files, or the displaying of that numbe rin the GUI?

If the former, have a look st this example code. It lists all the file sin a directory. You would need to adapt the accept method so that it only returns true for image files. Which ones those are depends on your circumstances, but for starters, probably those whose lowercase extension is "gif", "jpg", or "png".

As for the GUI, you should use a JLabel instead of a JTextField, since the number of files is not editable, right?
 
Norazanita Adnan
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Report post to moderator
Thanks Rob Prime....
you really help me a lot...
Thanks once again...
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Report post to moderator
You're welcome, even if I'm not Rob :-)

Please do not post the same question to multiple forums: CarefullyChooseOneForum

Let's continue the discussion in this duplicate thread.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!