Creating an .ini file for use?

Can someone explain to me the significance of .ini files?

Page 1 of 1

3 Replies - 3255 Views - Last Post: 24 January 2010 - 03:14 AM Rate Topic: -----

#1 solodolo  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 50
  • Joined: 31-December 09

Creating an .ini file for use?

Posted 23 January 2010 - 08:55 PM

Can someone explain to me the significance of .ini files? In my project, I am supposed to store the skins choices in an .ini file named "preferences.ini".

Right now in my directory I have a folder called Skins which holds the sub folders Trees, Plants, Animals, etc. which contain a set of images called "1.jpg, 2.jpg... 7.jpg, and a background.jpg" that make up the skin for that theme.

How can I go about creating a .ini file so I can use these images. And again, can someone explain to me the importance of this format. Why can't I just create an ImageIcon with the path of the image according to what theme a client selects?

Any information would help. Thanks.

Is This A Good Question/Topic? 0
  • +

Replies To: Creating an .ini file for use?

#2 Dogstopper  Icon User is offline

  • The Ninjaducky
  • member icon



Reputation: 2874
  • View blog
  • Posts: 11,047
  • Joined: 15-July 08

Re: Creating an .ini file for use?

Posted 23 January 2010 - 09:09 PM

The only reason I can think of is for "persistence". That is where when the user selects one skin, the selection can be kept in the file so that between shut-down times, it can stay the same (So that it doesn't revert to default every time you restart the app). This should be something simple.

preferences.ini
choice=3



Your program, when a skin is selected, changes that number to whatever skin number you want. Then, whenever you start the application, you read that choice and apply that skin
Was This Post Helpful? 0
  • +
  • -

#3 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10667
  • View blog
  • Posts: 39,615
  • Joined: 27-December 08

Re: Creating an .ini file for use?

Posted 23 January 2010 - 09:12 PM

INI Files are configurations/settings files. They allow you to store all your settings (like the path of the ImageIcons for example) in one place. I've included four links below- one for reading files, two for writing and creating files, and one on general INI info.

Links:
http://java.sun.com/...il/Scanner.html
http://java.sun.com/...rintWriter.html
http://java.sun.com/...va/io/File.html
http://en.wikipedia.org/wiki/INI_file
Was This Post Helpful? 0
  • +
  • -

#4 javafreak  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 11
  • View blog
  • Posts: 97
  • Joined: 21-September 09

Re: Creating an .ini file for use?

Posted 24 January 2010 - 03:14 AM

thnks for info
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1