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:br.upe.ecomp.dosa.controller.chart.FileLineChartDirectorManager.java

private Panel createContentsChartDirector(double[] values, boolean logarithmicYAxis, String measurement,
        int step) {
    Panel chartPanel = new Panel();

    chartPanel.setLayout(new java.awt.GridLayout(1, 1));

    chartPanel.setBackground(Color.white);

    // Create the chart and put them in the content pane
    ChartViewer viewer = new ChartViewer();
    this.createChart(viewer, chartPanel, values, step);
    chartPanel.add(viewer);//from w w w .  j ava2s  . c  om

    // JFreeChart chart = createChart("", "Sample", "Fitness", createSampleDataset(values,
    // measurement, step), false);
    //
    // ChartPanel jFreeChartPanel = new ChartPanel(chart);
    // chartPanel.add(jFreeChartPanel);

    return chartPanel;
}

From source file:ExposedFloat.java

public void init() {

    Panel buttonPanel = new PanelWithInsets(0, 0, 0, 0);
    buttonPanel.setLayout(new GridLayout(6, 2, 5, 5));
    buttonPanel.add(maximumButton);/*w  w w.  j  a  v  a2s  .  co m*/
    buttonPanel.add(minimumButton);
    buttonPanel.add(positiveInfinityButton);
    buttonPanel.add(negativeInfinityButton);
    buttonPanel.add(piButton);
    buttonPanel.add(notANumberButton);
    buttonPanel.add(new Button(multByZeroButtonString));
    buttonPanel.add(new Button(changeSignButtonString));
    buttonPanel.add(new Button(doubleButtonString));
    buttonPanel.add(new Button(halveButtonString));
    buttonPanel.add(new RepeaterButton(incrementButtonString));
    buttonPanel.add(new RepeaterButton(decrementButtonString));

    binaryField = new Label("00000000000000000000000000000000");
    signField = new Label("0");
    exponentField = new Label("00000000");
    mantissaField = new Label("000000000000000000000000");
    hexField = new Label("00000000");
    base2Field = new Label("0");
    base10Field = new Label("0");

    Font fieldFont = new Font("TimesRoman", Font.PLAIN, 12);
    binaryField.setFont(fieldFont);
    signField.setFont(fieldFont);
    exponentField.setFont(fieldFont);
    mantissaField.setFont(fieldFont);
    hexField.setFont(fieldFont);
    base2Field.setFont(fieldFont);
    base10Field.setFont(fieldFont);

    Panel numberPanel = new Panel();
    numberPanel.setBackground(Color.white);
    numberPanel.setLayout(new GridLayout(7, 1));
    numberPanel.add(signField);
    numberPanel.add(exponentField);
    numberPanel.add(mantissaField);
    Panel binaryPanel = new Panel();
    binaryPanel.setLayout(new BorderLayout());
    binaryPanel.add("Center", binaryField);
    numberPanel.add(binaryPanel);

    Panel hexPanel = new Panel();
    hexPanel.setLayout(new BorderLayout());
    hexPanel.add("Center", hexField);
    numberPanel.add(hexPanel);
    numberPanel.add(base2Field);
    numberPanel.add(base10Field);

    Panel labelPanel = new Panel();
    labelPanel.setBackground(Color.white);
    labelPanel.setLayout(new GridLayout(7, 1));
    Font labelFont = new Font("Helvetica", Font.ITALIC, 11);
    Label label = new Label(signString, Label.CENTER);
    label.setFont(labelFont);
    labelPanel.add(label);
    label = new Label(exponentString, Label.CENTER);
    label.setFont(labelFont);
    labelPanel.add(label);
    label = new Label(mantissaString, Label.CENTER);
    label.setFont(labelFont);
    labelPanel.add(label);
    label = new Label(binaryString, Label.CENTER);
    label.setFont(labelFont);
    labelPanel.add(label);
    label = new Label(hexString, Label.CENTER);
    label.setFont(labelFont);
    labelPanel.add(label);
    label = new Label(base2String, Label.CENTER);
    label.setFont(labelFont);
    labelPanel.add(label);
    label = new Label(base10String, Label.CENTER);
    label.setFont(labelFont);
    labelPanel.add(label);

    Panel dataPanel = new Panel();
    dataPanel.setLayout(new BorderLayout());
    dataPanel.add("West", labelPanel);
    dataPanel.add("Center", numberPanel);

    ColoredLabel title = new ColoredLabel(titleString, Label.CENTER, Color.cyan);
    title.setFont(new Font("Helvetica", Font.BOLD, 12));

    setBackground(Color.green);
    setLayout(new BorderLayout(5, 5));
    add("North", title);
    add("West", buttonPanel);
    add("Center", dataPanel);
}

From source file:HiResCoordTest.java

protected void addCanvas3D(Canvas3D c3d) {
    setLayout(new BorderLayout());

    Panel controlPanel = new Panel();
    controlPanel.add(c3d);//w ww  .jav a 2 s . co m

    Button button = null;

    button = new Button("Sun");
    button.addActionListener(this);
    controlPanel.add(button);

    button = new Button("Earth");
    button.addActionListener(this);
    controlPanel.add(button);

    button = new Button("House");
    button.addActionListener(this);
    controlPanel.add(button);

    add(controlPanel, BorderLayout.SOUTH);
    add(c3d, BorderLayout.CENTER);

    doLayout();
}

From source file:CustomAlphaTest.java

protected void addCanvas3D(Canvas3D c3d) {
    Frame frame = new Frame("Custom Alpha Test");

    Panel aPanel = new Panel();
    aPanel.setLayout(new BorderLayout());
    aPanel.add(c3d, BorderLayout.CENTER);

    frame.add(aPanel);// w w  w.j a v a 2 s. co  m

    frame.pack();
    frame.setSize(new Dimension(320, 320));
    frame.validate();
    frame.setVisible(true);

    doLayout();
}

From source file:MouseNavigateTest.java

protected void addCanvas3D(Canvas3D c3d) {
    setLayout(new BorderLayout());
    add(c3d, BorderLayout.CENTER);

    Panel controlPanel = new Panel();

    // add the UI to the frame
    m_RotationLabel = new Label("Rotation: ");
    m_RotationFieldX = new TextField("0.00");
    m_RotationFieldY = new TextField("0.00");
    m_RotationFieldZ = new TextField("0.00");
    controlPanel.add(m_RotationLabel);//from   w  w  w  .  j  ava2s . com
    controlPanel.add(m_RotationFieldX);
    controlPanel.add(m_RotationFieldY);
    controlPanel.add(m_RotationFieldZ);

    m_TranslationLabel = new Label("Translation: ");
    m_TranslationFieldX = new TextField("0.00");
    m_TranslationFieldY = new TextField("0.00");
    m_TranslationFieldZ = new TextField("0.00");
    controlPanel.add(m_TranslationLabel);
    controlPanel.add(m_TranslationFieldX);
    controlPanel.add(m_TranslationFieldY);
    controlPanel.add(m_TranslationFieldZ);

    m_ScaleLabel = new Label("Scale: ");
    m_ScaleFieldX = new TextField("0.00");
    m_ScaleFieldY = new TextField("0.00");
    m_ScaleFieldZ = new TextField("0.00");
    controlPanel.add(m_ScaleLabel);
    controlPanel.add(m_ScaleFieldX);
    controlPanel.add(m_ScaleFieldY);
    controlPanel.add(m_ScaleFieldZ);

    add(controlPanel, BorderLayout.SOUTH);

    doLayout();
}

From source file:SimpleLOD.java

public SimpleLOD() {
    VirtualUniverse myUniverse = new VirtualUniverse();
    Locale myLocale = new Locale(myUniverse);
    myLocale.addBranchGraph(buildViewBranch(myCanvas3D));
    myLocale.addBranchGraph(buildContentBranch());
    setTitle("SimpleLOD");
    setSize(400, 400);//from  www.j  av a 2 s.c  om
    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:SimpleRotator.java

public SimpleRotator() {
    VirtualUniverse myUniverse = new VirtualUniverse();
    Locale myLocale = new Locale(myUniverse);
    myLocale.addBranchGraph(buildViewBranch(myCanvas3D));
    //   myLocale.addBranchGraph(buildContentBranch(buildShape()));
    setTitle("SimpleRotator");
    setSize(400, 400);/*from  www  .java  2s  . 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:SplineAnim.java

public void init() {
    this.setLayout(new FlowLayout());

    // Create the canvas and the UI
    canvasPanel = new Panel();
    controlPanel = new Panel();
    createCanvasPanel(canvasPanel);//from   ww  w.j  av  a 2  s.  co  m
    this.add(canvasPanel);
    createControlPanel(controlPanel);
    this.add(controlPanel);

    // Create the scene.
    BranchGroup scene = createSceneGraph();

    // Setup keyframe data for our animation
    setupSplineKeyFrames();
    setupLinearKeyFrames();

    // Setup alpha, create the interpolators and start them. We
    // create both a linear and a spline interpolator and turn on
    // one depending on user selection. The default is spline.
    setupAnimationData();
    createInterpolators();
    startInterpolator();

    // Add viewing platform
    u = new SimpleUniverse(canvas);

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

    viewingPlatform.setNominalViewingTransform();

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

    u.addBranchGraph(scene);
}

From source file:SimpleKeyNav.java

public SimpleKeyNav() {
    VirtualUniverse myUniverse = new VirtualUniverse();
    Locale myLocale = new Locale(myUniverse);
    myLocale.addBranchGraph(buildViewBranch(myCanvas3D));
    myLocale.addBranchGraph(buildContentBranch());
    setTitle("SimpleKeyNav");
    setSize(400, 400);//from  w w  w  .  ja v a  2  s  . com
    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:SimpleMouse.java

public SimpleMouse() {
    VirtualUniverse myUniverse = new VirtualUniverse();
    Locale myLocale = new Locale(myUniverse);
    myLocale.addBranchGraph(buildViewBranch(myCanvas3D));
    myLocale.addBranchGraph(buildContentBranch());
    setTitle("SimpleMouse");
    setSize(400, 400);//from   ww w.j a  v 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);
}