Search in sources :

Example 56 with BoxLayout

use of javax.swing.BoxLayout in project JMRI by JMRI.

the class PositionablePropertiesUtil method sizePosition.

/**
     * Create and fill in the Size & Position tab of the UI.
     */
void sizePosition() {
    JPanel posPanel = new JPanel();
    JPanel xyPanel = new JPanel();
    xyPanel.setLayout(new BoxLayout(xyPanel, BoxLayout.Y_AXIS));
    JPanel xPanel = new JPanel();
    JLabel txt = new JLabel(" X: ");
    xPositionTextSpin = getSpinner(xPos, "x position");
    xPositionTextSpin.addChangeListener(SpinnerChangeListener);
    xPanel.add(txt);
    xPanel.add(xPositionTextSpin);
    JPanel yPanel = new JPanel();
    txt = new JLabel(" Y: ");
    yPositionTextSpin = getSpinner(yPos, "y position");
    yPositionTextSpin.addChangeListener(SpinnerChangeListener);
    yPanel.add(txt);
    yPanel.add(yPositionTextSpin);
    xyPanel.add(xPanel);
    xyPanel.add(yPanel);
    JPanel sizePanel = new JPanel();
    sizePanel.setLayout(new BoxLayout(sizePanel, BoxLayout.Y_AXIS));
    JPanel widthPanel = new JPanel();
    widthSizeTextSpin = getSpinner(fixedWidth, Bundle.getMessage("width"));
    widthSizeTextSpin.addChangeListener(SpinnerChangeListener);
    /*widthSizeText = new JTextField(""+fixedWidth, 10);
         widthSizeText.addKeyListener(PreviewKeyActionListener);*/
    txt = new JLabel(Bundle.getMessage("width") + ": ");
    widthPanel.add(txt);
    widthPanel.add(widthSizeTextSpin);
    JPanel heightPanel = new JPanel();
    /*heightSizeText = new JTextField(""+fixedHeight, 10);
         heightSizeText.addKeyListener(PreviewKeyActionListener);*/
    heightSizeTextSpin = getSpinner(fixedHeight, Bundle.getMessage("height"));
    heightSizeTextSpin.addChangeListener(SpinnerChangeListener);
    txt = new JLabel(Bundle.getMessage("height") + ": ");
    heightPanel.add(txt);
    heightPanel.add(heightSizeTextSpin);
    sizePanel.add(widthPanel);
    sizePanel.add(heightPanel);
    posPanel.add(xyPanel);
    posPanel.add(sizePanel);
    posPanel.setLayout(new BoxLayout(posPanel, BoxLayout.Y_AXIS));
    propertiesPanel.addTab(Bundle.getMessage("SizeTabTitle"), null, posPanel, Bundle.getMessage("SizeTabTooltip"));
}
Also used : JPanel(javax.swing.JPanel) BoxLayout(javax.swing.BoxLayout) JLabel(javax.swing.JLabel)

Example 57 with BoxLayout

use of javax.swing.BoxLayout in project JMRI by JMRI.

the class PositionablePropertiesUtil method display.

public void display() {
    propertiesPanel = new JTabbedPane();
    getCurrentValues();
    JPanel exampleHolder = new JPanel();
    for (int i = 0; i < txtList.size(); i++) {
        JPanel p = new JPanel();
        p.setBorder(BorderFactory.createTitledBorder(txtList.get(i).getDescription()));
        // add a visual example for each
        p.add(txtList.get(i).getLabel());
        exampleHolder.add(p);
    }
    //exampleHolder.add(example);
    JPanel tmp = new JPanel();
    JButton cancel = new JButton(Bundle.getMessage("ButtonCancel"));
    cancel.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            undoChanges();
            mFrame.dispose();
        }
    });
    tmp.setLayout(new BoxLayout(tmp, BoxLayout.Y_AXIS));
    tmp.add(propertiesPanel);
    tmp.add(detailpanel);
    tmp.add(exampleHolder);
    textPanel();
    editText();
    borderPanel();
    sizePosition();
    JPanel _buttonArea = new JPanel();
    _buttonArea.add(cancel);
    JButton applyButton = new JButton(Bundle.getMessage("ButtonApply"));
    _buttonArea.add(applyButton);
    applyButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            fontApply();
        }
    });
    JButton okButton = new JButton(Bundle.getMessage("ButtonOK"));
    _buttonArea.add(okButton);
    okButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            fontApply();
            mFrame.dispose();
        }
    });
    tmp.add(_buttonArea);
    exampleHolder.setBackground(_parent.getParent().getBackground());
    mFrame = new JFrame(_parent.getNameString());
    mFrame.add(tmp);
    mFrame.pack();
    mFrame.setVisible(true);
    preview();
}
Also used : JPanel(javax.swing.JPanel) ActionListener(java.awt.event.ActionListener) JFrame(javax.swing.JFrame) ActionEvent(java.awt.event.ActionEvent) JTabbedPane(javax.swing.JTabbedPane) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton)

Example 58 with BoxLayout

use of javax.swing.BoxLayout in project JMRI by JMRI.

the class EditCircuitFrame method makeContentPanel.

private void makeContentPanel() {
    JPanel contentPane = new JPanel();
    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
    addWindowListener(new java.awt.event.WindowAdapter() {

        @Override
        public void windowClosing(java.awt.event.WindowEvent e) {
            closingEvent();
        }
    });
    contentPane.add(Box.createVerticalStrut(STRUT_SIZE));
    JPanel p = new JPanel();
    p.add(new JLabel(Bundle.getMessage("AddRemoveIcons")));
    contentPane.add(p);
    contentPane.add(Box.createVerticalStrut(STRUT_SIZE));
    JPanel panel = new JPanel();
    //        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.add(CircuitBuilder.makeTextBoxPanel(false, _blockState, "blockState", false, null));
    _blockState.setPreferredSize(new Dimension(150, _blockState.getPreferredSize().height));
    contentPane.add(panel);
    panel = new JPanel();
    _blockName.setText(_block.getDisplayName());
    panel.add(CircuitBuilder.makeTextBoxPanel(false, _blockName, "blockName", true, "TooltipBlockName"));
    _blockName.setPreferredSize(new Dimension(300, _blockName.getPreferredSize().height));
    contentPane.add(panel);
    contentPane.add(MakeButtonPanel());
    contentPane.add(Box.createVerticalStrut(STRUT_SIZE));
    p = new JPanel();
    p.add(new JLabel(Bundle.getMessage("numTrackElements")));
    contentPane.add(p);
    panel = new JPanel();
    //        panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
    panel.add(Box.createHorizontalGlue());
    panel.add(CircuitBuilder.makeTextBoxPanel(false, _numTrackSeg, "Segments", false, null));
    _numTrackSeg.setPreferredSize(new Dimension(20, _numTrackSeg.getPreferredSize().height));
    panel.add(Box.createHorizontalStrut(STRUT_SIZE));
    panel.add(CircuitBuilder.makeTextBoxPanel(false, _numTurnouts, "Turnouts", false, null));
    _numTurnouts.setPreferredSize(new Dimension(20, _numTurnouts.getPreferredSize().height));
    panel.add(Box.createHorizontalStrut(STRUT_SIZE));
    contentPane.add(panel);
    contentPane.add(Box.createVerticalStrut(STRUT_SIZE));
    panel = new JPanel();
    //        panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
    _detectorSensorName.setPreferredSize(new Dimension(300, _detectorSensorName.getPreferredSize().height));
    panel.add(CircuitBuilder.makeTextBoxPanel(false, _detectorSensorName, "DetectionSensor", true, "detectorSensorName"));
    _detectorSensorName.setToolTipText(Bundle.getMessage("detectorSensorName"));
    contentPane.add(panel);
    panel = new JPanel();
    //        panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
    _errorSensorName.setPreferredSize(new Dimension(300, _errorSensorName.getPreferredSize().height));
    panel.add(CircuitBuilder.makeTextBoxPanel(false, _errorSensorName, "ErrorSensor", true, "detectorErrorName"));
    _errorSensorName.setToolTipText(Bundle.getMessage("detectorErrorName"));
    contentPane.add(panel);
    contentPane.add(MakePickListPanel());
    contentPane.add(Box.createVerticalStrut(STRUT_SIZE));
    JPanel pp = new JPanel();
    //        pp.setLayout(new BoxLayout(pp, BoxLayout.X_AXIS));
    _length.setText(Float.toString(_block.getLengthIn()));
    pp.add(CircuitBuilder.makeTextBoxPanel(false, _length, "Length", true, "TooltipBlockLength"));
    _length.setPreferredSize(new Dimension(100, _length.getPreferredSize().height));
    _units = new JToggleButton("foo", !_block.isMetric());
    _units.setToolTipText(Bundle.getMessage("TooltipPathUnitButton"));
    _units.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent event) {
            changeUnits();
        }
    });
    pp.add(_units);
    contentPane.add(pp);
    contentPane.add(Box.createVerticalStrut(STRUT_SIZE));
    contentPane.add(MakeDoneButtonPanel());
    JPanel border = new JPanel();
    border.setLayout(new java.awt.BorderLayout(20, 20));
    border.add(contentPane);
    setContentPane(border);
    pack();
    if (_firstInstance) {
        setLocationRelativeTo(_parent._editor);
        _firstInstance = false;
    } else {
        setLocation(_loc);
        setSize(_dim);
    }
    setVisible(true);
    changeUnits();
}
Also used : JPanel(javax.swing.JPanel) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) JToggleButton(javax.swing.JToggleButton) ActionListener(java.awt.event.ActionListener)

Example 59 with BoxLayout

use of javax.swing.BoxLayout in project JMRI by JMRI.

the class EditCircuitFrame method MakePickListPanel.

private JPanel MakePickListPanel() {
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.Y_AXIS));
    JPanel panel = new JPanel();
    panel.setLayout(new FlowLayout());
    _openPicklistButton = new JButton(Bundle.getMessage("OpenSensorPicklist"));
    _openPicklistButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent a) {
            if (_pickFrame == null) {
                openPickList();
            } else {
                closePickList();
            }
        }
    });
    _openPicklistButton.setToolTipText(Bundle.getMessage("ToolTipPickLists"));
    panel.add(_openPicklistButton);
    panel.setToolTipText(Bundle.getMessage("ToolTipPickLists"));
    buttonPanel.add(panel);
    return buttonPanel;
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton)

Example 60 with BoxLayout

use of javax.swing.BoxLayout in project JMRI by JMRI.

the class EditCircuitFrame method MakeButtonPanel.

private JPanel MakeButtonPanel() {
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.Y_AXIS));
    JPanel panel = new JPanel();
    panel.setLayout(new FlowLayout());
    JButton changeButton = new JButton(Bundle.getMessage("buttonChangeName"));
    changeButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent a) {
            changeBlockName();
        }
    });
    changeButton.setToolTipText(Bundle.getMessage("ToolTipChangeName"));
    panel.add(changeButton);
    JButton deleteButton = new JButton(Bundle.getMessage("ButtonDelete"));
    deleteButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent a) {
            deleteCircuit();
        }
    });
    deleteButton.setToolTipText(Bundle.getMessage("ToolTipDeleteCircuit"));
    panel.add(deleteButton);
    buttonPanel.add(panel);
    return buttonPanel;
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton)

Aggregations

BoxLayout (javax.swing.BoxLayout)593 JPanel (javax.swing.JPanel)510 JLabel (javax.swing.JLabel)301 Dimension (java.awt.Dimension)189 ActionEvent (java.awt.event.ActionEvent)179 JButton (javax.swing.JButton)173 ActionListener (java.awt.event.ActionListener)155 JScrollPane (javax.swing.JScrollPane)140 FlowLayout (java.awt.FlowLayout)130 JCheckBox (javax.swing.JCheckBox)74 BorderLayout (java.awt.BorderLayout)73 GridBagLayout (java.awt.GridBagLayout)66 ButtonGroup (javax.swing.ButtonGroup)58 JTable (javax.swing.JTable)53 JTextField (javax.swing.JTextField)53 Container (java.awt.Container)51 JmriJFrame (jmri.util.JmriJFrame)45 JComboBox (javax.swing.JComboBox)44 JSeparator (javax.swing.JSeparator)44 Box (javax.swing.Box)41