Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Class model or template

 
Bill Raterink
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends, it's me again. Well, my program works. It's not the most efficient, or the most functional, & DEFINITELY not the prettiest, but IT WORKS! I have you folks to thank. Now, here's my question. Where can I find a template or model for a java class? Just a simple stand-alone program, Something that would show me the best way (or at least an acceptable way) to layout a class. Should my main() be at the beginning? or at the end. I have 2 books & each show both. Should the GUI frames be ahead of or after the panels, etc. Should the main(), AND the GUI be at the front, back, doesn't matter, with respect to my "misc." functions such as read, write, scroll up/down, etc.? I'm sorry for rambling, but java just doesn't seem to fit my 60's concepts & the books I've found either assume I already know that, or they simply scramble them all over the place so I can't keep track of things. Thanks again for the help. I hope to make it into "intermediate" by spring. ; )
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I generally follow the following template:

The constructors I used to put later in the file, but now have them closer to the front.
I use NetBeans to build my screens, so the layout is whatever NetBeans uses. Doesn't matter to me -- I never/rarely edit those files.
[ October 03, 2003: Message edited by: Joel McNary ]
 
Bill Raterink
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joel,
Thanks for the reply. It's just what I think I was looking for.
One quick question, & I know, I'm showing my ignorance here, but why do you have 2 constructor areas & 2 main methods. Also, is there a reason your inner braces don't close, or is it just the shorthand?
Sometimes this whole java thing reminds me of trying to learn the "flow" of the RPG cycle. A friend finally drew it all out for me & then said "So, you put your file IN here, you put your file OUT there, then you...." and he did it all to the "Hokey-Pokey, IT WAS PATHETIC, but ya'know, I remember it to this day. What does THAT say about the human brain HA!HA!
Thanks again, & Please, don't sing. ; ) -Bill.
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've got two areas for those because I don't follow a strict template -- those areas can go either place depending on a variety of circumstances (including my mood on a given day )
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic