File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Less coding :: A dream" Watch "Less coding :: A dream" New topic

Less coding :: A dream


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: 4351

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).]

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.
I agree. Here's the link:
subject: Less coding :: A dream
It's not a secret anymore!