aspose file tools*
The moose likes Beginning Java and the fly likes making java program user friendly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "making java program user friendly" Watch "making java program user friendly" New topic
Author

making java program user friendly

Anuji Philip
Ranch Hand

Joined: Feb 25, 2002
Posts: 46
I am relatively a beginner and want to know these
java secrets;
While going through one famous program called
connection pool by Carl Moss I came to read following lines;
-----------------------------------------------
package javaservlets.jdbc;
import java.sql.*;
/**
* <p>This class serves as a JDBC connection repository. Since
* creating database connections is one of the most time
* intensive aspects of JDBC, we'll create a pool of connections.
* Each connection can be used and then replaced back into the
* pool.
*
* <p>A properties file 'ConnectionPool.cfg' will be used to
* specify the types of JDBC connections to create, as well as
* the minimum and maximum size of the pool. The format of
* the configuration file is:
*
* #(comment)
* JDBCDriver=<JDBC driver name>
* JDBCConnectionURL=<JDBC Connection URL>
* ConnectionPoolSize=<minimum size of the pool>
* ConnectionPoolMax=<maximum size of the pool, or -1 for none>
* ConnectionUseCount=<maximum usage count for one connection>
* ConnectionTimeout=<maximum idle lifetime (in minutes) of
* a connection>
* <other property for JDBC connection>=<value>
*
* <p>Any number of additional properties may be given (such
* as username and password) as required by the JDBC driver.
*
*/
-------------------------------------------------
just these comments are there in the program and
.cfg files are got created and there we can include the properties information as we want.
It's a wonder for me how such file can be created
and java program could automatically read that.
I want to create a similar file.Any body could
explain with an example and to give reference.
I also want to make this .cfg files read only.
I also want to make my program output to come on
full screen when program is executing.(in Windows)
Please give reply to my innocent querries.
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
ANUJI
I'm not familiar with that program but it looks like the cfg file is an xml document that the connection pool program reads before creating the connections.
If that is the case, then to do something similar, you'd need to specify the format of the xml file (with a dtd) and then write the code to parse the file when the application starts up.
hope that helps


Dave
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Actually the file looks like a standard Properties file.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
I also want to make my program output to come on full screen when program is executing.(in Windows)
You may want to take a look at The Full-Screen Exclusive Mode API Lesson of Sun's Java Tutorial.
Or did you mean in a maximized window?


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
I also want to make this .cfg files read only.
Take a look at the API documentation for the File class and you'll discover a method called setReadOnly.
Anuji Philip
Ranch Hand

Joined: Feb 25, 2002
Posts: 46
Thank you for the replies.
Actually it is the standard proprties file that
is very common in servlet programming.I said this
because I just saw many programs.What to do to
create such file
Anuji Philip
Ranch Hand

Joined: Feb 25, 2002
Posts: 46
PLEASE REPLY
Rene Liebmann
Ranch Hand

Joined: May 02, 2002
Posts: 196
The best way to create a standard property file is using the Properties class. There you have the possibility to add a set of Key - Value pairs.
If your set is ready you can store it using a FileOutputStream.
The only problem I know is, that you are not able to store comments over this method. If you load a properties file wit comments into the Properties class to change something then all the comments will disappear after saving it.
Hope this helps
Rene
 
Don't get me started about those stupid light bulbs.
 
subject: making java program user friendly