Example usage for javax.swing JMenu setMenuLocation

List of usage examples for javax.swing JMenu setMenuLocation

Introduction

In this page you can find the example usage for javax.swing JMenu setMenuLocation.

Prototype

public void setMenuLocation(int x, int y) 

Source Link

Document

Sets the location of the popup component.

Usage

From source file:Main.java

public static void main(final String args[]) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JMenuBar menuBar = new JMenuBar();

    // File Menu, F - Mnemonic
    JMenu fileMenu = new JMenu("File");
    fileMenu.setMenuLocation(10, 10);

    // File->New, N - Mnemonic
    JMenuItem newMenuItem = new JMenuItem("New");
    fileMenu.add(newMenuItem);//from  w  w w. ja  v  a2 s. c om

    frame.setJMenuBar(menuBar);
    frame.setSize(350, 250);
    frame.setVisible(true);
}