Example usage for java.awt Menu Menu

List of usage examples for java.awt Menu Menu

Introduction

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

Prototype

public Menu(String label) throws HeadlessException 

Source Link

Document

Constructs a new menu with the specified label.

Usage

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 w ww.  jav a2  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);
}

From source file:ExClip.java

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

    //// ww w .  ja  va 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:ExTexture.java

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

    ////w w  w  .jav  a2  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");

    ///* w  w w  . j a  va  2 s. c om*/
    //  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:ExDepthCue.java

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

    ////from  www. ja  va2 s .  com
    //  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: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  w w w .j  a  v a  2 s  .  c  om
        mt.add(switchMenu[i]);
    }
    exampleMenuBar.add(mt);

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

From source file:ExBluePrint.java

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

    ///*from  w ww. j  a  va 2  s  .  com*/
    //  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();
    }
}

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  ww .  ja va  2 s. com*/
    //  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  ww  w .  ja va2 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: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 v  a2 s  . c  o  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);
}