This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Less coding :: A dream Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Less coding :: A dream" Watch "Less coding :: A dream" New topic
Author

Less coding :: A dream

dragon_fly
Greenhorn

Joined: Mar 06, 2001
Posts: 3
Hi, there,
I have written many applications in GUI and generally endup
in writing long codes,extending upto hundreds of lines
Can anybody, tell me how do i reduce coding lines?? Other
than deleting , of course!!
eg.If i am using 10 buttons, i'l have to decalare and initialise them taking atleast 10 lines...
Please guide me....
Bye Amol..


---------<br />enter dragon, exit enlightened.
Bharatesh H Kakamari
Ranch Hand

Joined: Nov 09, 2000
Posts: 198
Less coding is very much achievable through code reuse. You can create and call a method that will do the basic intializations and then call this method wherever you are doing the initializations.
This is one of the suggestions.
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4340
    
    2

If you are having 10 buttons, you might be able to use a loop. You could put the labels in a vector.
Another thought is to use default colors etc. Use default when you can.
[This message has been edited by Randall Twede (edited March 07, 2001).]


SCJP
Visit my download page
Ruslan Ivanov
Ranch Hand

Joined: Feb 22, 2001
Posts: 72
GUI is almost never reusable , one day you come to work and someone has already changed my gui that it looked a day before and you have to work with an old stuff but the code that drives the gui stays the same that's what's good about it.
 
Consider Paul's rocket mass heater.
 
subject: Less coding :: A dream
 
Similar Threads
Retrieving data from database every 10 secs.
Java 6 - Grains
5 to 10 line coding Qs in SCJP.
to retreive datas from mysql table in jsp
File Read Help???