File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Less coding :: A dream

 
dragon_fly
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
Bharatesh H Kakamari
Ranch Hand
Posts: 198
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4353
2
Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
Ruslan Ivanov
Ranch Hand
Posts: 72
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic