Slide 1
Slide 2
Slide 3

Menu Bar in java programming (V82)

No Comments

JMenu Bar 

Menu Bar is a graphical user interface (GUI) component that displays a horizontal menu bar, usually located at the top of a window or application. It contains a collection of menus that provide access to commands and features of the application.

Example:

 

Source Code:

Copied!
    private void MenuClearActionPerformed(java.awt.event.ActionEvent evt) {                                          
         txtArea.setText(""); // Clear text area
    }                                         

    private void MenuExitActionPerformed(java.awt.event.ActionEvent evt) {                                         
        System.exit(0); // Close program
    }                                        

    private void MenuUppercaseActionPerformed(java.awt.event.ActionEvent evt) {                                              
        String text = txtArea.getText();
        txtArea.setText(text.toUpperCase());
    }                                             

    private void MenuLowercaseActionPerformed(java.awt.event.ActionEvent evt) {                                              
        String text = txtArea.getText();
        txtArea.setText(text.toLowerCase());
    }                                                                                      

Result:

Watch the video:


Ebook: https://softkhpc.blogspot.com/2025/05/java-programming-ebooks.html

back to top