Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Program Structure  RSS feed

 
Ransika deSilva
Ranch Hand
Posts: 524
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Di Shoe
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, please read this link about tabbedPane http://java.sun.com/docs/books/tutorial/uiswing/components/components.html
This is one of my favorite links on Swing Components. So basically when you use a tabbedPane, you are adding components to it as tabbes. Then you would implement action handler for each tab under ActionPerformed() method in you java/applet class. So when a tab is clicked, you do something accordingly.. Therefore, you don't need any other additional class unless you need to do custom drawing or to make a custom componet for your tabbedPane.
--Di
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!