Java carrot: How to use JMenuBar class

Java carrot: How to use JMenuBar class

import javax.swing.*;



public class JMenuBarClass

{

 public static void main(String[] args)

 {

   JFrame f = new JFrame("welcome");



   JMenuBar mb = new JMenuBar();


   JMenu m1 = new JMenu("File");

   JMenuItem mitem1 = new JMenuItem("New");


   m1.add(mitem1);


   JMenu m2 = new JMenu("Edit");

   JMenuItem mitem2 = new JMenuItem("cut");


   m2.add(mitem2);


   mb.add(m1);

   mb.add(m2);


   f.setJMenuBar(mb);

   f.setSize(200,200);

   f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

   f.setVisible(true);


  }

 }

  

java

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

How to Install OpenJDK 11 on CentOS 8

What is OpenJDK? OpenJDk or Open Java Development Kit is a free, open-source framework of the Java Platform, Standard Edition (or Java SE).

Java Core (2020) | Java for beginners | Brush up your Java Skills | Get Hired

In this video we will learn about all the major concepts that come under Java Core . The course is very carefully designed and is made with keeping simplicit...

Java Multithreading Example | Multithreading in Java

Java Multithreading Tutorial With Example | Multithreading in Java. Multithreading is a process of executing multiple threads simultaneously.

Java File Class Tutorial | Java.io File Class in Java Example

Java File class represents the path of directories and files. It provides the methods for renaming, deleting, and obtaining the properties of file or directory.

Java Hashmap Example | HashMap in Java

Java HashMap is the part of Collections since JDK1.2. Java HashMap provides the underlying implementation of the Map interface of Java.