Example usage for java.awt Panel Panel

List of usage examples for java.awt Panel Panel

Introduction

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

Prototype

public Panel() 

Source Link

Document

Creates a new panel using the default layout manager.

Usage

From source file:SimpleSwitch.java

public SimpleSwitch() {
    VirtualUniverse myUniverse = new VirtualUniverse();
    Locale myLocale = new Locale(myUniverse);
    myLocale.addBranchGraph(buildViewBranch(myCanvas3D));
    myLocale.addBranchGraph(buildContentBranch(buildShape()));
    setTitle("SimpleWorld");
    setSize(400, 400);//from  ww  w  .  j  a  v  a2s .  c o m
    setLayout(new BorderLayout());
    Panel bottom = new Panel();
    bottom.add(boxButton);
    bottom.add(coneButton);
    bottom.add(exitButton);
    add(BorderLayout.CENTER, myCanvas3D);
    add(BorderLayout.SOUTH, bottom);
    exitButton.addActionListener(this);
    boxButton.addActionListener(this);
    coneButton.addActionListener(this);
    setVisible(true);
}

From source file:SimpleBillboard.java

public SimpleBillboard() {
    VirtualUniverse myUniverse = new VirtualUniverse();
    Locale myLocale = new Locale(myUniverse);
    myLocale.addBranchGraph(buildViewBranch(myCanvas3D));
    myLocale.addBranchGraph(buildContentBranch());
    setTitle("SimpleBillboard");
    setSize(400, 400);/*from   w  w  w .  j  av a2  s.  c o  m*/
    setLayout(new BorderLayout());
    Panel bottom = new Panel();
    bottom.add(exitButton);
    add(BorderLayout.CENTER, myCanvas3D);
    add(BorderLayout.SOUTH, bottom);
    exitButton.addActionListener(this);
    setVisible(true);
}

From source file:SimpleTransform.java

public SimpleTransform() {
    VirtualUniverse myUniverse = new VirtualUniverse();
    Locale myLocale = new Locale(myUniverse);
    myLocale.addBranchGraph(buildViewBranch(myCanvas3D));
    myLocale.addBranchGraph(buildContentBranch(buildShape()));
    setTitle("SimpleWorld");
    setSize(400, 400);/*from  w ww. j  a  va2  s . co  m*/
    setLayout(new BorderLayout());
    Panel bottom = new Panel();
    bottom.add(leftButton);
    bottom.add(rightButton);
    bottom.add(exitButton);
    add(BorderLayout.CENTER, myCanvas3D);
    add(BorderLayout.SOUTH, bottom);
    exitButton.addActionListener(this);
    leftButton.addActionListener(this);
    rightButton.addActionListener(this);
    setVisible(true);
}

From source file:Text3DLoad.java

public void init() {

    if (textString == null) {
        textString = "Java3D";
    }//from ww  w  .  j a  v a 2s  .  c  o m
    setLayout(new BorderLayout());

    button = new Button("remove behaviors");
    button.addActionListener(this);
    Panel p = new Panel();
    p.add(button);
    add("South", p);

    GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();

    Canvas3D c = new Canvas3D(config);
    add("Center", c);

    // Create a simple scene and attach it to the virtual universe
    BranchGroup scene = createSceneGraph();

    // create a SimpleUniverse with 4 TransformGroups for the mouse
    // behaviors
    u = new SimpleUniverse(c);

    // add the behaviors to the ViewingPlatform
    ViewingPlatform viewingPlatform = u.getViewingPlatform();

    viewingPlatform.setNominalViewingTransform();

    // add orbit behavior to ViewingPlatform
    orbit = new OrbitBehavior(c, OrbitBehavior.REVERSE_ALL | OrbitBehavior.STOP_ZOOM);
    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0);
    orbit.setSchedulingBounds(bounds);
    viewingPlatform.setViewPlatformBehavior(orbit);

    behaviorsOn = true;

    u.addBranchGraph(scene);
}

From source file:SimpleMorph2.java

public SimpleMorph2() {
    VirtualUniverse myUniverse = new VirtualUniverse();
    Locale myLocale = new Locale(myUniverse);
    myLocale.addBranchGraph(buildViewBranch(myCanvas3D));
    myLocale.addBranchGraph(buildContentBranch());
    setTitle("SimpleMorph");
    setSize(400, 400);/*from w  w w  .  jav a2  s.  c o  m*/
    setLayout(new BorderLayout());
    Panel bottom = new Panel();
    bottom.add(exitButton);
    add(BorderLayout.CENTER, myCanvas3D);
    add(BorderLayout.SOUTH, bottom);
    exitButton.addActionListener(this);
    setVisible(true);
}

From source file:SimpleSounds.java

public SimpleSounds() {
    VirtualUniverse myUniverse = new VirtualUniverse();
    Locale myLocale = new Locale(myUniverse);
    //              buildUniverse(myCanvas3D);
    myLocale.addBranchGraph(buildContentBranch());
    myLocale.addBranchGraph(buildViewBranch(myCanvas3D));
    setTitle("SimpleSounds");
    setSize(400, 400);//  ww  w.  j av  a  2  s. c  om
    setLayout(new BorderLayout());
    Panel bottom = new Panel();
    bottom.add(sound1Button);
    bottom.add(sound2Button);
    bottom.add(exitButton);
    add(BorderLayout.CENTER, myCanvas3D);
    add(BorderLayout.SOUTH, bottom);
    exitButton.addActionListener(this);
    sound1Button.addActionListener(this);
    sound2Button.addActionListener(this);
    setVisible(true);
}

From source file:SimpleCollision2.java

public SimpleCollision2() {
    VirtualUniverse myUniverse = new VirtualUniverse();
    Locale myLocale = new Locale(myUniverse);
    myLocale.addBranchGraph(buildViewBranch(myCanvas3D));
    myLocale.addBranchGraph(buildContentBranch());
    setTitle("SimpleWorld");
    setSize(400, 400);/*from   w  w w .j ava  2 s  .co m*/
    setLayout(new BorderLayout());
    Panel bottom = new Panel();
    bottom.add(exitButton);
    add(BorderLayout.CENTER, myCanvas3D);
    add(BorderLayout.SOUTH, bottom);
    exitButton.addActionListener(this);
    setVisible(true);
}

From source file:SimpleCollision.java

public SimpleCollision() {
    VirtualUniverse myUniverse = new VirtualUniverse();
    Locale myLocale = new Locale(myUniverse);
    myLocale.addBranchGraph(buildViewBranch(myCanvas3D));
    myLocale.addBranchGraph(buildContentBranch());
    setTitle("SimpleWorld");
    setSize(400, 400);/*w w w .  j a v a  2  s . c o m*/
    setLayout(new BorderLayout());
    Panel bottom = new Panel();
    bottom.add(exitButton);
    add(BorderLayout.CENTER, myCanvas3D);
    add(BorderLayout.SOUTH, bottom);
    exitButton.addActionListener(this);
    setVisible(true);
}

From source file:SimpleMorph.java

/**
 * Constructor that generates the content using the class methods
 *///from w  w w  .  jav  a  2 s .  c o m
public SimpleMorph() {
    VirtualUniverse myUniverse = new VirtualUniverse();
    Locale myLocale = new Locale(myUniverse);
    myLocale.addBranchGraph(buildViewBranch(myCanvas3D));
    myLocale.addBranchGraph(buildContentBranch());
    setTitle("SimpleMorph");
    setSize(400, 400);
    setLayout(new BorderLayout());
    Panel bottom = new Panel();
    bottom.add(pyraButton);
    bottom.add(cubeButton);
    bottom.add(exitButton);
    add(BorderLayout.CENTER, myCanvas3D);
    add(BorderLayout.SOUTH, bottom);
    pyraButton.addActionListener(this);
    cubeButton.addActionListener(this);
    exitButton.addActionListener(this);
    setVisible(true);
}

From source file:HelloUniverse.java

public VirtualInputDevice(String[] args) {

    // default user-definable values
    printvalues = false;/*from  www . ja  v a2  s. c  om*/
    xscreeninitloc = 400;
    yscreeninitloc = 0;
    xscreensize = 400;
    yscreensize = 200;
    xobjinitloc = 0.0f;
    yobjinitloc = 0.0f;
    zobjinitloc = 2.2f;
    xaxisrotinit = 0.0f;
    yaxisrotinit = 0.0f;
    zaxisrotinit = 0.0f;

    for (int i = 0; i < args.length; i += 2) {
        if (args[i] == null)
            break;
        else if (args[i] == "printvalues")
            printvalues = (Boolean.valueOf(args[i + 1])).booleanValue();
        else if (args[i] == "xscreeninitloc")
            xscreeninitloc = (Integer.valueOf(args[i + 1])).intValue();
        else if (args[i] == "yscreeninitloc")
            yscreeninitloc = (Integer.valueOf(args[i + 1])).intValue();
        else if (args[i] == "xscreensize")
            xscreensize = (Integer.valueOf(args[i + 1])).intValue();
        else if (args[i] == "yscreensize")
            yscreensize = (Integer.valueOf(args[i + 1])).intValue();
        else if (args[i] == "xobjinitloc")
            xobjinitloc = (Float.valueOf(args[i + 1])).floatValue();
        else if (args[i] == "yobjinitloc")
            yobjinitloc = (Float.valueOf(args[i + 1])).floatValue();
        else if (args[i] == "zobjinitloc")
            zobjinitloc = (Integer.valueOf(args[i + 1])).floatValue();
    }

    if (printvalues == true) {
        System.out.println("Initial values for VirtualInputDevice:");
        System.out.println("xscreeninitloc = " + xscreeninitloc);
        System.out.println("yscreeninitloc = " + yscreeninitloc);
        System.out.println("xscreeninitsize = " + xscreensize);
        System.out.println("yscreeninitsize = " + yscreensize);
        System.out.println("xobjinitloc = " + xobjinitloc);
        System.out.println("yobjinitloc = " + yobjinitloc);
        System.out.println("zobjinitloc = " + zobjinitloc);
        System.out.println("xaxisrotinit = " + xaxisrotinit);
        System.out.println("yaxisrotinit = " + yaxisrotinit);
        System.out.println("zaxisrotinit = " + zaxisrotinit);
    }

    // initialize the InputDevice GUI
    Frame deviceFrame = new Frame();
    deviceFrame.setSize(xscreensize, yscreensize);
    deviceFrame.setLocation(xscreeninitloc, yscreeninitloc);
    deviceFrame.setTitle("Virtual Input Device");
    ButtonPositionControls positionControls;
    // initialize position with initial x, y, and z position
    positionControls = new ButtonPositionControls(xobjinitloc, yobjinitloc, zobjinitloc);
    WheelControls rotControls;
    // initialize rotations with initial angles in radians)
    rotControls = new WheelControls(xaxisrotinit, yaxisrotinit, zaxisrotinit);
    positionControls.setDevice(this);
    Panel devicePanel = new Panel();
    devicePanel.setLayout(new BorderLayout());
    devicePanel.add("East", positionControls);
    devicePanel.add("West", rotControls);
    deviceFrame.add(devicePanel);
    deviceFrame.pack();
    deviceFrame.setVisible(true);

    initPos.set(xobjinitloc, yobjinitloc, zobjinitloc);

    this.positionControls = positionControls;
    this.rotControls = rotControls;

    // default processing mode
    processingMode = InputDevice.DEMAND_DRIVEN;

    sensors[0] = new Sensor(this);
}