• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

making java program user friendly

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually the file looks like a standard Properties file.
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
PLEASE REPLY
 
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
sunglasses are a type of coolness prosthetic. Check out the sunglasses on this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic