How to use a JButton to display another form

Hello.
I am using Netbeans 6.5 to autogenerate a GUI. I have generated 2 separate forms, one is called MainMenu.java and the second is called subMenu.java.
How do I do it so that when you click the start button (jButton1) in the main menu (MainMenu.java) it displays the submenu (subMenu.java).
Here is the code as follows:
//MainMenu.java
public class MainMenu extends javax.swing.JApplet {
    /** Initializes the applet MainMenu */
    public void init() {
        try {
            java.awt.EventQueue.invokeAndWait(new Runnable() {
                public void run() {
                    initComponents();
        } catch (Exception ex) {
            ex.printStackTrace();
//Generated Code
    private void initComponents() {
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton1.setText("Start");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
        jButton2.setText("Exit");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
    }// </editor-fold>
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        System.exit(0);
    // Variables declaration - do not modify
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    // End of variables declaration
//subMenu.java
  public class subMenu extends javax.swing.JFrame {
    /** Creates new form subMenu */
    public subMenu() {
        initComponents();
//Generated Code
       private void initComponents() {
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        jButton1.setText("Level 1");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
        jButton2.setText("Level 2");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
           }// </editor-fold>
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
    * @param args the command line arguments
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new subMenu().setVisible(true);
    // Variables declaration - do not modify
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    // End of variables declaration

I asked my question in hopes that somebody has maybe had a similar question or has dealtwith something similar to what I am trying to do
But you said you already know how to do this. You said you know how to create a JFrame and display it. So what is your problem?
You said you know where to add the code. So again what is your problem?
All you posted is code that was generated by the IDE. You have not make any effort to add your own code. Why do you think the code to show a frame here, is any different than the code you used to show a frame in the past?
You learn by trying, not by asking people to spoon feed the answer to you.
If you would even make the slightest effort at filling in the code where the IDE has told you to add the code I would be more willing to help. But apparently you have no desire to make the effort.

Similar Messages

  • Save Records by using F10 and after pressing F10 it display another form?

    hello all
    is it possible to save records by pressing f10 key and after commit it display another form? if yes then help me
    sarah

    Hi,
    In the KEY-COMMIT trigger of the form write the code,
         COMMIT;
         NEW_FORM('<form_name>'); -- Or any other form opening built-ins like OPEN_FORM, CALL_FORM etc.Regards,
    Manu.
    If this answer is helpful or correct, please mark it. Thanks.

  • How to use buttons in hcm process and forms?

    Hi Experts,
    I want to know how to use buttons in HCM process and form.
    And when i click on the button it was validating all the fields and it was throwing an error ( complete SACHP fields) i am not using this filed in any where of my form.
    So, please help in getting out of this error. And help me with some document, which method will  trigger once we click on the button.
    Thanks & Regards,
    Rocky

    You do not need to add this field to your list. In the view V_T588MFPROPS (SAP delivered), this field is set as mandatory. In configuration, you must maintain the view V_T588MFPROPC (Customer area) and make sure the field is not set to mandatory. This will override the SAP delivered setting and the error message will be not be displayed.
    Derrick Banks
    Banks & Company, LLC

  • How to use PO message type to output 'Form' as PDF file

    Dear experts,
      I am working for a topic of how to use PO message type to output 'Form' as 'PDF file', and save to external file system automatically.
      Any one familiar to this topic, please kindly give me some guide, thank you!
    Regards,
    Joyce

    Hi,
       Go through the program RSTXPDFT4 (Converting SAPscript (OTF) or ABAP List Spool Job to PDF), you will get some idea.  Using this program you can convert spool into PDF file.
    -Alpesh

  • How to use one query results in another query

    hi,
    in help.sap I have founded that using variable type replacement path I can use one query results in another query. It is wrote there that I have to choose query name results I want to get in variable definition but I do not know where.
    How I can do this?
    Result I want to get is:
    In one query I have material prices in another material quantities. I want to calculate inventory value (price * quantity). Moreover prices are on plant level, quantities on storage type level. Plant is atribute of storage type.
    Can I do this?
    Regards,
    Andrzej

    Hi Andrzej,
    please check out this thread: Set parameters values depending on other parameters
    I had a discussion about query results as input for another query in there.
    For creating a workbook, just click on the save button after you ran your query in the bex.
    Siggi
    Message was edited by: Siegfried Szameitat

  • How to use a session bean in another session bean (or an EJB in a session)

    JDev 11.1.1.4, WLS 10.3.4, Windows 7 x64
    I have a login controller with a session-scoped bean that manages logins.
    I have another session-scoped bean that manages menu security.
    both modules compile and work fine now I need to share the data from one to another.
    I need to reference the login controller in the menu security bean. How do I reference (include) the login bean in the security bean?
    I tried an EJB - what a farce - these are supposed to be universal and easy ( basis of the oop in Java).
    the bean is defined:
    @Stateless(name = "SecurityEJB", mappedName = "ZITASApplication-ZITASModel-SecurityEJB")
    I have tried :
    ic = new InitialContext();
    session = (SecurityEJBLocal)ic.lookup("ZITASApplication-ZITASModel-SecurityEJB#model.security.logic.SecurityEJB");
    session = (SecurityEJBLocal)ic.lookup("ZITASApplication-ZITASModel-SecurityEJB#model.security.logic.SecurityEJBLocal");
    session = (SecurityEJBLocal)ic.lookup("java:ejb/model.security.logic.SecurityEJB");
    session = (SecurityEJBLocal)ic.lookup("java:ejb/SecurityEJB");
    session = (SecurityEJBLocal)ic.lookup("java:app/SecurityEJB");
    session = (SecurityEJBLocal)ic.lookup("java:module/SecurityEJB");
    All return null pointers and claim the name cannot be resolved.
    As you can see - I have found various claims to how to do this.
    One way says create a sevlet, generate a listener and use the sevlet. Basically one for every EJB - a lot of work to use the EJBs
    I would assume that this would be one of the easiest parts of java - as it is the foundation of re-usability and oop.
    I can do either in the application - the added complexity of the EJB is less desirable - but better programming?

    Hi,
    ic.lookup("ZITASApplication-ZITASModel-SecurityEJB#model.security.logic.SecurityEJB");This should work with remote interface. If you want to lookup local interface, you need to register it in web.xml. Quote:
    To access the business local interface you need to define ejb local references for your component environment (i.e. from your servlet environment). You can do this by defining references in your web.xml. For example:
    <ejb-local-ref>
    <ejb-ref-name>ejb/BusinessLogicBean</ejb-ref-name>
    <local>packagename.BusinessLogicBean</local>
    </ejb-local-ref>
    To lookup your local reference from your servlet you need to use the following JNDI reference:
    java:comp/env/ejb/BusinessLogicBean Another one
    First, declare a local ejb reference in your web.xml file (This will add it to JNDI):
    <ejb-local-ref>
    <ejb-ref-name>ejb/Foo</ejb-ref-name>
    <local>simple.ejb.FooLocal</local>
    </ejb-local-ref>
    Then it can be looked up from JNDI:
    InitialContext ctx = new InitialContext();
    FooLocal foo = ctx.lookup("java:comp/env/ejb/Foo");Hope this helps.
    Pedja
    Helpful links (judging from your first post, you are probably sick of these :) )
    How to lookup local EJB in Oracle Weblogic 10.3
    http://m-button.blogspot.com/2008/07/reminder-on-how-to-use-ejb3-with.html
    http://www.coderanch.com/t/451012/EJB-JEE/java/EJB-Local-Lookup-not-working

  • How to use "IMAQ ComplexPlaneToImage"? (Display after "IMAQ FFT")

    Hello,I use two ways to display a image after "IMAQ FFT":
    (1). Input a image->IMAQ FFT->Windraw(display);
    (2). Input a image->IMAQ FFT->IMAQ ComplexPlaneToImage(extracting magnitude) ->Winddraw(display).
    The two results are much different.
    I want to know what the two displayed images(especially in the second way) mean and where
    "IMAQ ComplexPlaneToImage" usually used.
    Thanks for your help!

    Hi Dan
    I am having some questions regarding the FFT Phase of the FFT with IMAQ ComplexPlaneToImage.
    From the posting below you mention that the phase is:
    Phase = Real/Magnitude.
    I am using the function ComplexPlaneToArray to see the value I am getting from ComplexPlaneToImage.
    Usually the phase is the inverse tangent  (Imaginary/Real). If we are using the Real and magnitude it will be the inverse cos(Real/Magnitude)
    I tried the above senario to verify the phase value we are getting from ComplexPlaneToArray.
    However, I get not get the value you are displaying in the phase  (ComplexPlaneToArray).
    How can I verify  ComplexPaneToArray ( phase) with the various
    ComplexPaneToArray(real)
    ComplexPaneToArray(magnitude)
    ComplexPlaneToArray(imaginary)
    I attached a phase fft.vi as an example of my issue.
    Regards,
    Corinne
    Attachments:
    phase fft.vi ‏153 KB

  • How to use old 2005 cinema display (20'') with MacBook Air (mid-2009)

    My old 20'' cinema display (2005) has three ports coming out of its power box (single-port dvi, usb, firewire).  Is it possible to use this display with my newer MacBook Air (mid-2009) ? If so, what kind of connector do I need?  Thank you very much for your help.

    To use my old Cinema display (2005) with my old PowerMac G5 (2005) I had to plug in all three ports (DVI, usb and firewire) into the desktop.  Can I really use the display just with the DVI output plugged into my MacBook Air mini-Display Port ? 

  • How to use one hash table inside another hash table

    Hi everyone,
    Any example of hash table inside another hash table.
    Can one here help me how to write one hash table inside another with repeating keys for the first hash table.
    Thanks,
    kanty.

    Do you mean you want the 'value' entries in a hash table to themselves be hash tables? Easy but this often indicates a design flaw.
    Hashtable<String,<Hashtable<String,Value>> fred = new Hashtable<String,<Hashtable<String,Value>> ();But what do you mean by "with repeating keys for the first hash table"?
    Edited by: sabre150 on Jul 2, 2010 10:11 PM
    Looks like you have already handled the declaration side in your other thread. I suspect you should be writing your own beans that hold the information and these beans would then be stored in a Map. The problem I have is that your description is too vague so I can't be certain.

  • How to use DAQ Assistant to display two analog channels in a XY Graph

    Hi,
    I am new to LabVIEW. I have been assigned a project in which i have to display two analog signals from an analog potentiostat i.e. voltage and current (also a voltage signal) on a graph using labview. I am using a myDAQ device to acquire these analog signals and I am using labview 2013 to display these signals on a graph. I am using DAQ assistant to configure these signals. Rightnow I have separate graphs for each channel. However, I want a single XY graph to display one voltage as a function of the other i.e. I want to have voltage on the X-axis and current output on the Y axis. Any kind of help is greatly appreciated.
    I have attached a screenshot of the VI. that I have made.
    Regards,
    Max
    Attachments:
    New Microsoft Word Document (2).docx ‏32 KB

    Thanks for the quick response. I was able to make a X-Y graph. However, I can only see a dot floating around. It's not drawing anything. I want to see it making a plot as it collects data. Also, I want to see the complete waveform formed when I stop the VI.
    Thanks,
    Max

  • How to use setters and getters in another program by using bean

    how to use the setters and getters methods using database connection by bean

    Say again?And so he did:
    http://forum.java.sun.com/thread.jspa?threadID=750645
    kind regards,
    Jos ;-)And again
    http://forum.java.sun.com/thread.jspa?threadID=750643&tstart=0
    No, that's his class mate I guess; it must be national getter and setter
    day somewhere today ;-)
    kind regards,
    Jos

  • How to use an Object Type from Another Database

    Hi,
    I have this requirement that I need to call a stored procedure from another DB (db1) but I am having a problem with this because one of the input parameters uses an object type defined in that DB (db1). Is it possible to use an object type from another database? TIA!

    Sven W. wrote:
    At least for queries, but I think also for procedure arguments..You (both) probably missed my post?
    We can't use a remote type as procedure argument, even with the same OID.
    It's OK for query on a remote object column though :
    SQL> conn remote_user@remote_db
    Entrez le mot de passe :
    Connecté.
    SQL> create type mytype oid '19A57209ECB73F91E03400400B40BBE3'
      2  as object (att1 number);
      3  /
    Type créé.
    SQL> create table mytable (col1 mytype);
    Table créée.
    SQL> insert into mytable values (mytype(777));
    1 ligne créée.
    SQL> create or replace function myfunc (p_in in mytype) return number
      2  is
      3  begin
      4   return p_in.att1;
      5  end;
      6  /
    Fonction créée.
    SQL> disconn
    Déconnecté de Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL>
    SQL>
    SQL>
    SQL>
    SQL>
    SQL> conn my_user@local_db
    Entrez le mot de passe :
    Connecté.
    SQL> create type mytype oid '19A57209ECB73F91E03400400B40BBE3'
      2  as object (att1 number);
      3  /
    Type créé.
    SQL> select * from mytable@test_dbl;
    COL1(ATT1)
    MYTYPE(777)
    SQL> declare
      2   res number;
      3  begin
      4   res := myfunc@test_dbl(mytype@test_dbl(777));
      5  end;
      6  /
    res := myfunc@test_dbl(mytype@test_dbl(777));
    ERREUR à la ligne 4 :
    ORA-06550: Ligne 4, colonne 26 :
    PLS-00331: référence non valide à REMOTE_USER.MYTYPE@TEST_DBL.WORLD
    ORA-06550: Ligne 4, colonne 2 :
    PL/SQL: Statement ignored
    SQL> declare
      2   res number;
      3  begin
      4   res := myfunc@test_dbl(mytype(777));
      5  end;
      6  /
    res := myfunc@test_dbl(mytype(777));
    ERREUR à la ligne 4 :
    ORA-06550: Ligne 4, colonne 9 :
    PLS-00306: numéro ou types d'arguments erronés dans appel à 'MYFUNC'
    ORA-06550: Ligne 4, colonne 2 :
    PL/SQL: Statement ignored

  • How to Retrieve data from database into another form ?

    Good Day!
    Am currently new at JSP. I've been studying it for awhile and still getting the hang of it. We are working on a project.
    Editing a given data. We have to retrieve the given data and post it to another form "Editing form".
    Since we can retrieve data using JSP but how are we going to post it to another form? I mean how are we going to transfer data from one form to another?
    Can anyone help me with codes please..

    The client is a web browser.
    The client submits a request (click a link, visit a form)
    The server gets to respond to this
    - look at request parameters from the client
    - access database
    - produce resulting html page
    - send page back to client.
    The standard pattern is to retrieve data from the database in java code, and then load that data into a bean.
    You then make that bean available as an attribute
    It is then available for use in your JSP - either <jsp:useBean> tag or using ${ELexpressions}
    All you can pass from the client to the server is request parameters - which are always strings.
    Draw a picture of where the information is, and the information flows. Very rarely does it go directly from one "form" to another.
    Cheers,
    evnafets

  • How to use template or fragment in PDF form

    Hi Expert,
    As required by project, I want to create a sample form only with company logo in header and address info in footer. Then this sample form can be made as a template. Any new form development will use this template form, no need to maintain logo and footer one by one.
    above is my requirement. In transaction SFP, I can see Tools->Template manager->add template. I tried to save my sample form as a template, but when preview it, no displaying but with error saying "not well format".
    Can anyone help me? I just want to create and use a custom template or fagment (it is said Fragment can also reuse to meet my requirement. but I also don't know how to use fragment).

    Hi
    I'm also starting with hierachical tree (HTree) and I got an example from any Oracle examples or whatever. It works with the 'hr' schema (employee, manager, department).
    In the case that I'm not finding any tutorial about htree, I'm taking this one as an example to build my own htree. If you are interested, I can email the example to you.
    regards
    remo

  • How to use a check box in smart forms????

    Hi All,
    Pls let me know how to use check boxes in smartforms.....??
    there are check boxe available which are crossed (i.e,, selected checkboxes) in the smartforms..
    But i need a checkbox which are not selected.( i.e.., which are not crossed).
    Its really urgent...
    Quick responses are highly appreciable..
    Bye

    Refer this thread
    Re: how to display symbols in smartforms
    We can create symbols in smartforms. For this, change the editor to text editor and then goto insert->characters->SAP Symbols and select the symbol you want.
    You cannot see the symbols in print preview, it'll appear only on a hard copy.
    You can also create as Text Element. In the left side of the right window,you can see a icon called Editor.Click it.
    Then in the Menu,
    go to->Change Editor
    Then in the menu,
    Insert->Characters->Displayable characters,select the character you want.Otherwise,if you want to insert SAP Icon,select that option instead of Displayable Character.

Maybe you are looking for