Need help!!!! GUI problems with netbeans

i have a problem with the interface i created using netbeans.
i created a JFrame, inside it a JDesktopPane, and inside that 3 JInternalFrames. the problem is in one of the JinternalFrames, i have 4 radio buttons which i forgot to add to a buttongroup and whenever i try to do that, the GUI doesn't work anymore. The bigger problem is that if i undo the changes, the thing still doesn't work and i have to copy my backup project folder over the one i work on to get an output.
i tried to edit the source code to add the 4 buttons to a button group but netbeans won't let me since i created the buttons thru it not by writing it myself
please i really need help with this and i hope its a stupid thing i'm just overlooking.
If u need the code, i will gladly post it.
thanks in advance

if you're not using a netbeans-specific layout manager, copy the working code
into notepad, make the changes, then compile and run from the command prompt.
if all works OK, dump netbeans

Similar Messages

  • I need help. Problems with ver, 10.2.152.32

    I am not very computer literate, so please be patient with me.  I will need step by step instructions - sorry.  While trying to play Zynga games - Farmtown & farmville, etc. I got a message to update my flash player if the games did not load in 10 sec.  Clicked on the link & downloaded flash player 10.2.152.32   I am still getting the message to upate, but when I updated it said it was completed.  I am not sure what to do now.  I did try uninstalling & reinstalling, but that didn't help either. I can send & receive gifts, and I can look at my neighbors, but not play the games.  Please help !!!  I have crops that are dying.  LOL
    Suzie

    From what I acn tell, I am using
    Windows 7, 64 bit, & Internet Explorer had my email wrong & had to re-register.  This is still Suzie.  Thanks

  • Urgent I need help about Problem with macbook pro

    The first sorry for my english,
    I have a macbook pro buy it me almost one year ago, and these days me the mouse remains I want and cannot do anything have to wait a few seconds and it returns to work, and also when it puts in rest it touched all the keys and the trackpad but it does not answer, I have to close the screen and wait awhile to raise it and return to react, if someone can help me it be be to him very grateful, in addition the guarantee of hardware is ended in 8 days. thank you very much

    Hi leptones, and welcome to Apple Discussions.
    I'm not sure if your warranty expires in 8 more days or it already expired 8 days ago? If you're still under warranty, I would definitely call AppleCare or go to an Apple Store or AASP; they can troubleshoot it and determine if it's something that needs fixing while you're still under warranty (if you are).

  • Need Help Troubleshooting Problem with Shared Internet Connection

    The setup:
    DSL Modem/Router
    Mac Running 10.4.4 connected to router directly, via ethernet cable
    Mac Running 10.2.8 connected to router wirelessly, via ethernet bridge
    The Mac connected by wire has no problems.
    The Mac connected by radio works perfectly with web browsers and with Apple software update, but it can't connect to the AIM server and it can't connect to the GMail POP server. It can connect to those servers via dial-up however.
    Any ideas on how to fix this?

    Could you list the make and model numbers of your dsl modem and your wireless bridge please?

  • Need help.Big problem with battery

    Hello all! I have HP Mini 110-3864sr for 3 years. I  rarely used the battery but if I do it , my notebook was working for 3-6 hours. 15 of August I left for business trip and  my HP stayed at home. When I came back on 22 of August, I switched it on, but I found that the battery doesn`t work at all. I have  Windows 7  and I see that the battery status is 0% and no  charging. I have done everything that I have found in the internet. I installed HP support assistant and did diagnostic from BIOS etc. Nothing helped, but HP support assistant says that the battery is OK. During  the test it starts charging for 15 sec and that is all. I suspect that when I left the battery was about 10% and during the  week It lost the power.
    I know that it must work because as I have said before it  cat run notebook for 3 hours +++. Please help what I have to do???
    This question was solved.
    View Solution.

    "I know that it must work because as I have said before it  cat run notebook for 3 hours +++. Please help what I have to do???"
    If you remove the battery and plug in the power adapter are you able to boot into Windows?
    If that is posssible, then your battery has most likely failed and requires replacement regardless of what the diagnostic test has told you.
    Notebook or netbook batteries are only guaranteed from new for one year. If you get three+ years of service life out of a notebook's battery, you can consider yourself quite fortunate.
    ****Please click on Accept As Solution if a suggestion solves your problem. It helps others facing the same problem to find a solution easily****
    2015 Microsoft MVP - Windows Experience Consumer

  • NEED HELP. Problem with Video iChat

    Hi there. I'm kind of new to the Mac world. I have a MacBook with Leopard. I seem to having a problem getting a video chat session up and running. I can iChat no problem but if I send a video chat invite the person gets it and accepts it but I receive an error message stating that i did not receive a response. The person that I'm sending the invite to is also on a MacBook using Tiger. I have a .Mac account and she does not. She is using her AIM account. I believe that she also received an error message about an invalid IP. Any suggestions?

    Same problem.
    But I can video chat with other people, this issue only affects 1 person, and they too can chat with other people, but when we try it fails with her seeing the IP error, I get a the other person didn't respond msg. Which just adds to the confusion. I used to be able to conference with her so this is a new error. Both video and voice only chats are affected, text chats still work.
    I'm on 10.5.1 on a G5 Mac Pro and she is on 10.4.x on an Intel MacBook Pro
    I can't be sure but it may have started after I upgraded to 10.5, but I also recently updated my Netgear (DG834G) firmware to V3.01.31. I've tried opening up various ports, checked everything that has been mentioned on here to date. The error is 100% reproducible with this specific person, and I can still conference with other people but I think they are all on 10.5.x

  • I need help : ( little problem with webcams

    yesterday buy webcams , and only on Skype got that problem :
    http://tinypic.com/view.php?pic=m81iyw&s=5
    on streaming program ( OBS - open broadcasting soft ) dont got that problem
    any got some answer what i must doing to repair that ?

    yesterday buy webcams , and only on Skype got that problem :
    http://tinypic.com/view.php?pic=m81iyw&s=5
    on streaming program ( OBS - open broadcasting soft ) dont got that problem
    any got some answer what i must doing to repair that ?

  • Need help troubleshooting problem with shadow images

    Has anyone encountered this problem and found a way to
    resolve it - I'm working in Captivate 2.
    I've created a training project that includes screens
    (slides) where popup windows appear. These popups mysteriously
    appear as faint images in a subsequent slide. The only connection
    I've been able to uncover so far is that recording the mouse click
    in the subsequent slide causes the popups from the previous slide
    to appear.
    Thank you - Info Design

    Could you list the make and model numbers of your dsl modem and your wireless bridge please?

  • Need help. Problems with word

    Microsoft Error Reporting log version: 2.0
    Error Signature:
    Exception: EXC_CRASH (SIGTRAP)
    Date/Time: 2013-12-03 22:18:01 +0000
    Application Name: Microsoft Word
    Application Bundle ID: com.microsoft.Word
    Application Signature: MSWD
    Application Version: 14.3.9.131030
    Crashed Module Name: merp
    Crashed Module Version: 2.2.4.131030
    Crashed Module Offset: 0x00004422
    Blame Module Name: Write-N-Cite Word 2011
    Blame Module Version: 4.2.891
    Blame Module Offset: 0x0003790f
    Application LCID: 3082
    Extra app info: Reg=en Loc=0x0c0a
    Crashed thread: 0

    You should contact Microsoft for Mac Support  and/or post in their forums.

  • Problem with Netbeans IDE 5.0: Building Gui

    Hello,
    I have the following problem with Netbeans IDE 5.0 (I made the same with netbeans 3.6 and it works properly):
    Step 1) Create a myJPanel class (new JPanel Form)
    Step 2) make a simple operation on myJPanel such as adding a JTable.
    Step 3) Create a myJForm Class (new JFrame Form)
    Step 4) Adding a JPanel to myJFrame (default name jPanel1)
    Step 5) Select JPanle1 within myJFrame and go to code-> custom creation code and write "new myJPanel();"
    this should set the jPanel1 (and all its contents and behaviours) created
    in step 4 equals to myJPanel();
    Step 6) run myJFrame;
    ........ and nothing happens. It is dispalyed just a gray JFrame.
    It seems that myJFrame is able to istantiate myJPanel() but is not able to paint it. what's wrong?
    Hope you may help me,
    thx

    Unfortunately, Netbeans 3.6 files and Netbeans 5 files are not compatible. Except the Java source files, Netbeans uses other aditional files such as xml files etc for forming GUI and other reasons. I have also faced the same problem with you. Good luck.

  • TS4040 I assumed this would help my problem with not being able to open apps like Preview or TextEdit since I installed Mountain Lion. Instead, first I'm prompted to enter a password, then once I do that, I get an error box telling me the Library needs re

    I assumed this would help my problem with not being able to open apps like Preview or TextEdit since I installed Mountain Lion. Instead, first I'm prompted to enter a password, then once I do that, I get an error box telling me the Library needs repairing. So I click on Repair, and once again I'm prompted for a password, which I enter, then the same error box opens, and so it goes. Can anyone help me with this problem? I'd greatly appreciate it.
    Thor

    Back up all data. Don't continue unless you're sure you can restore from a backup, even if you're unable to log in.
    This procedure will unlock all your user files (not system files) and reset their ownership and access-control lists to the default. If you've set special values for those attributes on any of your files, they will be reverted. In that case, either stop here, or be prepared to recreate the settings if necessary. Do so only after verifying that those settings didn't cause the problem. If none of this is meaningful to you, you don't need to worry about it.
    Step 1
    If you have more than one user account, and the one in question is not an administrator account, then temporarily promote it to administrator status in the Users & Groups preference pane. To do that, unlock the preference pane using the credentials of an administrator, check the box marked Allow user to administer this computer, then reboot. You can demote the problem account back to standard status when this step has been completed.
    Triple-click the following line to select it. Copy the selected text to the Clipboard (command-C):
    { sudo chflags -R nouchg,nouappnd ~ $TMPDIR.. ; sudo chown -Rh $UID:staff ~ $_ ; sudo chmod -R u+rwX ~ $_ ; chmod -R -N ~ $_ ; } 2> /dev/null
    Paste into the Terminal window (command-V). You'll be prompted for your login password, which won't be displayed when you type it. You may get a one-time warning to be careful. If you don’t have a login password, you’ll need to set one before you can run the command. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator.
    The command will take a noticeable amount of time to run. Wait for a new line ending in a dollar sign (“$”) to appear, then quit Terminal.
    Step 2 (optional)
    Step 1 should give you usable permissions in your home folder. This step will restore special attributes set by OS X on some user folders to protect them from unintended deletion or renaming. You can skip this step if you don't consider that protection to be necessary, and if everything is working as expected after step 1.
    Boot into Recovery by holding down the key combination command-R at startup. Release the keys when you see a gray screen with a spinning dial.
    When the OS X Utilities screen appears, select
    Utilities ▹ Terminal
    from the menu bar. A Terminal window will open.
    In the Terminal window, type this:
    res
    Press the tab key. The partial command you typed will automatically be completed to this:
    resetpassword
    Press return. A Reset Password window will open. You’re not  going to reset a password.
    Select your boot volume ("Macintosh HD," unless you gave it a different name) if not already selected.
    Select your username from the menu labeled Select the user account if not already selected.
    Under Reset Home Directory Permissions and ACLs, click the Reset button.
    Select
     ▹ Restart
    from the menu bar.

  • GUI problem with UNIX

     

    Hi Vasundhara,
    Try grouping the widgets in to a panel.
    Thanks,
    Madhu
    -----Original Message-----
    From: vasundhara [mailto:[email protected]]
    Sent: Wednesday, April 25, 2001 9:15 AM
    To: [email protected]; Joseph Mirwald
    Subject: Re: (forte-users) GUI problem with UNIX
    Hi Joseph
    We are using Forte 3.0 M2 on Solaris 5.8 The problem is with the push
    buttons, After we grid the controls and they look intact in the NT
    environment, but when we open the same window in SOlaris the controls are
    far apart.Do you have any idea about this?
    Regards
    Vasundhara
    ----- Original Message -----
    From: Joseph Mirwald <mailto:[email protected]>
    To: vasundhara <mailto:[email protected]> ;
    [email protected] <mailto:[email protected]>
    Sent: Wednesday, April 25, 2001 10:13 AM
    Subject: Re: (forte-users) GUI problem with UNIX
    Hello vashundara,
    please say which Version of Forte and which kind/version your UNIX OS is.
    There are some problems on AIX V4.3.x (Motif 2.x) and older releasese of
    Forte (up to Forte 3.M.x) and so on and it is necessary to look what it is.
    Maybe it is possible for you to say which widgets are the problem.
    Thanks forward
    Joseph Mirwald
    At 15:25 23.04.01 +0530, vasundhara wrote:
    Hi
    We are facing a strange problem when we try to port our application from NT
    to UNIX. The problem is that the GUI doesnt come properly. As per my
    knowledge gridding all the controls on the GUI shouldnot create this
    problem, but inspite of this we are facing it. Did anyone comeacross this
    situation?
    Thanks in advance
    Regards
    Vasundhara N.C
    Wisor Telecom Pvt Ltd
    Bangalore
    India

  • Genius needs to help! problems with my video card and system

    Hey guys! I'm going to post my specs first so that you get a good idea of what I'm running on:
    MSI Neo2 LS 865PE.....MAT=Slow
    Pentium4 2.4C.....FSB=233=2.8C hyperthreading enabled ~>1.55V
    Corsair TwinX 1gig PC3700.....memory on "AUTO" in BIOS with timings at 3,4,4,8 ~> 2.7V
    Radeon 9700NP.....stock speeds ~>1.7V
    AlienX case with 2 fan400 watt power supply and 6 case fans
    Zalman Alum/Copper heatsink fan
    1:I've had this motherboard for a few months now. I upgraded my video card from a nVidia Ti4200(128meg) to a Radeon 9800 a month ago, but I couldn't get it working at 8X AGP, no matter what voltages I threw at it. I returned it for a Radeon 9700NP hoping that it would work, but it still won't.
    I'm using BIOS 1.9 and since there is no option to select your AGP speed, I could only try using ATI's drivers. Once booted into Windows, there is a slider you can move to select you AGP speed. On my machine It says that It has performed some tests and has concluded that AGP 4x is the best for my system....but my system supports AGP 8X!
    I've moved the slider over to 8x (which requires a reboot) at least 5 times with each card but the slider refuses to move past 4xAGP after the reboot.
    2: My second problem: I had an old stick of KingMax PC3200 and decided to buy 3 more sticks. Unfortunatly, the 3 I bought did not match the one I had, so I only put 2 of the new sticks I bought into my system. Immediatly, My system would crash, lock up, files were corrupt, and I got PLENTY of blue screens of death with a long message containing: 0x0000007  with all these other numbers and "0"s. I did a search online and found out I had a hardware incompatibility problem. I never got this with my old stick of ram.
    I returned the 3 sticks of Ram and replaced them with the Corsair. Put my new Radeon 9700 in, formatted my hard drive....and within 24 hours, my system locked up 3 times, rebooted itself 5 times, and gave me the same BSOD as mentioned above with the same long message.  
    I didn't change anything except for the memory and the video card. I've been wanting to overclock, (thats why i bought the faster memory   ) but I'm not sure what to do at this point.
         I have my FSB at 233 but I'm scared to go any higher because of previous system instability at stock speeds. My RAM was running on 400 and MAT=Turbo with the most relaxed timings at 3,4,4,8.
    I've given myself hours of sleepless nights formatting when my system wouldnt boot into windows; overclocking....etc. I NEED HELP. PLEASE. PLEASE. Anything could work at this point.  
         I'm trying to get more info on how to run my system at a 5:4 ratio, also.  
    If anyone has problems like me or knows what could be the problem with my system, please reply to this post, it would help me a lot. I've been trying to fix these problems for a few months now so anything is greatly appreciated.  

    Thanks a lot to you guys that responded. I brought my computer home this past holiday and I want to let you know where I stand as of now. I guess this thread is like my blog for my computer. I want to clear some things before my first post makes everyone confused.
    1- I have only 2 sticks of memory in my system: the Corsair PC3700 TwinX 512x2
    I returned the 3 KingMax I bought, and still keep my old stick just in case.
    2- I am using the 400 watt power supply that came with the case. I read some reviews of the case and I know the reviewer did not have problems with the power supply. In my BIOS, there are some voltages it is weak on. Lets say: it it should be 5.00+, my power supply will be feeding it 4.96v or something like that, but I dont know, or think, that is a major problem...
    3- My computer will refuse to boot if memory speeds are set at anything below 400. SO....if I want to use a 5:4 ratio and have to set my memory speeds to "333" in BIOS, my system refuses to boot.
    4- This morning, I did manage to overclock my FSB to 250. Specs are as follow:
    Memory Timing @3,4,4,8,4.....speed set at "AUTO".....MAT at "SLOW"
    MY 2.4C's FSB was raised to 250 = 3.0gig  
    AGP/PCI frequency: 67.xx/3x.xx (cant go any lower)
    CPU voltage: 1.5500
    Memory voltage: 2.75
    Video Card voltage: 1.7
         Everything was fine for the whole day until I heard something click in my computer around midnight, and then seconds later, my computer froze and made a continuous beeeeeeeeeeeeeeeeeep. (you can imagine)
         This "click" and system crash has been plaguing me for months now. I dont know whay it happens. I was just using AIM when I heard the click and my heart stopped.
    My memory speeds have been set to "AUTO" even at the FSB of 250. But I don't know if this still means my system is at a 1:1 ratio. I know the BIOS then adjusts the memory to work at 500 if my FSB is 250...so I assume it is?    I love 3gig, but somehow I feel that 2.8 is faster, since the FSB=233 running parallel to my memory, also at 233
    A FSB of 250 is good enough for me, that's what I've been waiting 6 months for. If anyone knows how to set other ratios to achieve a FSB of 250+, please let me know, but as I said, my memory won't boot if its set at "333"

  • GUI - Problem with GridBag

    Hi everyone,
    I have been trying to get this GUI built from the ground up and I have encountered a problem with the GridBag(exception error that the fields being added can not be done. Also, my method main seems to be off track, I have a working program which the display fields have been modified to display object and everything else is the same except that I can not get the GUI to run.
    The following is the code and any suggestions as to what I can do to get this going will be appreciated. Thank you.
    import javax.swing.JLabel; /* displays text and images*/
    import javax.swing.SwingConstants; /* common constants used with Swing*/
    import javax.swing.Icon; /* interface used to manipulate images*/
    import javax.swing.ImageIcon; /* loads images*/
    import javax.swing.JOptionPane;
    import java.util.*;
    import java.io.PrintStream;
    import java.text.DecimalFormat;
    import java.text.NumberFormat;
    import java.text.*;     
    import javax.swing.JFrame;/* provides basic window features*/     
    import java.util.Arrays;
    import javax.swing.ImageIcon.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.awt.*;
    public class FinalInventoryGUI extends JFrame
    {//Private variables.
    private GridBagLayout layout = new GridBagLayout();
    private GridBagConstraints constraints = new GridBagConstraints();
    //Private data from main program
    private String productName;
    private String itmeNumber;
    private double unitPrice;
    private int unitStock;
    private double productValue;
    private double inventoryValue;
    private double reStkfee;
    //Declaration of the JLabels.
    private JLabel logoLabel;
    private JLabel productNameLabel;
    private JLabel itemNumberLabel;
    private JLabel unitPriceLabel;
    private JLabel unitStockLabel;
    private JLabel productValueLabel;
    private JLabel InventoryValueLabel;
    private JLabel reStkfeeLabel;
    //Declaration of the text Fields for data Entry.     
    private JTextField productNameText;
    private JTextField itemNumberText;
    private JTextField unitPriceText;
    private JTextField unitStockText;
    private JTextField productValueText;
    private JTextField inventoryValueText;
    private JTextField reStkfeeText;
    private JTextField titleText;
    //Declaration of the JButtons for user interface.
    private JButton first;//To move to first element in the array.
    private JButton next;//To move to next element in the array.
    private JButton previous;//To move to next element in the array.
    private JButton lastButton;//To move to the first element in the array.
    private JButton addButton;//To add a product to the array.
    private JButton modifyButton;//To modify an element in the array.
    private JButton deleteButton;//To remove a product from the array.
    private JButton saveButton;//To save the array elements to C:\.
    private JButton searchButton;//To search for an element in the array.
    private Product products[];//Declaration of array product[] for storing entries.
    private int NumOfProducts;//Declaration of the variable defining the number of products.
    private int Index=0;//Setting the counter index to initiate at "0".
    //Constants
    private final static int LOGO_WIDTH  = 4;
    private final static int LOGO_HEIGHT = 4;
    private final static int LABEL_WIDTH  = 1;
    private final static int LABEL_HEIGHT = 1;
    private final static int TEXT_WIDTH  = LOGO_WIDTH-LABEL_WIDTH;
    private final static int TEXT_HEIGHT = 1;
    private final static int BUTTON_WIDTH  = 1;
    private final static int BUTTON_HEIGHT = 1;
    private final static int LABEL_START_ROW = LABEL_HEIGHT+LABEL_WIDTH+1;
    private final static int LABEL_COLUMN = 0;
    private final static int TEXT_START_ROW = LABEL_START_ROW;
    private final static int TEXT_COLUMN = LABEL_WIDTH+1;
    private final static int BUTTON_START_ROW = LABEL_START_ROW+9*LABEL_HEIGHT;
    private final static int BUTTON_COLUMN = LABEL_COLUMN;
    private final static int SEARCH_START_ROW = BUTTON_START_ROW+3;
    final static String EMPTY_ARRAY_MESSAGE = "Hit ADD to add a new PRODUCT";
    //Constructor-New instance of the JLabelTextFieldView.
    public FinalInventoryGUI( Product productsIn)
        {//Passing the frame title to JFrame, set the IconImage.
             super("Welcome To The Inventory Program");
             setLayout(layout);
             //Copy the input array(products).
             setProduct(productsIn);//maybe the title?????
             //Start the display with the first element of the array.
             index = 0;
             //Build the GUI
             buildGUI();
             //Values
             updateAllTextFields();
             }//End of the constructor for building the GUI.
             //Methods for copying the input of Product array to the GUIs private array
             //variable
             private void setInventoryArray(Product productsIn[])
                  products = new Product[productIn.length];
                  for (int i = 0; i<products.length; i++)
                  {//Creates A Product array element from the input array.
                       prodcuts[i] = new Product(productIn);
                   products[i] = new Product(productIn[i].productName(), productIn[i].itemNumber(),
                                                      productIn[i].unitStock(), productIn[i].unitPrice());
              //System prints out a ineof the productsIn array to a string.
         }//End of the for statment.
         }//End for copying the array.
         //A method for updating each of the GUIs fields.
         private void updateAllTextFields()
              if(products.length > 0)//Then update the JTextField display.
              {// Update the product name text field.
              productNameText.setText(products[index].productName());
              //Update the Update the itemNumber text field.
              itemNumberText.set(String.format("%d", products[index].itemNumber()));
              //Update the title text field.
              titleText.setText(dvd[index].title());
              //Update the unitStock text field.
              unitStockText.setText(String.format("%d",products[index].unitStock()));
              //Update the unit price textField.
              unitPriceText.setText(String.format("$%.2f",products[index].unitPrice()));
              //Update the productValue textField.
              productValueText.setText(String.format("$%.2f", products[index].productValue()));
              //Update the restocking fee text field.
              reStkfeeText.setText(String.format("$%.2f",reStkfee()));
              //Update the total value of the inventory text field.
              inventoryValueText.setText(String.formtat("$%.2f",Product.productValue(products)));
              }//End of the if statement.
              else//Put a special message in the fields.
              {//Update the productName textField.
              productNameText.setText(EMPTY_ARRAY_MESSAGE);
              //Update the itemNumber textField
              itemNumberText.setText(EMPTY_ARRAY_MESSAGE);
              //Update the title textField.
              titleText.setText(EMPTY_ARRAY_MESSAGE);
              //Update the units in stock textField.
              unitStockText.setText(EMPTY_ARRAY_MESSAGE);
              //Update the unitPrice textFied.
              unitPriceText.setText(EMPTY_ARRAY_MESSAGE);
              //Update the productValue textField.
              productValueText.setText(EMPTY_ARRAY_MESSAGE);
              //Update the restocking fee textField.
              reStkfeeText.setText(EMPTY_ARRAY_MESSAGE);
              //Update the totatl inventoryValue textField.
              inventoryValueText.setText(EMPTY_ARRAY_MESSAGE);
              }//End else
         }//Set the appropriate fields editable or uneditable.
         private void setModifiableTextFieldsEnabled(Boolean state)
         {//The fields of the product name, item number, unit price,
         // and stock can be editable or non editable.
         itemNumber.setEditable(state);
         productName.setEditable(state);
         unitPrice.setEditable(state);
         unitStock.setEditable(state);
         }//End setting of the modifiable textFields.
         //Methods for the JButton methods.
         private class ButtonHandler implements ActionListener
              public void actionPerformed(ActionEvent event)
              {//This is the first button being pressed by the user.
                   if(event.getSource()==firstButton)
                        handleFirstButton();
                   }//End if
                   else if(event.getSource()==previousButton)//Button previous is pressed by user.
                        handlePreviousButton();
                   }//End else if
                   else if (event.getSource()==nextButton)//Button next is pressed by user.
                        handleNextButton();
                   }//End else if.
                   else if (event.getSource()==lastButton)//Button last is pressed by the user.
                        handleLastButton();
                   }//End else if.
                   else if(event.getSource()==firstButton)
                        handleFirstButton();
                   }//End else if.
         }//End metod of actionPeformed.
         }//End class ButtonHandler
         //Displaying the first element of the Product array
         private void handlerFirstButton()
         {//Setting the index to the first element in the array.
              index = 0;
         //Update and disable modification
         updateAllFields();
         setModifiableTextFieldsEnabled(false);
         }//End method for handling the first button.
         //Displaying the next element of the products array or wrap to the first.
         private void handleNextButton()
         {//Incrementation of the index.
         index++;
         //If the index exceeds the last valid array element, wrap around to the first
         //element of the array.
         if(index > products.length-1)
              index = 0;
         }//End if statment.
         //Update and disable the modification.
         updateAllFields();
         setModifiableTextFieldsEnabled(false);
         }//End method of handleNextButton.     
         private void handlePreviousButton()
              index--;
              if(index < 0)
                   index = products.length -1;
              }//End if statment.
              //Update and disabe modification.
              updateAllTextFields();
              setModifiableTextFieldsEnabled(false);
         }//End method of handlePreviousButton.
         private void handleLastButton()
              index--;
              if(index < products.length -1)
                   index = 2;
              }//End if statment.
              updateAllTextFields();
              setMdifiableTextFieldsEnabled(false);
              }//End method for handleLatButton
         //The textFieldHandler class - handling the events of the buttonsmethods
         private class TextFieldHandler implements ActionListener
              public void actionPerformed(ActionEvent event)
              {//The user pressed "ENTER" in the JTextField "title" text.
              if(event.getSource() == itemNumber)
                   //HandleItemNumberTextField()is fired.
              }//End the if statement.
              //The user pressed "ENTER" in the JTextField "title" text.
              else if (event.getSource() == titleText)
                   //HandleTitleTextField() is fired.
              }//End the if statement.
         //The user pressed "ENTER" in the JTextField "unitStoc" text.
              else if(event.getSource() == unitStockText)
                   //HandleUnitStockTextField() is fired.
              }//End the if statment
              //The user pressed "ENTER" in the JtextField "unitPrice" text.
              else if (event.getSource() == unitPriceText)
                   //HandleUnitPriceTextField() is fired.
              }//End the if statment.
         //The user pressed "ENTER" in the JTextField "Search" text.
         else if(event.getSource() == searchText)
              //HandleSearchTextField() is fired.
         }//End the if statment.
              }//End the method actionPerformed.
         }//End the inner class TextFieldhandler.
              //The GUI methods.
              //Building the GUI.
              private void BuildGUI()
              {//Mthod for adding the LOGO.
              buildLogo();
              //Add the text fields and their labels.
              buildLabels();
              buildTextFields();
              //Add the navigation and other buttons.
              buildMainButtons();
              //Provide value to the Fields.
              updateAllTextFields();
              //provide some setup to the frame.
                        setSize(FRAME_LENGTH, FRAME_WIDTH);
                        setLocation(FRAME-XLOC, FRAME_YLOC);
                        setResizable(false);
                        //PACK(); IS THIS NOT PART OF THE GUI ADDED AT THE END OR IS WHAT
                        //FOLLOWS THE SAME AS SAYING ".PACK()".
                        setDefaultCloseOperation(EXIT_ON_CLOSE);//DOES IT MATTER WHERE THIS LINE FALLS?
                        //WHEN I TRIED TO USE IT IN THE MAIN I RECEIVED AN ERROR AND THE SAME WHEN I
                        //PLACED IT IN THE CONSTRUCTOR--WHY?.
                        setVisible(true);
              }//End of building the GUI.
              //Addin the LOGO to the Frame.
              private void buildLogo()
                   constraints.weightx = 2;
                   constraints.weigthy = 1;
                   logoLabel = new JLabel(new ImageIcon("O2K.jpg"));
                   logoLabel.setText("Products Inventory");
                   constraints.fill = GridBagConstraints.BOTH;
                   addToGridbag(logoLabel,2,2,LOGO_WIDTH, LOGO_HEIGHT);
                   //Creating a vertical space.
                   addToGridBag(new JLabel(""),LOGO_HEIGHT+1,0, LOGO_WIDTH, LABEL_WIDTH);
              }//End the method with building the LOGO.
                   //Build the panel just containing the text.
                   private void buildLabels()
                   {//Set up if for readability).
                   int rows = 0;
                   int column = 0;
                   int width = 0;
                   int height = 0;
              column = LABEL_COLUMN;
              width = LABEL_WIDTH;
              height = LABEL_HEIGHT;
                   constraints.weightx = 1;
                   constraints.weighty = 0;
                        constraints.fill = GridbagConstraints.Both;
                        //Create the name labes and name the TextFields.
                        productNameLabel = new JLabel("Product Name:");
                        productnamelabel.setLabelfor(productNameField);
                        productNameLabel.setLabelFor(productNameText);
                        productNameLabel.setToolTipText("Enter The Product Name Here");
                        row = Label_START_ROW;          
                        addToGridBag(productNameLabel, row, column, width, height);
                        //Create the itemNumberLabel and TextField.
                        itemNumberLabel = new JLabel("Product Id:");
                        itemNumberLabel.setLabelFor(itemNumberText);
                        row += LABEL_HEIGHT;
                        addToGridBag(itemNumber, row, column, width, height);
                        //Create the title label for the Product and the title text field.
                        titleLabel = new JLabel("Inventory Of Products:");
                        titleLabel.setLabelFor(titleText);
                        row += LABEL_HEIGHT;
                        addToGridBag(titleLabel,row,column,width,height);
                        //Create the unitStock label and textField.
                        unitStockLabel = new JLabel("Units In Stock:");
                        unitStockLabel.setLabelFor(unitStockLabel);
                        row += LABEL_HEIGHT;
                        addToGridBag(unitStocklabel, row, column, height);
                        //Creat the unitPrice label and textField.
                        unitPriceLabel = new JLabel("Unit Price");
                        unitPriceLabel.setLabelFor(unitPriceLabel);
                        unitPriceLabel.setToolTipText("The Cost Of The Product");
                        row += LABEL_HEIGHT;
                        addToGridBag(unitPriceLabel, row, column, height);
                        //Create the productValue label and textField.
                        productValueLabel = new JLabel("Total Product Value:");          
                        productValueLabel.setLabelFor(productValueLabel);
                        row += LABEL_HEIGHT;
                        addToGridBag(productValue, row, column, height);
                        //Create the restocking fee of 1.05% Label and textField.
                        reStkfeeLabel = new JLabel("Product Restock Fee:");
                        reStkfeeLabel.setLabelFor(reStkfeeLabel);
                        row+= LABEL_HEIGHT;
                        addToGridBag(reStkfee, row, column, height);
                        //Create a vertical space.
                        row += LABEL_HEIGHT;
                        //Create the Total Inventory Value label and textField.
                        inventoryValueLabel = new JLabel("Total Inventory Value:");
                        inventoryValueLabel.setLabelFor(inventoryValueLabel);
                        row += LABEL_HEIGHT;
                        addToGridBag(inventoryValue, row, column, height);
              }//End the method for building the labels
                        //Build the methods for the TextFields.
                        private void buildTextFields()
                             {//Defining the variables
                             int row = 0;
                             int column = 0;
                             int width = 0;
                             int height = 0;
                             column = TEXT_COLUMN;
                             width = TEXT_WIDTH;
                             height = TEXT_HEIGHT;
                             constraints.fill = GridBagConstraints.BOTH;
                             constraints.weightx = 1;                    
                             TextFieldHandler handler = new TextFieldHandler();
                             productNameText = new JTextField("Product Name");
                             productNameText.setEditable(false);
                             row = TEXT_START_ROW;
                             addToGridBag(productNameText, row, column, height);
                        itemNumberText = new JTextField("Product Id");
                        itemNumberText.setEditable(false);
                        row = TEXT_START_ROW;
                        addToGridBag(itemNumberText, row, column, height);
                        titleText = new JTextField("Title");
                        titleText.addActionListener(handler);
                        titleText.setEditable(false);
                        row += TEXT_HEIGHT;
                        addToGridBag(titleText, row, column, height);
                        unitPriceText = new JTextField("Unit Price");
                        unitPriceText.addActionListener(handler);
                        unitPrice.setEditable(false);
                        row += TEXT_START_ROW;
                        addToGridBag(unitPriceText, row, column, height);
                        unitStockText = new JTextField("Units In Stock");
                        unitStockText.addActionListener(handler);
                        unitStockText.setEditable(false);
                        row += TEXT_START_ROW;
                        addToGridBag(unitStockText, row, column, height);
                        productValueText =new TextField("Product Value");
                        productValueText.addActionListener(handler);
                        productValueText.setEditable(false);
                        row += TEXT_START_ROW;
                        addToGridBag(productValueText, row, cloumn, height);
                             reStkfeeText =new JTextField("Restock Fee");
                        reStkfeeText.addActionListener(handler);
                        reStkfeeText.setEditable(false);
                        row += TEXT_START_ROW;
                        addToGridBag(reStkfeeText, row, cloumn, height);
                        //Creat vertical space.
                        row += TEXT_HEIGHT;
                        addToGridBag(new JLabel(""),row, column, height);
                        inventoryValueText =new TextField("Inventory Value");
                        inventoryValueText.addActionListener(handler);
                        inventoryValueText.setEditable(false);
                        row += TEXT_START_ROW;
                        addToGridBag(inventoryValueText, row, cloumn, height);
                        }//End the methods for building the TextFields.
                             //Add the main buttons to the frame.
                   private void buildMainButtons()
                             {//Declaraing the variables.
                             int row = 0;
                             int column = 0;
                             int width = 0;
                             int height = 0;                         
                             row =BUTTON_START_ROW;
                             column = BUTTON_COLUMN;
                             width = BUTTON_WIDTH;
                             height = BUTTON_HEIGHT;
                             constraints.weightx = 1;
                             constraints.weighty = 0;                         
                             //The constraints.fill = GridBagConstraints.HORIZONTAL;
                             ButtonHandler handler = new ButtonHandler();
                             //Creat a veritical space.
                             addToGridbag(new JLabel(""), row, column, width, height);
                             firstButton = new JButton("First");
                             firstButton.addActionListener(handler);
                             row += LABEL_HEIGHT;
                             addToGridBage(firstButton, row, column, width, height);                         
                             previousButton = new JButton("Previous");
                             previousButton.addActionListener(handler);
                             row += LABEL_HEIGHT;
                             addToGridBage(previousButton, row, column, width, height);     
                             nextButton = new JButton("Next");
                             nextButton.addActionListener(handler);
                             row += LABEL_HEIGHT;
                             addToGridBage(nextButton, row, column, width, height);     
                             lastButton = new JButton("Last");
                             lastButton.addActionListener(handler);
                             row += LABEL_HEIGHT;
                             addToGridBage(lastButton, row, column, width, height);     
                             addButton = new JButton("Add");
                             addButton.addActionListener(handler);
                             row += LABEL_HEIGHT;
                             addToGridBage(addButton, row, column, width, height);                         
                             deleteButton = new JButton("Delete");
                             deleteButton.addActionListener(handler);
                             row += LABEL_HEIGHT;
                             addToGridBage(deleteButton, row, column, width, height);
                             saveButton = new JButton("Save");
                             saveButton.addActionListener(handler);
                             row += LABEL_HEIGHT;
                             addToGridBage(saveButton, row, column, width, height);     
                             searchButton = new JButton("Search");
                             searchButton.addActionListener(handler);
                             row += LABEL_HEIGHT;
                             addToGridBage(searchButton, row, column, width, height);                         
                        //End methods for building the main butt0ns.
         private void addToGridBag(Component component, int row, int column, int width, int height)
         {               //Set up the upper-left corner of the component gridx and gridy.
                             constraints.gridx = column;
                             constraints.gridy = row;
                             //Set the numbers of rows and columns the components occupies.
                             constraints.gridwidth = width;
                             constraints.gridheight = height;
                             //set the constraints
                             Layout.setConstraints(component, constraints);
                             //Add the component to the JFrame.
                             add(component);                    
                        }//End method for addGridBag.                     
              //End class JLabelTextFieldViewGui.
    class Invetnory4
              public static void main(String args[])
                        {   //An array variable.
                             Product[]inventory;
                             inventory = new Product[10];
                             //Create and pass control to the GUI
                             FinalInventory gui = new FinaInventoryGUI(inventory);           
                        }//End method main
                   }//End class Inventory4     
    /*Inventory.java*/
    /*Means for importing program packages*/
    /*Beginning of the class type Inventory*/

    Hi Bryan,
    I took your advice and decided to take a different approach to the problem I am having, I decided to stay somewhat with the basics with little knowledge I have about coding. I am new to this and I am trying to learn through the fire but it's getting hot so if you don't mind, can you tell me what I need to do to fix the error messages I am getting.
    1. "else" without "if',
    2. can't load my icon-a JPG
    3. exception in thread amin
    process complete.
    4.Text area for displaying an iteration of the input
    the code is not as long as the other one! any help will be appreciated. Also I am attaching the code to the GUI that does work but I can not seem to get the actionListener aspect to work. Thanks again.
      //this one works and it serves as a model for what I am //trying to do in the fields. as well as designate a text area                                                              //where a each entry per iteration of input is displayed
    * @(#)InventoryGUIFrame.java
    * @author
    * @version 1.00 2008/2/2
    package components;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import javax.swing.ImageIcon;
    import javax.swing.event.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
    import java.text.*;
    import java.awt.*;
    * FormattedTextFieldDemo.java requires no other files.
    * It implements a mortgage calculator that uses four
    * JFormattedTextFields.
    public class InventoryGUIFrame extends JFrame
              String productName;
              String itemNumber;
              double unitPrice;
              double unitStock;
              //Labels to identify the fields
              private JLabel productNamelabel;
              private JLabel itemNumberlabel;
              private JLabel unitPricelabel;
              private JLabel unitStocklabel;
              //Fields for data Entry     
              private JTextField productNameField;
              private JTextField itemNumberField;
              private JTextField unitPriceField;
              private     JTextField unitStockField;
                   //Adding the JButtons
              JButton firstButton;
              JButton nextButton;
              JButton previousButton;
              JButton searchButton;
              JButton addButton;
              JButton deleteButton;
              JButton saveButton;
              //Constructor          
    public InventoryGUIFrame()
             super("Welcome To The Inventory Program");
             setLayout(new FlowLayout());
             setDefaultCloseOperation(EXIT_ON_CLOSE);
             JFrame Frame = new JFrame();
             Frame JPanel = new Frame();
             JPanel  JLabel= new JPanel();
             TextArea area = new TextArea();
         productNamelabel = new JLabel("PRODUCT  NAME");
         productNamelabel.setToolTipText("Name of the item you wish to calculate");
        add(productNamelabel);
         productNameField= new JTextField(8);
         add(productNameField);
         itemNumberlabel = new JLabel("PRODUCT  NUMBER");
         itemNumberlabel.setToolTipText("Number identifying the product");
         add(itemNumberlabel);
         itemNumberField =new JTextField(5);
         add(itemNumberField);
         unitPricelabel=new JLabel("PRODUCT  PRICE");
         unitPricelabel.setToolTipText("What is the cost of the product?:");
         add(unitPricelabel);
         unitPriceField = new JTextField(5);
         add(unitPriceField);          
         unitStocklabel = new JLabel("UNITS  IN  STOCK");
         unitStocklabel.setToolTipText("How many products in inventory?:");
         add(unitStocklabel);
         unitStockField = new JTextField(5);
         add(unitStockField);
         firstButton =new JButton("First");
         add(firstButton);
         nextButton = new JButton("Next");
         add(nextButton);
         previousButton = new JButton("Previous");
         add(previousButton);
         addButton = new JButton("Add");
         add(addButton);
         deleteButton = new JButton("Delete");
         add(deleteButton);
         saveButton = new JButton("Save");
         add(saveButton);
         searchButton = new JButton("Search");
         add(searchButton);
         public static void main(String args[])
         InventoryGUIFrame frame  = new InventoryGUIFrame();
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         frame.setSize(740,150);
         frame.setVisible(true);
      class InventorySystem6
    {     /*Declaration of products[] and the maximum storing capacity*/
       private Product products[] = new Product[MAX_NUM_OF_PRODUCTS];
       /*Prompts user to make another selection or exit program*/
       private static final String STOP_COMMAND = "stop";
            /*parameters defining maximun numbers of products available for storing in */
    private static final int MAX_NUM_OF_PRODUCTS = 100;
    /*Declaration of the variables */
    String name;
    String item;
    double stock;
    double price;
    double reStkfee=1.05;
    double pValue;
    double iValue;
    public InventorySystem6()
         /*Empty Constructor*/
    }/*Beginning of product input by the user*/
    public void inputProductInfo()
    {     /*Declaration of currency format*/     
                   DecimalFormat Currency = new DecimalFormat();
                   Scanner input = new Scanner(System.in);
                   /*Beginning of the Loop*/
                   JOptionPane.showMessageDialog(null,"Welcome to the Inventory Program\n","Welcome to the Inventory Program\n",
                   JOptionPane.PLAIN_MESSAGE);               
                   for(int i = 0; i<MAX_NUM_OF_PRODUCTS ; i++)
                   name = JOptionPane.showInputDialog( "What is the Product Name? ");
                   if(name.equalsIgnoreCase("stop"))
                   break;
         String item = JOptionPane.showInputDialog("Enter the products ID");
         String priceStr =JOptionPane.showInputDialog("Enter the products price");
         double price=Double.parseDouble(priceStr);
                   String stockStr=JOptionPane.showInputDialog("Enter the units in stock " );
                   double stock = Double.parseDouble(stockStr);          
                   double sum=price*stock;
              JOptionPane.showMessageDialog(null,"The product value is:"+sum, "pValue",
              JOptionPane.PLAIN_MESSAGE);
                   /* JOptionPane.showMessageDialog(null,"The Product Name is:"+productName, "productName"
                   ,"\n","The Product Id is "+productId,"Product ID"
                        ,"\n","The Unit Price is"+unitPrice,"Unit Price"
                             ,"\n","The Units In Stock is"+unitStock,"UnitStock"
                                  ,"\n","The Product Value is"+productValue, "productValue"
                                       ,"\n","The Restocking Fee is "+reStockfee,"Restock Fee"
                                            ,"\n","The Inventory Value is"+inventoryValue,"Inventory Value"
                                                 ,"\n","The Inventory Restock Fee is"+reStockfee,"Restock Fee"
                                                      ,"\n",JOptionPane.PLAIN_MESSAGE);*/
              //Product products[] = new Product[100];
                   products[i] = new Product();
                   products[i].setitem(item);
                   products[i].setname(name);
                   products[i].setprice(price);
                   products[i].setstock(stock);
                   products[i].setpValue(sum);
                   products[i].setreStkfee(reStkfee);
                   iValue += sum + products[i].getreStkfee();
    public void displayProductInfo()
    { /*Initialization of the variable total inventory value*/
    NumberFormat moneyFormat = NumberFormat.getCurrencyInstance();
    for(int i = 0; i<MAX_NUM_OF_PRODUCTS ; i++)
              Product product = products[i];
              if(product==null)
              System.out.println(products[i]);
                   break;
         System.out.printf("product name: %s\n ", product.getname());
         System.out.printf("product ID: %s \n", product.getitem());
         System.out.printf("Unit Price: %s \n", moneyFormat.format(product.getprice()));
         System.out.printf("units in Stock: %s \n", product.getstock());
         System.out.printf("Total product Value: %s \n", moneyFormat.format(product.getpValue()));
         System.out.printf("Restocking fee: %s \n", moneyFormat.format(product.getreStkfee()));
         System.out.printf("Inventory Value: %s \n", iValue);
    }/*Beginning of method main*/
    public static void main(String[] args)
    {/*Message*/
         /*Means for retrieving and storing new data input into inventory program*/
    InventorySystem6 JTableImageCreator = new InventorySystem6();
    JTableImageCreator.displayProductInfo();
    JTableImageCreator.inputProductInfo();
    class Product
    /*Declaration of and default value of specified variables*/
    //private Product products[] = new Product[100];
    private String item;
    String name;
    private double stock;
    private double price;
    private double pValue;
    private double reStkfee;
    //private String productNames[] = new String[1000]; //declaration of array "productNames" to store Product Names
    private double iValue;
    /*method defining the get and set values of each individual variable*/
    public String getname()
    {/*Mean for storing and retrieving input of name*/
    return name;
    }/*Means for setting the product name*/
    public void setname(String name)
    {/*null pointer argument exception defining metod for obtainng product name*/
    this.name = name;
    }/*Means for getting the units identifcation number inputted by the user*/
    public String getitem()
    {/*Means for returning the user input*/
    return item;
    }/*Means for setting the units identifcation */
    public void setitem(String item)
    {/*null pointer argument exception for setting the product identification number*/
    this.item = item;
    }/*Means for getting the units value input*/
    public double getstock()
    {/*Means for returning the variable of the units*/
    return stock;
    }/*Means for setting the units value*/
    public void setstock(double stock)
    this.stock = stock;
    public double getprice()
    {/*Means for returning the dollar value of the price of the unit(s)*/
    return price;
    }/*Means for setting and requesting user to input + dollar amt*/
    public void setprice(double price)
    this.price = price ;
    }/*Means for setting the value of the total product value*/
    public void setpValue(double pValue)
    this.pValue = pValue+(price*stock);
    }/*Means for getting the value of the product*/
    public double getpValue()
    {/*Means for returning the value*/
         return pValue;
    }/*Means for getting the TtlInventoryValue of products entered*/
    public void setiValue(double iValue)
    {/*Condition Statement*/
              this.iValue=iValue;
    public double getiValue()
              return iValue;
    public void setreStkfee(double reStkfee)
         this.reStkfee=stock*price*1.05;
    /*Means for setting restockin fee of the total products*/
    public double getreStkfee()
    {/*Means for calculating the restocking fee of each products units nStock*/
                   return reStkfee;
    }/*Method for string the elements in [i] for display*/
    public String toString()
         {/*Means for returning defined string of elements in [i]*/
              return "Product{" +
    "item="+ item +
    ", name="+ name +
    ", stock="+ stock +
    ", price="+price +
    ", pValue="+pValue +
    ", reStkfee="+ reStkfee +
    ", iValue="+iValue+     
    }/*End set and get method*/
    }/*End of class Product*/
    /*Delcaration of the class type sortproductNames*/                    
    class sortproductNames extends Product
    {/*Declaration of the variable productName*/
    protected String name;
    /*Means for setting and getting values of the variable productName*/
    public void setname(String name)
    this.name = name;
    public String getname()
    return name;
    public int compareTo(Object object)
    { // for sorting by product name
    Product anotherProduct = (Product) object;
    return name.compareTo( anotherProduct.name);
                   g.drawImage(image,0,0,200,50,0,0,image.getWidth(null), image.getHeight(null),null);
              else;
                   g.drawString("O2K", 10,10);
    * @(#)InventoryGUIFrame.java
    * @author
    * @version 1.00 2008/2/2
    package components;
    import java.io.*;
    import java.awt.font.*;
    import java.awt.geom.*;
    import java.awt.image.*;
    import javax.imagio.*;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import javax.swing.ImageIcon;
    import javax.swing.event.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
    import java.text.*;
    import java.awt.*;
    * FormattedTextFieldDemo.java requires no other files.
    * It implements a mortgage calculator that uses four
    * JFormattedTextFields.
    public class InventoryGUIPanelFrameTextArea extends JFrame
    String productName;
    String itemNumber;
    double unitPrice;
    double unitStock;
    //Labels to identify the fields
    private JLabel productNamelabel;
    private JLabel itemNumberlabel;
    private JLabel unitPricelabel;
    private JLabel unitStocklabel;
    //Fields for data Entry     
    private JTextField productNameField;
    private JTextField itemNumberField;
    private JTextField unitPriceField;
    private     JTextField unitStockField;
    private Product[] products;
    private int unitStock;
    private int currentIndex=0;
    //Adding the JButtons
    JButton firstButton;
    JButton nextButton;
    JButton previousButton;
    JButton searchButton;
    JButton addButton;
    JButton deleteButton;
    JButton saveButton;
    //Constructor          
    public InventoryGUIPanelFrameTextArea()
    super("Welcome To The Inventory Program");
    this.products = products;
    this.numOfProducts = products;
    JFrame JPanel = new JFrame();
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setLayout(new GridLayout());
    showLogo();
    showLabels();
    showInputFields();
    showButtons();
    public void showLogo()
    O2K myLogo = new O2K();
    this.add(myLogo);
    public void showLabels()
    JPanel panel = new JPanel();
    panel.add(new JLabel("PRODUCT NAME"));
    panel.add(new JLabel("ITEM NUMBER"));
    panel.add(new JLabel("UNIT PRICE"));
    panel.add(new JLabel("UNITS IN STOCK"));
    this.add(panel);
    public void showInputFields()
    itemNumber =new JTextField(5);
    itemNumber.setEditable(false);
    productName= new JTextField(10);
    productName.setEditable(false);
    unitPrice= new JTextField(5);
    unitPrice.setEditable(false);
    unitStock = new JTextField(10);
    unitStock.setEditable(false);
    panel.setEditable(false);
    panel.add(itemNumber);
    panel.add(productName);
    panel.add(unitPrice);
    panel.add(unitStock);
    this.add(panel);
    public void showButtons()
    JPanel panel = new JPanel();
    first = new JButton("First");
    next = new JButton("Next");
    previous = new JButton("Previous");
    add = new JButton ("Add");
    delete = new JButton ("Delete");
    search = new JButton ("Search");
    save = new JButton ("Save");
    panel.add(first);
    panel.add(next);
    panel.add(previous);
    panel.add(add);
    panel.add(delete);
    panel.add(search);
    panel.add(save);
    panel.add(this);
    ButtonActionHandler handler = new ButtonActionHandler();
    first.addActionListener(handler);
    next.addActionListener(handler);
    previous.addActionListener(handler);
    add.addActionListener(handler);
    delete.addActionListener(handler);
    search.addActionListener(handler);
    save.addActinListener(handler);
    this.add(panel);
    setFields(0);
    protected void paintComponent (Graphics g)
    public void setFields(int i)
    setItemNumber(i);
    setProductName(i);
    setUnitPrice(i);
    setUnitStock(i);
    public void setItemNumber( int i)
    itemNumber.setText(products[i].getItemNumber());
    public void setProductName(int i)
    productname.setText(products[i].getProductName());
    public void setUnitPrice( int i)
    unitPrice.setText(String.valueOf(products[i].getunitPrice()));
    public void setUnitStock(int i)
    unitStock.setText(String.valueOf(products[i].getunitStock()));
    private class ButtonActionHandler implements ActionListener
    public void actionPerformed(ActionEvent event)
    if(event.getSource()==first)
    currentIndex=0;
    setFields(currentIndex);
    else if(event.getSource()==next)
    currentIndex++;
    if(currentIndex==unitStock);
    currentIndex--;
    setFields(currentIndex);
    else if (event.getSource()==previous)
    currentIndex--;
    if(curentIndex < 0)
    currentIndex=0;
    setFields(currentIndex);
    else if(event.getSource()==last)
    currentIndex = unitStock -1;
    setFields(currentIndex);
    else if(event.getSource()==add)
    currentIndex = productName ++;
    setFields(currentIndex);
    else if(event.getSource()==delete)
    currentIndex= productName -1;
    setFields(currentIndex);
    else if (event.getSource()==search)
    currentIndex=productName ++;
    setFields(currentIndex);
    else if (event.getSource()==save)
    currentIndex=productName ++;
    setFields(currentIndex);
    public static void main(String args[])
    JFrame mainFrame = new JFrame();
    mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    mainFrame.setSize(400,300);
    mainFrame.setVisible(true);
    class InventorySystem6
    {     /*Declaration of products[] and the maximum storing capacity*/
    private Product products[] = new Product[MAX_NUM_OF_PRODUCTS];
    /*Prompts user to make another selection or exit program*/
    private static final String STOP_COMMAND = "stop";
         /*parameters defining maximun numbers of products available for storing in [i]*/
    private static final int MAX_NUM_OF_PRODUCTS = 100;
    /*Declaration of the variables */
    String name;
    String item;
    double stock;
    double price;
    double reStkfee=1.05;
    double pValue;
    double iValue;
    public InventorySystem6()
         /*Empty Constructor*/
    }/*Beginning of product input by the user*/
    public void inputProductInfo()
    {     /*Declaration of currency format*/     
                   DecimalFormat Currency = new DecimalFormat();
                   Scanner input = new Scanner(System.in);
                   /*Beginning of the Loop*/
                   JOptionPane.showMessageDialog(null,"Welcome to the Inventory Program\n","Welcome to the Inventory Program\n",
                   JOptionPane.PLAIN_MESSAGE);               
                   for(int i = 0; i<MAX_NUM_OF_PRODUCTS ; i++)
                   name = JOptionPane.showInputDialog( "What is the Product Name? ");
                   if(name.equalsIgnoreCase("stop"))
                   break;
         String item = JOptionPane.showInputDialog("Enter the products ID");
         String priceStr =JOptionPane.showInputDialog("Enter the products price");
         double price=Double.parseDouble(priceStr);
                   String stockStr=JOptionPane.showInputDialog("Enter the units in stock " );
                   double stock = Double.parseDouble(stockStr);          
                   double sum=price*stock;
              JOptionPane.showMessageDialog(null,"The product value is:"+sum, "pValue",
              JOptionPane.PLAIN_MESSAGE);
                   /* JOptionPane.showMessageDialog(null,"The Product Name is:"+productName, "productName"
                   ,"\n","The Product Id is "+productId,"Product ID"
                        ,"\n","The Unit Price is"+unitPrice,"Unit Price"
                             ,"\n","The Units In Stock is"+unitStock,"UnitStock"
                                  ,"\n","The Product Value is"+productValue, "productValue"
                                       ,"\n","The Restocking Fee is "+reStockfee,"Restock Fee"
                                            ,"\n","The Inventory Value is"+inventoryValue,"Inventory Value"
                                                 ,"\n","The Inventory Restock Fee is"+reStockfee,"Restock Fee"
                                                      ,"\n",JOptionPane.PLAIN_MESSAGE);*/
              //Product products[] = new Product[100];
                   products[i] = new Product();
                   products[i].setItemNumber(itemNumber);
                   products[i].setPrdocutName(productName);
                   products[i].setUnitPrice(unitPrice);
                   products[i].setUnitStock(unitStock);
                   products[i].setProductValue(sum);
                   products[i].setReStkfee(reStkfee);
                   inventoryValue += sum + products[i].getreStkfee();
    public void displayProductInfo()
    { /*Initialization of the variable total inventory value*/
    NumberFormat moneyFormat = NumberFormat.getCurrencyInstance();
    for(int i = 0; i<MAX_NUM_OF_PRODUCTS ; i++)
              Product product = products[i];
              if(product==null)
              System.out.println(products[i]);
                   break;
         System.out.printf("product name: %s\n ", product.getproductName());
         System.out.printf("product ID: %s \n", product.getitemNumber());
         System.out.printf("Unit Price: %s \n", moneyFormat.format(product.getunitPrice()));
         System.out.printf("units in Stock: %s \n", product.getunitStock());
         System.out.printf("Total product Value: %s \n", moneyFormat.format(product.getproductValue()));
         System.out.printf("Restocking fee: %s \n", moneyFormat.format(product.getreStkfee()));
         System.out.printf("Inventory Value: %s \n", inventoryValue);
    }/*Beginning of method main*/
    public static void main(String[] args)
    {/*Message*/
         /*Means for retrieving and storing new data input into inventory program*/
    InventorySystem6 JTableImageCreator = new InventorySystem6();
    JTableImageCreator.displayProductInfo();
    JTableImageCreator.inputProductInfo();
    class Product
    /*Declaration of and default value of specified variables*/
    //private Product products[] = new Product[100];
    protected String itemNumber;
    protected String prodcutname;
    protected double unitStock;
    protected double unitPrice;
    protected double productValue;
    protected double reStkfee;
    protected double inventoryValue;
    //private String productNames[] = new String[1000]; //declaration of array "productNames" to store Product Names
    /*method defining the get and set values of each individual variable*/
    public String getproductName()
    {/*Mean for storing and retrieving input of name*/
    return productName;
    }/*Means for setting the product name*/
    public void setProductName(String productName)
    {/*null pointer argument exception defining metod for obtainng product name*/
    this.productName = ProductName;
    }/*Means for getting the units identifcation number inputted by the user*/
    public String getitemNumber()
    {/*Means for returning the user input*/
    return itemNumber;
    }/*Means for setting the units identifcation */
    public void setItemNumber(String itemNumber)
    {/*null pointer argument exception for setting the product identification number*/
    this.itemNumber = itemNumber;
    }/*Means for getting the units value input*/
    public double getunitStock()
    {/*Means for returning the variable of the units*/
    return unitStock;
    }/*Means for setting the units value*/
    public void setUnitStock(double unitStock)
    this.unitStock = unitStock;
    public double getunitPrice()
    {/*Means for returning the dollar value of the price of the unit(s)*/
    return unitPrice;
    }/*Means for setting and requesting user to input + dollar amt*/
    public void setUnitPrice(double unitPrice)
    this.unitPrice = unitPrice ;
    }/*Means for setting the value of the total product value*/
    public void setProductValue(double prodcutValue)
    this.prodcutValue = unitPrice*unitStock;
    }/*Means for getting the value of the product*/
    public double getproductValue()
    {/*Means for returning the value*/
         return productValue;
    }/*Means for getting the TtlInventoryValue of products entered*/
    public void setInvetnoryValue(double invetnoryValue)
    {/*Condition Statement*/
              this.inventoryValue=inventoryValue;
    public double getinvetotyValue()
              return productValue;
    public void setReStkfee(double reStkfee)
         this.reStkfee=stock*price*1.05;
    /*Means for setting restockin fee of the total products*/
    public double getreStkfee()
    {/*Means for calculating the restocking fee of each products units nStock*/
                   return reStkfee;
    }/*Method for string the elements in [i] for display*/
    public String toString()
         {/*Means for returning defined string of elements in [i]*/
              return "Product{" +
    "itemNumber="+ itemNumber +
    ", productName="+ productName +
    ", unitStock="+ unitStock +
    ", unitPrice="+unitPrice +
    ", productValue="+prodcutValue +
    ", reStkfee="+ reStkfee +
    ", inventoryValue="+inventoryValue+     
    }/*End set and get method*/
    }/*End of class Product*/
    /*Delcaration of the class type sortproductNames*/                    
    class sortproductNames extends Product
    {/*Declaration of the variable productName*/
    protected String name;
    /*Means for setting and getting values of the variable productName*/
    public void setProdcutName(String productName)
    this.productName = productName;
    public String getproductName()
    return productName;
    public int compareTo(Object object)
    { // for sorting by product name
    Product anotherProduct = (Product) object;
    return productName.compareTo( anotherProduct.productName);
         class myGraphics extends component          
              private BufferedImage image;
              private boolean imageFound = true;
              public myGraphics()
                   super();
                   try
                        image=ImageIO.read(new File("Logo.jpg"));
                   catch(IOException x)
                        x.printStackTrace();
                        imageFound = false;
              public void paint(Graphics g)
                   g.drawImage(image,0,0,200,50,0,0,image.getWidth(null), image.getHeight(null),null);
              else;
                   g.drawString("O2K", 10,10);

  • Problem with netbeans IDE

    hey! i am a learner of j2se 5.0 and am horrible at command line compiling. so i use netbeans IDE and well it has been doing excellently till now.
    recently i had a porblem with ImageIcons and i found the exact problem which i was having but with repect to applets , that is, the images were not displaying properly. i have managed to solve the problem as far as applets are concerned, but it is not so with applications.
    the thing is when i use the run function of the IDE, it displays all icons perfectly and its as if nothing is wrong.
    it creates a .jar file which when i separately click to execute by going to its folder, does so but does not display any images. In fact it executes and behaves in such a way that it's exactly as if i have not used icons in the program- it displays everything else. should i change some setting of the IDE? but if some setting is to be changed, y is it running normally when run from the IDE( F6 key).
    also when i used the command line (after some research to learn to use it) to extract all files from the .jar file, all the images were in it!!!as well as all the class files. so i can't even say that the IDE has not bundled up the images into the .jar file.
    could some1 please help??i need help with .jar files and not applets.

    first i deefined a method as shown in the Java tutorial
    ImageIcon icon =createImageIcon("lion.jpg","name");
    ( within the contructor of the class)
    then after completing the constructor for the class- (I am trying to display an ImageIcon on the background of a JFrame)
    i provided the following definition after the constructor and b4 the main method:
    protected static ImageIcon createImageIcon(String path,
    String description) {
    java.net.URL imgURL = LabelDemo.class.getResource(path);
    if (imgURL != null) {
    return new ImageIcon(imgURL, description);
    } else {
    System.err.println("Couldn't find file: " + path);
    return null;
    this is what i did-and when run from the IDE-it is perfect, but the jar file ggenerated when executed displays every single thing-all swing components e.t.c EXCEPT the image
    the image is in the same folder as the source file- i checked because if not, an error is indicated- so that is not the problem here.
    this same exact code works perfectly with applets and they execute perfectly both from the IDE and also when executed separately.
    the same problem also iccurs when trying to display on labels and buttons.(only for JFrames not for JApplets)
    the thing is in the java tutorial the method is given for applets and so my applets worked -so is there somethin i'm missing for frames- as far as i know they r very similar as far as usage is concerned.

Maybe you are looking for

  • How to insert serial Number in BI Publisher Report

    Hi All,     I want to insert serial numbers in BI Publisher report. For Example:    SNO      1      2      3      4 I tried below code in XML file...but i confused where i need to add these code in XML file <?xdoxslt:set_variable($_XDOCTX, 'var', 0)?

  • HELP PLEASE MY ITUNES WONT OPEN

    IVE DONE EVERYTHING IVE DOWNLOADED QUICKTIME N ITUNES TOGHTHER PLZ I NEED HELPPPPPP THX

  • Use of Typecast in Receiving Bluetooth Data

    Hi everyone, I am trying to establish communication between a Bluetooth transmitter (Server) and a Bluetooth receiver (client) located in a PDA, and display the result on the PDA.  I have already setup the PDA and am able to delpoy applications to it

  • Display newline using out.println

    Can anyone tell me how can I put a new line using the out.println? Because I wanna to display the record in the following format which is Username : xxx UserID : xxx Age : xxx so on ..... Actually I wanna to do it in a table form(HTML).... Can anyone

  • Report in DM module (ISU)for Meter removed that have debts &security charge

    I am beginner in  SAP ISU, looking forward for solution , I have a  techno-functional task-  "I need to develope a report in DM module(ISU) for Meter removed that have debts and security charge with generalised Requirement. Moderator message: please