About 8,330 results
Open links in new tab
  1. swing - How to build a java Main Menu - Stack Overflow

    Obviously I am trying to make a main menu using the swing components. I understand that in order to make my menu happen, I have to utilize CardLayout, which I do in the code below: (Everything is imported of course)

  2. Java Swing | JMenuBar | GeeksforGeeks

    May 20, 2022 · JMenu(String name, boolean b) : Creates a new Menu with a specified name and boolean value specifies it as a tear-off menu or not. A tear-off menu can be opened and dragged away from its parent menu bar or menu.

  3. How to Use Menus (The Java™ Tutorials > Creating a GUI With …

    Creating and Setting Up Menu Bars; Creating and Populating Menus; Creating, Populating, and Controlling Popup Menus; Implementing Menu Items

  4. java - A Starting Menu for a simple game - Stack Overflow

    Apr 12, 2011 · Here is some sample code for creating a simple menu like you described, assuming your JFrame is called frame. //Create the menu bar. //Build the first menu. "File menu"); new ImageIcon("images/new.gif")); The important …

  5. Create a simple menu with Java - Stack Overflow

    Mar 12, 2021 · @CodeTiger Do you want your menu to be as a console output or should it have GUI. You could do a switch/case e.g. public static void main(String[] args) { System.out.println("C) Create new cargo <name> <weight> <strength>"); System.out.println("L) Load cargo from dock <stackIndex>"); System.out.println("U) Unload cargo from ship <srcStackIndex>");

  6. JAVA Swing Menu Example - Java Code Geeks

    Jul 25, 2016 · A menu bar contains one or more menus and has a customary, platform-dependent location — usually along the top of a window. A popup menu is a menu that is invisible until the user makes a platform-specific mouse action, such as pressing the right mouse button, over a popup-enabled component. The popup menu then appears under the cursor.

  7. Create a main menu. : Menu « Swing JFC - Java

    Create a main menu. import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; public class Main implements ActionListener { Main() { JFrame f = new JFrame("Menu Demo"); f.setSize(220, 200); f.setDefaultCloseOperation ...

  8. Java Program to Create a Menu and Menu Bar - Sanfoundry

    1. Create a menu using JMenu class. 2. To create menu items use the JMenuItem class. 3. Create a menu bar using JMenuBar and add the menu to it. 4. Set the menu to the frame using setJMenuBar function. 5. Display the label of the menu item selected.

  9. Java AWT MenuItem & Menu - GeeksforGeeks

    Nov 13, 2023 · The Java AWT Menu class represents a pop-up menu component in a graphical user interface (GUI) that can contain a collection of MenuItem objects. It provides a way to create and manage menus in Java AWT applications.

  10. Create a Main Menu - Swing - BrainKart

    Fortunately, Swing makes creating and managing the main menu easy. This section shows you how to construct a basic main menu. Subsequent sections will show you how to add options to it. Constructing the main menu requires several steps. First, create the JMenuBar object that will hold the menus.

  11. Some results have been removed
Refresh