Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes Java Class model or template Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java Class model or template" Watch "Java Class model or template" New topic
Author

Java Class model or template

Bill Raterink
Greenhorn

Joined: Sep 03, 2003
Posts: 29
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

Joined: Aug 20, 2001
Posts: 1824

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 ]

Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Bill Raterink
Greenhorn

Joined: Sep 03, 2003
Posts: 29
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

Joined: Aug 20, 2001
Posts: 1824

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 )
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Class model or template