aspose file tools*
The moose likes Java in General and the fly likes Program Structure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

Program Structure

Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
Hello world,
I am writting a stock controlling program using swing. I have a JTabbedPane and have so many different tabs for example "Logging, Searching , Addint data to the database ,Biiling " etc.
What I want to know is.. is it ok if i write all the coding for every tab in a single class.?. if it is not the way, do i have to write a class for each and every tab?. If it is so how can i link all the classes to appear in a JTabbedPane. Please tell me what to do. If i should use different classes please write down the structure i should follow.
Another question if I use different classes will I be able to access each and every variable where ever I want.
Thanks


SCJP 1.4, SCMAD 1.0<br />SCWCD, SCBCD (in progress)
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
I personally would have a separate class for each tab. Each pane of the JTabbedPane would contain one instance of each of your classes.
Another question if I use different classes will I be able to access each and every variable where ever I want.
As long as you hold references to the instances of each tab this should not be a problem.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Please do not cross post. Continue the conversation here.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Program Structure