I copied the file from your email into an empty project. Right click in the file and select "Run File". A JFrame with menu bar (as shown in your gui builder) was displayed in the upper left corner. To simplify things, you can click on "Source" in the editor toolbar window, and just display the source code, then do the "Run File"

There's also terminology issue. NetBeans has an "Output Window" which you can see at the bottom of your image. I would call the JFrame, that you want to see displayed, your programs "Main Window".

HTH,
-ernie

On 3/15/22 5:01 PM, Zulfi Khan wrote:

The output GUI sticks to the NetBeans window. I can’t see the output window. I have attached the image. Somebbody please guide me.


The steps of the development are as follows:


1. Add a JFrame Form class by right clicking on the name of the application

2.Click on the Jframe Form class just added.

3. It would show the Source and Design menu items.

4. Click on the design menu item

5. It open the palette.

6. Click on the swing menus in the palette

7. Drag the 'menu bar' from the swing menu options and put it on top of the JFrame Form class file. We will see the originalsquare box of the JFrame form class with the menu bar lying on top of it. Menu bar has options File and Edut. This process is called adding a JMenuBar to a JFrame.

8. Next step is to add Jmenus to JMenuBar

9. Drag Jmenu and place it on the File menu. File menu will be enclosed in square box. This means that the menu has been well placed.

10. Next add JMenu Item to the JMenu

11. Run the application



The code is given below:

/*

* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license

* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template

*/

package com.mycompany.menugui;


/**

*

* @author zulfi

*/

public class MenuGuiForm extends javax.swing.JFrame {


/**

* Creates new form MenuGuiForm

*/

public MenuGuiForm() {

initComponents();

}


/**

* This method is called from within the constructor to initialize the form.

* WARNING: Do NOT modify this code. The content of this method is always

* regenerated by the Form Editor.

*/

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {


jMenuItem1 = new javax.swing.JMenuItem();

jMenuBar1 = new javax.swing.JMenuBar();

jMenu1 = new javax.swing.JMenu();

jMenu3 = new javax.swing.JMenu();

jMenu2 = new javax.swing.JMenu();


jMenuItem1.setText("jMenuItem1");


setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);


jMenu1.setText("File");


jMenu3.setText("jMenu3");

jMenu1.add(jMenu3);


jMenuBar1.add(jMenu1);


jMenu2.setText("Edit");

jMenuBar1.add(jMenu2);


setJMenuBar(jMenuBar1);


javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGap(0, 400, Short.MAX_VALUE)

);

layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGap(0, 275, Short.MAX_VALUE)

);


pack();

}// </editor-fold>


/**

* @param args the command line arguments

*/

public static void main(String args[]) {

/* Set the Nimbus look and feel */

//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">

/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.

* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

*/

try {

for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

}

}

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(MenuGuiForm.class.getName()).log(java.util.logging.Level.SEVERE,null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(MenuGuiForm.class.getName()).log(java.util.logging.Level.SEVERE,null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(MenuGuiForm.class.getName()).log(java.util.logging.Level.SEVERE,null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(MenuGuiForm.class.getName()).log(java.util.logging.Level.SEVERE,null, ex);

}

//</editor-fold>


/* Create and display the form */

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new MenuGuiForm().setVisible(true);

}

});

}


// Variables declaration - do not modify

private javax.swing.JMenu jMenu1;

private javax.swing.JMenu jMenu2;

private javax.swing.JMenu jMenu3;

private javax.swing.JMenuBar jMenuBar1;

private javax.swing.JMenuItem jMenuItem1;

// End of variables declaration

}

Zulfi.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
For additional commands, e-mail: users-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
For additional commands, e-mail: users-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to