About 88 results
Open links in new tab
  1. 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 …

  2. java - Adding Menubar to JFrame - Stack Overflow

    Mar 15, 2015 · You add the menubar after your frame has been set visible. Due to this, the frame is first rendered and afterwards the menubar is added. Try: frame.setJMenubar(mb); frame.validate(); frame.repaint(); this should solve the problem.

  3. Java JFrame - GeeksforGeeks

    3 days ago · JFrame in Java is a class that allows you to crеatе and manage a top-lеvеl window in a Java application. It sеrvеs as thе main window for GUI-basеd Java applications and providеs a platform-indеpеndеnt way to crеatе graphical usеr intеrfacеs.

  4. Create menu bar and menu item on frame Java Swing

    In this program, we will learn how to create a menu bar on the frame in Java Swing. JMenuBar is the class that is mandatory for the menu bar. The swing package is also important for the menu bar. If we want to create menu items on the menu bar its possible with the JMenuItem class. One or more menu items we create on one menu.

  5. java - How do I make a swing menu bar that is present at the top …

    Jan 20, 2020 · As @jhamon says, create a subclass of JFrame that has your menu defined, and then subclass that for any other frame. As @mwarren and @jhamon said in comments you have to use inheritance. Create a Subclass of your JFrame and implement all the required functionality for the MenuBar there.

  6. JFrame basic tutorial and examples - CodeJava.net

    Jul 6, 2019 · JFrame is a Swing’s top-level container that renders a window on screen. A frame is a base window on which other components rely, such as menu bar, panels, labels, text fields, buttons, etc. Almost every Swing application starts with JFrame window. This article provides a summary of common practices when using JFrame in Swing development. 1.

  7. What is JFrame in Java with Examples - CodeSpeedy

    The JFrame is a class of java.swing package which is inherited and extended from the Java AWT package. It is used for creating lightweight window applications. It includes various components such as labels, panels, buttons, etc for creating a beautiful Graphical User Interface (GUI).

  8. Java JFrame Example - Java Code Geeks

    Jun 6, 2014 · In this article, we include a Java JFrame tutorial through examples. We will discuss some of the main methods and how JFrame and other main classes like JPanel, JLabel, and JButton fit into the Swing hierarchy. We will then create a simple GUI using the javax.swing package. 1. Introduction.

  9. Java JFrame - Making Main Windows - Java Made Easy!

    There are two ways of creating a Java JFrame, either by creating a variable that is the JFrame or by having our class be a subclass of JFrame. Let's start with creating a JFrame variable. Here you can see we are creating a JFrame variable called window.

  10. JFrame (Java Platform SE 8 ) - Oracle

    To change the default behavior, you invoke the method setDefaultCloseOperation(int). To make the JFrame behave the same as a Frame instance, use setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE). For more information on content panes and other features that root panes provide, see Using Top-Level Containers in The Java Tutorial.

  11. Some results have been removed
Refresh