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);


  }

 }

  

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Java Fundamentals: Learn Java for absolute beginners |Simpliv

Java Fundamentals: Learn Java for absolute beginners

Java Essentials : Learn Core Java From Basic to Advance

Learn Java Programming Using Practical Assignments. Start Building Back-end Web Applications Robust Test Automation Frameworks By End Of The Course. Learn More!

Fundamentos de Java: Aprende Java desde cero, sin misterios | Simpliv

Fundamentos de Java: Aprende Java desde cero, sin misterios