Example usage for java.awt Panel setLayout

List of usage examples for java.awt Panel setLayout

Introduction

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

Prototype

public void setLayout(LayoutManager mgr) 

Source Link

Document

Sets the layout manager for this container.

Usage

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.  ja  v  a  2  s.  c om

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

    doLayout();
}

From source file:HelloUniverse.java

public VirtualInputDevice(String[] args) {

    // default user-definable values
    printvalues = false;//from   w w w  .j av  a 2  s . com
    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);
}

From source file:tracing.ShollAnalysisDialog.java

public ShollAnalysisDialog(String title, double x_start, double y_start, double z_start,
        PathAndFillManager pafm, ImagePlus originalImage) {

    super(IJ.getInstance(), title, false);

    this.x_start = x_start;
    this.y_start = y_start;
    this.z_start = z_start;

    this.originalImage = originalImage;
    twoDimensional = (originalImage.getStackSize() == 1);

    shollPointsAllPaths = new ArrayList<ShollPoint>();
    shollPointsSelectedPaths = new ArrayList<ShollPoint>();

    numberOfAllPaths = 0;/*from  www .j  ava  2  s .c  om*/
    numberOfSelectedPaths = 0;

    for (Path p : pafm.allPaths) {
        boolean selected = p.getSelected();
        if (p.getUseFitted()) {
            p = p.fitted;
        } else if (p.fittedVersionOf != null)
            continue;
        addPathPointsToShollList(p, x_start, y_start, z_start, shollPointsAllPaths);
        ++numberOfAllPaths;
        if (selected) {
            addPathPointsToShollList(p, x_start, y_start, z_start, shollPointsSelectedPaths);
            ++numberOfSelectedPaths;
        }
    }

    useAllPathsCheckbox.setLabel("Use all " + numberOfAllPaths + " paths in analysis?");
    useSelectedPathsCheckbox.setLabel("Use only the " + numberOfSelectedPaths + " selected paths in analysis?");

    addWindowListener(this);

    setLayout(new GridBagLayout());

    GridBagConstraints c = new GridBagConstraints();

    c.gridx = 0;
    c.gridy = 0;
    c.anchor = GridBagConstraints.LINE_START;
    int margin = 10;
    c.insets = new Insets(margin, margin, 0, margin);
    useAllPathsCheckbox.addItemListener(this);
    add(useAllPathsCheckbox, c);

    ++c.gridy;
    c.insets = new Insets(0, margin, margin, margin);
    add(useSelectedPathsCheckbox, c);
    useSelectedPathsCheckbox.addItemListener(this);

    ++c.gridy;
    c.insets = new Insets(margin, margin, 0, margin);
    add(normalAxes, c);
    normalAxes.addItemListener(this);
    ++c.gridy;
    c.insets = new Insets(0, margin, 0, margin);
    add(semiLogAxes, c);
    semiLogAxes.addItemListener(this);
    ++c.gridy;
    c.insets = new Insets(0, margin, margin, margin);
    add(logLogAxes, c);
    logLogAxes.addItemListener(this);

    ++c.gridy;
    c.insets = new Insets(margin, margin, 0, margin);
    add(noNormalization, c);
    noNormalization.addItemListener(this);
    ++c.gridy;
    c.insets = new Insets(0, margin, margin, margin);
    if (twoDimensional)
        normalizationForSphereVolume.setLabel("Normalize for area enclosed by circle");
    else
        normalizationForSphereVolume.setLabel("Normalize for volume enclosed by circle");
    add(normalizationForSphereVolume, c);
    normalizationForSphereVolume.addItemListener(this);

    ++c.gridy;
    c.gridx = 0;
    Panel separationPanel = new Panel();
    separationPanel.add(new Label("Circle / sphere separation (0 for unsampled analysis)"));
    sampleSeparation.addTextListener(this);
    separationPanel.add(sampleSeparation);
    add(separationPanel, c);

    c.gridx = 0;
    ++c.gridy;
    c.insets = new Insets(margin, margin, margin, margin);
    add(resultsPanel, c);

    ++c.gridy;
    Panel buttonsPanel = new Panel();
    buttonsPanel.setLayout(new BorderLayout());
    Panel topRow = new Panel();
    Panel middleRow = new Panel();
    Panel bottomRow = new Panel();

    topRow.add(makeShollImageButton);
    makeShollImageButton.addActionListener(this);

    topRow.add(drawShollGraphButton);
    drawShollGraphButton.addActionListener(this);

    middleRow.add(exportDetailAsCSVButton);
    exportDetailAsCSVButton.addActionListener(this);

    middleRow.add(exportSummaryAsCSVButton);
    exportSummaryAsCSVButton.addActionListener(this);

    bottomRow.add(addToResultsTableButton);
    addToResultsTableButton.addActionListener(this);

    buttonsPanel.add(topRow, BorderLayout.NORTH);
    buttonsPanel.add(middleRow, BorderLayout.CENTER);
    buttonsPanel.add(bottomRow, BorderLayout.SOUTH);

    add(buttonsPanel, c);

    pack();

    GUI.center(this);
    setVisible(true);

    updateResults();
}

From source file:gdsc.smlm.ij.plugins.SpotAnalysis.java

private Panel createChoicePanel(Choice list, String label) {
    Panel panel = new Panel();
    panel.setLayout(new BorderLayout());
    Label listLabel = new Label(label, 0);
    //listLabel.setFont(monoFont);
    //list.setSize(fontWidth * 3, fontWidth);
    panel.add(listLabel, BorderLayout.WEST);
    panel.add(list, BorderLayout.CENTER);
    return panel;
}

From source file:gdsc.smlm.ij.plugins.SpotAnalysis.java

private Panel createTextPanel(TextField textField, String label, String value) {
    Panel panel = new Panel();
    panel.setLayout(new BorderLayout());
    Label listLabel = new Label(label, 0);
    //listLabel.setFont(monoFont);
    //textField.setSize(fontWidth * 3, fontWidth);
    textField.setText(value);/*from w w w .  ja va 2s  . com*/
    panel.add(listLabel, BorderLayout.WEST);
    panel.add(textField, BorderLayout.CENTER);
    return panel;
}

From source file:gdsc.smlm.ij.plugins.SpotAnalysis.java

private Panel createLabelPanel(Label field, String label, String value) {
    Panel panel = new Panel();
    panel.setLayout(new BorderLayout());
    Label listLabel = new Label(label, 0);
    //listLabel.setFont(monoFont);
    //textField.setSize(fontWidth * 3, fontWidth);
    field.setText(value);/*from   w w  w.j  ava  2 s.  com*/
    panel.add(listLabel, BorderLayout.WEST);
    panel.add(field, BorderLayout.CENTER);
    return panel;
}

From source file:CircleOfSquares.java

ControlPanel() {

    setLayout(new BorderLayout(5, 5));

    Panel leftButtonPanel = new Panel();
    leftButtonPanel.setLayout(new GridLayout(2, 1, 0, 5));
    leftButtonPanel.add(new GrayButton(StringTable.step));
    resetButton.disable();//ww w.  java2  s . c om
    leftButtonPanel.add(resetButton);
    explanationLabel = new ColoredLabel("This is where the explanation goes...", Label.CENTER, Color.lightGray);

    explanationLabel.setBackground(ColorTable.explanationLabel);
    Font plainFont = new Font("TimesRoman", Font.ITALIC, 12);
    explanationLabel.setFont(plainFont);

    add("West", leftButtonPanel);
    add("Center", explanationLabel);
}

From source file:CircleOfSquares.java

RegisterPanel() {

    setLayout(new BorderLayout(5, 5));

    pcRegister = new LabeledRegister(StringTable.pc);
    optopRegister = new LabeledRegister(StringTable.optop);
    frameRegister = new LabeledRegister(StringTable.frame);
    varsRegister = new LabeledRegister(StringTable.vars);

    setBackground(ColorTable.registersAreaColor);

    Panel labeledRegisterPanel = new Panel();
    labeledRegisterPanel.setLayout(new GridLayout(1, 4, 5, 5));

    labeledRegisterPanel.add(pcRegister);
    labeledRegisterPanel.add(optopRegister);
    labeledRegisterPanel.add(frameRegister);
    labeledRegisterPanel.add(varsRegister);

    Label title = new Label(StringTable.Registers, Label.CENTER);
    title.setFont(new Font("Helvetica", Font.BOLD, 11));
    add("West", title);
    add("Center", labeledRegisterPanel);
}

From source file:JVMSimulator.java

ControlPanel() {

    setLayout(new BorderLayout(5, 5));

    Panel leftButtonPanel = new Panel();
    leftButtonPanel.setLayout(new GridLayout(2, 2, 5, 5));
    leftButtonPanel.add(stepButton);//from   ww w.  ja va  2  s  .co m
    resetButton.disable();
    leftButtonPanel.add(runButton);
    leftButtonPanel.add(resetButton);
    leftButtonPanel.add(stopButton);
    stopButton.disable();
    explanationLabel = new ColoredLabel("This is where the explanation goes...", Label.CENTER, Color.lightGray);

    explanationLabel.setBackground(SimData.explanationLabel);
    Font plainFont = new Font("TimesRoman", Font.ITALIC, 12);
    explanationLabel.setFont(plainFont);

    add("West", leftButtonPanel);
    add("Center", explanationLabel);
}

From source file:JVMSimulator.java

RegisterPanel() {

    setLayout(new BorderLayout(5, 5));

    pcRegister = new LabeledRegister(StringTable.pc);
    optopRegister = new LabeledRegister(StringTable.optop);
    frameRegister = new LabeledRegister(StringTable.frame);
    varsRegister = new LabeledRegister(StringTable.vars);

    setBackground(SimData.registersAreaColor);

    Panel labeledRegisterPanel = new Panel();
    labeledRegisterPanel.setLayout(new GridLayout(1, 4, 5, 5));

    labeledRegisterPanel.add(pcRegister);
    labeledRegisterPanel.add(optopRegister);
    labeledRegisterPanel.add(frameRegister);
    labeledRegisterPanel.add(varsRegister);

    Label title = new Label(StringTable.Registers, Label.CENTER);
    title.setFont(new Font("Helvetica", Font.BOLD, 11));
    add("West", title);
    add("Center", labeledRegisterPanel);
}