Example usage for javax.swing JMenu applyComponentOrientation

List of usage examples for javax.swing JMenu applyComponentOrientation

Introduction

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

Prototype

public void applyComponentOrientation(ComponentOrientation o) 

Source Link

Document

Sets the ComponentOrientation property of this menu and all components contained within it.

Usage

From source file:Main.java

public Main() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JMenuBar bar = new JMenuBar();
    JMenu menu = new JMenu("File");
    ComponentOrientation ori = ComponentOrientation.LEFT_TO_RIGHT;

    menu.applyComponentOrientation(ori);
    bar.add(menu);//from  w  w  w  . ja  va 2s .  c o m

    menu.add(new JMenuItem("Close"));
    menu.add(new JSeparator()); // SEPARATOR
    menu.add(new JMenuItem("Exit"));

    setJMenuBar(bar);
    add(new JLabel("A placeholder"));

    pack();
    setSize(300, 300);
    setVisible(true);

    menu.doClick(100);
}

From source file:Main.java

public Main() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JMenuBar bar = new JMenuBar();
    JMenu menu = new JMenu("File");
    ComponentOrientation ori = ComponentOrientation.LEFT_TO_RIGHT;

    menu.applyComponentOrientation(ori);
    bar.add(menu);//from   w w  w  .  j  a  v a  2  s .  c o  m

    menu.add(new JMenuItem("Close"));
    menu.add(new JSeparator()); // SEPARATOR
    menu.add(new JMenuItem("Exit"));

    setJMenuBar(bar);
    add(new JLabel("A placeholder"));

    pack();
    setSize(300, 300);
    setVisible(true);

    MenuElement[] e = menu.getSubElements();
}

From source file:Main.java

public Main() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JMenuBar bar = new JMenuBar();
    JMenu menu = new JMenu("File");
    ComponentOrientation ori = ComponentOrientation.LEFT_TO_RIGHT;

    menu.applyComponentOrientation(ori);
    bar.add(menu);/*from w  w  w .  j a va 2s  . c  o  m*/

    menu.add(new JMenuItem("Close"));
    menu.add(new JSeparator()); // SEPARATOR
    menu.add(new JMenuItem("Exit"));

    setJMenuBar(bar);
    add(new JLabel("A placeholder"));

    pack();
    setSize(300, 300);
    setVisible(true);

    menu.insert(new JMenuItem("Exit"), 0);
}

From source file:Main.java

public Main() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JMenuBar bar = new JMenuBar();
    JMenu menu = new JMenu("File");
    ComponentOrientation ori = ComponentOrientation.LEFT_TO_RIGHT;

    menu.applyComponentOrientation(ori);
    bar.add(menu);// ww w  .j  a  v  a2s .co  m

    menu.add(new JMenuItem("Close"));
    menu.add(new JSeparator()); // SEPARATOR
    menu.add(new JMenuItem("Exit"));

    setJMenuBar(bar);
    add(new JLabel("A placeholder"));

    pack();
    setSize(300, 300);
    setVisible(true);

    menu.isSelected();
}

From source file:Main.java

public Main() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JMenuBar bar = new JMenuBar();
    JMenu menu = new JMenu("File");
    ComponentOrientation ori = ComponentOrientation.LEFT_TO_RIGHT;

    menu.applyComponentOrientation(ori);
    bar.add(menu);/*from   w w w  . j a va2 s .c o m*/

    menu.add(new JMenuItem("Close"));
    menu.add(new JSeparator()); // SEPARATOR
    menu.add(new JMenuItem("Exit"));

    setJMenuBar(bar);
    add(new JLabel("A placeholder"));

    pack();
    setSize(300, 300);
    setVisible(true);

    menu.insert("Exit", 0);
}

From source file:Main.java

public Main() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JMenuBar bar = new JMenuBar();
    JMenu menu = new JMenu("File");
    ComponentOrientation ori = ComponentOrientation.LEFT_TO_RIGHT;

    menu.applyComponentOrientation(ori);
    bar.add(menu);/*from   ww  w  .j  a v a 2s.  co  m*/

    menu.add(new JMenuItem("Close"));
    menu.add(new JSeparator()); // SEPARATOR
    menu.add(new JMenuItem("Exit"));

    setJMenuBar(bar);
    add(new JLabel("A placeholder"));

    pack();
    setSize(300, 300);
    setVisible(true);

    menu.isPopupMenuVisible();
}

From source file:Main.java

public Main() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JMenuBar bar = new JMenuBar();
    JMenu menu = new JMenu("File");
    ComponentOrientation ori = ComponentOrientation.LEFT_TO_RIGHT;

    menu.applyComponentOrientation(ori);
    bar.add(menu);//from  w ww . j  a  va  2  s  . c om

    menu.add(new JMenuItem("Close"));
    menu.add(new JSeparator()); // SEPARATOR
    menu.add(new JMenuItem("Exit"));

    setJMenuBar(bar);
    add(new JLabel("A placeholder"));

    pack();
    setSize(300, 300);
    setVisible(true);

    menu.insertSeparator(0);
}

From source file:Main.java

public Main() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JMenuBar bar = new JMenuBar();
    JMenu menu = new JMenu("File");
    ComponentOrientation ori = ComponentOrientation.LEFT_TO_RIGHT;

    menu.applyComponentOrientation(ori);
    bar.add(menu);/*from  www.j  a  v a  2  s  .  com*/

    menu.add(new JMenuItem("Close"));
    menu.add(new JSeparator()); // SEPARATOR
    menu.add(new JMenuItem("Exit"));

    setJMenuBar(bar);
    add(new JLabel("A placeholder"));

    pack();
    setSize(300, 300);
    setVisible(true);

    menu.isTearOff();
}

From source file:Main.java

public Main() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JMenuBar bar = new JMenuBar();
    JMenu menu = new JMenu("File");
    ComponentOrientation ori = ComponentOrientation.LEFT_TO_RIGHT;

    menu.applyComponentOrientation(ori);
    bar.add(menu);//from   ww w.  j  a  v  a 2s . c o m

    menu.add(new JMenuItem("Close"));
    menu.add(new JSeparator()); // SEPARATOR
    menu.add(new JMenuItem("Exit"));

    setJMenuBar(bar);
    add(new JLabel("A placeholder"));

    pack();
    setSize(300, 300);
    setVisible(true);

    menu.isTopLevelMenu();
}

From source file:Main.java

public Main() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JMenuBar bar = new JMenuBar();
    JMenu menu = new JMenu("File");
    ComponentOrientation ori = ComponentOrientation.LEFT_TO_RIGHT;

    menu.applyComponentOrientation(ori);
    bar.add(menu);/*from w ww.j  a  v  a2s  .com*/

    menu.add(new JMenuItem("Close"));
    menu.add(new JSeparator()); // SEPARATOR
    menu.add(new JMenuItem("Exit"));

    setJMenuBar(bar);
    add(new JLabel("A placeholder"));

    pack();
    setSize(300, 300);
    setVisible(true);

    menu.menuSelectionChanged(false);
}