Can not refer to main frame as not in package

I made my frame by simply typing "new ProgramProj();" under main string args which worked fine (well actually my lecturer did it like that) .
I've tried to copy the layout of "normal" layout by getting the content pane, etc. but then I get an illegal argument exception (cannot add window to a container)...Is there a way to keep this method and be able to refer to this frame from another frame because I need to set the text of a label on the main frame from another frame under the action listener:
        if(event.getSource() == cmdSaveSettings) {
        if(txtPlayerOneName.getText().equals(emptyText)) {
             JOptionPane.showMessageDialog(null, "alert", "Please enter player one's name", JOptionPane.ERROR_MESSAGE);
       else {
            playerOneName = txtPlayerOneName.getText();
            ProgramProj.lblplayerOneName.setText(playerOneName); //ProgramProj is the file name that cannot be found
       }I've added the action listeners but nothing happens. Would really appreciate the help, thanks in advance.

Cleo123 wrote:
So are you saying that if I use a JOptionPane as a frame I won't have any trouble retrieving the data inputted as I will not have to specify which frame I want the data to go to because it will be a option pane OF the main frame?If the JOptionPane holds a JPanel that you have a reference to, then you can get information out of the JPanel easily.
I've used a separate frame frame because I gather a lot more information which takes a page such as a colour chooser for the counter they want, (connect 4), option boxes for the grid size they want, combo box for the shape of the counter, sound and time check boxes and then text fields if they want a timer handicap...So I thought it best for it to be more that a message box as I wouldn't want a load of message boxes requesting one piece of data at the time. You can get your info all together with a JOptionPane.
For instance what if you had a JPanel (and enum) that looked like so:
    enum Difficulty
        EASY("Easy"),
        MODERATE("Moderate"),
        DIFFICULT("Difficult"),
        VERY_DIFFICULT("Kick Ass");
        private String text = "";
        private Difficulty(String text)
            this.text = text;
        @Override
        public String toString()
            return text;
    class PrefPanel extends JPanel
        private JTextField nameField = new JTextField(20);
        private JComboBox difficultyCB = new JComboBox(Difficulty.values());
        public PrefPanel()
            JPanel labelPanel = new JPanel(new GridLayout(0, 1, 10, 10));
            JPanel dataPanel = new JPanel(new GridLayout(0, 1, 10, 10));
            labelPanel.add(new JLabel("Name: "));
            dataPanel.add(nameField);
            labelPanel.add(new JLabel("Difficulty: "));
            dataPanel.add(difficultyCB);
            setBorder(BorderFactory.createEmptyBorder(5, 5, 25, 5));
            setLayout(new BorderLayout(10, 10));
            add(labelPanel, BorderLayout.WEST);
            add(dataPanel, BorderLayout.CENTER);
        public String getNameText()
            return nameField.getText();
        public Difficulty getDifficulty()
            if (difficultyCB.getSelectedIndex() >= 0)
                return (Difficulty)difficultyCB.getSelectedItem();               
            else
                return null;
    }You could then show the JPanel in a JOptionPane and retrieve the info easily like so:
        public void actionPerformed(ActionEvent event)
            boolean preferencesObtained = false;
            PrefPanel prefPanel = new PrefPanel(); // here's the JPanel object
            while (!preferencesObtained)
                int result = JOptionPane.showConfirmDialog(
                        GetNameMain.this, // this holds a reference to the JFrame or other JComponent
                        prefPanel, // place the JPanel object in the JOptionPane
                        "Select Preferences",
                        JOptionPane.OK_CANCEL_OPTION,
                        JOptionPane.PLAIN_MESSAGE);
                if (result == JOptionPane.OK_OPTION)
                    if (!prefPanel.getNameText().isEmpty())
                        // get the information from the PrefPanel object and place into
                        // variables of choice
                        name = prefPanel.getNameText();
                        nameLabel.setText(name);
                        difficulty = prefPanel.getDifficulty();
                        difficultyLabel.setText(difficulty.toString());
                        preferencesObtained = true;
                    else
                        JOptionPane.showMessageDialog(GetNameMain.this,
                                "Please fill all data fields", "Incomplete Data",
                                JOptionPane.ERROR_MESSAGE);
                else // cancel pressed
                    preferencesObtained = true;
        }

Similar Messages

  • Library rolls in iphoto not showing in main frame

    in iphoto three of my "rolls" of film that i previously downloaded appear in the top of the main frame but when i click on the picture to look at it or edit, it has a blank gray square with an in the middle. if anyone has any tips for me, please contact me! thanks.

    soccer20
    The ! or ? turns up because iPhoto has lost the connection between the thumbnsil and the photo it represents. The most common cause of this is User Activity in the iPhoto Library Folder. Have you ever moved, renamed or altered anything in this folder?
    You could try rebuild the library by holding down the apple and option (or alt)keys and launching iPhoto. Use the resulting dialogue to rebuild.
    regards
    TD

  • Why is the "Common DOM API" not included in main JDK1.4 / JAXP1.1 packages?

    Hi,
    It's good the core XML DOM is implemented in Java, and even better that this is to become integrated into JDK1.4. However, I don't understand why the JDK1.4 / JAXP 1.1 only includes the "org.w3c.dom" package and not the other DOM packages ("org.w3c.dom.events", etc. such as those implemented in Xerces or those that appear in the Common DOM API).
    Can anyone explain how to use this functionality (all DOM APIs) using JAXP 1.1 or JDK 1.4 ? Or must I stick to including the Apache implementation?
    Some useful references:
    http://java.sun.com/j2se/1.4/docs/guide/plugin/dom/index.html
    http://xml.apache.org/xerces-j/
    Hopefully someone can explain this a bit more to me...
    Thanks,
    Chris

    I am curious for the answer to this as well... I have been using Java SDK 1.3.1 with Apache's xerces 2.0.0-beta4, and am now trying to upgrade to SDK 1.4 with xerces 2.0.0..
    Also, what about package org.w3c.dom.ranges? Does anyone know if this an Apache-defined package, or is it a standard w3c one (in which case, why is it not part of the Common DOM API set)?
    Thanks for any help!

  • How can I put my main Application class in a package?

    Hello,
    I would like to put my main Application class for my air app inside a package. If I create a regular FLX application, this works fine. In that case I just move the application file created into a packade and change the run/debug settings. This does not work for an Air app however, when I try I first get the error:
    Adobe AIR application is missing the corresponding MyApp-app.xml
    So I move the MyApp-app.xml into the same package, then I get:
    Unknown error generating output application.xml files. Check the Eclipse error log for more details.
    Is it possible to have the man Application class reside inside a package for air applications?
    Regards,
    Mikael

    Hi Mikael,
    I ran into the same result as you so I asked around and it sounds like this might not be supported.  However, I'd recommend reposting this question over on the Flash Builder forums to see if anyone has found a workaround.
    Please let me know if you're able to resolve this.
    Thanks,
    Chris

  • How to call main frame from showMessage OK button clicked?.

    hello,
    I create one project. there, I create one textfield and button. after clicking it, the input add into JList.
    when I click the list component and enter OK button ,it will go to another window.
    When the input is fault, it show error in dialog box. then, when i click the OK button, it must go to main window and processed from first.
    My problem is,
    When I click OK in show dialog box, it is not going to main frame.
    if((source==ConnectButton) != firstSel)
                String message="Not Able to Connect to the Specified IP !!!";
              int answer = JOptionPane.showConfirmDialog(MainFrame.emsMainFrame, message);
              if (answer == JOptionPane.YES_OPTION) {
                  initcomp();
                   MainFrame.setSize(750, 550);
                   // Image icon = Toolkit.getDefaultToolkit().getImage("Images.gif");
                    //emsMainFrame.setIconImage(icon);
                     emsMainFrame.setVisible(true);
                     emsMainFrame.setEnabled(true);
                      initSNMPlogin();
                    // BroIPSelect.setVisible(true);
                    // BroIPSelect.setEnabled(true);
            // workPanel.add();
            //   JPanel cp = new JPanel(new GridLayout(0,3));
              workPanel.setVisible(true);
            workPanel.add( new JLabel( "work" ) );
           // leftPanel.setVisible(true);
          else if (answer == JOptionPane.NO_OPTION) {
            // User clicked NO.
                  System.exit(0);
        }        To go to main frame and access , what can I do.
    thanks.

    Wow that's a mess.
    Normally when you want to go back to your main window, the only thing you have to do is hide your second window. Then the focus automatically returns to your main window.
    Hiding a frame is calling setVisible(false) on it.
    If you keep a reference somewhere to your hidden frame, you can easily show it up again without rebuilding it.
    But post some other code.
    What is "MainFrame"?
    Is it a class with static methods for accessing MainFrame.emsMainFrame?
    Note that objects/instances/variables/references should start with a lowercase letter, and classes should start with an uppercase letter.
    Why do you call initcomp()? If it is a function for initialising the GUI components, then make it run once at the start of your program.
    Why do you have this XOR:
    ((source==ConnectButton) != firstSel)

  • Frame line not display in next page of main window

    hi Xpert,
    I am creating layout in SAP SCRIpt,it working fine only the main window of next page  frame line is not display.
    i m define next page as a FIRST page and writing main window of first page following coding
    /:           POSITION XORIGIN '0.50' CM YORIGIN '7.75' CM
    /:           SIZE HEIGHT '17' CM WIDTH '19.25' CM
    /:           BOX  FRAME 10 TW
    when i run the program first page are coming properly and only when i go in second page of output then main window lines not displaying.
    please guide me how to solve this problem.
    Regards,
    pravin

    Hi Praveen,
    In that case why you have to make the main window in the first page and secondry window.
    You can use it as manin window itself. Print the total amount in the main window itself in the first page. and copy that main window to the second page.
    In the first page under the main window create a text. and there u print the total value and text.
    Now copy the main window to the second page..only COPY DONT CREATE NEW.
    In the second page now under the main window create the table to print the line items. What every u add in the second page main window it will come in the first age also in the smartforms. But it will nto get printed in the first page.After the text to print the totals call the COMMAND option and call next page in that.
    Hope you got me..
    Regards
    Ansari

  • Opening a new file in photoshopcc and the file name is displayed but no white working canvas. you can see it as a layer in the layers panel and if i draw on the grey area i can see int on the layer but not on the main screen.

    opening a new file in photoshop cc and the file name is displayed but no white working canvas. you can see it as a layer in the layers panel and if i draw on the grey area i can see int on the layer but not on the main screen.

    Graphics card is the problem.
    Trying to update drivers now.
    Thanks for your help
    john

  • HT5019 I connect my macbook pro to an Epson wireless projector. The macbook can see the projector wirelessly and the image on the macbook is displayed on the projector. However on system ref., the arrangement tab does not show and thus cannot have multipl

    I connect my macbook pro to an Epson wireless projector. The macbook can see the projector wirelessly and the image on the macbook is displayed on the projector. However on system ref., the arrangement tab does not show and thus cannot have multiple view.
    I am trying to project Pro Presenter on the Epson projector such that I have the detail screen on the macbook and only the screen I want people to see on the projector display. This has not been possible because the arrangement tab on the Display section of the System Preference is not showing. If i tried to search for the arangement, it comes back with the message that there is not other source detected, hence the arrangement tab is not showing.
    I have also tried to connect the Epson directly to the Macbook but it still the same result, so its not because it is a wireless connection. Can someone advise me jhow to go around this problem. I have used windows before and it is very easy to extend ptojection on windows, but this system seems to be frustrating to me.
    Thanks,
    Toks

    Hi Toksyb!
    You may want to try clearing out the PRAM on your computer. This process is explained through this article:
    About NVRAM and PRAM
    http://support.apple.com/kb/ht1379
    Thanks for using the Apple Support Communities!
    Cheers,
    Braden

  • Hello my name is jose quant, and let me know how I can use CAMERA RAW adobe bridge because the bridge use and want to open a camera raw image, I get a message that says: MAIN BRIDGE aplicaion NOT ACTIVATED. BRIDGE REQUIRES A PARTICULAR PRODUCT HAS BEGUN A

    Hello my name is jose quant, and let me know how I can use CAMERA RAW adobe bridge because the bridge use and want to open a camera raw image, I get a message that says: MAIN BRIDGE aplicaion NOT ACTIVATED. BRIDGE REQUIRES A PARTICULAR PRODUCT HAS BEGUN AT LEAST ONCE TO ACTIVATE THIS FEATURE. I wonder what that means?
    I use a lapto (windows 7) 64-Bit operating system.
    Thank you,
    my email is: [email protected], if you send me the answer to my query

    You need to activate Photoshop.
    Mylenium

  • HT5085 i have photo stream window  which i can not closo on main window of my I pad

    i have photo stream window  which i can not closo on main window of my I pad

    iCloud.com does not have a photos tab.  You would access these pictures on your computer via iPhoto, or on another iOS device.

  • Commitment item can not derived from main asset number

    Dear all,
    Our client have 1 G/L LVA and divided to many asset class LVA. Asset lva will post to general expense when run depreciation, and they want the acquisition/procurement of LVA should check the budget of the general expense.
    It means the acquisition of LVA will check the budget of general expense, then no budget when run depreciation.
    I already setting for no check budget for run depreciation. However, i found trouble when set the derivation from main asset number to commitment item. I want to set from main asset number because only 1 G/L LVA.
    Derivation rule from main asset number not populated to commitment item which i'm expecting, example
    FMDERIVE (1)   CI from main asset number (for acquisition)
                       asset number         CI
                      23000000000        7400000102
    FMDERIVE  (2)  CI from g/l account
                       G/L acct.                CI
                     2290000001          2290000001
    Because asset number 23000000000 assign to g/l 2290000001, then the tracing always read the g/l account, then derive to commititem 2290000001 NOT to 7400000102.
    I already give many condition however it can not work. Even i deactivate fmderive (2), asset number can not populate to relevant commitment item.
    Please give me advice how derive the commitment item from main asset number or relevan things.
    Regards,
    Dewi

    Hi Dewi
    Please have a look at these notes which I think are interesting:
    [736914|https://service.sap.com/sap/support/notes/736914]     Budget relevance of asset transactions
    [1268001|https://service.sap.com/sap/support/notes/1268001] FI313 - No funds center entered/derived
    So, if you need to derive the FMAA from the Asset master data, you could enable a derivation step calling function module FMDT_READ_MD_ASSET. Take care of following derivation steps which may be overwriting the derived values from FMDT_READ_MD_ASSET. See the trace log, according to note [666322|https://service.sap.com/sap/support/notes/666322]
    Cheers
    Mar

  • My iPhoto hangs right after it opens - i can open it remotely but not on my main machine

    My iPhoto hangs right after it opens - i can open it remotely but not on my main machine

    Before anyone can help, they need information to work with. Basic stuff:
    - What version of iPhoto.
    - What version of the Operating System.
    - Details. What were you doing when the problem arose?
    - Did it ever work properly?
    - Are there error messages?
    - What steps have you tried already to solve the issue.
    Anything else you can think of that might allow someone else to understand your issue.
    With this kind of information somebody can develop a starting point for troubleshooting the issue.
    Posts that consist of "iPhoto doesn't work. Help" or "iPhoto won't print" or "Suddenly I have no photos!!!!!!!!!!" mean that any helper is simply guessing. With information, s/he may be able to get your issue resolved sooner.

  • When i want to download the new version of iPhoto, i get this message : You can not update this software since you do not have the main version. What should i do ?

    HI,
    I got this problem : when i want to download the new version of iPhoto, i get this message : You can not update this software since you do not have the main version. What should i do ?
    IPhoto was already on my MacBook Pro when i bought it.
    Thank you for your help
    Thierry

    Welcome to Apple Support Communities
    Open App Store > Purchases, and see if iPhoto app is listed. If not, unhide it > http://support.apple.com/kb/HT4928 Apart from that, check that iPhoto is in Applications folder. If not, put it in this folder.
    If nothing works, remove iPhoto, open App Store > Purchases, and install iPhoto free of charge

  • Can we execute sequence not from the 1st frame to end?

    I had a problem that I want to execute sequence not from the 1st frame but from the specific frame that I want to execute to the end. How can I do? Please help me.

    Instead of using a sequence I suggest you use a state machine. By using a state machine you can begin anywhere you like.
    For more information in regards to a state machine, see the following link:
    http://zone.ni.com/devzone/conceptd.nsf/webmain/C74CEC177A289DBD86256C4E00600196?opendocument
    Hope this helps.
    Mike

  • Can not start WebLogic in Eclipse. Error: "Could not find the main class."

    I have installed Eclipse 2.0 and WebLogic Server 6.1. and the WebLogc plug in from GENUITEC (and jdk1.3.1_04, on Win2K Server). After I have done the configuration, the WebLogic start/stop buttons are integried into the Eclipse Toolbar, but when I click on the start button to start Weblogic, it pops up a dialog box "Java Virtual Machine Launcher" with message: "Could not find the main class. Program will exit!"
    Starting WebLogc Server from the Start panel works fine.
    Does any one have seen this before or have a suggestion what I should do?
    Many many thanks in advance.
    Huan

    Weblogic must be started with a full JDK; otherwise
    JSPs and dynamic EJB stubs could not be deployed. The
    error message
    indicates you are attempting to use a JRE. Configure
    Eclipse JRE to point to a JDK. The product
    documentation will help you with this process. It does not work for me. :-(
    I have tried JDK 1.3.1 and 1.4.1: same result: I get a "Could not find the main class: Program will exit"
    For free expert support please consider contacting
    Genuitec at [email protected] If just want any
    answer ask a newsgroup.
    WayneI'll try the support at '[email protected]' :)
    Michel
    Michel Szybist
    [email protected]
    Fax: +33 (0)173729897
    SMS: http://www.szybist.net/

Maybe you are looking for

  • Using software instruments that are stored on an external drive.

    I recently bought Logic 9. Doing a custom install, I stored the instrument library on an external disk thinking it would be easy to use the instruments at a later time. Now, however, when I create a software instrument track, I only see the basic exs

  • Oracle 9i Portal

    Title : Oracle 9iAS O/S : MS Windows POST: REPLY (W/QUOTE) Author : adedoja adeyemi Type : Question Date : Jun 5, 2002 16:18 PT Hi Can anyone advice on what to do pls. The portal installation stopped after 20%,the statement displayed was an unexpecte

  • External Presenter removed from meeting after 1 hour of presenting

    Any time we have give presentation rights to an external customer who is coming in as a guest and using the web access to the meeting, and they are presenting for over 1 hour they are removed from the meeting while still actively presenting content.

  • How to make modal page to be auto size regarding content in the page?

    Hi, guys: I created a modal page (Dan Mcghan's modal page plugin from skillbuilder web site), which pops up when user clicks the master table to see drill down data. However, some rows in the modal page have too many characters, and modal page cannot

  • Epson will provide Preview feature

    I am running 10.3.9 and my Epson Stylus Color 777 does not provide the Preview feature anymore...It provided that feature for the last four years. I installed no new software on the computor lately..... While in text doument, selecting Print and then