Example usage for java.awt Menu add

List of usage examples for java.awt Menu add

Introduction

In this page you can find the example usage for java.awt Menu add.

Prototype

public void add(String label) 

Source Link

Document

Adds an item with the specified label to this menu.

Usage

From source file:ExAmbientLight.java

public void initialize(String[] args) {
    // Initialize the window, menubar, etc.
    super.initialize(args);
    exampleFrame.setTitle("Java 3D Ambient Light Example");

    ///* www.jav  a2  s.  c o  m*/
    //  Add a menubar menu to change node parameters
    //    Light on/off
    //    Color -->
    //

    Menu m = new Menu("AmbientLight");

    lightOnOffMenu = new CheckboxMenuItem("Light on/off", lightOnOff);
    lightOnOffMenu.addItemListener(this);
    m.add(lightOnOffMenu);

    colorMenu = new CheckboxMenu("Color", colors, currentColor, this);
    m.add(colorMenu);

    exampleMenuBar.add(m);
}

From source file:AppearanceTest.java

public Menu createMenu() {
    String szName = getName();/*from   w  w w . j a v a2 s  .  c  o m*/
    String[] itemArray = getMenuItemNames();
    ActionListener listener = this;

    Menu menu = new Menu(szName);

    MenuItem menuItem = new MenuItem("Null");
    menuItem.addActionListener(listener);
    menu.add(menuItem);

    menuItem = new MenuItem("Non_Null");
    menuItem.addActionListener(listener);
    menu.add(menuItem);

    for (int n = 0; n < itemArray.length; n++) {
        menuItem = new MenuItem(itemArray[n]);
        menuItem.addActionListener(listener);
        menu.add(menuItem);
    }

    return menu;
}

From source file:ExLightScope.java

public void initialize(String[] args) {
    // Initialize the window, menubar, etc.
    super.initialize(args);
    exampleFrame.setTitle("Java 3D Light Scoping Example");

    ////ww  w . jav a 2  s.com
    //  Add a menubar menu to change node parameters
    //    Use bounding leaf
    //

    Menu m = new Menu("DirectionalLights");

    light1OnOffMenu = new CheckboxMenuItem("Red light with sphere set 1 scope", light1OnOff);
    light1OnOffMenu.addItemListener(this);
    m.add(light1OnOffMenu);

    light2OnOffMenu = new CheckboxMenuItem("Blue light with sphere set 2 scope", light2OnOff);
    light2OnOffMenu.addItemListener(this);
    m.add(light2OnOffMenu);

    light3OnOffMenu = new CheckboxMenuItem("White light with universal scope", light3OnOff);
    light3OnOffMenu.addItemListener(this);
    m.add(light3OnOffMenu);

    exampleMenuBar.add(m);
}

From source file:ExTransform.java

public void initialize(String[] args) {
    // Initialize the window, menubar, etc.
    super.initialize(args);
    exampleFrame.setTitle("Java 3D Transform Example");

    // Add a menu to select among transform options

    Menu mt = new Menu("Transform");
    switchMenu = new CheckboxMenuItem[options.length];
    for (int i = 0; i < options.length; i++) {
        switchMenu[i] = new CheckboxMenuItem(options[i].name);
        switchMenu[i].addItemListener(this);
        switchMenu[i].setState(false);//from w  w  w .  java2 s .c o  m
        mt.add(switchMenu[i]);
    }
    exampleMenuBar.add(mt);

    currentSwitch = 0;
    switchMenu[currentSwitch].setState(true);
}

From source file:ExDepthCue.java

public void initialize(String[] args) {
    // Initialize the window, menubar, etc.
    super.initialize(args);
    exampleFrame.setTitle("Java 3D ExDepthCue Example");

    ///*from w w  w  .  j ava  2 s  .  c o  m*/
    //  Add a menubar menu to change node parameters
    //    Depth cueing
    //    Depth-cue color -->
    //

    Menu m = new Menu("Depth Cueing");

    depthCueOnOffMenu = new CheckboxMenuItem("Depth cueing", depthCueOnOff);
    depthCueOnOffMenu.addItemListener(this);
    m.add(depthCueOnOffMenu);

    colorMenu = new CheckboxMenu("Depth-cue color", colors, currentColor, this);
    m.add(colorMenu);

    exampleMenuBar.add(m);
}

From source file:ExLightBounds.java

public void initialize(String[] args) {
    // Initialize the window, menubar, etc.
    super.initialize(args);
    exampleFrame.setTitle("Java 3D Light Bounds Example");

    ////www . j  av a2  s . co m
    //  Add a menubar menu to change node parameters
    //    Use bounding leaf
    //    Bounds size -->
    //    Bounding leaf position -->
    //

    Menu m = new Menu("DirectionalLight");

    boundingLeafOnOffMenu = new CheckboxMenuItem("Use bounding leaf", boundingLeafOnOff);
    boundingLeafOnOffMenu.addItemListener(this);
    m.add(boundingLeafOnOffMenu);

    boundsMenu = new CheckboxMenu("Bounds size", bounds, currentBounds, this);
    m.add(boundsMenu);

    positionMenu = new CheckboxMenu("Bounding leaf position", positions, currentPosition, this);
    if (boundingLeafOnOff)
        // Bounding leaf on
        positionMenu.setEnabled(true);
    else
        // Bounding leaf off
        positionMenu.setEnabled(false);
    m.add(positionMenu);

    exampleMenuBar.add(m);
}

From source file:ExTexture.java

public void initialize(String[] args) {
    // Initialize the window, menubar, etc.
    super.initialize(args);
    exampleFrame.setTitle("Java 3D Texture Mapping Example");

    ////from   ww w  .  java 2 s.c om
    //  Add a menubar menu to change texture parameters
    //    Image -->
    //    Boundary mode -->
    //    Boundary color -->
    //    Filter mode -->
    //

    Menu m = new Menu("Texture");

    textureOnOffMenu = new CheckboxMenuItem("Texturing enabled", textureOnOff);
    textureOnOffMenu.addItemListener(this);
    m.add(textureOnOffMenu);

    imageMenu = new CheckboxMenu("Image", images, currentImage, this);
    m.add(imageMenu);

    boundaryMenu = new CheckboxMenu("Boundary mode", boundaries, currentBoundary, this);
    m.add(boundaryMenu);

    colorMenu = new CheckboxMenu("Boundary color", colors, currentColor, this);
    m.add(colorMenu);

    filterMenu = new CheckboxMenu("Filter mode", filters, currentFilter, this);
    m.add(filterMenu);

    exampleMenuBar.add(m);

    //
    //  Add a menubar menu to change texture attributes parameters
    //    Mode -->
    //    Blend color -->
    //

    m = new Menu("TextureAttributes");

    modeMenu = new CheckboxMenu("Mode", modes, currentMode, this);
    m.add(modeMenu);

    blendColorMenu = new CheckboxMenu("Blend color", colors, currentBlendColor, this);
    m.add(blendColorMenu);

    xformMenu = new CheckboxMenu("Transform", xforms, currentXform, this);
    m.add(xformMenu);

    exampleMenuBar.add(m);

    // Preload the texture images
    //   Use the texture loading utility to read in the texture
    //   files and process them into an ImageComponent2D
    //   for use in the Background node.
    if (debug)
        System.err.println("Loading textures...");

    textureComponents = new Texture2D[images.length];

    String value = null;
    for (int i = 0; i < images.length; i++) {
        value = (String) images[i].value;
        textureComponents[i] = loadTexture(value);
    }

    tex = textureComponents[currentImage];

}

From source file:ExDirectionalLight.java

public void initialize(String[] args) {
    // Initialize the window, menubar, etc.
    super.initialize(args);
    exampleFrame.setTitle("Java 3D Directional Light Example");

    ///*from   ww w.j a  v  a 2  s. c o  m*/
    //  Add a menubar menu to change node parameters
    //    Light on/off
    //    Color -->
    //    Direction -->
    //

    Menu m = new Menu("DirectionalLight");

    lightOnOffMenu = new CheckboxMenuItem("Light on/off", lightOnOff);
    lightOnOffMenu.addItemListener(this);
    m.add(lightOnOffMenu);

    colorMenu = new CheckboxMenu("Color", colors, currentColor, this);
    m.add(colorMenu);

    directionMenu = new CheckboxMenu("Direction", directions, currentDirection, this);
    m.add(directionMenu);

    exampleMenuBar.add(m);
}

From source file:ExText.java

public void initialize(String[] args) {
    // Initialize the window, menubar, etc.
    super.initialize(args);
    exampleFrame.setTitle("Java 3D Text Example");

    ///*  ww w  .  j  a  va2s  . co  m*/
    //  Add a menubar menu to change node parameters
    //    Font -->
    //

    Menu m = new Menu("Font3D");

    // Get a list of available fonts
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    String[] fontNames = ge.getAvailableFontFamilyNames();
    fonts = new NameValue[fontNames.length];
    Font newFont = null;

    // Add those fonts to a list and build the font menu
    if (debug)
        System.err.println("Loading fonts...");
    for (int i = 0; i < fontNames.length; i++) {
        if (debug)
            System.err.println("  " + fontNames[i]);
        newFont = new Font(fontNames[i], Font.PLAIN, 1);
        fonts[i] = new NameValue(fontNames[i], newFont);
    }
    fontMenu = new CheckboxMenu("Font", fonts, currentFont, this);
    m.add(fontMenu);

    exampleMenuBar.add(m);
}

From source file:ExPointLight.java

public void initialize(String[] args) {
    // Initialize the window, menubar, etc.
    super.initialize(args);
    exampleFrame.setTitle("Java 3D Point Light Example");

    ///*from  www .  j a v a 2 s.  c  o m*/
    //  Add a menubar menu to change node parameters
    //    Light on/off
    //    Color -->
    //    Position -->
    //    Attenuation -->
    //

    Menu m = new Menu("PointLight");

    lightOnOffMenu = new CheckboxMenuItem("Light on/off", lightOnOff);
    lightOnOffMenu.addItemListener(this);
    m.add(lightOnOffMenu);

    colorMenu = new CheckboxMenu("Color", colors, currentColor, this);
    m.add(colorMenu);

    positionMenu = new CheckboxMenu("Position", positions, currentPosition, this);
    m.add(positionMenu);

    attenuationMenu = new CheckboxMenu("Attenuation", attenuations, currentAttenuation, this);
    m.add(attenuationMenu);

    exampleMenuBar.add(m);
}