• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java application with multiple levels of pages

 
John Horn
Greenhorn
Posts: 1
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a program that I have written for a green screen computer system that I'm trying to recreate in Java. There are multiple levels of pages as you go through the application. Basically, it starts off with a summary page with many different categories. Click on one of the catagories and it opens a page with a list of items in that category. Click on one of the items and you can edit that item. Or add a new one or whatever.

I am really struggling with how to do this in a Java app. Currently I have a class to represent each of the pages and am using a CardLayout manager for the main summary screen and then swapping to the various screens as I move through the app. This seems to work but is really clunky and brittle. I keep breaking it as I add my actual functionality to the app.

I hope that makes sense.  (Also, if this is not the right forum, let me know and I'll move it.

  - Anarien
 
 
Les Morgan
Rancher
Posts: 717
17
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John,
Well, let me ask are you mixing your GUI with your program logic? (adding significant logic to your GUI components to do things) If you are, then stop it.  Therein is probably most of your problem and your design buggaboo.

I would think along this line:

- HTML and XML
- Use something like a JEditorPane to display the HTML
- Save the HTML and XML in a database so it is easily updatable.

Have a main logic that makes calls to the db to bring back any info, XML, and formatting, HTML, that is needed and provides a middle tier to your application.  Think along the line of GUI, as a distinct layer, Business Rules, your rules and logic to tie things together, and the back end, the database.  Divide the project into these 3 categories and work from there, you'll see a lot better results if you do.
Les
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

From what I understood, I would approach it the following way
1) Class Content - Holds the actual data
2) Class page to represent the content visually
3) Page needs to have two modes. Read only and Edit
4) An index - Can be something as simple as a List.
5) OR use a JTree in case you have multiple and or subcategories. Each tree 'node' would be a reference to one content item
6) Either of 5 or 6 would mean the content class should have a Title along with the actual data. This title value would be displayed in the index
7) CardLayout is the logical choice for swapping.


 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!