Пример #1
0
 // replace the car or engine checkbox and text with only the road and number and a Set button
 protected JPanel addSet(RollingStock rs) {
   JPanel pSet = new JPanel();
   pSet.setLayout(new GridBagLayout());
   JButton setButton = new JButton(Bundle.getMessage("Set"));
   setButton.setName(rs.getId());
   setButton.addActionListener(
       (ActionEvent e) -> {
         if (Car.class.isInstance(rs)) {
           carSetButtonActionPerfomed(e);
         } else {
           engineSetButtonActionPerfomed(e);
         }
       });
   JLabel label =
       new JLabel(
           TrainCommon.padString(
               rs.toString(),
               Control.max_len_string_attibute + Control.max_len_string_road_number));
   setLabelFont(label);
   addItem(pSet, label, 0, 0);
   addItemLeft(pSet, setButton, 1, 0);
   pSet.setAlignmentX(LEFT_ALIGNMENT);
   return pSet;
 }