0 Replies Latest reply: Jan 31, 2009 3:42 AM by 843807 RSS

    swing

    843807
      i want to create a button called warehouse in a window called main such that when i click on it opens a new panel that has the following buttons addItem,check quantity. here is a sample of my main class. please help!


      import javax.swing.*;
      import java.awt.*;
      import java.awt.event.*;
      public class InventorySoftware
      {

      public static void main(String[]args)
      {
           JFrame main= new JFrame();
           

           JPanel p1= new JPanel();
           JButton pos = new JButton("POINT OF SALE");
           JButton warhse = new JButton("WAREHOUSE");
           main.setTitle("INVENTORY CONTROL SYSTEM");
           main.setSize(600,350);
           
           pos.setBounds(new Rectangle(20,20,20,80));
           warhse.setBounds(new Rectangle(20,20,20,80));
           
           
           p1.setLayout(new FlowLayout());
           p1.setBackground(Color.gray);
           p1.add(pos);
           p1.add(warhse);
           
           main.setContentPane(p1);
           
           main.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
           main.setVisible(true);
           }
      }

      Edited by: andy2kibet on Jan 31, 2009 1:41 AM