JAVA SWING GUI HELP - java application - simulating PDA system?

itslindsay87

New member
Joined
Apr 22, 2010
Messages
1
Reaction score
0
Points
1
Hi,

i'm doing a project in uni. we have to deisgn and create a java application which will simulate a PDA system for stock control. i have never done java swing with the gui before and kind struggling. so far we have our increments for each of the options within the PDA system.

1.main menu - with all three options
2. View Product Details
3. Modify Product
4. Order Stock

so far we have our JFrame as the main menu with a JPanel on top and the rest of the options as JPanels. We are having problems at the simple stages of connectiong the JPanels together.SO far we can get the buttons on the main menu working but their taking us on totally new JPanels rather than ones already in our project i.e Option 1 View Product Details.

private void ViewProductDetailsActionPerformed(java.awt.event.ActionEvent evt) {

// when view product details button pressed the JPanel Option1 is displayed

JPanel Option1 = newJPanel;
Option1.setVisible(true);
MainPanel.setVisible(false);

we realized that the "JPanel Option1 = newJPanel;" is where we are going wrong and can't seem to get the part to where the button is clicked it takes us onto one of the existing JPanels within the project but a new JPanel instead.

When then thought it would be this but no luck so far.


private void ViewProductDetailsActionPerformed(java.awt.event.ActionEvent evt) {

// when view product details button pressed the JPanel Option1 is displayed

JPanel Option1 = JPanel("Option1");
Option1.setVisible(true);
MainPanel.setVisible(false);

Any Help, Solutions or Advice would be great
thank you
Lindsay
 
Looks like you are just now learning Swing. I can not follow your intent with your choice of variable names.

If I were you, Make a JTabbedPane, put 3 tabs with JComponents upon the tab panel. Put that JTabbedPane in the JFrame. Get all that working and then it is a snap to create a JFrame that appears to change JFrame contents.

Swing code is bulky and will not paste here in Y! Answers.
 
Back
Top