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:ExBackgroundColor.java

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

    ////from ww  w . j  a va2s.c  om
    //  Add a menubar menu to change node parameters
    //    Color -->
    //

    Menu m = new Menu("Background");

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

    exampleMenuBar.add(m);
}

From source file:ExBackgroundImage.java

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

    ///*w  w w . j av  a  2 s .  c  om*/
    //  Add a menubar menu to change node parameters
    //    Image -->
    //

    Menu m = new Menu("Background");

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

    exampleMenuBar.add(m);

    // Preload the background images
    //   Use the texture loading utility to read in the image
    //   files and process them into an ImageComponent2D
    //   for use in the Background node.
    if (debug)
        System.err.println("  background images...");
    TextureLoader texLoader = null;
    String value = null;
    imageComponents = new ImageComponent2D[images.length];

    for (int i = 0; i < images.length; i++) {
        value = (String) images[i].value;
        if (value == null) {
            imageComponents[i] = null;
            continue;
        }
        texLoader = new TextureLoader(value, this);
        imageComponents[i] = texLoader.getImage();
        // Component could be null if image couldn't be loaded
    }
}

From source file:ExSpotLight.java

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

    ////  w w  w.j a  v  a 2  s  .co m
    //  Add a menubar menu to change node parameters
    //    Light on/off
    //    Color -->
    //    Position -->
    //    Direction -->
    //    Attenuation -->
    //    Spread Angle -->
    //    Concentration -->
    //

    Menu m = new Menu("SpotLight");

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

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

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

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

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

    spreadMenu = new CheckboxMenu("Spread Angle", spreads, currentSpread, this);
    m.add(spreadMenu);

    concentrationMenu = new CheckboxMenu("Concentration", concentrations, currentConcentration, this);
    m.add(concentrationMenu);

    exampleMenuBar.add(m);
}

From source file:ExHenge.java

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

    ////from w ww.  ja  va 2  s . c  o  m
    //  Add a menubar menu to change parameters
    //    Dim ambient light
    //    Bright ambient light
    //    Red directional light
    //    Yellow directional light
    //    Orange point light
    //

    Menu m = new Menu("Lights");

    ambientOnOffMenu = new CheckboxMenuItem("Dim ambient light", ambientOnOff);
    ambientOnOffMenu.addItemListener(this);
    m.add(ambientOnOffMenu);

    brightAmbientOnOffMenu = new CheckboxMenuItem("Bright ambient light", brightAmbientOnOff);
    brightAmbientOnOffMenu.addItemListener(this);
    m.add(brightAmbientOnOffMenu);

    redDirectionalOnOffMenu = new CheckboxMenuItem("Red directional light", redDirectionalOnOff);
    redDirectionalOnOffMenu.addItemListener(this);
    m.add(redDirectionalOnOffMenu);

    yellowDirectionalOnOffMenu = new CheckboxMenuItem("Yellow directional light", yellowDirectionalOnOff);
    yellowDirectionalOnOffMenu.addItemListener(this);
    m.add(yellowDirectionalOnOffMenu);

    orangePointOnOffMenu = new CheckboxMenuItem("Orange point light", orangePointOnOff);
    orangePointOnOffMenu.addItemListener(this);
    m.add(orangePointOnOffMenu);

    exampleMenuBar.add(m);
}

From source file:ExSwitch.java

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

    // Add a menu to select among switch options
    Menu mt = new Menu("Switch");
    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 ww  w . j  a v a  2s  .  c  o  m*/
        mt.add(switchMenu[i]);
    }
    exampleMenuBar.add(mt);

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

From source file:ExExponentialFog.java

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

    ////from   w  ww  .  jav  a  2  s.c  om
    //  Add a menubar menu to change node parameters
    //    Coupled background color
    //    Background color -->
    //    Fog color -->
    //    Fog density -->
    //

    Menu m = new Menu("ExponentialFog");

    coupledBackgroundOnOffMenu = new CheckboxMenuItem("Couple background color", coupledBackgroundOnOff);
    coupledBackgroundOnOffMenu.addItemListener(this);
    m.add(coupledBackgroundOnOffMenu);

    backgroundColorMenu = new CheckboxMenu("Background color", colors, currentBackgroundColor, this);
    m.add(backgroundColorMenu);
    backgroundColorMenu.setEnabled(!coupledBackgroundOnOff);

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

    densityMenu = new CheckboxMenu("Fog density", densities, currentDensity, this);
    m.add(densityMenu);

    exampleMenuBar.add(m);
}

From source file:ExLinearFog.java

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

    ////from   ww  w  .  j a v  a2 s. c  o  m
    //  Add a menubar menu to change node parameters
    //    Coupled background color
    //    Background color -->
    //    Fog color -->
    //    Fog front distance -->
    //    Fog back distance -->
    //

    Menu m = new Menu("LinearFog");

    coupledBackgroundOnOffMenu = new CheckboxMenuItem("Couple background color", coupledBackgroundOnOff);
    coupledBackgroundOnOffMenu.addItemListener(this);
    m.add(coupledBackgroundOnOffMenu);

    backgroundColorMenu = new CheckboxMenu("Background color", colors, currentBackgroundColor, this);
    m.add(backgroundColorMenu);
    backgroundColorMenu.setEnabled(!coupledBackgroundOnOff);

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

    frontMenu = new CheckboxMenu("Fog front distance", fronts, currentFront, this);
    m.add(frontMenu);

    backMenu = new CheckboxMenu("Fog back distance", backs, currentBack, this);
    m.add(backMenu);

    exampleMenuBar.add(m);
}

From source file:ExSound.java

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

    ///*  w  w  w .  j  a  va 2 s  .co  m*/
    //  Add a menubar menu to change node parameters
    //    Background sound on/off
    //    Point sound on/off
    //

    Menu m = new Menu("Sounds");

    backgroundSoundOnOffMenu = new CheckboxMenuItem("Background sound on/off", backgroundSoundOnOff);
    backgroundSoundOnOffMenu.addItemListener(this);
    m.add(backgroundSoundOnOffMenu);

    pointSoundOnOffMenu = new CheckboxMenuItem("Point sound on/off", pointSoundOnOff);
    pointSoundOnOffMenu.addItemListener(this);
    m.add(pointSoundOnOffMenu);

    volumeMenu = new CheckboxMenu("Volume", volumes, currentVolume, this);
    m.add(volumeMenu);

    exampleMenuBar.add(m);
}

From source file:ExClip.java

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

    ///* w  w w. jav  a 2s  . c  o  m*/
    //  Add a menubar menu to change node parameters
    //    Coupled background color
    //    Background color -->
    //    Fog color -->
    //    Fog front distance -->
    //    Fog back distance -->
    //    Coupled clip back distance
    //    Clip back distance -->
    //

    Menu m = new Menu("Fog and Clip");

    coupledBackgroundOnOffMenu = new CheckboxMenuItem("Couple background color", coupledBackgroundOnOff);
    coupledBackgroundOnOffMenu.addItemListener(this);
    m.add(coupledBackgroundOnOffMenu);

    backgroundColorMenu = new CheckboxMenu("Background color", colors, currentBackgroundColor, this);
    m.add(backgroundColorMenu);
    backgroundColorMenu.setEnabled(!coupledBackgroundOnOff);

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

    frontMenu = new CheckboxMenu("Fog front distance", fronts, currentFront, this);
    m.add(frontMenu);

    backMenu = new CheckboxMenu("Fog back distance", backs, currentBack, this);
    m.add(backMenu);

    coupledClipBackOnOffMenu = new CheckboxMenuItem("Couple clip back distance", coupledClipBackOnOff);
    coupledClipBackOnOffMenu.addItemListener(this);
    m.add(coupledClipBackOnOffMenu);

    clipBackMenu = new CheckboxMenu("Clip back distance", clipBacks, currentClipBack, this);
    clipBackMenu.setEnabled(!coupledClipBackOnOff);
    m.add(clipBackMenu);

    exampleMenuBar.add(m);
}

From source file:ExBluePrint.java

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

    ///* ww  w.  j  a  v a  2  s.c  o  m*/
    //  Add a menubar menu to change parameters
    //    (images)
    //    --------
    //    Wireframe
    //    Shaded
    //

    // Add a menu to select among background and shading options
    Menu m = new Menu("Options");

    imageMenu = new CheckboxMenuItem[images.length];
    for (int i = 0; i < images.length; i++) {
        imageMenu[i] = new CheckboxMenuItem(images[i].name);
        imageMenu[i].addItemListener(this);
        imageMenu[i].setState(false);
        m.add(imageMenu[i]);
    }
    imageMenu[currentImage].setState(true);

    m.addSeparator();

    appearanceMenu = new CheckboxMenuItem[2];
    appearanceMenu[0] = new CheckboxMenuItem("Wireframe");
    appearanceMenu[0].addItemListener(this);
    appearanceMenu[0].setState(false);
    m.add(appearanceMenu[0]);

    appearanceMenu[1] = new CheckboxMenuItem("Shaded");
    appearanceMenu[1].addItemListener(this);
    appearanceMenu[1].setState(true);
    m.add(appearanceMenu[1]);

    exampleMenuBar.add(m);

    // Preload background images
    TextureLoader texLoader = null;
    imageComponents = new ImageComponent2D[images.length];
    String value = null;
    for (int i = 0; i < images.length; i++) {
        value = (String) images[i].value;
        if (value == null) {
            imageComponents[i] = null;
            continue;
        }
        texLoader = new TextureLoader(value, this);
        imageComponents[i] = texLoader.getImage();
    }
}