コード例 #1
1
  private void setSpinnerModelsNotNull() {
    startHourSpinner.setModel(new SpinnerNumberModel(model.getStartHour(), 00, 23, 1));
    startMinuteSpinner.setModel(new SpinnerNumberModel(model.getStartMinute(), 00, 59, 1));

    endHourSpinner.setModel(new SpinnerNumberModel(model.getFinishedHour(), 00, 23, 1));
    endMinuteSpinner.setModel(new SpinnerNumberModel(model.getFinishedMinute(), 00, 59, 1));
  }
コード例 #2
0
  private void setSpinnerModelsNull() {
    startHourSpinner.setModel(new SpinnerNumberModel(0, 0, 23, 1));
    startMinuteSpinner.setModel(new SpinnerNumberModel(0, 0, 59, 1));

    endHourSpinner.setModel(new SpinnerNumberModel(0, 0, 23, 1));
    endMinuteSpinner.setModel(new SpinnerNumberModel(0, 0, 59, 1));
  }
コード例 #3
0
  public ObstetCalculatorWindow() {
    Calendar dtNow = Calendar.getInstance();
    // Date dtNow = new Date();

    dtDay = dtNow.get(Calendar.DAY_OF_MONTH);
    dtMonth = dtNow.get(Calendar.MONTH);
    dtYear = dtNow.get(Calendar.YEAR);

    initComponents();

    spinDays.setModel(new SpinnerNumberModel(dtDay, 1, maxDay(), 1));
    spinMonth.setModel(new SpinnerNumberModel(dtMonth + 1, 1, 12, 1));
    spinYear.setModel(new SpinnerNumberModel(dtYear, dtYear - 1, dtYear + 1, 1));
    spinYear.setEditor(new javax.swing.JSpinner.NumberEditor(spinYear, "####"));

    SetListeners();

    txtWeek.addKeyListener(keyListW);
    txtDays.addKeyListener(keyListD);

    // setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    // setMaximizedBounds(new java.awt.Rectangle(0, 0, 0, 0));
    setResizable(false);
    this.setTitle("Obstet Tools");
  }
コード例 #4
0
ファイル: SpinSlider.java プロジェクト: Roxside/EvoGame
 public SpinSlider() {
   this.setLayout(new FlowLayout());
   final JSpinner spinner = new JSpinner();
   final JSlider slider = new JSlider();
   slider.addChangeListener(
       new ChangeListener() {
         @Override
         public void stateChanged(ChangeEvent e) {
           JSlider s = (JSlider) e.getSource();
           spinner.setValue(s.getValue());
         }
       });
   this.add(slider);
   spinner.setModel(new SpinnerNumberModel(50, 0, 100, 1));
   spinner.setEditor(new JSpinner.NumberEditor(spinner, "0'%'"));
   spinner.addChangeListener(
       new ChangeListener() {
         @Override
         public void stateChanged(ChangeEvent e) {
           JSpinner s = (JSpinner) e.getSource();
           slider.setValue((Integer) s.getValue());
         }
       });
   this.add(spinner);
 }
コード例 #5
0
 private void jSpinner3StateChanged(javax.swing.event.ChangeEvent evt) {
   dtMonth = (int) spinMonth.getValue() - 1;
   if (dtDay > maxDay()) {
     dtDay = maxDay();
   }
   // dtDay = Math.min(dtDay, maxDay());
   spinDays.setModel(new SpinnerNumberModel(dtDay, 1, maxDay(), 1));
 }
コード例 #6
0
 public Component getTableCellEditorComponent(
     JTable table, Object value, boolean isSelected, int row, int column) {
   try {
     if (value instanceof Double || value instanceof BigDecimal) {
       double valMax = CastUtils.toDouble0(table.getValueAt(row, column - 1));
       double val = CastUtils.toDouble0(value);
       spinner.setModel(new SpinnerNumberModel(val, 0d, valMax, 0.1d));
     } else {
       int valMax = CastUtils.toInteger0(table.getValueAt(row, column - 1));
       int val = CastUtils.toInteger0(value);
       spinner.setModel(new SpinnerNumberModel(val, 0, valMax, 1));
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
   spinner.setValue(value);
   return spinner;
 }
コード例 #7
0
ファイル: EquipmentModels.java プロジェクト: dlabat/pcgen-svn
 @Override
 public Component getTableCellEditorComponent(
     JTable table, Object value, boolean isSelected, int row, int column) {
   EquipmentFacade equipment = (EquipmentFacade) table.getValueAt(row, 0);
   int maxQuantity = equipmentList.getQuantity(equipment);
   SpinnerNumberModel model =
       new SpinnerNumberModel(((Integer) value).intValue(), 1, maxQuantity, 1);
   spinner.setModel(model);
   return spinner;
 }
コード例 #8
0
ファイル: IntegerOptionUI.java プロジェクト: vardars/FreeCol
  /**
   * Creates a new <code>IntegerOptionUI</code> for the given <code>IntegerOption</code>.
   *
   * @param option The <code>IntegerOption</code> to make a user interface for.
   * @param editable boolean whether user can modify the setting
   */
  public IntegerOptionUI(final IntegerOption option, boolean editable) {
    super(option, editable);

    int value = option.getValue();
    if (editable) {
      int min = option.getMinimumValue();
      int max = option.getMaximumValue();
      if (min > max) {
        int tmp = min;
        min = max;
        max = tmp;
      }
      int stepSize = Math.max(1, Math.min((max - min) / 10, 1000));
      spinner.setModel(new SpinnerNumberModel(value, min, max, stepSize));
    } else {
      spinner.setModel(new SpinnerNumberModel(value, value, value, 1));
    }

    initialize();
  }
コード例 #9
0
 private void initCommon() {
   dt_initdebate_timeofhansard.setModel(
       new SpinnerDateModel(new Date(), null, null, Calendar.HOUR));
   dt_initdebate_timeofhansard.setEditor(
       new JSpinner.DateEditor(
           dt_initdebate_timeofhansard,
           BungeniEditorProperties.getEditorProperty("metadataTimeFormat")));
   ((JSpinner.DefaultEditor) dt_initdebate_timeofhansard.getEditor())
       .getTextField()
       .setEditable(false);
 }
コード例 #10
0
ファイル: MainWindow.java プロジェクト: mklinke/break-planner
 private JSpinner getNewBreakTimeSpinner() {
   if (newBreakTimeSpinner == null) {
     newBreakTimeSpinner = new JSpinner();
     newBreakTimeSpinner.setModel(
         new SpinnerDateModel(
             new Date(),
             new LocalTime(0, 0).toDateTimeToday().toDate(),
             new LocalTime(23, 59).toDateTimeToday().toDate(),
             Calendar.HOUR_OF_DAY));
   }
   return newBreakTimeSpinner;
 }
コード例 #11
0
 /**
  * This method initializes spnCapacity
  *
  * @return javax.swing.JSpinner
  * @uml.property name="spnCapacity"
  */
 private JSpinner getSpnCapacity() {
   if (spnCapacity == null) {
     spnCapacity = new JSpinner();
     spnCapacity.setPreferredSize(new Dimension(50, 20));
     spnCapacity.setModel(new SpinnerNumberModel(1, 1, 10000, 1));
     spnCapacity.addChangeListener(
         new javax.swing.event.ChangeListener() {
           public void stateChanged(javax.swing.event.ChangeEvent e) {
             currentSchool.setCapacity((Integer) spnCapacity.getValue());
           }
         });
   }
   return spnCapacity;
 }
コード例 #12
0
ファイル: GridTool.java プロジェクト: MalukuSeito/maptool
  public GridTool() {
    try {
      setIcon(new ImageIcon(ImageUtil.getImage("net/rptools/maptool/client/image/grid.gif")));
    } catch (IOException ioe) {
      ioe.printStackTrace();
    }
    // Create the control panel
    controlPanel = new FormPanel("net/rptools/maptool/client/ui/forms/adjustGridControlPanel.xml");
    controlPanel.setBorder(BorderFactory.createLineBorder(Color.black));

    gridSizeSpinner = controlPanel.getSpinner("gridSize");
    gridSizeSpinner.setModel(new SpinnerNumberModel());
    gridSizeSpinner.addChangeListener(new UpdateGridListener());

    gridOffsetXTextField = controlPanel.getTextField("offsetX");
    gridOffsetXTextField.addKeyListener(new UpdateGridListener());

    gridOffsetYTextField = controlPanel.getTextField("offsetY");
    gridOffsetYTextField.addKeyListener(new UpdateGridListener());

    gridSecondDimensionLabel = (JETALabel) controlPanel.getLabel("gridSecondDimensionLabel");
    gridSecondDimension = controlPanel.getTextField("gridSecondDimension");
    gridSecondDimension.addFocusListener(new UpdateGridListener());

    colorWell = (JETAColorWell) controlPanel.getComponentByName("colorWell");
    colorWell.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            copyControlPanelToGrid();
          }
        });

    JButton closeButton = (JButton) controlPanel.getComponentByName("closeButton");
    closeButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            resetTool();
            //				Lee: just to make the light sources snap to their owners after the tool is closed
            Zone z = MapTool.getFrame().getCurrentZoneRenderer().getZone();
            z.putTokens(z.getTokens());
          }
        });
    zoomSlider = (JSlider) controlPanel.getComponentByName("zoomSlider");
    zoomSlider.setMinimum(0);
    zoomSlider.setMaximum(zoomSliderStopCount);
    ZoomChangeListener zoomListener = new ZoomChangeListener();
    zoomSlider.addChangeListener(zoomListener);
    zoomSlider.addMouseListener(zoomListener);
  }
コード例 #13
0
ファイル: RegistroDeSalida.java プロジェクト: rcancino/sw2
 @Override
 protected JComponent buildContent() {
   salidaField = new JSpinner();
   SpinnerDateModel model = new SpinnerDateModel(new Date(), null, null, Calendar.MINUTE);
   salidaField.setModel(model);
   salidaField.setEnabled(enabled);
   afterCreated(salidaField);
   JPanel panel = new JPanel(new BorderLayout());
   FormLayout layout = new FormLayout("40dlu,2dlu,100dlu", "");
   final DefaultFormBuilder builder = new DefaultFormBuilder(layout);
   builder.append("Salida:", salidaField);
   panel.add(builder.getPanel(), BorderLayout.CENTER);
   panel.add(buildButtonBarWithOKCancel(), BorderLayout.SOUTH);
   return panel;
 }
コード例 #14
0
 public void setSpinnerSemester(JSpinner spinnerSemester) {
   this.spinnerSemester = spinnerSemester;
   java.util.List<Semester> semesterList = svmContext.getSvmModel().getSemestersAll();
   if (semesterList.isEmpty()) {
     // keine Semester erfasst
     SpinnerModel spinnerModel = new SpinnerListModel(new String[] {""});
     spinnerSemester.setModel(spinnerModel);
     spinnerSemester.setEnabled(false);
     return;
   }
   Semester[] semesters = semesterList.toArray(new Semester[semesterList.size()]);
   SpinnerModel spinnerModelSemester = new SpinnerListModel(semesters);
   spinnerSemester.setModel(spinnerModelSemester);
   spinnerSemester.addChangeListener(
       new ChangeListener() {
         @Override
         public void stateChanged(ChangeEvent e) {
           onSemesterSelected();
         }
       });
   // Model initialisieren
   kurseSemesterwahlModel.setSemester(
       kurseSemesterwahlModel.getInitSemester(svmContext.getSvmModel()));
 }
コード例 #15
0
 public void setFormats(Format inputFormat, Format outputFormat) {
   this.inputFormat = inputFormat;
   this.outputFormat = outputFormat;
   // System.out.println("Spinner model: " + spinner.getModel());
   spinner.setModel(spinner.getModel());
   // System.out.println("**** Setting spinner editor");
   if (inputFormat instanceof DecimalFormat) {
     spinner.setEditor(
         new JSpinner.NumberEditor(spinner, ((DecimalFormat) inputFormat).toPattern()));
   } else if (outputFormat instanceof SimpleDateFormat) {
     spinner.setEditor(
         new JSpinner.DateEditor(spinner, ((SimpleDateFormat) inputFormat).toPattern()));
   }
   initSpinner();
   initComboBox();
 }
コード例 #16
0
  public ScalaProjectSettingsPanel(Project project) {
    myProject = project;
    outputSpinner.setModel(new SpinnerNumberModel(35, 1, null, 1));

    ScalaUiWithDependency[] deps = DependencyAwareInjectionSettings.EP_NAME.getExtensions();
    for (ScalaUiWithDependency uiWithDependency : deps) {
      if (INJECTION_SETTINGS_NAME.equals(uiWithDependency.getName())) {
        injectionPrefixTable = uiWithDependency.createComponent(injectionJPanel);
        break;
      }
    }
    if (injectionPrefixTable == null)
      injectionPrefixTable = new ScalaUiWithDependency.NullComponentWithSettings();

    setSettings();
  }
コード例 #17
0
  /** @return spinner_fine_tune */
  protected JSpinner getSpinner_fine_tune() {
    if (spinner_fine_tune == null) {
      spinner_fine_tune = new JSpinner();
      spinner_fine_tune.setModel(new SpinnerNumberModel(100.0, 0, 100.0, 0.1));
      spinner_fine_tune.addChangeListener(
          new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
              double value = (Double) getSpinner_fine_tune().getValue();
              appEngine.setRobotRatioPercentage((float) value);

              getSlider_animationControl().setValue((int) value);
            }
          });
    }
    return spinner_fine_tune;
  }
コード例 #18
0
 @Override
 protected JSpinner createSpinner(int b) {
   JSpinner spinner = new JSpinner();
   SpinnerListModel model = new SpinnerListModel(_keyList);
   spinner.setModel(model);
   ((JSpinner.ListEditor) spinner.getEditor()).getTextField().setEditable(false);
   model.addChangeListener(
       new ChangeListener() {
         @Override
         public void stateChanged(ChangeEvent arg0) {
           update();
         }
       });
   Dimension d = new Dimension(40, spinner.getPreferredSize().height);
   spinner.setMinimumSize(d);
   spinner.setPreferredSize(d);
   return spinner;
 }
コード例 #19
0
  public JPanel getAdditionalCharacteristicsPanel(final DisplayObjectType displayObjectType) {
    JLabel translationFactorLabel = new JLabel("Verschiebungsfaktor: ");
    SpinnerModel spinnerModel = new SpinnerNumberModel(100, 0, 5000, 1);
    _translationFactorSpinner.setModel(spinnerModel);
    _translationFactorSpinner.setMaximumSize(new Dimension(60, 30));
    _translationFactorSpinner.setEnabled(_dotDefinitionDialogFrame.isEditable());
    JPanel translationPanel = new JPanel();
    translationPanel.setLayout(new BoxLayout(translationPanel, BoxLayout.X_AXIS));
    translationPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 10));
    translationPanel.add(translationFactorLabel);
    translationPanel.add(_translationFactorSpinner);

    JLabel joinByLineLabel = new JLabel("Verbindungslinie: ");
    _joinByLineCheckBox.setSelected(false);
    _joinByLineCheckBox.setEnabled(_dotDefinitionDialogFrame.isEditable());
    JPanel joinByLinePanel = new JPanel();
    joinByLinePanel.setLayout(new BoxLayout(joinByLinePanel, BoxLayout.X_AXIS));
    joinByLinePanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    joinByLinePanel.add(joinByLineLabel);
    joinByLinePanel.add(_joinByLineCheckBox);

    JPanel invisiblePanel = new JPanel();
    invisiblePanel.add(new JTextField());
    invisiblePanel.setVisible(false);

    JPanel thePanel = new JPanel();
    thePanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));
    thePanel.setLayout(new SpringLayout());
    thePanel.add(translationPanel);
    thePanel.add(joinByLinePanel);
    thePanel.add(invisiblePanel);
    SpringUtilities.makeCompactGrid(thePanel, 3, 5, 5);

    if (displayObjectType != null) {
      DOTPoint dotPoint = (DOTPoint) displayObjectType;
      _translationFactorSpinner.setValue(dotPoint.getTranslationFactor());
      _joinByLineCheckBox.setSelected(dotPoint.isJoinByLine());
    }
    addChangeListeners(); // Erst jetzt, denn sonst werden die Setzungen von
                          // _translationFactorSpinner und _joinByLineCheckBox schon verarbeitet!

    return thePanel;
  }
コード例 #20
0
  @Override
  protected void initFieldsEdit() {
    dt_initdebate_timeofhansard.setModel(
        new SpinnerDateModel(new Date(), null, null, Calendar.HOUR));
    dt_initdebate_timeofhansard.setEditor(
        new JSpinner.DateEditor(dt_initdebate_timeofhansard, "HH:mm"));
    ((JSpinner.DefaultEditor) dt_initdebate_timeofhansard.getEditor())
        .getTextField()
        .setEditable(false);

    if (getOoDocument().propertyExists("Bungeni_DebateOfficialTime")) {
      try {
        ooDocMetadata meta = new ooDocMetadata(getOoDocument());
        String strTime = meta.GetProperty("Bungeni_DebateOfficialTime");
        SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm");
        dt_initdebate_timeofhansard.setValue(timeFormat.parse(strTime));
      } catch (ParseException ex) {
        log.error("initFieldsEdit : " + ex.getMessage());
      }
    }
    return;
  }
コード例 #21
0
 /** @return spinner_rotation */
 private JSpinner getSpinner_rotation() {
   if (spinner_rotation == null) {
     spinner_rotation = new JSpinner();
     spinner_rotation.setMaximumSize(new Dimension(80, 27));
     spinner_rotation.setMinimumSize(new Dimension(80, 27));
     spinner_rotation.setPreferredSize(new Dimension(80, 27));
     spinner_rotation.setModel(
         new SpinnerNumberModel(0.0, -Double.MAX_VALUE, Double.MAX_VALUE, 1));
     spinner_rotation.setValue(TwoAxes3D.getRotation());
     spinner_rotation.addChangeListener(
         new ChangeListener() {
           @Override
           public void stateChanged(ChangeEvent e) {
             TwoAxes3D.setRotation((Double) spinner_rotation.getValue());
             fireActionEvent(
                 new ActionEvent(
                     TwoAxes3DSettingsPanel.this,
                     0,
                     SycamoreFiredActionEvents.UPDATE_AGREEMENTS_GRAPHICS.name()));
           }
         });
   }
   return spinner_rotation;
 }
コード例 #22
0
    public TimePanel(CronExpression date) {
      super(null);

      int sh = 25;
      lbl_type.setSize(100, sh);
      lbl_year.setSize(80, sh);
      lbl_month.setSize(80, sh);
      lbl_day_of_month.setSize(60, sh);
      //			lbl_week_of_year	.setSize(60,  sh);
      lbl_week_of_month.setSize(60, sh);
      lbl_day_of_week.setSize(80, sh);
      lbl_hour.setSize(60, sh);
      lbl_minute.setSize(60, sh);
      lbl_second.setSize(60, sh);

      cells =
          new Component[][] {
            {lbl_type, combo_type, null},
            {lbl_year, combo_year, every_year},
            {lbl_month, combo_month, every_month},
            {lbl_day_of_month, combo_day_of_month, every_day_of_month},
            //			{lbl_week_of_year,	 combo_week_of_year	,every_week_of_year	},
            {lbl_week_of_month, combo_week_of_month, every_week_of_month},
            {lbl_day_of_week, combo_day_of_week, every_day_of_week},
            {lbl_hour, combo_hour, every_hour},
            {lbl_minute, combo_minute, every_minute},
            {lbl_second, combo_second, every_second},
          };

      combo_year.setModel(new SpinnerNumberModel(1900, 1900, Short.MAX_VALUE, 1));
      combo_day_of_month.setModel(new SpinnerNumberModel(1, 1, 31, 1));
      //			combo_week_of_year	.setModel(new SpinnerNumberModel(1, 1, 54, 1));
      combo_week_of_month.setModel(new SpinnerNumberModel(1, 1, 5, 1));
      combo_hour.setModel(new SpinnerNumberModel(0, 0, 23, 1));
      combo_minute.setModel(new SpinnerNumberModel(0, 0, 59, 1));
      combo_second.setModel(new SpinnerNumberModel(0, 0, 59, 1));

      combo_type.setSelectedItem(date.type);
      combo_type.addItemListener(this);

      layoutChilds();

      // set default value
      try {

        MonthOfYear moy = EnumManager.getEnum(MonthOfYear.class, date.month.getKey());

        DayOfWeek dow = EnumManager.getEnum(DayOfWeek.class, date.day_of_week.getKey());

        combo_year.setValue(date.year.getKey());
        combo_month.setValue(moy);
        combo_day_of_month.setValue(date.day_of_month.getKey());
        //				combo_week_of_year	.setValue(date.week_of_year.getKey());
        combo_week_of_month.setValue(date.week_of_month.getKey());
        combo_day_of_week.setValue(dow);
        combo_hour.setValue(date.hour.getKey());
        combo_minute.setValue(date.minute.getKey());
        combo_second.setValue(date.second.getKey());

        every_year.setSelected(date.year.getValue());
        every_month.setSelected(date.month.getValue());
        every_day_of_month.setSelected(date.day_of_month.getValue());
        //				every_week_of_year	.setSelected(date.week_of_year.getValue());
        every_week_of_month.setSelected(date.week_of_month.getValue());
        every_day_of_week.setSelected(date.day_of_week.getValue());
        every_hour.setSelected(date.hour.getValue());
        every_minute.setSelected(date.minute.getValue());
        every_second.setSelected(date.second.getValue());

        for (int c = 0; c < cells.length; c++) {
          if (c > 0) {
            JCheckBox check = ((JCheckBox) cells[c][2]);
            cells[c][1].setEnabled(!check.isSelected());
          }
        }

        if (every_day_of_week.isSelected()) {
          every_week_of_month.setVisible(!every_day_of_week.isSelected());
          combo_week_of_month.setVisible(!every_day_of_week.isSelected());
          repaint();
        }

      } catch (Exception err) {
        err.printStackTrace();
      }
    }
コード例 #23
0
ファイル: ChunkEditor.java プロジェクト: holmgard/PCGG2012
  /** Initialize the contents of the frame. */
  private void initialize() {
    frmSuperChunkEditor = new JFrame();
    frmSuperChunkEditor.setTitle("Super Chunk Editor");
    frmSuperChunkEditor.setBounds(100, 100, 1000, 414);
    frmSuperChunkEditor.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    SpringLayout springLayout = new SpringLayout();
    frmSuperChunkEditor.getContentPane().setLayout(springLayout);

    JPanel chunkPanel = new JPanel();
    springLayout.putConstraint(
        SpringLayout.NORTH,
        chunkPanel,
        10,
        SpringLayout.NORTH,
        frmSuperChunkEditor.getContentPane());
    springLayout.putConstraint(
        SpringLayout.WEST, chunkPanel, 10, SpringLayout.WEST, frmSuperChunkEditor.getContentPane());
    springLayout.putConstraint(
        SpringLayout.SOUTH,
        chunkPanel,
        366,
        SpringLayout.NORTH,
        frmSuperChunkEditor.getContentPane());
    springLayout.putConstraint(
        SpringLayout.EAST,
        chunkPanel,
        -381,
        SpringLayout.EAST,
        frmSuperChunkEditor.getContentPane());
    chunkPanel.setBackground(Color.WHITE);
    frmSuperChunkEditor.getContentPane().add(chunkPanel);

    JPanel panel = new JPanel();
    springLayout.putConstraint(
        SpringLayout.NORTH, panel, 10, SpringLayout.NORTH, frmSuperChunkEditor.getContentPane());
    springLayout.putConstraint(SpringLayout.WEST, panel, 6, SpringLayout.EAST, chunkPanel);
    springLayout.putConstraint(
        SpringLayout.SOUTH, panel, -10, SpringLayout.SOUTH, frmSuperChunkEditor.getContentPane());
    chunkPanel.setLayout(null);

    levelDrawer = new LevelDrawer();
    levelDrawer.addMouseMotionListener(
        new MouseMotionAdapter() {
          @Override
          public void mouseDragged(MouseEvent e) {
            if (!mousePressed) return;

            if (tileRadio.isSelected()) {
              if (draw) currentChunk.getMap()[e.getX() / 16][e.getY() / 16] = currentTile;
              else currentChunk.getMap()[e.getX() / 16][e.getY() / 16] = 0;
            } else {
              SpriteTemplate[][] sprites = currentChunk.getSprites();
              if (draw) {
                SpriteTemplate sprite = sprites[e.getX() / 16][e.getY() / 16];
                if (sprite != null) {
                  if ((sprite.type != currentSprite.type)
                      || (sprite.winged != currentSprite.winged))
                    sprites[e.getX() / 16][e.getY() / 16] = currentSprite.clone();
                } else sprites[e.getX() / 16][e.getY() / 16] = currentSprite.clone();
              } else {
                sprites[e.getX() / 16][e.getY() / 16] = null;
              }
            }

            levelDrawer.repaint();
          }
        });
    levelDrawer.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mousePressed(MouseEvent arg0) {
            mousePressed = true;
            if (arg0.getButton() == MouseEvent.BUTTON1) // if left button clicked
            draw = true;
            else if (arg0.getButton() == MouseEvent.BUTTON3) draw = false;

            if (tileRadio.isSelected()) {
              if (draw) currentChunk.getMap()[arg0.getX() / 16][arg0.getY() / 16] = currentTile;
              else currentChunk.getMap()[arg0.getX() / 16][arg0.getY() / 16] = 0;
            } else {
              SpriteTemplate[][] sprites = currentChunk.getSprites();
              if (draw) {
                SpriteTemplate sprite = sprites[arg0.getX() / 16][arg0.getY() / 16];
                if (sprite != null) {
                  if ((sprite.type != currentSprite.type)
                      || (sprite.winged != currentSprite.winged))
                    sprites[arg0.getX() / 16][arg0.getY() / 16] = currentSprite.clone();
                } else sprites[arg0.getX() / 16][arg0.getY() / 16] = currentSprite.clone();
              } else {
                sprites[arg0.getX() / 16][arg0.getY() / 16] = null;
              }
            }

            levelDrawer.repaint();
          }

          @Override
          public void mouseReleased(MouseEvent e) {
            mousePressed = false;
          }
        });
    levelDrawer.setBackground(SystemColor.control);
    levelDrawer.setBounds(10, 11, 512, 128);
    chunkPanel.add(levelDrawer);
    frmSuperChunkEditor.getContentPane().add(panel);
    SpringLayout sl_panel = new SpringLayout();
    panel.setLayout(sl_panel);

    JPanel settingsPanel = new JPanel();
    sl_panel.putConstraint(SpringLayout.NORTH, settingsPanel, 0, SpringLayout.NORTH, panel);
    sl_panel.putConstraint(SpringLayout.WEST, settingsPanel, 0, SpringLayout.WEST, panel);
    sl_panel.putConstraint(SpringLayout.EAST, settingsPanel, 0, SpringLayout.EAST, panel);
    panel.add(settingsPanel);

    JPanel tilePanel = new JPanel();
    sl_panel.putConstraint(SpringLayout.NORTH, tilePanel, 148, SpringLayout.NORTH, panel);
    sl_panel.putConstraint(SpringLayout.SOUTH, tilePanel, 0, SpringLayout.SOUTH, panel);
    sl_panel.putConstraint(SpringLayout.SOUTH, settingsPanel, -6, SpringLayout.NORTH, tilePanel);
    sl_panel.putConstraint(SpringLayout.WEST, tilePanel, 0, SpringLayout.WEST, panel);
    sl_panel.putConstraint(SpringLayout.EAST, tilePanel, 0, SpringLayout.EAST, panel);
    SpringLayout sl_settingsPanel = new SpringLayout();
    settingsPanel.setLayout(sl_settingsPanel);

    widthSpinner = new JSpinner();
    widthSpinner.setModel(new SpinnerNumberModel(8, 1, 32, 1));
    sl_settingsPanel.putConstraint(
        SpringLayout.NORTH, widthSpinner, 10, SpringLayout.NORTH, settingsPanel);
    settingsPanel.add(widthSpinner);

    JLabel lblWidth = new JLabel("Width");
    sl_settingsPanel.putConstraint(
        SpringLayout.WEST, widthSpinner, -65, SpringLayout.WEST, lblWidth);
    sl_settingsPanel.putConstraint(
        SpringLayout.EAST, widthSpinner, -6, SpringLayout.WEST, lblWidth);
    sl_settingsPanel.putConstraint(
        SpringLayout.NORTH, lblWidth, 10, SpringLayout.NORTH, settingsPanel);
    sl_settingsPanel.putConstraint(
        SpringLayout.EAST, lblWidth, -10, SpringLayout.EAST, settingsPanel);
    settingsPanel.add(lblWidth);

    heightSpinner = new JSpinner();
    heightSpinner.setModel(new SpinnerNumberModel(8, 1, 15, 1));
    sl_settingsPanel.putConstraint(
        SpringLayout.NORTH, heightSpinner, 6, SpringLayout.SOUTH, widthSpinner);
    sl_settingsPanel.putConstraint(
        SpringLayout.WEST, heightSpinner, 0, SpringLayout.WEST, widthSpinner);
    sl_settingsPanel.putConstraint(
        SpringLayout.EAST, heightSpinner, 0, SpringLayout.EAST, widthSpinner);
    settingsPanel.add(heightSpinner);

    JLabel lblHeight = new JLabel("Height");
    sl_settingsPanel.putConstraint(
        SpringLayout.NORTH, lblHeight, 6, SpringLayout.SOUTH, widthSpinner);
    sl_settingsPanel.putConstraint(
        SpringLayout.EAST, lblHeight, -10, SpringLayout.EAST, settingsPanel);
    settingsPanel.add(lblHeight);

    JButton btnNew = new JButton("New");
    sl_settingsPanel.putConstraint(
        SpringLayout.NORTH, btnNew, 6, SpringLayout.SOUTH, heightSpinner);
    sl_settingsPanel.putConstraint(SpringLayout.EAST, btnNew, 0, SpringLayout.EAST, widthSpinner);
    btnNew.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            createNewChunk();
          }
        });
    settingsPanel.add(btnNew);

    JButton btnAddChunk = new JButton("Add Chunk");
    sl_settingsPanel.putConstraint(
        SpringLayout.WEST, btnAddChunk, 10, SpringLayout.WEST, settingsPanel);
    btnAddChunk.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            addChunk();
          }
        });
    sl_settingsPanel.putConstraint(
        SpringLayout.SOUTH, btnAddChunk, -10, SpringLayout.SOUTH, settingsPanel);
    settingsPanel.add(btnAddChunk);
    panel.add(tilePanel);
    SpringLayout sl_tilePanel = new SpringLayout();
    tilePanel.setLayout(sl_tilePanel);

    tileRadio = new JRadioButton("Tile");
    buttonGroup.add(tileRadio);
    tileRadio.setSelected(true);
    sl_tilePanel.putConstraint(SpringLayout.NORTH, tileRadio, 10, SpringLayout.NORTH, tilePanel);
    sl_tilePanel.putConstraint(SpringLayout.WEST, tileRadio, 10, SpringLayout.WEST, tilePanel);
    tilePanel.add(tileRadio);

    enemyRadio = new JRadioButton("Enemy");
    buttonGroup.add(enemyRadio);
    sl_tilePanel.putConstraint(SpringLayout.WEST, enemyRadio, 0, SpringLayout.WEST, tileRadio);
    tilePanel.add(enemyRadio);

    tileCombo = new JComboBox();
    tileCombo.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            selectTile();
          }
        });

    sl_tilePanel.putConstraint(SpringLayout.NORTH, enemyRadio, 6, SpringLayout.SOUTH, tileCombo);
    sl_tilePanel.putConstraint(SpringLayout.EAST, tileCombo, 227, SpringLayout.WEST, tilePanel);
    sl_tilePanel.putConstraint(SpringLayout.NORTH, tileCombo, 6, SpringLayout.SOUTH, tileRadio);
    sl_tilePanel.putConstraint(SpringLayout.WEST, tileCombo, 10, SpringLayout.WEST, tilePanel);
    tilePanel.add(tileCombo);

    enemyCombo = new JComboBox();
    enemyCombo.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            selectSprite();
          }
        });
    sl_tilePanel.putConstraint(SpringLayout.NORTH, enemyCombo, 6, SpringLayout.SOUTH, enemyRadio);
    sl_tilePanel.putConstraint(SpringLayout.WEST, enemyCombo, 10, SpringLayout.WEST, tilePanel);
    sl_tilePanel.putConstraint(SpringLayout.EAST, enemyCombo, 0, SpringLayout.EAST, tileCombo);
    tilePanel.add(enemyCombo);

    wingedCheck = new JCheckBox("winged");
    wingedCheck.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            selectSprite();
          }
        });
    sl_tilePanel.putConstraint(SpringLayout.NORTH, wingedCheck, 6, SpringLayout.SOUTH, enemyCombo);
    sl_tilePanel.putConstraint(SpringLayout.WEST, wingedCheck, 0, SpringLayout.WEST, tileRadio);
    tilePanel.add(wingedCheck);

    JPanel libPanel = new JPanel();
    springLayout.putConstraint(
        SpringLayout.EAST, libPanel, -10, SpringLayout.EAST, frmSuperChunkEditor.getContentPane());
    springLayout.putConstraint(SpringLayout.EAST, panel, -6, SpringLayout.WEST, libPanel);
    springLayout.putConstraint(
        SpringLayout.NORTH, libPanel, 10, SpringLayout.NORTH, frmSuperChunkEditor.getContentPane());
    springLayout.putConstraint(
        SpringLayout.WEST, libPanel, 852, SpringLayout.WEST, frmSuperChunkEditor.getContentPane());
    springLayout.putConstraint(
        SpringLayout.SOUTH,
        libPanel,
        -10,
        SpringLayout.SOUTH,
        frmSuperChunkEditor.getContentPane());
    frmSuperChunkEditor.getContentPane().add(libPanel);
    SpringLayout sl_libPanel = new SpringLayout();
    libPanel.setLayout(sl_libPanel);

    JButton btnDelete = new JButton("Delete");
    sl_libPanel.putConstraint(SpringLayout.NORTH, btnDelete, 300, SpringLayout.NORTH, libPanel);
    sl_libPanel.putConstraint(SpringLayout.EAST, btnDelete, -10, SpringLayout.EAST, libPanel);
    btnDelete.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            removeChunk(list.getSelectedValue());
          }
        });
    libPanel.add(btnDelete);

    JButton btnSave = new JButton("Save");
    btnSave.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              cl.writeLibToFile(new File("chunkLibrary.res"));
            } catch (Exception e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
              JOptionPane.showMessageDialog(null, "Failed to save the chunks.");
            }
          }
        });
    sl_libPanel.putConstraint(SpringLayout.NORTH, btnSave, 0, SpringLayout.SOUTH, btnDelete);
    sl_libPanel.putConstraint(SpringLayout.WEST, btnSave, 10, SpringLayout.WEST, libPanel);
    libPanel.add(btnSave);

    JScrollPane scrollPane = new JScrollPane();
    sl_libPanel.putConstraint(SpringLayout.NORTH, scrollPane, 0, SpringLayout.NORTH, libPanel);
    sl_libPanel.putConstraint(SpringLayout.WEST, scrollPane, 0, SpringLayout.WEST, libPanel);
    sl_libPanel.putConstraint(SpringLayout.SOUTH, scrollPane, -6, SpringLayout.NORTH, btnDelete);
    sl_libPanel.putConstraint(SpringLayout.EAST, scrollPane, 122, SpringLayout.WEST, libPanel);
    libPanel.add(scrollPane);

    list = new JList();
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    scrollPane.setViewportView(list);
    sl_libPanel.putConstraint(SpringLayout.NORTH, list, 211, SpringLayout.NORTH, libPanel);
    sl_libPanel.putConstraint(SpringLayout.EAST, list, 73, SpringLayout.WEST, libPanel);
    list.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            selectChunk();
          }
        });
    sl_libPanel.putConstraint(SpringLayout.SOUTH, list, -24, SpringLayout.NORTH, btnDelete);
    sl_libPanel.putConstraint(SpringLayout.WEST, list, 0, SpringLayout.WEST, btnSave);
  }
コード例 #24
0
ファイル: LingDisplay.java プロジェクト: lizziesilver/tetrad
  public LingDisplay(final Ling.StoredGraphs storedGraphs) {
    this.storedGraphs = storedGraphs;

    if (storedGraphs.getNumGraphs() == 0) {
      workbench = new GraphWorkbench();
    } else {
      workbench = new GraphWorkbench(storedGraphs.getGraph(0));
    }

    subsetIndices = getStableIndices(storedGraphs);

    final SpinnerNumberModel model =
        new SpinnerNumberModel(subsetIndices.size() == 0 ? 0 : 1, 0, subsetIndices.size(), 1);
    model.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            int index = model.getNumber().intValue();
            workbench.setGraph(storedGraphs.getGraph(subsetIndices.get(index - 1)));
          }
        });

    spinner = new JSpinner();
    subsetCombo = new JComboBox(new String[] {"Show Stable", "Show Unstable", "Show All"});
    subsetCombo.setSelectedItem("Show Stable");
    spinner.setModel(model);
    totalLabel = new JLabel(" of " + subsetIndices.size());

    subsetCombo.setMaximumSize(subsetCombo.getPreferredSize());
    subsetCombo.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            resetDisplay();
          }
        });

    spinner.setPreferredSize(new Dimension(50, 20));
    spinner.setMaximumSize(spinner.getPreferredSize());
    Box b = Box.createVerticalBox();
    Box b1 = Box.createHorizontalBox();
    //        b1.add(Box.createHorizontalGlue());
    //        b1.add(Box.createHorizontalStrut(10));
    b1.add(subsetCombo);
    b1.add(Box.createHorizontalGlue());
    b1.add(new JLabel("DAG "));
    b1.add(spinner);
    b1.add(totalLabel);

    b.add(b1);

    Box b2 = Box.createHorizontalBox();
    JPanel graphPanel = new JPanel();
    graphPanel.setLayout(new BorderLayout());
    JScrollPane jScrollPane = new JScrollPane(workbench);
    //        jScrollPane.setPreferredSize(new Dimension(400, 400));
    graphPanel.add(jScrollPane);
    //        graphPanel.setBorder(new TitledBorder("DAG"));
    b2.add(graphPanel);
    b.add(b2);

    setLayout(new BorderLayout());
    //        add(menuBar(), BorderLayout.NORTH);
    add(b, BorderLayout.CENTER);
  }
コード例 #25
0
ファイル: LingDisplay.java プロジェクト: lizziesilver/tetrad
  private void resetDisplay() {
    String option = (String) subsetCombo.getSelectedItem();

    if ("Show All".equals(option)) {
      final List<Integer> _subsetIndices = getAllIndices(getStoredGraphs());
      subsetIndices.clear();
      subsetIndices.addAll(_subsetIndices);

      int min = subsetIndices.size() == 0 ? 0 : 1;
      final SpinnerNumberModel model = new SpinnerNumberModel(min, min, subsetIndices.size(), 1);
      model.addChangeListener(
          new ChangeListener() {
            public void stateChanged(ChangeEvent e) {
              int index = model.getNumber().intValue();
              workbench.setGraph(storedGraphs.getGraph(subsetIndices.get(index - 1)));
            }
          });

      spinner.setModel(model);
      totalLabel.setText(" of " + _subsetIndices.size());

      if (subsetIndices.isEmpty()) {
        workbench.setGraph(new EdgeListGraph());
      } else {
        workbench.setGraph(storedGraphs.getGraph(subsetIndices.get(0)));
      }
    } else if ("Show Stable".equals(option)) {
      final List<Integer> _subsetIndices = getStableIndices(getStoredGraphs());
      subsetIndices.clear();
      subsetIndices.addAll(_subsetIndices);

      int min = subsetIndices.size() == 0 ? 0 : 1;
      final SpinnerNumberModel model = new SpinnerNumberModel(min, min, subsetIndices.size(), 1);
      model.addChangeListener(
          new ChangeListener() {
            public void stateChanged(ChangeEvent e) {
              int index = model.getNumber().intValue();
              workbench.setGraph(storedGraphs.getGraph(subsetIndices.get(index - 1)));
            }
          });

      spinner.setModel(model);
      totalLabel.setText(" of " + _subsetIndices.size());

      if (subsetIndices.isEmpty()) {
        workbench.setGraph(new EdgeListGraph());
      } else {
        workbench.setGraph(storedGraphs.getGraph(subsetIndices.get(0)));
      }
    } else if ("Show Unstable".equals(option)) {
      final List<Integer> _subsetIndices = getUnstableIndices(getStoredGraphs());
      subsetIndices.clear();
      subsetIndices.addAll(_subsetIndices);

      int min = subsetIndices.size() == 0 ? 0 : 1;
      final SpinnerNumberModel model = new SpinnerNumberModel(min, min, subsetIndices.size(), 1);
      model.addChangeListener(
          new ChangeListener() {
            public void stateChanged(ChangeEvent e) {
              int index = model.getNumber().intValue();
              workbench.setGraph(storedGraphs.getGraph(subsetIndices.get(index - 1)));
            }
          });

      spinner.setModel(model);
      totalLabel.setText(" of " + _subsetIndices.size());

      if (subsetIndices.isEmpty()) {
        workbench.setGraph(new EdgeListGraph());
      } else {
        workbench.setGraph(storedGraphs.getGraph(subsetIndices.get(0)));
      }
    }
  }
コード例 #26
0
  /**
   * Creates, binds and configures the UI components.
   *
   * <p>If possible, the components are created using the BasicComponentFactory, or the Bindings
   * class.
   */
  private void initComponents() {
    // Text Components
    textField =
        BasicComponentFactory.createTextField(
            presentationModel.getModel(ExampleBean.PROPERTYNAME_TEXT));
    textArea =
        BasicComponentFactory.createTextArea(
            presentationModel.getModel(ExampleBean.PROPERTYNAME_TEXT));
    passwordField =
        BasicComponentFactory.createPasswordField(
            presentationModel.getModel(ExampleBean.PROPERTYNAME_TEXT));
    textLabel =
        BasicComponentFactory.createLabel(
            presentationModel.getModel(ExampleBean.PROPERTYNAME_TEXT));

    // Formatted Input
    dateField =
        BasicComponentFactory.createDateField(
            presentationModel.getModel(ExampleBean.PROPERTYNAME_DATE));
    integerField =
        BasicComponentFactory.createIntegerField(
            presentationModel.getModel(ExampleBean.PROPERTYNAME_INT_VALUE));
    longField =
        BasicComponentFactory.createLongField(
            presentationModel.getModel(ExampleBean.PROPERTYNAME_LONG_VALUE));

    // Choice
    ValueModel intChoiceModel = presentationModel.getModel(ExampleBean.PROPERTYNAME_INT_CHOICE);
    leftIntRadio =
        BasicComponentFactory.createRadioButton(intChoiceModel, ExampleBean.LEFT_INTEGER, "Left");
    centerIntRadio =
        BasicComponentFactory.createRadioButton(
            intChoiceModel, ExampleBean.CENTER_INTEGER, "Center");
    rightIntRadio =
        BasicComponentFactory.createRadioButton(intChoiceModel, ExampleBean.RIGHT_INTEGER, "Right");
    alignmentIntCombo =
        BasicComponentFactory.createComboBox(
            new SelectionInList(ExampleBean.INTEGER_CHOICES, intChoiceModel));

    ValueModel objectChoiceModel =
        presentationModel.getModel(ExampleBean.PROPERTYNAME_OBJECT_CHOICE);
    leftObjectRadio =
        BasicComponentFactory.createRadioButton(objectChoiceModel, ExampleBean.LEFT, "Left");
    centerObjectRadio =
        BasicComponentFactory.createRadioButton(objectChoiceModel, ExampleBean.CENTER, "Center");
    rightObjectRadio =
        BasicComponentFactory.createRadioButton(objectChoiceModel, ExampleBean.RIGHT, "Right");
    alignmentObjectCombo =
        BasicComponentFactory.createComboBox(
            new SelectionInList(ExampleBean.OBJECT_CHOICES, objectChoiceModel));

    // Lists
    comboBox =
        BasicComponentFactory.createComboBox(
            presentationModel.getSelectionInList(), TutorialUtils.createAlbumListCellRenderer());

    list =
        BasicComponentFactory.createList(
            presentationModel.getSelectionInList(), TutorialUtils.createAlbumListCellRenderer());

    table = new JTable();
    table.setModel(TutorialUtils.createAlbumTableModel(presentationModel.getSelectionInList()));
    table.setSelectionModel(
        new SingleListSelectionAdapter(
            presentationModel.getSelectionInList().getSelectionIndexHolder()));

    // Misc
    checkBox =
        BasicComponentFactory.createCheckBox(
            presentationModel.getModel(ExampleBean.PROPERTYNAME_BOOLEAN_VALUE), "available");
    colorPreview = new JPanel();
    colorPreview.setBorder(new LineBorder(Color.GRAY));
    updatePreviewPanel();

    ValueModel floatModel = presentationModel.getModel(ExampleBean.PROPERTYNAME_FLOAT_VALUE);
    slider = new JSlider();
    slider.setModel(
        new BoundedRangeAdapter(
            ConverterFactory.createFloatToIntegerConverter(floatModel, 100), 0, 0, 100));
    floatLabel =
        BasicComponentFactory.createLabel(
            ConverterFactory.createStringConverter(floatModel, NumberFormat.getPercentInstance()));
    spinner = new JSpinner();
    spinner.setModel(
        SpinnerAdapterFactory.createNumberAdapter(
            presentationModel.getModel(ExampleBean.PROPERTYNAME_INT_LIMITED),
            0, // defaultValue
            0, // minValue
            100, // maxValue
            5)); // step
  }
コード例 #27
0
 private void jSpinner4StateChanged(javax.swing.event.ChangeEvent evt) {
   dtYear = (int) spinYear.getValue();
   dtDay = Math.min(dtDay, maxDay());
   spinDays.setModel(new SpinnerNumberModel(dtDay, 1, maxDay(), 1));
 }
コード例 #28
0
ファイル: RoundingSpinner.java プロジェクト: jbudynk/starjava
  /**
   * Sets the model for this spinner.
   *
   * @param model new model
   * @throws ClassCastException if <code>model</code> is not an instance of <code>
   *     RoundingSpinnerModel</code>
   */
  public void setModel(SpinnerModel model) {
    super.setModel((RoundingSpinnerModel) model);

    /* This appears to be necessary to update the visual components. */
    setValue(model.getValue());
  }
コード例 #29
0
 public void setModel(SpinnerNumberModel newModel) {
   m_model = newModel;
   m_spinner.setModel(m_model);
 }
コード例 #30
0
ファイル: Cogmaker.java プロジェクト: kaffeel/ThulikaIME
  /** Initialize the contents of the frame. */
  private void initialize() {
    frmMaker = new JFrame();
    frmMaker.setTitle("ThulikaMaker");
    frmMaker.setBounds(100, 100, 564, 637);
    frmMaker.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    fcOpen = new JFileChooser();
    fcOpen.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    fcSave = new JFileChooser();
    fcSave.setFileSelectionMode(JFileChooser.FILES_ONLY);
    frmMaker.getContentPane().setLayout(new BorderLayout(0, 0));

    JLayeredPane layeredPane = new JLayeredPane();
    frmMaker.getContentPane().add(layeredPane, BorderLayout.NORTH);
    layeredPane.setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
            },
            new RowSpec[] {
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
            }));

    JLabel lblWidth = new JLabel("Width");
    layeredPane.add(lblWidth, "2, 2");

    widthBox = new JTextField();
    layeredPane.add(widthBox, "6, 2");
    widthBox.setColumns(10);

    JLabel lblHeight = new JLabel("Height");
    layeredPane.add(lblHeight, "2, 4");

    heightBox = new JTextField();
    layeredPane.add(heightBox, "6, 4");
    heightBox.setColumns(10);

    JButton btnLoadBundle = new JButton("Load Bundle");
    layeredPane.add(btnLoadBundle, "6, 6");
    final JFileChooser openBox;
    openBox = new JFileChooser();
    openBox.setFileSelectionMode(JFileChooser.FILES_ONLY);
    btnLoadBundle.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            int returnVal = fcOpen.showOpenDialog(frmMaker);

            if (returnVal == JFileChooser.APPROVE_OPTION) {
              File file = fcOpen.getSelectedFile();
              letterFilePath = file.getPath();
              trainer.loadLettersAction(
                  letterFilePath,
                  Integer.parseInt(widthBox.getText()),
                  Integer.parseInt(heightBox.getText()));
            } else {
              // nothing
            }
            charListBox.setListData(trainer.getCharSet().keySet().toArray());
            charListBox.setSelectedIndex(0);
          }
        });

    JLayeredPane layeredPane_1 = new JLayeredPane();
    frmMaker.getContentPane().add(layeredPane_1, BorderLayout.SOUTH);
    layeredPane_1.setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
            },
            new RowSpec[] {
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
              FormFactory.RELATED_GAP_ROWSPEC,
              FormFactory.DEFAULT_ROWSPEC,
            }));

    JLabel lblLanguageId = new JLabel("Language ID");
    layeredPane_1.add(lblLanguageId, "2, 2");

    langBox = new JTextField();
    layeredPane_1.add(langBox, "6, 2");
    langBox.setColumns(10);

    JButton btnSaveEngine = new JButton("Save Engine");
    layeredPane_1.add(btnSaveEngine, "6, 4");
    btnSaveEngine.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            if (letterFilePath == null || letterFilePath.isEmpty()) {
              JOptionPane.showMessageDialog(frmMaker, "Please load a file");
            } else {
              int returnVal = fcSave.showSaveDialog(frmMaker);
              if (returnVal == JFileChooser.APPROVE_OPTION) {
                File file = fcSave.getSelectedFile();
                try {
                  if (trainer.trainAndSave(file.getPath(), langBox.getText())) {
                    JOptionPane.showMessageDialog(frmMaker, "Engine saved!");
                  }
                } catch (IOException e) {
                  JOptionPane.showMessageDialog(frmMaker, e.getMessage());
                  e.printStackTrace();
                }
              } else {
                // nothing
              }
            }
          }
        });

    JLayeredPane layeredPane_2 = new JLayeredPane();
    frmMaker.getContentPane().add(layeredPane_2);

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBounds(165, 11, 102, 150);
    layeredPane_2.add(scrollPane);

    imageListBox = new JList();
    imageListBox.setFont(new Font("Kartika", Font.PLAIN, 11));
    imageListBox.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent arg0) {
            // try {
            ImageFile iFile = (ImageFile) imageListBox.getSelectedValue();

            if (iFile == null) {
              imageListBox.setSelectedIndex(0);
              iFile = (ImageFile) imageListBox.getSelectedValue();
              if (iFile == null) {
                return;
              }
            }
            ImageData iData = iFile.getImageData();
            imageLabel.setIcon(
                new ImageIcon(
                    getImageFromArray(iData.getPixels(), iData.getWidth(), iData.getHeight())));
            imageLabel.setBounds(0, 0, iData.getWidth(), iData.getHeight());
            /*} catch (Exception e) {
            	// ignore
            }*/
          }
        });
    imageListBox.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    scrollPane.setViewportView(imageListBox);

    JScrollPane scrollPane_1 = new JScrollPane();
    scrollPane_1.setBounds(277, 11, 261, 259);
    layeredPane_2.add(scrollPane_1);

    imageLabel = new JLabel("Image");
    scrollPane_1.setViewportView(imageLabel);

    JScrollPane scrollPane_2 = new JScrollPane();
    scrollPane_2.setBounds(9, 11, 102, 259);
    layeredPane_2.add(scrollPane_2);

    charListBox = new JList();
    scrollPane_2.setViewportView(charListBox);
    charListBox.setFont(new Font("Kartika", Font.PLAIN, 11));

    JLayeredPane layeredPane_3 = new JLayeredPane();
    layeredPane_3.setBounds(10, 295, 486, 142);
    layeredPane_2.add(layeredPane_3);

    JLabel lblSymbol = new JLabel("Symbol");
    lblSymbol.setBounds(10, 11, 46, 14);
    layeredPane_3.add(lblSymbol);

    JLabel lblAlign = new JLabel("Align");
    lblAlign.setBounds(10, 39, 46, 14);
    layeredPane_3.add(lblAlign);

    JLabel lblRules = new JLabel("Rules");
    lblRules.setBounds(10, 66, 46, 14);
    layeredPane_3.add(lblRules);

    symField = new JTextField();
    symField.setEditable(false);
    symField.setFont(new Font("Kartika", Font.PLAIN, 12));
    symField.setBounds(81, 5, 86, 20);
    layeredPane_3.add(symField);
    symField.setColumns(10);

    alignSelector = new JSpinner();
    alignSelector.setModel(new SpinnerNumberModel(0, -1, 1, 1));
    alignSelector.setBounds(81, 36, 29, 20);
    layeredPane_3.add(alignSelector);

    rulesBox = new JTextField();
    rulesBox.setFont(new Font("Kartika", Font.PLAIN, 12));
    rulesBox.setBounds(81, 64, 381, 20);
    layeredPane_3.add(rulesBox);
    rulesBox.setColumns(10);

    JButton btnSaveSymbol = new JButton("Save Symbol");
    btnSaveSymbol.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            CharData currentChar = (CharData) charListBox.getSelectedValue();
            currentChar.setAlign((Integer) alignSelector.getValue());
            Map<String, String> rules = getRules(rulesBox.getText());
            if (rules != null) {
              currentChar.setMergeRules(rules);
            }
            String alterStr = alterBox.getText();
            // String msg = setAlternativesList(currentChar, alterStr);
            // currentChar.setAlternatives(getAlternativesList(currentChar, alterStr));
            /*if(msg!=null && !msg.isEmpty()) {
            	JOptionPane.showMessageDialog(frmMaker,"Characters "+msg +" cannot be found");
            }*/
          }
        });
    btnSaveSymbol.setBounds(81, 95, 106, 23);
    layeredPane_3.add(btnSaveSymbol);

    JLabel lblAlternates = new JLabel("Alternates");
    lblAlternates.setBounds(234, 11, 60, 14);
    layeredPane_3.add(lblAlternates);

    alterBox = new JTextField();
    alterBox.setFont(new Font("Kartika", Font.PLAIN, 11));
    alterBox.setBounds(304, 8, 158, 20);
    layeredPane_3.add(alterBox);
    alterBox.setColumns(10);

    JButton btnDeleteFile = new JButton("Delete File");
    btnDeleteFile.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            String filename = ((ImageFile) imageListBox.getSelectedValue()).getFilename();
            if (trainer.deleteFile(filename)) {
              JOptionPane.showMessageDialog(frmMaker, "File " + filename + " is deleted");
            }
            try {
              populateImageData();
            } catch (Exception e) {
              imageListBox.clearSelection();
              charListBox.setSelectedIndex(0);
              charListBox.setListData(trainer.getCharSet().keySet().toArray());
            }
          }
        });
    btnDeleteFile.setBounds(165, 196, 89, 23);
    layeredPane_2.add(btnDeleteFile);
    charListBox.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent arg0) {
            populateImageData();
          }
        });
  }