Example usage for javax.swing Box createHorizontalBox

List of usage examples for javax.swing Box createHorizontalBox

Introduction

In this page you can find the example usage for javax.swing Box createHorizontalBox.

Prototype

public static Box createHorizontalBox() 

Source Link

Document

Creates a Box that displays its components from left to right.

Usage

From source file:visolate.Visolate.java

private Box getToolpathBox() {
    Dimension d;/*w w  w.jav a 2s  .  c  om*/
    Box toolpathsBox = Box.createHorizontalBox();

    toolpathsButton = new JButton("Make Toolpaths");
    toolpathsButton.setBackground(Color.WHITE);
    toolpathsButton.setVerticalAlignment(AbstractButton.CENTER);
    toolpathsButton.setHorizontalAlignment(AbstractButton.CENTER);
    d = toolpathsButton.getPreferredSize();
    toolpathsButton.setMaximumSize(new Dimension(d.width, d.height));
    toolpathsButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            computeToolpaths();
        }
    });
    toolpathsBox.add(toolpathsButton);

    //    toolpathsBox.add(Box.createHorizontalStrut(16));

    ButtonGroup modeGroup = new ButtonGroup();

    voronoiButton = new JRadioButton("voronoi");
    modeGroup.add(voronoiButton);
    voronoiButton.setBackground(Color.WHITE);
    // VORONOI_MODE is the default mode.
    voronoiButton.setSelected(true);
    toolpathsBox.add(voronoiButton);

    outlineButton = new JRadioButton("outline");
    modeGroup.add(outlineButton);
    outlineButton.setBackground(Color.WHITE);
    // VORONOI_MODE is the default mode.
    outlineButton.setSelected(false);
    toolpathsBox.add(outlineButton);

    return toolpathsBox;
}

From source file:visolate.Visolate.java

private Box getTopologyBox() {
    Dimension d;/*from www  .ja  v  a  2 s . c  o m*/
    Box topologyBox = Box.createHorizontalBox();

    topologyButton = new JButton("Fix Topology");
    topologyButton.setBackground(Color.WHITE);
    topologyButton.setVerticalAlignment(AbstractButton.CENTER);
    topologyButton.setHorizontalAlignment(AbstractButton.CENTER);
    d = topologyButton.getPreferredSize();
    topologyButton.setMaximumSize(new Dimension(d.width, d.height));
    topologyButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            fixTopology();
        }
    });
    topologyBox.add(topologyButton);

    //    topologyBox.add(Box.createHorizontalStrut(16));

    manualTopology = new JCheckBox("manual");
    manualTopology.setBackground(Color.WHITE);
    manualTopology.setSelected(false);
    topologyBox.add(manualTopology);
    return topologyBox;
}

From source file:visolate.Visolate.java

private Box getMosaicBox() {
    Dimension d;//  w  ww  .  ja  v a  2 s  . co  m
    if (myMosaicBox == null) {
        myMosaicBox = Box.createHorizontalBox();

        mosaicButton = new JButton("Save High-Res");
        mosaicButton.setBackground(Color.WHITE);
        mosaicButton.setVerticalAlignment(AbstractButton.CENTER);
        mosaicButton.setHorizontalAlignment(AbstractButton.CENTER);
        d = mosaicButton.getPreferredSize();
        mosaicButton.setMaximumSize(new Dimension(d.width, d.height));
        mosaicButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                saveMosaic();
            }
        });
        myMosaicBox.add(mosaicButton);

        mosaicField = new JTextField();
        d = mosaicField.getPreferredSize();
        mosaicField.setMaximumSize(new Dimension(Integer.MAX_VALUE, d.height));
        mosaicField.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                saveMosaic();
            }
        });
        //    mosaicField.addFocusListener(new FocusAdapter() {
        //        public void focusLost(FocusEvent e) { saveMosaic(); } });
        myMosaicBox.add(mosaicField);

        mosaicBrowseButton = new JButton("Browse...");
        mosaicBrowseButton.setBackground(Color.WHITE);
        mosaicBrowseButton.setVerticalAlignment(AbstractButton.CENTER);
        mosaicBrowseButton.setHorizontalAlignment(AbstractButton.CENTER);
        d = mosaicBrowseButton.getPreferredSize();
        mosaicBrowseButton.setMaximumSize(new Dimension(d.width, d.height));
        mosaicBrowseButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                File file = browse();
                if (file != null)
                    saveMosaic(file);
            }
        });
        myMosaicBox.add(mosaicBrowseButton);

        mosaicTilesButton = new JCheckBox("individual tiles");
        mosaicTilesButton.setBackground(Color.WHITE);
        mosaicTilesButton.setSelected(false);
        myMosaicBox.add(mosaicTilesButton);
    }
    return myMosaicBox;
}

From source file:zxmax.tools.timerreview.gui.StartTimerWindow.java

private Component getPnlNewTimer() {
    setTitle(I18N.getLabel(getClass(), "window.title"));
    JPanel pnlNewTimer = new JPanel();
    LayoutManager layout = new MigLayout("flowy", "[328.00][grow,fill]", "[][][][][]");
    taFocusOn = new JTextArea();
    taFocusOn.setWrapStyleWord(true);//from   w ww  . j a  v a  2  s  .  c o  m
    JScrollPane spFocusOn = new JScrollPane();
    tfTitle = new JTextField(30);
    JButton btnStart = new JButton();

    pnlNewTimer.setLayout(layout);
    btnStart.setText(I18N.getLabel(this.getClass(), TAB_NEW_TIMER_BTN_START_LABEL));
    taFocusOn.setColumns(20);
    taFocusOn.setForeground(new Color(0, 153, 0));
    taFocusOn.setRows(5);
    taFocusOn.setTabSize(2);
    taFocusOn.setText(I18N.getLabel(this.getClass(), TAB_NEW_TIMER_FOCUS_ON_TEXT_AREA_TEXT));
    taFocusOn.setToolTipText(I18N.getLabel(this.getClass(), TAB_NEW_TIMER_FOCUS_ON_TEXT_AREA_TOOL_TIP));
    spFocusOn.setViewportView(taFocusOn);
    taFocusOn.getAccessibleContext().setAccessibleName("taFocusOn");

    btnStart.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent evt) {
            storeDataAndStartTimer();
        }
    });
    btnStart.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent evt) {
            logger.debug(evt.getKeyCode() + ", " + evt.getKeyChar());
            if (KeyEvent.VK_ENTER == evt.getKeyCode()) {
                storeDataAndStartTimer();
            }
        }
    });

    JLabel lblTitle = new JLabel(I18N.getLabel(this.getClass(), TAB_NEW_TIMER_TITLE_LABEL));

    pnlNewTimer.add(lblTitle, "cell 0 0");
    pnlNewTimer.add(tfTitle, "cell 0 1 2 1,growx");
    JLabel lblFocusOn = new JLabel(I18N.getLabel(this.getClass(), TAB_NEW_TIMER_FOCUS_ON_LABEL));
    pnlNewTimer.add(lblFocusOn, "cell 0 2");
    pnlNewTimer.add(spFocusOn, "cell 0 3 2 1,growx");
    pnlNewTimer.add(btnStart, "cell 0 4 2 1,growx");

    Box horizontalBox = Box.createHorizontalBox();
    pnlNewTimer.add(horizontalBox, "flowx,cell 1 0");

    JLabel lblDurata = new JLabel(I18N.getLabel(this.getClass(), TAB_NEW_TIMER_DURATA_LABEL));
    lblDurata.setHorizontalAlignment(SwingConstants.RIGHT);
    pnlNewTimer.add(lblDurata, "cell 1 0,alignx right");
    lblDurata.setLabelFor(txtDurata);

    txtDurata = new JTextField("20");
    txtDurata.setToolTipText(I18N.getLabel(this.getClass(), TAB_NEW_TIMER_DURATA_TOOL_TIP));
    pnlNewTimer.add(txtDurata, "cell 1 0,alignx center");
    txtDurata.setColumns(2);

    return pnlNewTimer;
}