Search in sources :

Example 1 with GroupsComboBox

use of net.parostroj.timetable.gui.components.GroupsComboBox in project grafikon by jub77.

the class EditTrainDialog method initComponents.

private void initComponents() {
    javax.swing.JLabel typeLabel = new javax.swing.JLabel();
    typeComboBox = new javax.swing.JComboBox<>();
    numberTextField = new javax.swing.JTextField();
    javax.swing.JLabel numberLabel = new javax.swing.JLabel();
    descriptionTextField = new javax.swing.JTextField();
    javax.swing.JLabel descLabel = new javax.swing.JLabel();
    speedTextField = new javax.swing.JTextField();
    javax.swing.JLabel speedLabel = new javax.swing.JLabel();
    weightTextField = new javax.swing.JTextField();
    routeEditBox = new net.parostroj.timetable.gui.components.TextTemplateEditBox();
    javax.swing.JLabel weightLabel = new javax.swing.JLabel();
    javax.swing.JLabel routeLabel = new javax.swing.JLabel();
    javax.swing.JButton okButton = new javax.swing.JButton();
    javax.swing.JButton cancelButton = new javax.swing.JButton();
    // NOI18N
    setTitle(ResourceLoader.getString("edit.train"));
    // NOI18N
    typeLabel.setText(ResourceLoader.getString("create.train.type"));
    numberTextField.setColumns(20);
    // NOI18N
    numberLabel.setText(ResourceLoader.getString("create.train.number"));
    descriptionTextField.setColumns(30);
    // NOI18N
    descLabel.setText(ResourceLoader.getString("create.train.description"));
    speedTextField.setColumns(10);
    // NOI18N
    speedLabel.setText(ResourceLoader.getString("create.train.speed"));
    // NOI18N
    weightLabel.setText(ResourceLoader.getString("edit.train.weight"));
    // NOI18N
    routeLabel.setText(ResourceLoader.getString("edit.train.route"));
    // NOI18N
    okButton.setText(ResourceLoader.getString("button.ok"));
    okButton.addActionListener(this::okButtonActionPerformed);
    // NOI18N
    cancelButton.setText(ResourceLoader.getString("button.cancel"));
    cancelButton.addActionListener(this::cancelButtonActionPerformed);
    groupsComboBox = new GroupsComboBox(false);
    JLabel groupLabel = new JLabel(ResourceLoader.getString("create.train.group"));
    JPanel optionsPanel = new JPanel();
    JPanel routeEditPanel = new JPanel();
    JPanel techTimesPanel = new JPanel();
    techTimesPanel.setBorder(BorderFactory.createEmptyBorder());
    JPanel connectedTrainsPanel = new JPanel();
    connectedTrainsPanel.setBorder(BorderFactory.createEmptyBorder());
    FlowLayout flTechTimesPanel = (FlowLayout) techTimesPanel.getLayout();
    flTechTimesPanel.setHgap(0);
    flTechTimesPanel.setAlignOnBaseline(true);
    flTechTimesPanel.setAlignment(FlowLayout.LEFT);
    flTechTimesPanel.setVgap(0);
    JPanel weightLimitPanel = new JPanel();
    JLabel weightLimitLabel = new JLabel(ResourceLoader.getString("edit.train.weight.limit") + ":");
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    layout.setHorizontalGroup(layout.createParallelGroup(Alignment.TRAILING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(Alignment.TRAILING).addComponent(techTimesPanel, GroupLayout.DEFAULT_SIZE, 375, Short.MAX_VALUE).addComponent(connectedTrainsPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addGroup(layout.createSequentialGroup().addComponent(okButton).addPreferredGap(ComponentPlacement.RELATED).addComponent(cancelButton)).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.LEADING).addComponent(routeLabel).addComponent(weightLabel).addComponent(weightLimitLabel).addComponent(speedLabel).addComponent(descLabel).addComponent(numberLabel).addComponent(groupLabel).addComponent(typeLabel)).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.LEADING).addComponent(routeEditPanel, GroupLayout.DEFAULT_SIZE, 301, Short.MAX_VALUE).addComponent(optionsPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(descriptionTextField, GroupLayout.DEFAULT_SIZE, 301, Short.MAX_VALUE).addComponent(weightTextField, GroupLayout.DEFAULT_SIZE, 301, Short.MAX_VALUE).addComponent(numberTextField, GroupLayout.DEFAULT_SIZE, 301, Short.MAX_VALUE).addComponent(typeComboBox, 0, 301, Short.MAX_VALUE).addComponent(routeEditBox, GroupLayout.DEFAULT_SIZE, 301, Short.MAX_VALUE).addComponent(groupsComboBox, GroupLayout.DEFAULT_SIZE, 301, Short.MAX_VALUE).addComponent(weightLimitPanel, GroupLayout.DEFAULT_SIZE, 301, Short.MAX_VALUE).addComponent(speedTextField, GroupLayout.DEFAULT_SIZE, 301, Short.MAX_VALUE)))).addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(typeLabel).addComponent(typeComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)).addPreferredGap(ComponentPlacement.RELATED).addComponent(optionsPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(groupsComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(groupLabel)).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(numberLabel).addComponent(numberTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(descriptionTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(descLabel)).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(speedTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(speedLabel)).addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addPreferredGap(ComponentPlacement.RELATED).addComponent(weightLimitPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)).addGroup(layout.createSequentialGroup().addGap(10).addComponent(weightLimitLabel))).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(weightTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(weightLabel)).addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addPreferredGap(ComponentPlacement.RELATED).addComponent(routeEditBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(ComponentPlacement.RELATED).addComponent(routeEditPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)).addGroup(layout.createSequentialGroup().addGap(10).addComponent(routeLabel))).addPreferredGap(ComponentPlacement.RELATED).addComponent(techTimesPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(ComponentPlacement.RELATED).addComponent(connectedTrainsPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(cancelButton).addComponent(okButton)).addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    GridBagLayout gblConnectedTrainsPanel = new GridBagLayout();
    connectedTrainsPanel.setLayout(gblConnectedTrainsPanel);
    JLabel joinedTrainsLabel = new JLabel(ResourceLoader.getString("edit.train.joined"));
    GridBagConstraints gbcJoinedTrainsLabel = new GridBagConstraints();
    gbcJoinedTrainsLabel.fill = GridBagConstraints.HORIZONTAL;
    gbcJoinedTrainsLabel.anchor = GridBagConstraints.WEST;
    gbcJoinedTrainsLabel.gridwidth = 2;
    gbcJoinedTrainsLabel.insets = new Insets(0, 0, 5, 5);
    gbcJoinedTrainsLabel.gridx = 0;
    gbcJoinedTrainsLabel.gridy = 0;
    connectedTrainsPanel.add(joinedTrainsLabel, gbcJoinedTrainsLabel);
    JLabel previousTrainLabel = new JLabel(ResourceLoader.getString("edit.train.joined.previous") + ": ");
    GridBagConstraints gbcPreviousTrainLabel = new GridBagConstraints();
    gbcPreviousTrainLabel.anchor = GridBagConstraints.WEST;
    gbcPreviousTrainLabel.insets = new Insets(0, 10, 5, 5);
    gbcPreviousTrainLabel.gridx = 0;
    gbcPreviousTrainLabel.gridy = 1;
    connectedTrainsPanel.add(previousTrainLabel, gbcPreviousTrainLabel);
    JComboBox<Wrapper<Train>> previousTrainComboBox = new JComboBox<>();
    previousTrainModel = new WrapperListModel<>(true);
    previousTrainComboBox.setModel(previousTrainModel);
    GridBagConstraints gbcPreviousTrainComboBox = new GridBagConstraints();
    gbcPreviousTrainComboBox.insets = new Insets(0, 0, 5, 0);
    gbcPreviousTrainComboBox.weightx = 1.0;
    gbcPreviousTrainComboBox.fill = GridBagConstraints.HORIZONTAL;
    gbcPreviousTrainComboBox.anchor = GridBagConstraints.NORTHWEST;
    gbcPreviousTrainComboBox.gridx = 1;
    gbcPreviousTrainComboBox.gridy = 1;
    connectedTrainsPanel.add(previousTrainComboBox, gbcPreviousTrainComboBox);
    JLabel nextTrainLabel = new JLabel(ResourceLoader.getString("edit.train.joined.next") + ": ");
    GridBagConstraints gbcNextTrainLabel = new GridBagConstraints();
    gbcNextTrainLabel.anchor = GridBagConstraints.WEST;
    gbcNextTrainLabel.insets = new Insets(0, 10, 0, 5);
    gbcNextTrainLabel.gridx = 0;
    gbcNextTrainLabel.gridy = 2;
    connectedTrainsPanel.add(nextTrainLabel, gbcNextTrainLabel);
    JComboBox<Wrapper<Train>> nextTrainComboBox = new JComboBox<>();
    nextTrainModel = new WrapperListModel<>(true);
    nextTrainComboBox.setModel(nextTrainModel);
    GridBagConstraints gbcNextTrainComboBox = new GridBagConstraints();
    gbcNextTrainComboBox.weightx = 1.0;
    gbcNextTrainComboBox.fill = GridBagConstraints.HORIZONTAL;
    gbcNextTrainComboBox.anchor = GridBagConstraints.NORTHWEST;
    gbcNextTrainComboBox.gridx = 1;
    gbcNextTrainComboBox.gridy = 2;
    connectedTrainsPanel.add(nextTrainComboBox, gbcNextTrainComboBox);
    layout.linkSize(SwingConstants.HORIZONTAL, typeLabel, numberLabel, descLabel, speedLabel, weightLabel, routeLabel, groupLabel, weightLimitLabel);
    GridBagLayout gblWeightLimitPanel = new GridBagLayout();
    gblWeightLimitPanel.columnWeights = new double[] { 0.0, 0.0 };
    gblWeightLimitPanel.rowWeights = new double[] { 0.0 };
    weightLimitPanel.setLayout(gblWeightLimitPanel);
    weightLimitCheckBox = new JCheckBox();
    weightLimitCheckBox.addItemListener(e -> weightLimitEditBox.setEnabled(e.getStateChange() == ItemEvent.SELECTED));
    GridBagConstraints gbcWeightLimitCheckBox = new GridBagConstraints();
    gbcWeightLimitCheckBox.anchor = GridBagConstraints.WEST;
    gbcWeightLimitCheckBox.gridx = 1;
    gbcWeightLimitCheckBox.gridy = 0;
    weightLimitPanel.add(weightLimitCheckBox, gbcWeightLimitCheckBox);
    weightLimitEditBox = new ValueWithUnitEditBox();
    weightLimitEditBox.setUnits(Arrays.asList(WeightUnit.values()));
    weightLimitEditBox.setUnit(WeightUnit.T);
    GridBagConstraints gbcWeightLimitEditBox = new GridBagConstraints();
    gbcWeightLimitEditBox.weightx = 1.0;
    gbcWeightLimitEditBox.fill = GridBagConstraints.HORIZONTAL;
    gbcWeightLimitEditBox.anchor = GridBagConstraints.NORTHWEST;
    gbcWeightLimitEditBox.gridx = 0;
    gbcWeightLimitEditBox.gridy = 0;
    weightLimitPanel.add(weightLimitEditBox, gbcWeightLimitEditBox);
    javax.swing.JLabel techTimesLabel = new javax.swing.JLabel();
    techTimesPanel.add(techTimesLabel);
    techTimesLabel.setText(ResourceLoader.getString("create.train.technological.time"));
    Component delimiterStrut1 = Box.createHorizontalStrut(5);
    techTimesPanel.add(delimiterStrut1);
    javax.swing.JLabel beforeLabel = new javax.swing.JLabel();
    techTimesPanel.add(beforeLabel);
    beforeLabel.setText(ResourceLoader.getString("create.train.time.before"));
    Component delimiterStrut2 = Box.createHorizontalStrut(5);
    techTimesPanel.add(delimiterStrut2);
    timeBeforeTextField = new javax.swing.JTextField();
    techTimesPanel.add(timeBeforeTextField);
    timeBeforeTextField.setColumns(6);
    Component delimiterStrut3 = Box.createHorizontalStrut(5);
    techTimesPanel.add(delimiterStrut3);
    javax.swing.JLabel afterLabel = new javax.swing.JLabel();
    techTimesPanel.add(afterLabel);
    afterLabel.setText(ResourceLoader.getString("create.train.time.after"));
    Component delimiterStrut4 = Box.createHorizontalStrut(5);
    techTimesPanel.add(delimiterStrut4);
    timeAfterTextField = new javax.swing.JTextField();
    techTimesPanel.add(timeAfterTextField);
    timeAfterTextField.setColumns(6);
    GridBagLayout gblRouteEditPanel = new GridBagLayout();
    routeEditPanel.setLayout(gblRouteEditPanel);
    javax.swing.JLabel routeInsertLabel = new javax.swing.JLabel();
    GridBagConstraints gbcRouteInsertLabel = new GridBagConstraints();
    gbcRouteInsertLabel.anchor = GridBagConstraints.WEST;
    gbcRouteInsertLabel.insets = new Insets(0, 0, 0, 5);
    gbcRouteInsertLabel.gridx = 0;
    gbcRouteInsertLabel.gridy = 0;
    routeEditPanel.add(routeInsertLabel, gbcRouteInsertLabel);
    routeInsertLabel.setText(ResourceLoader.getString("edit.train.insert.node"));
    fromNodeButton = new javax.swing.JButton();
    GridBagConstraints gbcFromNodeButton = new GridBagConstraints();
    gbcFromNodeButton.weightx = 1.0;
    gbcFromNodeButton.fill = GridBagConstraints.HORIZONTAL;
    gbcFromNodeButton.anchor = GridBagConstraints.WEST;
    gbcFromNodeButton.insets = new Insets(0, 0, 0, 5);
    gbcFromNodeButton.gridx = 1;
    gbcFromNodeButton.gridy = 0;
    routeEditPanel.add(fromNodeButton, gbcFromNodeButton);
    fromNodeButton.addActionListener(this::fromNodeButtonActionPerformed);
    toNodeButton = new javax.swing.JButton();
    GridBagConstraints gbcToNodeButton = new GridBagConstraints();
    gbcToNodeButton.weightx = 1.0;
    gbcToNodeButton.fill = GridBagConstraints.HORIZONTAL;
    gbcToNodeButton.anchor = GridBagConstraints.WEST;
    gbcToNodeButton.insets = new Insets(0, 0, 0, 5);
    gbcToNodeButton.gridx = 2;
    gbcToNodeButton.gridy = 0;
    routeEditPanel.add(toNodeButton, gbcToNodeButton);
    toNodeButton.addActionListener(this::toNodeButtonActionPerformed);
    stationsComboBox = new javax.swing.JComboBox<>();
    GridBagConstraints gbcStationsComboBox = new GridBagConstraints();
    gbcStationsComboBox.weightx = 1.0;
    gbcStationsComboBox.fill = GridBagConstraints.HORIZONTAL;
    gbcStationsComboBox.anchor = GridBagConstraints.NORTHWEST;
    gbcStationsComboBox.insets = new Insets(0, 0, 0, 5);
    gbcStationsComboBox.gridx = 3;
    gbcStationsComboBox.gridy = 0;
    routeEditPanel.add(stationsComboBox, gbcStationsComboBox);
    javax.swing.JButton insertButton = new javax.swing.JButton();
    GridBagConstraints gbcInsertButton = new GridBagConstraints();
    gbcInsertButton.anchor = GridBagConstraints.EAST;
    gbcInsertButton.gridx = 4;
    gbcInsertButton.gridy = 0;
    routeEditPanel.add(insertButton, gbcInsertButton);
    insertButton.setText("^");
    insertButton.addActionListener(this::insertButtonActionPerformed);
    GridBagLayout gblOptionsPanel = new GridBagLayout();
    gblOptionsPanel.columnWeights = new double[] { 0.0, 0.0 };
    gblOptionsPanel.rowWeights = new double[] { 0.0, 0.0, 0.0 };
    optionsPanel.setLayout(gblOptionsPanel);
    dieselCheckBox = new javax.swing.JCheckBox();
    GridBagConstraints gbcDieselCheckBox = new GridBagConstraints();
    gbcDieselCheckBox.anchor = GridBagConstraints.WEST;
    gbcDieselCheckBox.insets = new Insets(0, 0, 5, 5);
    gbcDieselCheckBox.gridx = 0;
    gbcDieselCheckBox.gridy = 0;
    optionsPanel.add(dieselCheckBox, gbcDieselCheckBox);
    // NOI18N
    dieselCheckBox.setText(ResourceLoader.getString("create.train.diesel"));
    dieselCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    dieselCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
    emptyCheckBox = new javax.swing.JCheckBox();
    GridBagConstraints gbcEmptyCheckBox = new GridBagConstraints();
    gbcEmptyCheckBox.weightx = 1.0;
    gbcEmptyCheckBox.anchor = GridBagConstraints.WEST;
    gbcEmptyCheckBox.fill = GridBagConstraints.HORIZONTAL;
    gbcEmptyCheckBox.insets = new Insets(0, 0, 5, 0);
    gbcEmptyCheckBox.gridx = 1;
    gbcEmptyCheckBox.gridy = 0;
    optionsPanel.add(emptyCheckBox, gbcEmptyCheckBox);
    // NOI18N
    emptyCheckBox.setText(ResourceLoader.getString("create.train.empty"));
    emptyCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    emptyCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
    electricCheckBox = new javax.swing.JCheckBox();
    GridBagConstraints gbcElectricCheckBox = new GridBagConstraints();
    gbcElectricCheckBox.anchor = GridBagConstraints.WEST;
    gbcElectricCheckBox.insets = new Insets(0, 0, 5, 5);
    gbcElectricCheckBox.gridx = 0;
    gbcElectricCheckBox.gridy = 1;
    optionsPanel.add(electricCheckBox, gbcElectricCheckBox);
    // NOI18N
    electricCheckBox.setText(ResourceLoader.getString("create.train.electric"));
    electricCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    electricCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
    showLengthCheckBox = new javax.swing.JCheckBox();
    GridBagConstraints gbcShowLengthCheckBox = new GridBagConstraints();
    gbcShowLengthCheckBox.insets = new Insets(0, 0, 5, 0);
    gbcShowLengthCheckBox.weightx = 1.0;
    gbcShowLengthCheckBox.anchor = GridBagConstraints.WEST;
    gbcShowLengthCheckBox.fill = GridBagConstraints.HORIZONTAL;
    gbcShowLengthCheckBox.gridx = 1;
    gbcShowLengthCheckBox.gridy = 1;
    optionsPanel.add(showLengthCheckBox, gbcShowLengthCheckBox);
    // NOI18N
    showLengthCheckBox.setText(ResourceLoader.getString("create.train.show.station.length"));
    showLengthCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    showLengthCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
    // NOI18N
    managedFreightCheckBox = new javax.swing.JCheckBox(ResourceLoader.getString("edit.train.managed.freight"));
    managedFreightCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    managedFreightCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
    GridBagConstraints gbcManagedFreightCheckBox = new GridBagConstraints();
    gbcManagedFreightCheckBox.weightx = 1.0;
    gbcManagedFreightCheckBox.anchor = GridBagConstraints.NORTHWEST;
    gbcManagedFreightCheckBox.fill = GridBagConstraints.HORIZONTAL;
    gbcManagedFreightCheckBox.insets = new Insets(0, 0, 5, 5);
    gbcManagedFreightCheckBox.gridx = 0;
    gbcManagedFreightCheckBox.gridy = 2;
    optionsPanel.add(managedFreightCheckBox, gbcManagedFreightCheckBox);
    // NOI18N
    optionalCheckBox = new javax.swing.JCheckBox(ResourceLoader.getString("edit.train.optional.train"));
    GridBagConstraints gbcCheckBox = new GridBagConstraints();
    optionalCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    optionalCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
    gbcCheckBox.weightx = 1.0;
    gbcCheckBox.anchor = GridBagConstraints.WEST;
    gbcCheckBox.fill = GridBagConstraints.HORIZONTAL;
    gbcCheckBox.gridx = 1;
    gbcCheckBox.gridy = 2;
    optionsPanel.add(optionalCheckBox, gbcCheckBox);
    getContentPane().setLayout(layout);
    pack();
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) FlowLayout(java.awt.FlowLayout) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ValueWithUnitEditBox(net.parostroj.timetable.gui.components.ValueWithUnitEditBox) GroupsComboBox(net.parostroj.timetable.gui.components.GroupsComboBox) GroupLayout(javax.swing.GroupLayout) Component(java.awt.Component) Wrapper(net.parostroj.timetable.gui.wrappers.Wrapper) JComboBox(javax.swing.JComboBox) JLabel(javax.swing.JLabel) JCheckBox(javax.swing.JCheckBox) JLabel(javax.swing.JLabel) GroupLayout(javax.swing.GroupLayout) JCheckBox(javax.swing.JCheckBox)

Example 2 with GroupsComboBox

use of net.parostroj.timetable.gui.components.GroupsComboBox in project grafikon by jub77.

the class CreateTrainView method initComponents.

private void initComponents() {
    javax.swing.JLabel jLabel1 = new javax.swing.JLabel();
    fromComboBox = new javax.swing.JComboBox<>();
    javax.swing.JLabel jLabel2 = new javax.swing.JLabel();
    toComboBox = new javax.swing.JComboBox<>();
    speedTextField = new javax.swing.JTextField();
    speedTextField.setColumns(10);
    javax.swing.JLabel jLabel3 = new javax.swing.JLabel();
    stopTextField = new javax.swing.JTextField();
    stopTextField.setColumns(10);
    javax.swing.JLabel jLabel4 = new javax.swing.JLabel();
    javax.swing.JButton cancelButton = new javax.swing.JButton();
    javax.swing.JButton okButton = new javax.swing.JButton();
    javax.swing.JLabel jLabel5 = new javax.swing.JLabel();
    nameTextField = new javax.swing.JTextField();
    javax.swing.JLabel jLabel6 = new javax.swing.JLabel();
    typeComboBox = new javax.swing.JComboBox<>();
    javax.swing.JLabel jLabel7 = new javax.swing.JLabel();
    startTimeTextField = new javax.swing.JTextField();
    startTimeTextField.setColumns(10);
    commentTextField = new javax.swing.JTextField();
    javax.swing.JLabel jLabel8 = new javax.swing.JLabel();
    dieselCheckBox = new javax.swing.JCheckBox();
    electricCheckBox = new javax.swing.JCheckBox();
    javax.swing.JLabel jLabel9 = new javax.swing.JLabel();
    javax.swing.JButton throughButton = new javax.swing.JButton();
    throughTextField = new javax.swing.JTextField();
    // NOI18N
    jLabel1.setText(ResourceLoader.getString("from.node"));
    // NOI18N
    jLabel2.setText(ResourceLoader.getString("to.node"));
    // NOI18N
    jLabel3.setText(ResourceLoader.getString("create.train.speed"));
    // NOI18N
    jLabel4.setText(ResourceLoader.getString("create.train.stop"));
    // NOI18N
    cancelButton.setText(ResourceLoader.getString("button.cancel"));
    cancelButton.addActionListener(this::cancelButtonActionPerformed);
    // NOI18N
    okButton.setText(ResourceLoader.getString("button.ok"));
    okButton.addActionListener(this::okButtonActionPerformed);
    // NOI18N
    jLabel5.setText(ResourceLoader.getString("create.train.number"));
    // NOI18N
    jLabel6.setText(ResourceLoader.getString("create.train.type"));
    // NOI18N
    jLabel7.setText(ResourceLoader.getString("create.train.starttime"));
    // NOI18N
    jLabel8.setText(ResourceLoader.getString("create.train.description"));
    // NOI18N
    dieselCheckBox.setText(ResourceLoader.getString("create.train.diesel"));
    dieselCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    dieselCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
    // NOI18N
    electricCheckBox.setText(ResourceLoader.getString("create.train.electric"));
    electricCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    electricCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
    // NOI18N
    jLabel9.setText(ResourceLoader.getString("create.train.through"));
    // NOI18N
    throughButton.setText(ResourceLoader.getString("create.train.throughbutton"));
    throughButton.addActionListener(this::throughButtonActionPerformed);
    throughTextField.setEditable(false);
    groupComboBox = new GroupsComboBox(false);
    JLabel label = new JLabel(ResourceLoader.getString("create.train.group"));
    managedFreightCheckBox = new JCheckBox(ResourceLoader.getString("edit.train.managed.freight"));
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING, layout.createSequentialGroup().addComponent(okButton).addPreferredGap(ComponentPlacement.RELATED).addComponent(cancelButton)).addGroup(Alignment.TRAILING, layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.LEADING, false).addComponent(jLabel8, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(jLabel6, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(jLabel5, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(jLabel1, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(jLabel4, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(jLabel3, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(jLabel2, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(jLabel9).addComponent(label, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(speedTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(jLabel7).addPreferredGap(ComponentPlacement.RELATED).addComponent(startTimeTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)).addComponent(stopTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addGroup(layout.createSequentialGroup().addComponent(throughTextField, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addPreferredGap(ComponentPlacement.RELATED).addComponent(throughButton)).addComponent(typeComboBox, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(toComboBox, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(fromComboBox, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(commentTextField, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(nameTextField, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(groupComboBox, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addGroup(layout.createSequentialGroup().addComponent(managedFreightCheckBox).addPreferredGap(ComponentPlacement.RELATED).addComponent(dieselCheckBox).addPreferredGap(ComponentPlacement.RELATED).addComponent(electricCheckBox))))).addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(jLabel6).addComponent(typeComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(groupComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(label)).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(managedFreightCheckBox).addComponent(dieselCheckBox).addComponent(electricCheckBox)).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(jLabel5).addComponent(nameTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(commentTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(jLabel8)).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(fromComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(jLabel1)).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(toComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(jLabel2)).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(jLabel9).addComponent(throughButton).addComponent(throughTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(jLabel3).addComponent(speedTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(jLabel7).addComponent(startTimeTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(stopTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(jLabel4)).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(cancelButton).addComponent(okButton)).addContainerGap()));
    this.setLayout(layout);
}
Also used : JLabel(javax.swing.JLabel) JCheckBox(javax.swing.JCheckBox) GroupsComboBox(net.parostroj.timetable.gui.components.GroupsComboBox) JLabel(javax.swing.JLabel) JCheckBox(javax.swing.JCheckBox) GroupLayout(javax.swing.GroupLayout) GroupLayout(javax.swing.GroupLayout)

Aggregations

GroupLayout (javax.swing.GroupLayout)2 JCheckBox (javax.swing.JCheckBox)2 JLabel (javax.swing.JLabel)2 GroupsComboBox (net.parostroj.timetable.gui.components.GroupsComboBox)2 Component (java.awt.Component)1 FlowLayout (java.awt.FlowLayout)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 JComboBox (javax.swing.JComboBox)1 JPanel (javax.swing.JPanel)1 ValueWithUnitEditBox (net.parostroj.timetable.gui.components.ValueWithUnitEditBox)1 Wrapper (net.parostroj.timetable.gui.wrappers.Wrapper)1