Example usage for javax.swing BoxLayout Y_AXIS

List of usage examples for javax.swing BoxLayout Y_AXIS

Introduction

In this page you can find the example usage for javax.swing BoxLayout Y_AXIS.

Prototype

int Y_AXIS

To view the source code for javax.swing BoxLayout Y_AXIS.

Click Source Link

Document

Specifies that components should be laid out top to bottom.

Usage

From source file:com.unionpay.upmp.jmeterplugin.gui.UPMPUrlConfigGui.java

private void init() {// called from ctor, so must not be overridable
    this.setLayout(new BorderLayout());

    // WEB REQUEST PANEL
    JPanel webRequestPanel = new JPanel();
    webRequestPanel.setLayout(new BorderLayout());
    webRequestPanel.setBorder(//from www  .ja  v  a  2s.co  m
            BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), UPMPConstant.upmp_request)); // $NON-NLS-1$

    JPanel northPanel = new JPanel();
    northPanel.setLayout(new BoxLayout(northPanel, BoxLayout.Y_AXIS));
    northPanel.add(getProtocolAndMethodPanel());
    northPanel.add(getPathPanel());

    webRequestPanel.add(northPanel, BorderLayout.NORTH);
    webRequestPanel.add(getParameterPanel(), BorderLayout.CENTER);

    this.add(getWebServerTimeoutPanel(), BorderLayout.NORTH);
    this.add(webRequestPanel, BorderLayout.CENTER);
    this.add(getProxyServerPanel(), BorderLayout.SOUTH);
}

From source file:es.urjc.ia.fia.genericSearch.statistics.JUNGStatistics.java

@Override
public void showStatistics() {

    // Layout: tree and radial
    treeLayout = new TreeLayout<AuxVertex, ACTION>(this.tree, 35, 100);
    radialLayout = new RadialTreeLayout<AuxVertex, ACTION>(this.tree, 35, 130);

    radialLayout.setSize(new Dimension(200 * (this.tree.getHeight() + 1), 200 * (this.tree.getHeight() + 1)));

    // The BasicVisualizationServer<V,E> is parameterized by the edge types
    vv = new VisualizationViewer<AuxVertex, ACTION>(treeLayout);
    vv.setPreferredSize(new Dimension(800, 600)); //Sets the viewing area size
    vv.setBackground(Color.white); // Background color

    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<AuxVertex>());
    vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<AuxVertex, ACTION>());

    // Setup up a new vertex to paint transformer
    Transformer<AuxVertex, Paint> vertexPaint = new Transformer<AuxVertex, Paint>() {
        @Override//from  ww w.j a va  2s  . c om
        public Paint transform(AuxVertex arg0) {
            if (arg0.getState().isSolution() && arg0.isExplored()) {
                return Color.GREEN;
            } else if (arg0.isExplored()) {
                return Color.CYAN;
            } else if (arg0.isDuplicated()) {
                return Color.GRAY;
            } else {
                return Color.WHITE;
            }
        }
    };

    // Tooltip for vertex
    Transformer<AuxVertex, String> toolTipsState = new Transformer<AuxVertex, String>() {

        @Override
        public String transform(AuxVertex arg0) {
            String sortInfo = "";
            if (arg0.isExplored()) {
                if (arg0.getState().isSolution() && arg0.isExplored()) {
                    sortInfo = "<u><i>Solution state " + arg0.getExplored() + "</i></u>";
                } else {
                    sortInfo = "<u><i>Explored state " + arg0.getExplored() + "</i></u>";
                }
            } else if (arg0.isDuplicated()) {
                sortInfo = "<u><i>Duplicated state </i></u>";
            } else {
                sortInfo = "<u><i>Unexplored state</i></u>";
            }
            return "<html><p>" + sortInfo + "</p>" + "<p>State: " + arg0.getState().toString() + "</p>"
                    + "<p>Cost: " + arg0.getState().getSolutionCost() + "</p></html>";
        }

    };
    vv.setVertexToolTipTransformer(toolTipsState);

    // Tooltip for edge
    Transformer<ACTION, String> toolTipsAction = new Transformer<ACTION, String>() {

        @Override
        public String transform(ACTION arg0) {
            return "Cost: " + arg0.cost();
        }

    };
    vv.setEdgeToolTipTransformer(toolTipsAction);

    vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<AuxVertex, ACTION>());
    vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller<ACTION>());

    vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint);
    vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);

    // Create a graph mouse and add it to the visualization component
    DefaultModalGraphMouse<State<ACTION>, ACTION> gm = new DefaultModalGraphMouse<State<ACTION>, ACTION>();
    gm.setMode(ModalGraphMouse.Mode.TRANSFORMING);
    vv.setGraphMouse(gm);
    vv.addKeyListener(gm.getModeKeyListener());

    JFrame vFrame = new JFrame("Statistics Tree View");
    vFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    /*
    vFrame.getContentPane().add(vv);
    vFrame.pack();
    vFrame.setVisible(true);
    */

    rings = new Rings();
    Container content = vFrame.getContentPane();
    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
    content.add(panel);

    JComboBox modeBox = gm.getModeComboBox();
    modeBox.addItemListener(gm.getModeListener());
    gm.setMode(ModalGraphMouse.Mode.TRANSFORMING);

    final ScalingControl scaler = new CrossoverScalingControl();

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });

    JToggleButton radial = new JToggleButton("Radial");
    radial.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {

                LayoutTransition<AuxVertex, ACTION> lt = new LayoutTransition<AuxVertex, ACTION>(vv, treeLayout,
                        radialLayout);
                Animator animator = new Animator(lt);
                animator.start();
                vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
                vv.addPreRenderPaintable(rings);
            } else {
                LayoutTransition<AuxVertex, ACTION> lt = new LayoutTransition<AuxVertex, ACTION>(vv,
                        radialLayout, treeLayout);
                Animator animator = new Animator(lt);
                animator.start();
                vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
                vv.removePreRenderPaintable(rings);
            }
            vv.repaint();
        }
    });

    JPanel scaleGrid = new JPanel(new GridLayout(1, 0));
    scaleGrid.setBorder(BorderFactory.createTitledBorder("Zoom"));

    /*
     * Statistics 
     */
    JLabel stats = new JLabel();
    long totalTime = endTime.getTime() - initTime.getTime();
    stats.setText("<html>" + "<b>Total States:</b> " + this.totalStates + "<br>" + "<b>Explored States:</b> "
            + this.explorerStates + "<br>" + "<b>Duplicated States (detected):</b> " + this.duplicatedStates
            + "<br>" + "<b>Solution States:</b> " + this.solutionStates + "<br>" + "<b>Total time: </b>"
            + totalTime + " milliseconds" + "</html>");

    JPanel legend = new JPanel();
    legend.setLayout(new BoxLayout(legend, BoxLayout.Y_AXIS));

    JLabel len = new JLabel("<html><b>Lengend</b></html>");
    JLabel lexpl = new JLabel("Explored state");
    lexpl.setBackground(Color.CYAN);
    lexpl.setOpaque(true);
    JLabel lune = new JLabel("Unexplored state");
    lune.setBackground(Color.WHITE);
    lune.setOpaque(true);
    JLabel ldupl = new JLabel("Duplicated state");
    ldupl.setBackground(Color.GRAY);
    ldupl.setOpaque(true);
    JLabel lsol = new JLabel("Solution state");
    lsol.setBackground(Color.GREEN);
    lsol.setOpaque(true);

    legend.add(len);
    legend.add(lexpl);
    legend.add(lune);
    legend.add(ldupl);
    legend.add(lsol);

    JPanel controls = new JPanel();
    controls.add(stats);
    scaleGrid.add(plus);
    scaleGrid.add(minus);
    controls.add(radial);
    controls.add(scaleGrid);
    //controls.add(modeBox);
    controls.add(legend);

    content.add(controls, BorderLayout.SOUTH);

    vFrame.pack();
    vFrame.setVisible(true);
}

From source file:edu.ucla.stat.SOCR.analyses.gui.ConfidenceIntervalAnalysis.java

protected void doGraph() {

    graphPanel.removeAll();//w ww  .  j  a va  2s . c o m
    JPanel innerPanel = new JPanel();
    JScrollPane graphPane = new JScrollPane(innerPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

    graphPanel.add(graphPane);
    innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.Y_AXIS));
    graphPanel.setLayout(new BoxLayout(graphPanel, BoxLayout.Y_AXIS));

    confidenceCanvas = new ConfidenceCanvasGeneralUpper(sampleSizes, nTrials);
    confidenceCanvas.setBackground(Color.white);

    innerPanel.setPreferredSize(new Dimension(650, 400));
    confidenceCanvas.setIntervalType(ci_choice);
    innerPanel.add(confidenceCanvas);

    confidenceCanvas.update(cvIndex, ciData, sampleData, xBar);

    /*   String[][] ci_storage= new String[xyLength][nTrials];
       for (int i=0; i<nTrials; i++)
          for(int j=0; j<sampleSizes[i]; j++)
    ci_storage[j][i] = sampleData[i][j]+"";
               
       JFreeChart bwChart = chartFactory.getBoxAndWhiskerChart("Box and Whisker Plot", independentHeader, "yHeader",  nTrials, 1, xyLength, ci_storage);
       ChartPanel chartPanel = new ChartPanel(bwChart, false);
       chartPanel.setPreferredSize(new Dimension(plotWidth,plotHeight));
       innerPanel.add(chartPanel);
       */
    graphPanel.validate();
}

From source file:cloud.gui.CloudGUI.java

private JPanel createAddInstancePanel() {
    JPanel addInstancePanel = new JPanel();
    addInstancePanel.setBorder(BorderFactory.createTitledBorder("Launch Instance"));
    addInstancePanel.setLayout(new BoxLayout(addInstancePanel, BoxLayout.Y_AXIS));
    //--------------------------//      
    JPanel labelPanel = new JPanel();
    labelPanel.setBorder(BorderFactory.createEmptyBorder());
    labelPanel.setLayout(new BorderLayout());
    JLabel addANewInstancelbl = new JLabel("Add a new instance with the following configuration:");
    labelPanel.add(addANewInstancelbl);//  w  ww .  j av  a 2 s .co m
    addInstancePanel.add(labelPanel);
    //--------------------------//      
    JPanel nodeConfigurationsPanel = new JPanel();
    nodeConfigurationsPanel.setLayout(new GridLayout(4, 2));
    nodeConfigurationsPanel.setBorder(BorderFactory.createEmptyBorder());

    JLabel cpuSpeedlbl = new JLabel("CPU Speed (GHz)");
    nodeConfigurationsPanel.add(cpuSpeedlbl);

    cpuSpeed = new JComboBox(CPU_SPEEDS);
    cpuSpeed.setSelectedItem("2.0");
    nodeConfigurationsPanel.add(cpuSpeed);

    JLabel bandwidthlbl = new JLabel("Bandwidth (MB/s):");
    nodeConfigurationsPanel.add(bandwidthlbl);

    bandwidthes = new JComboBox(BANDWIDTHES);
    bandwidthes.setSelectedItem("2");
    nodeConfigurationsPanel.add(bandwidthes);

    JLabel memoryLbl = new JLabel("Memory (GB)");
    nodeConfigurationsPanel.add(memoryLbl);

    memories = new JComboBox(MEMORIES);
    memories.setSelectedIndex(2);
    nodeConfigurationsPanel.add(memories);

    JLabel simultaneousDownloadsLbl = new JLabel("Simulatenous Downloads:");
    nodeConfigurationsPanel.add(simultaneousDownloadsLbl);

    sDownloads = new JTextArea("70");
    nodeConfigurationsPanel.add(sDownloads);

    addInstancePanel.add(nodeConfigurationsPanel);
    //--------------------------//      
    JPanel addInstanceButtonPanel = new JPanel();
    addInstanceButtonPanel.setBorder(BorderFactory.createEmptyBorder());
    addInstanceButtonPanel.setLayout(new GridLayout(2, 2));

    addInstanceButton = new JButton("Launch Instance");
    addInstanceButtonPanel.add(addInstanceButton);

    addInstancePanel.add(addInstanceButtonPanel);
    return addInstancePanel;
}

From source file:PickTest.java

private void setupGUI(JPanel panel) {
    ButtonGroup bg;//from w ww  .j a  va2 s .c  om

    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.setBorder(new BevelBorder(BevelBorder.RAISED));

    panel.add(new JLabel(pickModeString));
    bg = new ButtonGroup();
    addRadioButton(panel, bg, pickModeString, boundsString, true);
    addRadioButton(panel, bg, pickModeString, geometryString, false);
    addRadioButton(panel, bg, pickModeString, geometryIntersectString, false);

    panel.add(new JLabel(toleranceString));
    bg = new ButtonGroup();
    addRadioButton(panel, bg, toleranceString, tolerance0String, false);
    addRadioButton(panel, bg, toleranceString, tolerance2String, true);
    addRadioButton(panel, bg, toleranceString, tolerance4String, false);
    addRadioButton(panel, bg, toleranceString, tolerance8String, false);

    panel.add(new JLabel(viewModeString));
    bg = new ButtonGroup();
    addRadioButton(panel, bg, viewModeString, perspectiveString, true);
    addRadioButton(panel, bg, viewModeString, parallelString, false);

}

From source file:medsavant.uhn.cancer.UserCommentApp.java

private JPanel getMainCommentPanel(Map<OntologyTerm, Collection<UserComment>> otCommentMap,
        final UserCommentGroup lcg, final VariantRecord vr) {
    JPanel innerPanel = new JPanel(); //Todo: may need to specify width of this panel?                
    innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.Y_AXIS));
    for (final Map.Entry<OntologyTerm, Collection<UserComment>> e : otCommentMap.entrySet()) {
        OntologyTerm ot = e.getKey();//from w w w.  j av a2s.  co m
        Collection<UserComment> userComments = e.getValue();

        JPanel otPanel = new JPanel();
        otPanel.setLayout(new BoxLayout(otPanel, BoxLayout.Y_AXIS));
        //otPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK));

        //Define horizontal panel with ontology title and reply to ontology icon.
        JPanel ontologyTitlePanel = getOntologyTitlePanel(vr, ot);
        otPanel.add(ontologyTitlePanel);
        UserComment oldComment = null;
        for (final UserComment userComment : userComments) {
            if (userComment.isDeleted()) {
                continue;
            }
            updateStatusPanel(oldComment);
            otPanel.add(getCommentBlock(lcg, userComment));
            oldComment = userComment;
        }
        updateStatusPanel(oldComment);
        otPanel.add(getOntologySeparator());
        innerPanel.add(otPanel);
    }

    return innerPanel;
}

From source file:com.archivas.clienttools.arcmover.gui.panels.ProfilePanel.java

private void initGuiComponents() {
    fileListModel = new FileListTableModel();
    fileList = new FileListTable(fileListModel);
    fileList.addKeyListener(new KeyAdapter() {
        @Override/*from  ww  w  . ja  v a 2 s  .c  o m*/
        public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) {
                openSelectedFile();
                e.consume();
            }
        }
    });
    fileList.setAutoCreateColumnsFromModel(true);
    fileList.setDropMode(DropMode.ON_OR_INSERT_ROWS);
    fileList.setFillsViewportHeight(true);
    fileList.setGridColor(new Color(-1));

    fileListScrollPane = new JScrollPane(fileList);
    fileListScrollPane.setAutoscrolls(false);
    fileListScrollPane.setBackground(UIManager.getColor("TableHeader.background"));
    fileListScrollPane.setPreferredSize(new Dimension(100, 128));
    fileListScrollPane.setEnabled(false);

    //
    // toolbar
    //

    final JToolBar toolBar1 = new JToolBar();
    toolBar1.setBorderPainted(false);
    toolBar1.setFloatable(false);
    toolBar1.setRollover(true);
    toolBar1.putClientProperty("JToolBar.isRollover", Boolean.TRUE);

    homeDirectoryButton = new JButton();
    homeDirectoryButton.setHorizontalAlignment(2);
    homeDirectoryButton.setIcon(GUIHelper.HOME_ICON);
    homeDirectoryButton.setMargin(new Insets(3, 3, 3, 3));
    homeDirectoryButton.setText("");
    homeDirectoryButton.setToolTipText("Go to home directory");
    homeDirectoryButton.setEnabled(false);
    toolBar1.add(homeDirectoryButton);

    refreshButton = new JButton();
    refreshButton.setHorizontalAlignment(2);
    refreshButton.setIcon(new ImageIcon(getClass().getResource("/images/refresh.gif")));
    refreshButton.setMargin(new Insets(3, 3, 3, 3));
    refreshButton.setText("");
    refreshButton.setToolTipText("Refresh current directory listing");
    refreshButton.setEnabled(false);
    toolBar1.add(refreshButton);

    upDirectoryButton = new JButton();
    upDirectoryButton.setHideActionText(false);
    upDirectoryButton.setHorizontalAlignment(2);
    upDirectoryButton.setIcon(GUIHelper.UP_DIR_ICON);
    upDirectoryButton.setMargin(new Insets(3, 3, 3, 3));
    upDirectoryButton.setToolTipText("Up");
    upDirectoryButton.setEnabled(false);
    toolBar1.add(upDirectoryButton);

    browseDirectoryButton = new JButton();
    browseDirectoryButton.setHideActionText(false);
    browseDirectoryButton.setHorizontalAlignment(2);
    browseDirectoryButton.setIcon(GUIHelper.DIRECTORY_ICON);
    browseDirectoryButton.setMargin(new Insets(3, 3, 3, 3));
    browseDirectoryButton.setToolTipText(BROWSE_LFS_TEXT);
    browseDirectoryButton.setEnabled(false);
    toolBar1.add(browseDirectoryButton);

    profileModel = new ProfileComboBoxModel();
    profileSelectionCombo = new JComboBox(profileModel);
    profileSelectionCombo.setEnabled(false);
    profileSelectionCombo.setToolTipText("Select a namespace profile");
    profileSelectionCombo.setPrototypeDisplayValue("#");

    pathCombo = new JComboBox();
    pathCombo.setEditable(false);
    pathCombo.setEnabled(false);
    pathCombo.setToolTipText("Current directory path");
    pathCombo.setPrototypeDisplayValue("#");

    sslButton = new JButton();
    sslButton.setAlignmentY(0.0f);
    sslButton.setBorderPainted(false);
    sslButton.setHorizontalAlignment(2);
    sslButton.setHorizontalTextPosition(11);
    sslButton.setIcon(new ImageIcon(getClass().getResource("/images/lockedstate.gif")));
    sslButton.setMargin(new Insets(0, 0, 0, 0));
    sslButton.setMaximumSize(new Dimension(20, 20));
    sslButton.setMinimumSize(new Dimension(20, 20));
    sslButton.setPreferredSize(new Dimension(20, 20));
    sslButton.setText("");
    sslButton.setToolTipText("View certificate");
    sslButton.setEnabled(false);

    //
    // profile and toolbar buttons
    //
    JPanel profileAndToolbarPanel = new FixedHeightPanel();
    profileAndToolbarPanel.setLayout(new BoxLayout(profileAndToolbarPanel, BoxLayout.X_AXIS));
    profileAndToolbarPanel.add(profileSelectionCombo);
    profileAndToolbarPanel.add(Box.createHorizontalStrut(25));
    profileAndToolbarPanel.add(toolBar1);

    //
    // Path & SSLCert button
    //
    JPanel pathPanel = new FixedHeightPanel();
    pathPanel.setLayout(new BoxLayout(pathPanel, BoxLayout.X_AXIS));
    pathCombo.setAlignmentY(CENTER_ALIGNMENT);
    pathPanel.add(pathCombo);
    pathPanel.add(Box.createHorizontalStrut(5));
    sslButton.setAlignmentY(CENTER_ALIGNMENT);
    pathPanel.add(sslButton);

    //
    // Put it all together
    //
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    add(profileAndToolbarPanel);
    add(Box.createVerticalStrut(5));
    add(pathPanel);
    add(Box.createVerticalStrut(5));
    add(fileListScrollPane);
    setBorder(new EmptyBorder(12, 12, 12, 12));
}

From source file:com.accenture.assets.ui.dialogs.panels.NewProjectConfigurationDialogPanel.java

/**
 * // w w w . ja va 2  s. c  o m
 * @return
 */
private JPanel getFinalPanel() {
    if (finalPanel == null) {
        finalPanel = new JPanel();
        finalPanel.setLayout(new BoxLayout(finalPanel, BoxLayout.Y_AXIS));
        finalPanel.add(getProjectNamePanel());
        finalPanel.add(getGroupIdPanel());
        finalPanel.add(getArtifactIdPanel());

        finalPanel.add(getVersionPanel());

        finalPanel.add(getPathPanel());

        //finalPanel.add(getRootPanel());
        finalPanel.add(getTechnologyPanel());
        finalPanel.add(getButtonsPanel());
        finalPanel.setName("finalPanel");
    }
    return finalPanel;
}

From source file:org.obiba.onyx.jade.instrument.gehealthcare.CardiosoftInstrumentRunner.java

/**
 * Create an information dialog that tells the user to wait while the data is being processed.
 *///from  ww  w  .j  ava2  s .c  o  m
private void showProcessingDialog() {

    JPanel messagePanel = new JPanel();
    messagePanel.setAlignmentX(Component.CENTER_ALIGNMENT);
    messagePanel.setLayout(new BoxLayout(messagePanel, BoxLayout.Y_AXIS));

    JLabel message = new JLabel(ecgResourceBundle.getString("Message.ProcessingEcgMeasurement"));
    message.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));
    messagePanel.add(message);

    JLabel subMessage = new JLabel(ecgResourceBundle.getString("Message.ProcessingEcgMeasurementInstructions"));
    subMessage.setFont(new Font(Font.DIALOG, Font.PLAIN, 14));
    subMessage.setForeground(Color.RED);
    messagePanel.add(subMessage);

    JFrame window = new JFrame();
    window.add(messagePanel);
    window.pack();

    // Make sure dialog stays on top of all other application windows.
    window.setAlwaysOnTop(true);
    window.setLocationByPlatform(true);

    // Center dialog horizontally at the bottom of the screen.
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    window.setLocation((screenSize.width - window.getWidth()) / 2, screenSize.height - window.getHeight() - 70);

    window.setEnabled(false);
    window.setVisible(true);

}

From source file:econtroller.gui.ControllerGUI.java

private void createControllerDesignSection() {
    controllerDesignPanel = new JPanel();
    controllerDesignPanel.setLayout(new BoxLayout(controllerDesignPanel, BoxLayout.Y_AXIS));
    controllerDesignPanel.setBorder(BorderFactory.createTitledBorder("Controller Configurations"));

    createDesignSection();//  w w  w. ja va  2s .co  m
    createSenseActTimersSection();
    createDesignSectionButtons();

    controlPanel.add(controllerDesignPanel);
}