Inventory GUI Assignment

I can't figure out how to get this to work correctly. I need the GUI to display one product at a time and add buttons "next, previous, last, first". My main problem is not being able to step through displaying the arrat one product at a time. That of course prevents me from applying any button actions. Any help for this Java moron would be greatly appreciated.
import java.util.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Inventory7 // Main class
     //main method begins execution of java application
     public static void main(String args[])
          int i; // varialbe for looping
          double total = 0; // variable for total inventory
          final int dispProd = 0; // variable for actionEvents
          // Instantiate a product object
          final ProductAdd[] nwProduct = new ProductAdd[5];
          // Instantiate objects for the array
          for (i=0; i<5; i++)
               nwProduct[0] = new ProductAdd("Paper", 101, 10, 1.00, "Box");
               nwProduct[1] = new ProductAdd("Pen", 102, 10, 0.75, "Pack");
               nwProduct[2] = new ProductAdd("Pencil", 103, 10, 0.50, "Pack");
               nwProduct[3] = new ProductAdd("Staples", 104, 10, 1.00, "Box");
               nwProduct[4] = new ProductAdd("Clip Board", 105, 10, 3.00, "Two Pack");
          for (i=0; i<5; i++)
               total += nwProduct.calcValue(); // calculate total inventory cost
          final JButton firstBtn = new JButton("First"); // first button
          final JButton prevBtn = new JButton("Previous"); // previous button
          final JButton nextBtn = new JButton("Next"); // next button
          final JButton lastBtn = new JButton("Last"); // last button
          final JLabel label; // logo
          final JTextArea textArea; // text area for product list
          final JPanel buttonJPanel; // panel to hold buttons
          //JLabel constructor for logo
          Icon logo = new ImageIcon("C:/logo.jpg"); // load logo
          label = new JLabel(logo); // create logo label
          label.setToolTipText("Company Logo"); // create tooltip
          buttonJPanel = new JPanel(); // set up panel
          buttonJPanel.setLayout( new GridLayout(1, 4)); //set layout
          // add buttons to buttonPanel
          buttonJPanel.add(firstBtn);
          buttonJPanel.add(prevBtn);
          buttonJPanel.add(nextBtn);
          buttonJPanel.add(lastBtn);
          textArea = new JTextArea(nwProduct[3]+"\n"); // create textArea for product display
          // add total inventory value to GUI
          textArea.append("\nTotal value of Inventory "+new java.text.DecimalFormat("$0.00").format(total)+"\n\n");
          textArea.setEditable(false); // make text uneditable in main display
          JFrame invFrame = new JFrame(); // create JFrame container
          invFrame.setLayout(new BorderLayout()); // set layout
          invFrame.getContentPane().add(new JScrollPane(textArea), BorderLayout.CENTER); // add textArea to JFrame
          invFrame.getContentPane().add(buttonJPanel, BorderLayout.SOUTH); // add buttons to JFrame
          invFrame.getContentPane().add(label, BorderLayout.NORTH); // add logo to JFrame
          invFrame.setTitle("Office Min Inventory"); // set JFrame title
          invFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // termination command
          //invFrame.pack();
          invFrame.setSize(400, 400); // set size of JPanel
          invFrame.setLocationRelativeTo(null); // set screem location
          invFrame.setVisible(true); // display window
          // assign actionListener and actionEvent for each button
          firstBtn.addActionListener(new ActionListener()
               public void actionPerformed(ActionEvent ae)
                    textArea.setText(nwProduct[0]+"\n");
               } // end firstBtn actionEvent
          }); // end firstBtn actionListener
          lastBtn.addActionListener(new ActionListener()
               public void actionPerformed(ActionEvent ae)
                    textArea.setText(nwProduct[4]+"n");
               } // end lastBtn actionEvent
          }); // end lastBtn actionListener
//          prevBtn.addActionListener(new ActionListener()
//               public void actionPerformed(ActionEvent ae)
//                    dispProd = (nwProduct.length+dispProd-1) % nwProduct.length;
//                    textArea.setText(nwProduct.display(dispProd)+"\n");
//               } // end prevBtn actionEvent
//          }); // end prevBtn actionListener
     } // end main
} // end class Inventory6
class Product
     protected String prodName; // name of product
     protected int itmNumber; // item number
     protected int units; // number of units
     protected double price; // price of each unit
     protected double value; // value of total units
     public Product(String name, int number, int unit, double each) // Constructor for class Product
          prodName = name;
          itmNumber = number;
          units = unit;
          price = each;
     } // end constructor
     public void setProdName(String name) // method to set product name
          prodName = name;
     public String getProdName() // method to get product name
          return prodName;
     public void setItmNumber(int number) // method to set item number
          itmNumber = number;
     public int getItmNumber() // method to get item number
          return itmNumber;
     public void setUnits(int unit) // method to set number of units
          units = unit;
     public int getUnits() // method to get number of units
          return units;
     public void setPrice(double each) // method to set price
          price = each;
     public double getPrice() // method to get price
          return price;
     public double calcValue() // method to set value
          return units * price;
} // end class Product
class ProductAdd extends Product
     private String feature; // variable for added feature
     public ProductAdd(String name, int number, int unit, double each, String addFeat)
          // call to superclass Product constructor
          super(name, number, unit, each);
          feature = addFeat;
     }// end constructor
          public void setFeature(String addFeat) // method to set added feature
               feature = addFeat;
          public String getFeature() // method to get added feature
               return feature;
          public double calcValueRstk() // method to set value and add restock fee
               return units * price * 0.05;
          public String toString()
               return String.format("Product: %s\nItem Number: %d\nIn Stock: %d\nPrice: $%.2f\nType: %s\nTotal Value of Stock: $%.2f\nRestock Cost: $%.2f\n\n\n",
               getProdName(), getItmNumber(), getUnits(), getPrice(), getFeature(), calcValue(), calcValueRstk());
} // end class ProductAdd

I just have one more question. I have intergrated the code example you gave me into my original code. Now I have a ton of errors that seem to pertain to the fact that I have numbers involved. Please help.
import java.util.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Inventory extends JFrame// Main class
     private JLabel prodNameLabel;
     private JLabel numberLabel;
     private JLabel unitLabel;
     private JLabel priceLabel;
     private JLabel featureLabel;
     private JLabel valueLabel;
     private JLabel rstkLabel;
     private JLabel totalLabel;
     private JTextField prodNameField;
     private JTextField numberField;
     private JTextField unitField;
     private JTextField priceField;
     private JTextField featureField;
     private JTextField valueField;
     private JTextField rstkField;
     private JTextField totalField;
     private JButton firstBtn;
     private JButton prevBtn;
     private JButton nextBtn;
     private JButton lastBtn;
     private JPanel buttonJPanel;
     private JPanel fieldJPanel;
     private JPanel fontJPanel;
     private List<ProductAdd> nwProduct;
     private int currProd = 0;
     private double total; // variable for total inventory
     public Inventory()
          initComponents();
     private void initComponents()
          prodNameLabel = new JLabel("Product Name:");
          numberLabel = new JLabel("Item Number:");
          unitLabel = new JLabel("In Stock:");
          priceLabel = new JLabel("Each Item Cost:");
          featureLabel = new JLabel("Type of Item:");
          valueLabel = new JLabel("Value of Item Inventory:");
          rstkLabel = new JLabel("Cost to Re-Stock Item:");
          totalLabel = new JLabel("Total Value of Inventory:");
          firstBtn = new JButton("First");
          prevBtn = new JButton("Previous");
          nextBtn = new JButton("Next");
          lastBtn = new JButton("Last");
          prodNameField = new JTextField();
          prodNameField.setEditable(false);
          numberField = new JTextField();
          numberField.setEditable(false);
          unitField = new JTextField();
          unitField.setEditable(false);
          priceField = new JTextField();
          priceField.setEditable(false);
          featureField = new JTextField();
          featureField.setEditable(false);
          valueField = new JTextField();
          valueField.setEditable(false);
          rstkField = new JTextField();
          rstkField.setEditable(false);
          totalField = new JTextField();
          totalField.setEditable(false);
          prodNameLabel.setSize(200, 20);
          numberLabel.setSize(200, 20);
          unitLabel.setSize(200, 20);
          priceLabel.setSize(200, 20);
          featureLabel.setSize(200, 20);
          valueLabel.setSize(200, 20);
          rstkLabel.setSize(200, 20);
          totalLabel.setSize(200, 20);
          prodNameField.setSize(100, 20);
          numberField.setSize(100, 20);
          unitField.setSize(100, 20);
          priceField.setSize(100, 20);
          featureField.setSize(100, 20);
          valueField.setSize(100, 20);
          rstkField.setSize(100, 20);
          totalField.setSize(100, 20);
          buttonJPanel = new JPanel(); // set up panel
          buttonJPanel.setLayout( new GridLayout(1, 4)); //set layout
          // add buttons to buttonJPanel
          buttonJPanel.add(firstBtn);
          buttonJPanel.add(prevBtn);
          buttonJPanel.add(nextBtn);
          buttonJPanel.add(lastBtn);
          nwProduct = new ArrayList<ProductAdd>();
          nwProduct.add(new ProductAdd("Paper", 101, 10, 1.00, "Box"));
          nwProduct.add(new ProductAdd("Pen", 102, 10, 0.75, "Pack"));
          nwProduct.add(new ProductAdd("Pencil", 103, 10, 0.50, "Pack"));
          nwProduct.add(new ProductAdd("Staples", 104, 10, 1.00, "Box"));
          nwProduct.add(new ProductAdd("Clip Board", 105, 10, 3.00, "Two Pack"));
          total = (nwProduct.size() += calcValue());
          prodNameField.setText(nwProduct.get(currProd).getProdName());
          numberField.setInt(nwProduct.get(currProd).getItmNumber());
          unitField.setInt(nwProduct.get(currProd).getUnits());
          priceField.setInt(nwProduct.get(currProd).getPrice());
          featureField.setText(nwProduct.get(currProd).getFeature());
          valueField.setInt(nwProduct.get(currProd).calcValue());
          rstkField.setInt(nwProduct.get(currProd).calcValueRstk());
          totalField.setInt(total);
          fieldJPanel = new JPanel();
          fieldJPanel.setLayout(new GridLayout(8, 2));
          fieldJPanel.add(prodNameLabel);
          fieldJPanel.add(prodNameField);
          fieldJPanel.add(numberLabel);
          fieldJPanel.add(numberField);
          fieldJPanel.add(unitLabel);
          fieldJPanel.add(unitField);
          fieldJPanel.add(priceLabel);
          fieldJPanel.add(priceField);
          fieldJPanel.add(featureLabel);
          fieldJPanel.add(featureField);
          fieldJPanel.add(valueLabel);
          fieldJPanel.add(valueField);
          fieldJPanel.add(rstkLabel);
          fieldJPanel.add(rstkField);
          fieldJPanel.add(totalLabel);
          fieldJPanel.add(totalField);
          JFrame invFrame = new JFrame();
          invFrame.setLayout( new BorderLayout());
          invFrame.setTitle("Office Min Inventory");
          invFrame.getContentPane().add(fontJPanel, BorderLayout.NORTH);
          invFrame.getContentPane().add(buttonJPanel, BorderLayout.SOUTH);
          invFrame.getContentPane().add(fieldJPanel, BorderLayout.CENTER);
          invFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // termination command
          invFrame.setSize(400, 400); // set size of JPanel
          invFrame.setLocationRelativeTo(null); // set screem location
          invFrame.setVisible(true); // display window
          firstBtn.addActionListener(new ActionListener()
               public void actionPerformed(ActionEvent evt)
                    goFirst();
          lastBtn.addActionListener(new ActionListener()
               public void actionPerformed(ActionEvent evt)
                    goLast();
          prevBtn.addActionListener(new ActionListener()
               public void actionPerformed(ActionEvent evt)
                    goBack();
          nextBtn.addActionListener(new ActionListener()
               public void actionPerformed(ActionEvent evt)
                    goNext();
     private void goFirst()
          prodNameField.setText(nwProduct.get(0).getProdName());
          numberField.setInt(nwProduct.get(0).getItmNumber());
          unitField.setInt(nwProduct.get(0).getUnits());
          priceField.setInt(nwProduct.get(0).getPrice());
          featureField.setText(nwProduct.get(0).getFeature());
          valueField.setInt(nwProduct.get(0).calcValue());
          rstkField.setInt(nwProduct.get(0).calcValueRstk());
          totalField.setInt(total);
     private void goLast()
          prodNameField.setText(nwProduct.get(nwProduct.size() - 1).getProdName());
          numberField.setInt(nwProduct.get(nwProduct.size() - 1).getItmNumber());
          unitField.setInt(nwProduct.get(nwProduct.size() - 1).getUnits());
          priceField.setInt(nwProduct.get(nwProduct.size() - 1).getPrice());
          featureField.setText(nwProduct.get(nwProduct.size() - 1).getFeature());
          valueField.setInt(nwProduct.get(nwProduct.size() - 1).calcValue());
          rstkField.setInt(nwProduct.get(nwProduct.size() - 1).calcValueRstk());
          totalField.setInt(total);
     private void goBack()
          if(currProd > 0)
               currProd--;
               prodNameField.setText(nwProduct.get(currProd).getProdName());
               numberField.setInt(nwProduct.get(currProd).getItmNumber());
               unitField.setInt(nwProduct.get(currProd).getUnits());
               priceField.setInt(nwProduct.get(currProd).getPrice());
               featureField.setText(nwProduct.get(currProd).getFeature());
               valueField.setInt(nwProduct.get(currProd).calcValue());
               rstkField.setInt(nwProduct.get(currProd).calcValueRstk());
               totalField.setInt(total);
     private void goNext()
          if(currProd < nwProduct.size() - 1)
               currProd++;
               prodNameField.setText(nwProduct.get(currProd).getProdName());
               numberField.setInt(nwProduct.get(currProd).getItmNumber());
               unitField.setInt(nwProduct.get(currProd).getUnits());
               priceField.setInt(nwProduct.get(currProd).getPrice());
               featureField.setText(nwProduct.get(currProd).getFeature());
               valueField.setInt(nwProduct.get(currProd).calcValue());
               rstkField.setInt(nwProduct.get(currProd).calcValueRstk());
               totalField.setInt(total);
     //main method begins execution of java application
          public static void main(String args[])
               new Inventory().setVisible(true);
          } // end main method
} // end class Inventory
class Product
     protected String prodName; // name of product
     protected int itmNumber; // item number
     protected int units; // number of units
     protected double price; // price of each unit
     protected double value; // value of total units
     public Product(String name, int number, int unit, double each) // Constructor for class Product
          prodName = name;
          itmNumber = number;
          units = unit;
          price = each;
     } // end constructor
     public void setProdName(String name) // method to set product name
          prodName = name;
     public String getProdName() // method to get product name
          return prodName;
     public void setItmNumber(int number) // method to set item number
          itmNumber = number;
     public int getItmNumber() // method to get item number
          return itmNumber;
     public void setUnits(int unit) // method to set number of units
          units = unit;
     public int getUnits() // method to get number of units
          return units;
     public void setPrice(double each) // method to set price
          price = each;
     public double getPrice() // method to get price
          return price;
     public double calcValue() // method to set value
          return units * price;
} // end class Product
class ProductAdd extends Product
     private String feature; // variable for added feature
     public ProductAdd(String name, int number, int unit, double each, String addFeat)
          // call to superclass Product constructor
          super(name, number, unit, each);
          feature = addFeat;
     }// end constructor
          public void setFeature(String addFeat) // method to set added feature
               feature = addFeat;
          public String getFeature() // method to get added feature
               return feature;
          public double calcValueRstk() // method to set value and add restock fee
               return units * price * 0.05;
          public String toString()
               return String.format("%s%d%d$%.2f%s$%.2f$%.2f",
               getProdName(), getItmNumber(), getUnits(), getPrice(), getFeature(), calcValue(), calcValueRstk());
} // end class ProductAdd
class FontJPanel extends JPanel
     // display welcome message
     public void paintComponent( Graphics g )
          super.paintComponent( g ); //call superclass's paintComponent
          // set font to Monospaced (Courier), italic, 12pt and draw a string
          g.setFont( new Font( "Monospaced", Font.ITALIC, 12 ) );
          g.drawString( "min", 90, 70 );
          // set font to Serif (Times), bold, 24pt and draw a string
          g.setColor( Color.RED );
          g.setFont( new Font( "Serif", Font.BOLD, 24 ) );
          g.drawString( "OFFICE", 60, 60 );
     } // end method paintComponent
} // end class FontJPanel

Similar Messages

  • SAP Address Type on the SAP Web Gui - Assignment Blocks

    Hello SAP Gurus
    I am trying to configure system so that different Business Roles can only see different Address Type on the SAP Web Gui - is this possible ? 
    For instance Business Role  - "X" can only see the Standard Address Type and Business Role "Y" can not see the Standard Address but see other ones on the assignment blocks
    Thank you

    Hi Raj,
    You can achieve this by enhancing the Addresses and Address Types assignment block.
    Based on the Address Type 'Standard Address' entry, filter out the corresponding address
    in the Addresses AB. This determination can be performed in the enhancement views.
    Once the view are created, create a new configuration with Role config key 'Y''.
    Add the enhancement views to the Displayed Assignment block section. And remove
    the standard assignment blocks from this section so that they will not be available in
    the personalization so that this user cannot view the standard address.
    Regards,
    Leon

  • Assign Project Code to Freight charges in AP Invoice

    Project Code field is not available in Freight Charges window at all though it can be displayed and edited by selecting Project Code to be visible and Active in Journal Entry Form Settings Table Format.  As this is a limitation in SAP B1 please feedback to Development for improvement.
    It is important to allocate Project Code to Freight charges in AP Invoice as every Purchase expense of Inventory or Non Inventory is assigned a Project Code for recognition in Profit and Loss Statement.  
    Kedalene Chong

    Hello,
    Your requirement to add project code on Freight Charges form is valid. This is well known issue and we have it on the waiting list; however, I cannot specify in which release this will be fixed.
    Is there any other specific requirement on Cost Accounting you would like to solve?
    Thanks.
    Peter Dominik
    SAP
    B1 Product Definition

  • Inventory Org finalisation

    Hi Folks,
    Could some one explain bit detail about Inventory Master Org, Inventory Org and Sub Inventory Org.
    I need clear explanation related to finance as well Inventory.
    Regards
    Prasanth

    Hi,
    So for the implementation of Financials, u will need the following:
    1. Query for the Operating Unit (OU) setup
    HRMS Responsibility: Setup --> Organizations --> Organizations
    In the organization Classifications, add "Inventory Organization"
    Click on the button "Others" --> Accounting Information
    Assign respective values for the organization
    Save
    Click on the button "Others" -->Inventory Information
    Assign respective values for the organization (will require some accounting keys here)
    Save
    2. In Order Management Responsibility for the Organization
    Setup --> System Parameters --> Values
    Search for "Item Validation Organization" and assign the Operating Unit Name
    This is necessary for Receivables Module.
    Hope this answer your question...
    Vik

  • Regading purchase order number range assign & migo no.range assign

    Hi,
    Can any body suggest me , Where we assign number range for Purchase order after creation of number range?
    And also where we define number range for MIGO posting, if any objects for that then give me deatils plz.
    Regards,
    Sohail

    Hi
    SPRO>Materials Management>Purchasing>Purchase Order>Define Number Ranges and assign the same in Define Document Types
    ,Assign the number range against the relevant PO document type
    For MIGO
    SPRO>Materials Management>Inventory Management and Physical Inventory>Number Assignment>
    or Use OBF4 Tcode
    Regards
    Amuthan M

  • Physical inventory -RF device

    I have created 2 PI documents.
    Document 1 has BIN A& C
    Document  2 has Bin B & D.
    When i carry out the counting,the BIN A & C are at two corners of the warehouse & same for B& D.
    Can i see the bins in ascending  order so that the bins are listed in RF like A,B,C& D
    This will make the counting process simple & less time consuming
    How list the bins in ascending order in the RF device?

    Hi
    for testing PI documents through RFID u need to folow the below the steps.
    1.Create RF queues & assign authorisation to warehouse through LRFMD.
    2.Create the inventory document & assign user in the counter field for the inventory document.
    3.Check the RF transaction (I believe it is LM51) where you can see PI document is assigned to the respective user provided that the user has logged in through his/her login.
    4.Regarding the question of transfering PI document like TO to other queue in LRF1 is not possible. You have to develop this. In standard you can only transfer TO's
    Hope this will clear your issue.
    Regards,
    sathya.

  • Assign number ranges

    Hi
    i am having a problem in migo(Number range 49 missing) can anyone let me know how to fix it

    Hi
    Goto SPRO-> Material Management->Inventory mgmt & physical inventory->Number assignment->define number assignment for accounting documents.
    click on fist one financial accounting document types select WE & check for number range 49 (if it is not there enter 49) then come back & click on
    financial accounting number ranges enter your company code click on intervals
    check for number 49 if it is not there insert number range for 49.
    Regards

  • UPDATE ERROR -"SAPSQL_ARRAY_INSERT_DUPREC" CX_SY_OPEN_SQL_DBC

    DEAR ALL!
    I am facing the following error while posting goods issue through VL01N and stock posting through MB1C ( m.type 521 without production order ).
    Table COBK is not updated wile doing those trasactions, this cause the runtime error.how to solve this issue?
    I searched SAP notes but problem not yet solved.Kindly go through the following error and give your suggestions.
    Thanks in advance. 
    Error analysis
        An exception occurred. This exception is dealt with in more detail below
        . The exception, which is assigned to the class 'CX_SY_OPEN_SQL_DB', was
         neither
        caught nor passed along using a RAISING clause, in the procedure
         "INSERT_TABLES" "(FORM)"
        Since the caller of the procedure could not have expected this exception
         to occur, the running program was terminated.
        The reason for the exception is:
        If you use an ABAP/4 Open SQL array insert to insert a record in
        the database and that record already exists with the same key,
        this results in a termination.
        (With an ABAP/4 Open SQL single record insert in the same error
        situation, processing does not terminate, but SY-SUBRC is set to 4.)
    Sivasubramaniam,
    SD consultant.

    Hi Siva,
    I am not sure but check your number range assignment for Material doc no. it might have exhausted.
    The menu path is IMG> Materials Management> Inventory Management and Physical Inventory>Number Assignment>Define Number Assignment for Material and Phys. Inv. Docs. (check for your material doc type
    REWARD if it helps you!!
    Regards,
    Ajinkya

  • Creating a new window from and action event

    Hey I have a problem i would like most of my menu items to create a new window containing a set text and i was thinking of creating a new container with a JTextArea but for some reason its not working. if someone could help me that be great... so my question is how do create another window (TextArea) with my tokenized array info in it open up when Print File or Print Total is the event??
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
    import java.io.*;
    import java.util.StringTokenizer;
    import javax.swing.plaf.*;
    class PhoneProject extends JFrame implements ActionListener
         private static final int WIDTH = 260;
         private static final int HEIGHT = 160;
         private static final int X_ORIGIN = 402;
         private static final int Y_ORIGIN = 299;
         ArrayList internalCalls = new ArrayList();
         ArrayList externalCalls = new ArrayList();
         PhoneCall internal;
         PhoneCall external;
         JMenu query = new JMenu("Query");
         JMenu proccess = new JMenu("Proccess");
         String inRecord;
         int numExtension;
         int numCallType;
         int numSeconds;
         int totalIntTime;
         int totalExtTime;
    public static void main(String args[])
              PhoneProject frame = new PhoneProject();
              frame.setVisible(true);
    public  void LoadArray(File myFile) throws IOException
              FileReader fr = new FileReader(myFile);
              BufferedReader br = new BufferedReader(fr);
              while ((inRecord = br.readLine()) != null)
                   StringTokenizer tokenizer = new StringTokenizer(inRecord);
                   String extension = tokenizer.nextToken();
                   String callType = tokenizer.nextToken();
                   String seconds = tokenizer.nextToken();
                   numExtension = Integer.parseInt(extension);
                   numCallType = Integer.parseInt(callType);
                   numSeconds = Integer.parseInt(seconds);
                   if (numCallType == 0)
                        internal= new PhoneCall(numExtension, numCallType, numSeconds);
                        totalIntTime = (totalIntTime + numSeconds);
                        //System.out.println(totalIntTime + "int");
                        internalCalls.add(internal);
                   if (numCallType == 1)
                        external = new PhoneCall(numExtension, numCallType, numSeconds);
                        totalExtTime = (totalExtTime + numSeconds);
                        //System.out.println(totalExtTime + "EXT");
                        externalCalls.add(external);
                   System.out.println(internal.getSeconds());     
         public PhoneProject()
              Container contentPane;
              setBounds(X_ORIGIN, Y_ORIGIN, WIDTH, HEIGHT);
              setTitle("Phone Analyzer");
              setResizable(true);
              contentPane = getContentPane();
            contentPane.setLayout(new BorderLayout());
              JMenu file = new JMenu("File");
              JMenuItem  item;
              item = new JMenuItem("Open");
              item.addActionListener(this);
              file.add(item);
              item = new JMenuItem("Exit");
              item.addActionListener(this);
              file.add(item);
              proccess.setEnabled(false);
              item = new JMenuItem("Print File");
              item.addActionListener(this);
              proccess.add(item);
              item = new JMenuItem("Print Totals");
              item.addActionListener(this);
              proccess.add(item);
              item = new JMenu("Low and High");
              item.addActionListener(this);
              proccess.add(item);
              JMenuItem subItem = new JMenuItem("Compare");
              subItem.addActionListener(this);
              item.add(subItem);
              query.setEnabled(false);
              item = new JMenu("Average Total Utilization");
              item.addActionListener(this);
              query.add(item);
              JMenuItem itemInt = new JMenuItem("Internal");
              itemInt.addActionListener(this);
              item.add(itemInt);
              JMenuItem itemExt = new JMenuItem("External");
              itemExt.addActionListener(this);
              item.add(itemExt);
              item = new JMenuItem("Highest Internal Utilization");
              item.addActionListener(this);
              query.add(item);
              item = new JMenuItem("Highest Total Utilization");
              item.addActionListener(this);
              query.add(item);
              JMenuBar menuBar = new JMenuBar();
            setJMenuBar(menuBar);
            menuBar.add(file);
            menuBar.add(proccess);
            menuBar.add(query);
              contentPane.add(new JTextArea("Phone Report"));
      public void actionPerformed(ActionEvent event)
           String menuName;
           menuName = event.getActionCommand();
           if (menuName == "Open")
                JFileChooser chooser = new JFileChooser();
                int returnVal = chooser.showOpenDialog(this);
                if (returnVal == JFileChooser.APPROVE_OPTION)
                     try
                        File myFile = chooser.getSelectedFile();
                        this.LoadArray(myFile);
                        proccess.setEnabled(true);
                        query.setEnabled(true);
                     catch (Exception e)
         if (menuName == "Print File")
    JTextArea display = new JTextArea();
              display.setText("Hello");testing to see if it works
              display.setVisible(true);
         if (menuName == "Print Total")
                                               JTextArea display = new JTextArea();
              display.setText("Hello");//testing
              display.setVisible(true);
           if (menuName == "Exit")
                System.exit(0);
    }Phone.txt
    2000 0 300
    2000 0 538
    2000 1 305
    2000 1 729
    2005 0 205
    2005 0 305
    2005 1 592
    2005 1 594
    2010 0 364
    2010 0 464
    2010 1 904
    2010 1 100
    2020 0 234
    2020 0 839
    2020 1 999
    2020 1 210
    Assignment: Array Based GUI Assignment
    Telephone call data has been collected from a company's telephone switch. You have been asked to analyze it and produce various statistics.
    Input File
    The input file is a sequential file. It is in no specific order. The file contains an extension number, type of call, and the length of call in seconds. A record is produced each time a call is made from that extension. You should create your own test file.
    Field     Type     Description
    Extension     Integer     Extension number. This is a 4 digit number. Valid Extensions are 2000 to 2020.
    Type     Integer     Value of 1 means internal, any other value is an external call.
    Time     Long     Length of call in seconds
    Example:
    �     2000,1,60 : ----->>>> Extension 2000 had an internal call that lasted 60 seconds
    �     2000,1,356: ----->>>> Extension 2000 had an internal call that lasted 356 seconds
    �     2019,2,65: ------>>>> Extension 2019 had an external call that lasted 65 seconds
    �     2001,1,355: ----->>>> Extension 2001 had an internal call that lasted 355 seconds
    Process
    1.     Use 2 arrays to accumulate the time of calls for each extension, both internal and external.
    2.     The reports and queries are to be produced from the arrays.
    Hints:
    �     Create 2 arrays: one for internal calls and one for external calls.
    �     Load the arrays in Form Load: do not do any calculations here.
    �     The report and queries can totally be produced from the arrays.
    Output: Report
    Telephone Useage Report
    Extension Internal External
    2000 4500 3500
    2001 19350 22981
    2002 2333 900
    2003 3144 122
    Totals 99999 99999
    Output: Queries
    On the form add add query capability.
    1.     Average Total Utilization: Internal Calls: 9999 (total length of all internal calls / number extensions)
    2.     Average Total Utilization: External Calls: 9999
    3.     Extension with the highest internal call utilization: Ext xxxx; 9999 seconds.
    4.     Extension with the highest total utilization.
    Form Design
    The design of the form is up to you. However, use the following guidelines:
    �     use menus (preferred) or command buttons
    �     use a common dialog box to ask for the file name
    �     use a list box or text box to display the output
    the caption on the form should include your name

    hi
    u can try like following code
    if (menuName == "Print File")
              new mytextframe();
    class mytextframe extends JFrame{
         JTextArea display = new JTextArea();
         public mytextframe()
              setSize(300,300);
              setVisible(true);
              add(display);
              display.setText( "ello");
    }

  • Run time error while doing PGI

    hi gurus
    while doing PGI i am experiencing run time error.
    the ERROR ANALYSIS says that " check doc number 49 in company code 1234 and fiscal year 2007. and correct the number range status if necessary".
    i'm confused. please guide how to rectify the problem.
    thank you all in advance
    regards
    madhu

    Create new number range in T.Code:FBN1
    Go to menu path:
    IMG > Materials Management >Inventory Management and Physical Inventory > Number Assignment > Define Number Assignment for Accounting Documents
    Click on "Financial Accounting Document Types"
    go to Accounting Documents WA, WI, WL and double click on them and change the number range to the new number range created.
    Regards
    AK

  • Material reconciliation should be done vendor wise or  project wise

    Hi all,
    how to do material reconciliation should be done vendor wise or  project wise?? any help....MIRCMR is not working

    You could use MB51/MB5B report in ALV grid and have look ups the way you wish with either Vendor or WBS/Network. However, it will not give you correct picture as Vendor is only associated with receipts (and subcontracting issues) and hence you will find lot many issues without vendor - all clubbed together.
    For projects, it will only show you transactions groups per project where your inventory is assigned to project, but for rest it will again be grouped together.
    Your requirement to see stock as per project is relevant if all your inventory is sub-divided into project stock only.
    Regards,
    Dakshesh

  • Keyboard shortcut for "Save a Copy" in Acrobat 9 Pro?

    I cannot find a keyboard shortcut for Save a Copy in Acrobat 9.3.2. THere's nothing in the help docs.
    Even more bizarrely, the idiots who designed the GUI assigned the y shortcut on the File menu to both "Modify PDF Portfolio" *AND* "Save a Copy", so hitting Alt + f, y performs only the former not the latter.
    Any ideas or am I SOL?
    Thanks.

    Hi Dan,
    "Save a Copy" is Adobe Reader.
    It is not associated with Acrobat Professional's "File" drop-down.
    fwiw –
    For Acrobat Pro 9; a link to a free downloadable 13 x 19 poster in PDF format (for Windows and Mac) is at:
    http://help.adobe.com/en_US/Acrobat/9.0/Professional/WS58a04a822e3e50102bd615109794195ff-7 aee.w.html
    Be well...

  • Immediate TO for posting change

    Hi,
    Is it possible to have immediate TO for posting change?
    I have done the following setting in LE-WM Interface to Inventory Management: Assigned the reference movement to WM movement and checked the indicator for Create transfer order immediately -A.
    I am able to manually convert the psoting change notice -> TO without any error. The system also works fine in case of Automatic TO. However the system does not create TO's immediately.
    I have one  more question: During Automatic / Immediate TO creation, how does the system know the affected stock? For ex.
    In case of transfer posting using 321, how will the system  select the source?
    Regards
    Deepak

    Hi,
    I think the following may apply to your issue.
    When you post a material document in IM, and movement types both "with" and "without" automatic transfer order creation exist in that document, the system does not start the automatic transfer order creation program.
    Check out this link: http://help.sap.com/saphelp_47x200/helpdata/en/c6/f85c504afa11d182b90000e829fbfe/frameset.htm

  • Delete a row in a table

    Hi,
    My requirement in OAF is to delete a row in a table if the row doesn't have mapping to another table.
    If there is a mapping then the row must not be deleted.
    I have created two VO and formed two ROW.
    While using my code if there exists a mapping for a row in two tables, then the row doesnt get deleted.
    But i want to DELETE when there exists no reference in second table.
    The Code used in AM is
    *public void deleteOU(String ReferenceId1) {*
    OAViewObject VOB=getBLTARBOUMAPEOView1();
    Row row=VOB.getCurrentRow();
    Boolean flag=false;
    *while(row!=null) {*
    OAViewObject VOB1=getBLTINVMAPVO1();
    Row row1=VOB1.first();
    *while(row1!=null) {*
    *if((row1.getAttribute("OuReffId").equals(ReferenceId1))){*
    flag=true;
    throw new OAException("Can't delete because Inventory is Assigned for this Operating Unit",OAException.ERROR);
    *else{*
    row1=VOB1.next();
    *if(flag==false){*
    System.out.println("Remove");
    row.remove();
    Ex:
    Table1
    ReferenceId OU
    1 ABC
    2 DEF
    Table2
    ReferenceId OUID
    2 567
    In the example my code must not allow to delete the 2nd ReferenceId in Table 1.
    Please advice.
    Thanks in Advance,
    Jegan

    Hi,
    I have modified the Query, now the row deletes the next row in the table.
    For ex:
    If i click 1st row second row is deleted.
    *public void deleteOU(String ReferenceId1) {*
    OAViewObject VOB=getBLTARBOUMAPEOView1();
    Row row=VOB.getCurrentRow();
    Boolean flag=false;
    *while(row!=null) {*
    System.out.println(ReferenceId1);
    OAViewObject VOB1=getBLTINVMAPVO1();
    Row row1=VOB1.first();
    *while(row1!=null) {*
    *if((row1.getAttribute("OuReffId").equals(ReferenceId1))){*
    flag=true;
    throw new OAException("Can't delete because Inventory is Assigned for this Operating Unit",OAException.ERROR);
    *else{*
    row1=VOB1.next();
    *if(row1==null){*
    row.remove();
    *//getOADBTransaction().commit();*
    throw new OAException("Deleted Successfully",OAException.CONFIRMATION);
    Please help to solve this issue.

  • Material document no. range

    Hi experts,
    For outbound delivery, there's a material document no. range after PGI or reverse PGI. Where are this no. range defined?
    Pls advise. Thx.

    Cathy,
    Material Doc number ranges are defined in OMBT.  The path is IMG>MM>Inventory Management and Physical Inventory>Number Assignment>Define number assignment for material and phys inv docs.
    Regards,
    DB49

Maybe you are looking for