Why is there an error with this GUI

Hi again
When i try to run the pump screen the little box which displays the numbers dont appear in the pump screen frame but instead in teh consoel screen
frame.Which shouldnt happen but i cant find any reason why it is doing this or a way to stop it.Below is teh code for the pump screen and teh console screen.
public void ConsoleScreen()
        makeFrame();
     * Create a 3x2 grid and place five components within it.action listener that is teh button knows ot run
     * teh method and that teh method that srunning
    private void makeFrame()
        frame = new JFrame("Console Screen");
        Container contentPane = frame.getContentPane();
        contentPane.setLayout(new FlowLayout());
         JButton NewDayReset = new JButton ("NewDayReset");
        contentPane.add(NewDayReset);
        NewDayReset.addActionListener(new ActionListener() {
                               public void actionPerformed(ActionEvent e) { NewDayReset(); }
          JButton ViewTotalPetrolSold = new JButton ("ViewTotalPetrolSold");
        contentPane.add(ViewTotalPetrolSold);
         ViewTotalPetrolSold.addActionListener(new ActionListener() {
                               public void actionPerformed(ActionEvent e) {ViewTotalPetrolSold(); }
    JButton ViewTotalTakings= new JButton ("ViewTotalTakings");
        contentPane.add(ViewTotalTakings);
         ViewTotalTakings.addActionListener(new ActionListener() {
                               public void actionPerformed(ActionEvent e) {ViewTotalTakings(); }
       JButton AmmountToPayForTheTransaction= new JButton ("AmmountToPayForTheTransaction");
        contentPane.add(AmmountToPayForTheTransaction);
         AmmountToPayForTheTransaction.addActionListener(new ActionListener() {
                               public void actionPerformed(ActionEvent e) { AmmountToPayForTheTransaction(); }
           JButton ResetPump= new JButton ("ResetPump");
        contentPane.add(ResetPump);
        ResetPump.addActionListener(new ActionListener() {
                               public void actionPerformed(ActionEvent e) { ResetPump(); }
        SignIn = new JFrame("Peters Petrol Pump");
        Container contentPaneSignIn = SignIn.getContentPane();
        contentPaneSignIn.setLayout(new GridLayout(4,1));
        JLabel password = new JLabel(" Please Enter Password");
        contentPaneSignIn.add(password);
        passwordInput = new JPasswordField();
        contentPaneSignIn.add(passwordInput);
        passwordInput.addActionListener(new ActionListener() {
                                            public void actionPerformed(ActionEvent event) {
                                                String passwordField = new String(passwordInput.getPassword());
                                                if(passwordField.equals (Password)) {
                                                        ConsoleScreen();
                                                else { String string = "Password is incorrect";
                                                    JOptionPane.showMessageDialog(null, string);}
        SignIn.pack();
        SignIn.setVisible(true);
          Font font = new Font("SansSerif", Font.BOLD, 10);           
    JLabel label;
    JLabel label2;
    JLabel label3;
    JLabel label4;
    JLabel label5;
    JFormattedTextField input;
    JFormattedTextField input2;
    JFormattedTextField input3;
    JFormattedTextField input4;
    JFormattedTextField input5;
    JPanel panel;
   Format currency = NumberFormat.getCurrencyInstance(Locale.UK);
    label = new JLabel("Amount To Pay");   
    label2 = new JLabel("Price Per Litre");
    label3 = new JLabel("Litres Dispensed");
    label4 = new JLabel("Total Money Taken  for that day");
    label5 = new JLabel("Total Petrol Sold  for that day");
    input = new JFormattedTextField(currency);
    input2 = new JFormattedTextField(currency);
    input3 = new JFormattedTextField();
    input4 = new JFormattedTextField(currency);
    input5 = new JFormattedTextField();
    input.setValue(AmmountToPay);
    input2.setValue(PencePerLitre);   
    input3.setValue(LitresDispensedPerTransaction);
    input4.setValue(TotalTakings);
    input5.setValue(TotalPetrolSold);
    input.setColumns(7);
    input2.setColumns(7);
    input3.setColumns(7);
    input4.setColumns(7);
    input5.setColumns(7);
    input.setFont(font);
    input2.setFont(font);
    input3.setFont(font);
    input4.setFont(font);
    input5.setFont(font);
    input.setEditable(false);
    input2.setEditable(true);
    input3.setEditable(false);
    input4.setEditable(false);
    input5.setEditable(false);
    panel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    panel.add(label);
    panel.add(input);
    panel.add(label2);
    panel.add(input2);
    panel.add(label3);
    panel.add(input3);
    panel.add(label4);
    panel.add(input4);
    panel.add(label5);
    panel.add(input5);
    frame.add(panel);
    frame.pack();
    frame.setVisible(true);  
        frame.pack();
        frame.setVisible(true);
    public void PumpScreen()
        NewFrame();
    private void NewFrame ()
        newFrame = new JFrame("Pump Screen");
        Container contentPane = newFrame.getContentPane();
        contentPane.setLayout(new FlowLayout()) ; 
          JButton AmmountToPayForTheTransaction = new JButton ("AmmountToPayForTheTransaction");
        contentPane.add(AmmountToPayForTheTransaction);
         AmmountToPayForTheTransaction.addActionListener(new ActionListener() {
                               public void actionPerformed(ActionEvent e) { AmmountToPayForTheTransaction(); }
                    JButton CostPerLitre = new JButton ("Cost Per Litre");
        contentPane.add(CostPerLitre);
  CostPerLitre.addActionListener(new ActionListener() {
                               public void actionPerformed(ActionEvent e) {   CostPerLitre(); }
             JButton StopSqueezing = new JButton ("Stop Squeezing");
        contentPane.add(StopSqueezing);
         StopSqueezing.addActionListener(new ActionListener() {
                               public void actionPerformed(ActionEvent e) { StopSqueezing();
                                 keepRunning=false;}
                           JButton squeezeNozzle = new JButton ("Start Squeezing");
        contentPane.add(squeezeNozzle);
         squeezeNozzle.addActionListener(new ActionListener() {
                               public void actionPerformed(ActionEvent e) { squeezeNozzle();
                               JButton RemoveNozzle = new JButton ("Remove Nozzle");
        contentPane.add(RemoveNozzle);
         RemoveNozzle.addActionListener(new ActionListener() {
                               public void actionPerformed(ActionEvent e) { RemoveNozzle();
                                JButton ReplaceNozzle = new JButton ("Replace Nozzle");
        contentPane.add(ReplaceNozzle);
        ReplaceNozzle.addActionListener(new ActionListener() {
                               public void actionPerformed(ActionEvent e) { ReplaceNozzle ();
        Font font = new Font("SansSerif", Font.BOLD, 10);           
    JLabel label;
    JLabel label2;
    JLabel label3;
    JLabel label4;
    JLabel label5;
    JLabel label6;
    JFormattedTextField input;
    JFormattedTextField input2;
    JFormattedTextField input3;
    JFormattedTextField input4;
    JFormattedTextField input5;
    JFormattedTextField input6;
    JPanel panel;
    Format currency = NumberFormat.getCurrencyInstance(Locale.UK);
    label = new JLabel("Amount To Pay");
    label2 = new JLabel("Price Per Litre");
    label3 = new JLabel("Litres");
    label4 = new JLabel("Nozzle in Use");
    label5 = new JLabel("Nozzle Out of Use");
    label6 = new JLabel("Nozzle Not in Use");
    input = new JFormattedTextField(currency);
    input2 = new JFormattedTextField(currency);
    input3 = new JFormattedTextField();
    input4 = new JFormattedTextField();
    input5 = new JFormattedTextField();
    input6 = new JFormattedTextField();
    input.setValue(AmmountToPay);
    input2.setValue(PencePerLitre);   
    input3.setValue(LitresDispensedPerTransaction);
    input4.setValue(NozzleInUse);   
    input5.setValue(NozzleOutOfOrder);   
    input6.setValue(NozzleReady);
    input.setColumns(7);
    input2.setColumns(7);
    input3.setColumns(7);
    input4.setColumns(7);
    input5.setColumns(7);
    input6.setColumns(7);
    input.setFont(font);
    input2.setFont(font);
    input3.setFont(font);
    input4.setFont(font);
    input5.setFont(font);
    input6.setFont(font);
    input.setEditable(false);
    input2.setEditable(false);
    input3.setEditable(false);
    input4.setEditable(false);
    input5.setEditable(false);
    input6.setEditable(false);
    panel = new JPanel(new FlowLayout());
    panel.add(label);   
    panel.add(input);
    panel.add(label2);
    panel.add(input2);
    panel.add(label3);
    panel.add(input3);
    panel.add(label4);
    panel.add(input4);
    panel.add(label5);
    panel.add(input5);
    panel.add(label6);
    panel.add(input6);
    frame.add(panel); 
    frame.pack();
    frame.setVisible(true);     
        newFrame.pack();
        newFrame.setVisible(true);
}

Without fishing through the world here:
        frame = new JFrame("Console Screen");
        Container contentPane = frame.getContentPane();
        contentPane.setLayout(new FlowLayout());Notice you set contentPane to the ContentPane of your "Console Screen" and then proceed to add everything to it.
Other than that, I'd ask you: do you know how to work your debugger?

Similar Messages

  • Is there a error with this code

    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    public class ClickMe extends Applet implements MouseListener {
    private Spot spot = null;
    private static final int RADIUS = 7;
    public void init() {
    addMouseListener(this);
    public void paint(Graphics g) {
    //draw a black border and a white background
    g.setColor(Color.white);
    g.fillRect(0, 0, getSize().width - 1, getSize().height - 1);
    g.setColor(Color.black);
    g.drawRect(0, 0, getSize().width - 1, getSize().height - 1);
    //draw the spot
    g.setColor(Color.red);
    if (spot != null) {
    g.fillOval(spot.x - RADIUS, spot.y - RADIUS, RADIUS * 2, RADIUS * 2);
    public void mousePressed(MouseEvent event) {
    if (spot == null) {
    spot = new Spot(RADIUS);
    spot.x = event.getX();
    spot.y = event.getY();
    repaint();
    public void mouseClicked(MouseEvent event) {}
    public void mouseReleased(MouseEvent event) {}
    public void mouseEntered(MouseEvent event) {}
    public void mouseExited(MouseEvent event) {}
    When I compile the the code I get a "cannot resolve symbol"
    private Spot spot = null;
    spot = new Spot(RADIUS);
    I don't know if these are errors in the code

    'cannot resolve symbol' errors usually mean a problem with the declarations and initialisations at the start of your class. This is specifically to do with your line private Spot spot = null;
    i haven`t much time to look at your code, but i would suggest getting rid of the null initialisation here, and do you ever actually change this value? after a quick look it seems that you only query it to see if the variable spot is null. if you never affect this value, then it will always be null and only one if statement will ever be executed.
    but as i said i haven`t any time, so could be off here
    boutye - boss is coming bak argh!

  • HT201442 so why was there an error with me trying to restore my ipod i dont get it please someone explain?!

    So there was an error when i tried to restore my ipod i don't get it.. someone please help me!?

    If not this error:
    iOS: Restore error 3194 or 'This device isn't eligible for the requested build'
    What was the error?

  • I have received an error message when trying to install 13 new apps for Creative Cloud. It reads: "Error There was an error with this action. Try again later.  7b1f5f56-79b3-4a0d-8fd2-137b1a3e6b67" I don't know what to do.

    I have received an error message when trying to install 13 new apps for Creative Cloud. It reads: "Error There was an error with this action. Try again later.  7b1f5f56-79b3-4a0d-8fd2-137b1a3e6b67" I don't know what to do.

    AppTrial1 where are you seeing this error exactly?  For information on how to install the Adobe Creative applications included with the Creative Cloud please see Install and update apps - https://helpx.adobe.com/creative-cloud/help/install-apps.html.

  • Why is there a error appearing in this??

    I have written a program to search if the particular item is present in the file or not.. so why is there any error hope it is right!
    BufferedReader check;
         try{
             check=new BufferedReader(new FileReader(FileName));
        }catch(FileNotFoundException ex){
            System.out.println("Sorry file not found");
            return; 
                                System.out.println("Enter the item to be found");
                                String input_item=in.readLine();
                                String item= input_item.toUpperCase();
                                System.out.println("Searching for "+item);
                                int messenger=0, x=0;
                                 while(x<sType.length) {
                                    sType[x]=check.readLine();
                                    sNum[x]=Integer.parseInt(check.readLine());
                                    sPrice[x]=Float.parseFloat(check.readLine());
                                    if(item.equals(sType[x])) {
                                        System.out.println("Found "+sType[x]);
                                        System.out.println("-------------------------------------------------------");
                                        System.out.print("Stock Name :");
                                        System.out.println("\t"+sType[x]);
                                        System.out.print("Stock Level:");
                                        System.out.println("\t"+sNum[x]);
                                        System.out.print("Stock Price:");   
                                        System.out.println("\t$"+sPrice[x]);
                                        System.out.println("-------------------------------------------------------");
                                        messenger=1;
                                    x++;
                                if(messenger==0) {
                                    System.out.println("Sorry "+item+" not available");
      and the file contains the following in the particular format
    LOGITECH CORDLESS DESKTOP LX300
    200
    50.2
    MONITER
    62
    54.9
    PANASONIC
    54
    32.3
    MOUSE
    95
    21.4pl help why this error is appearing???
    Exception in thread "main" java.lang.NumberFormatException: null
    at java.lang.Integer.parseInt(Integer.java:415)
    at java.lang.Integer.parseInt(Integer.java:497)
    at programname.<init>(NewMain.java:17)
    ??????????????????????????????????????????????????????

    Please do not post the same question more than once!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    http://forum.java.sun.com/thread.jspa?messageID=9919410

  • I just got the following message fro Adobe when I try to update:  "Error There was an error with this action. Try again later.  3cde7ed8-ce06-45ae-8fa8-58cc80a9d1ec"

    I just got the following message fro Adobe when I try to update:  "Error There was an error with this action. Try again later.  3cde7ed8-ce06-45ae-8fa8-58cc80a9d1ec"

    Link for Download & Install & Setup & Activation problems may help
    -Online Chat http://www.adobe.com/support/download-install/supportinfo/

  • Sign in error 'There was an error with this action. Try again later.'

    Get an error message when trying to log into CC to download my initial apps.
    Purchased from Amazon and the process completed successfully until I attempted to log in and down load from adobe.com. had to create new adobe account just to post this question.
    The error message appears repeatedly 'There was an error with this action. Try again later.'
    The error message is followed by a series of 5 groups of numbers and letters with dashes between each group.
    Windows 7 rig. Attempted 3 different browsers. same error.. 'There was an error with this action. Try again later.'
    attempted fix posted by another forum member recommending the removal of a .db file in the appData folder. No .db file existed as described.
    Thank you for any suggestions.

    Adobe contact information - http://helpx.adobe.com/contact.html may help
    -Select your product and what you need help with
    -Click on the blue box "Still need help? Contact us"

  • HT201210 why is there an error occurring when trying to do a software update ios6 on iphone 4s

    why is there an error occurring when trying to do a software update ios6 on iphone 4s??

    You might find this article helpful: http://support.apple.com/kb/TS3694
    It has the error range of 3000's which states
    Errors 3000-3999 (3002, 3004, 3013, 3014, 3018, 3164, 3194, and so on): Error codes in the 3000 range generally mean that iTunes cannot contact the gs.apple.com server on ports 80 or 443. This may be because out-of-date or incorrectly configured security or firewall software is interfering, an old version of iTunes is installed, an entry in your hosts file redirecting requests to gs.apple.com (see error 1004 above), or because of your Internet proxy settings. If you are using a proxy, try without using one or with a known-good network. If that does not resolve the issue, follow iTunes for Windows: Troubleshooting security software issues. Error 3014 may indicate that you need to free up more disk space on the computer before trying to restore again. Error 3194 most likely indicates you do not have the latest version of iTunes installed Update to the latest version of iTunes. 

  • Errors with SAP GUI 7.10 issues with IE 7.0? and most curr patches?

    We are attempting to patch our SAP GUI 7.0 with the most recent GUI patches
    GUI patch 12
    BW patch 500
    BI patch 900
    we are applying these patches to correct the following
    >preview and printing of blank pages with web browser(ie 6.0)
    >german lang. toolbar appearing
    >missing active components when using analyzer (BW 3x)
    >BI rspc error 'x dump'
    these issues above have been corrected, however we are now having issues with this GUI and IE 7.0 , printing errors
    As anyone had these same issues above, and could you recommend on what patch combination (if any) have corrected them
    We have worked on this project for the last few months, to get the correct combination of patches that would not break anything else installed.  But, now we are finding that we may have issues with IE 7,0 and the SAP GUI with the above patches.
    Please advise
    Maria

    what happens on the desktops with IE 7.0 is that it looses printing capabilities.

  • HT1711 When I try to play a song on I-Tunes I receive the Message "The Song can not be used because original can not be found" Can anyone out there help me with this?

    When I try to play a song on I-Tunes, I receive the Message "The song can not be used because the original can not be found.  Can anyone out there help me  with this problem?

    The iTunes application saves your iTunes Store purchases--as well as any music, audiobooks, or videos you import--to your computer's hard disk, not the iTunes application itself.
    The error message you note indicates that the purchase in question can’t be located where it is stored in your iTunes Music folder in order to play it, and may have been moved or deleted.
    You will need to help iTunes locate the file. Follow the steps in this article:
    http://support.apple.com/kb/TS1967
    This article may also be helpful:
    http://support.apple.com/kb/TS1408

  • When connecting my ipod to PC I get message Theres a problem with this drive

    I have a new computer
    When I connect my Ipod to it I get the message 'theres a problem with this drive
    scan the drive now to fix it - no idea what this means

    I have a new computer
    When I connect my Ipod to it I get the message 'theres a problem with this drive
    scan the drive now to fix it - no idea what this means

  • HT5022 10.8.4 is throwing an error with this software: "Airport Utility cannot be installed on this disk. The version of Mac OS X on this volume is not supported"

    10.8.4 is throwing an error with this software: "Airport Utility cannot be installed on this disk. The version of Mac OS X on this volume is not supported"

    You are trying to install a version of Airport Utility earlier than 6.0, correct? If so see the following: Installing the Old AirPort Utility (Version 5.6) on Mountain Lion | frank.is.

  • I have photos in a DVD. In order to visualize them in iPhoto, must I necessarily import them? Can't I see the pictures from the media without importing? If not, is there any application with this functionality? I dont't like pre-visualization for photos.

    I have photos in a DVD. In order to visualize them in iPhoto, must I necessarily import them? Can't I see the pictures from the media without importing? If not, is there any application with this functionality? I need an app that allows me to navigate through the photos without selecting all of them. I realy dont't like pre-visualization for photos...

    In order to visualize them in iPhoto, must I necessarily import them?
    iPhoto is a Database. Before it can work with any data it must be imported to the database, so yes it is necessry to import them.
    Can't I see the pictures from the media without importing?
    See above.
    If not, is there any application with this functionality?
    Hundreds. Any image viewer will do the job. On your Mac the Finder has QuickLook and there is the Preview app as well. Online you can download any of these:
    http://www.macupdate.com/find/mac/image%20viewer

  • TS3694 why is there an error 9006 and how can i fix it?? please answer for ipad mini

    why is there an error 9006 and how can i fix it?? please answer and btw its an ipad mini

    if you are trying to download and install ios7, it is probably because of the enormous amount of traffic apple's download servers must be experiencing. things should return to normal before too long, just hang tight

  • I can't update my iOS 5! it downloads it and than say that there is error with connection? what should I do?

    it downloads it and than say that there is error with connection? what should I do?

    Are you getting a network connection error or a different error ? If it is a network connection and you've tried turning off all your firewall and antivirus software then you could try downloading the update via a browser : https://discussions.apple.com/message/16703914#16703914

Maybe you are looking for