public void initialize(Instrument instrument) {
    ExpireTimeSpinnerModel model = new ExpireTimeSpinnerModel(instrument);
    this.setModel(model);

    JFormattedTextField textField = ((DateEditor) this.getEditor()).getTextField();
    textField.setValue(model._value);
    textField.addFocusListener(
        new FocusListener() {
          public void focusGained(FocusEvent e) {}

          public void focusLost(FocusEvent e) {
            ExpireTimeSpinnerModel model = (ExpireTimeSpinnerModel) getModel();
            JFormattedTextField textField = ((DateEditor) getEditor()).getTextField();
            try {
              DateTime newTime = DateTime.fromDate((Date) getValue());
              if (newTime.compareTo(model.getEndTime()) > 0) {
                textField.setValue(model.getEndTime());
              } else if (newTime.compareTo(model.getBeginTime()) < 0) {
                textField.setValue(model.getBeginTime());
              } else if (DeliveryHoliday.instance.isHoliday(newTime)) {
                textField.setValue(model.getNextAvaliableTime(newTime));
              }
            } catch (IllegalArgumentException exception) // the input maybe out of datetime range
            {
              textField.setValue(model.getEndTime());
            }
          }
        });
  }
Beispiel #2
0
  private void addFocusGainSelectListener() {
    field.addFocusListener(
        new FocusAdapter() {
          public void focusGained(FocusEvent e) {
            SwingUtilities.invokeLater(
                new Runnable() {

                  @Override
                  public void run() {
                    field.selectAll();
                  }
                });
          }
        });
  }
  /** Setup field listeners. */
  private void initializeFieldListeners() {

    checkboxMonitor.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {

            model.setMonitor(new Boolean(checkboxMonitor.isSelected()));
          }
        });

    textfieldName.addFocusListener(
        new FocusAdapter() {
          public void focusLost(FocusEvent event) {
            model.setName(textfieldName.getText());
          }
        });

    textfieldTare.addFocusListener(
        new FocusAdapter() {
          public void focusLost(FocusEvent event) {

            try {
              textfieldTare.commitEdit();
            } catch (ParseException e) {
              logger.warn(e);
            }

            model.setTare((Double) textfieldTare.getValue());
          }
        });

    comboboxType.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            model.setScaletype((ScaleType) comboboxType.getSelectedItem());
          }
        });
  }
  public PizzeriaEditWindow(final SearchWindow parentWindow, final CanModifyPizzeria model) {
    this.model = model;
    this.parentWindow = parentWindow;
    final PizzeriaEditWindow that = this;
    Arrays.fill(fromHour, "");
    Arrays.fill(toHour, "");
    initComponents();

    // obsługa przycisku "next" w pierwszym okienku (ten przycisk różni się od
    // innych, bo sprawdza czy wypełniono pola
    nextButton1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (nameField.getText().isEmpty()) {
              JOptionPane.showMessageDialog(
                  null, "Nie podano nazwy!", "Błąd", JOptionPane.INFORMATION_MESSAGE);
              return;
            }
            if (addressField.getText().isEmpty()) {
              JOptionPane.showMessageDialog(
                  null, "Nie podano adresu!", "Błąd", JOptionPane.INFORMATION_MESSAGE);
              return;
            }

            cl_mainPanel.next(mainPanel);
          }
        });
    // w momencie gdy focus opuszcza pole do wpisywania godzin, zostają one
    // uaktualnione w odpowiedniej tablicy (fromHour lub toHour)
    fromField.addFocusListener(
        new FocusAdapter() {
          @Override
          public void focusLost(FocusEvent e) {
            fromHour[dayComboBox.getSelectedIndex()] = fromField.getText();
          }
        });
    toField.addFocusListener(
        new FocusAdapter() {
          @Override
          public void focusLost(FocusEvent e) {
            toHour[dayComboBox.getSelectedIndex()] = toField.getText();
          }
        });
    // ten kod wczytuje do pól tekstowych po wybraniu dnia wcześniej wpisane
    // godziny, które zapisano w tablicach fromHour i toHour
    dayComboBox.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String from = fromHour[dayComboBox.getSelectedIndex()];
            String to = toHour[dayComboBox.getSelectedIndex()];
            fromField.setText(from);
            toField.setText(to);
          }
        });
    // zapisz dane, uaktualnij listę w okienku-rodzicu i wyjdź z okienka
    endButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String[] hours = setHours();

            if (pizzeriaId == null) {
              model.Pizzeria_insert(
                  nameField.getText(),
                  addressField.getText(),
                  siteField.getText(),
                  phoneField.getText(),
                  hours);
            } else {
              model.Pizzeria_update(
                  pizzeriaId,
                  nameField.getText(),
                  addressField.getText(),
                  siteField.getText(),
                  phoneField.getText(),
                  hours);
            }

            parentWindow.refresh();
            that.dispose();
          }
        });
  }
  private void initializeComponents() {
    this.setTitle("Configuration");
    this.setResizable(false);

    setLayout(new BorderLayout(20, 20));

    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.X_AXIS));
    mainPanel.setBorder(new LineBorder(mainPanel.getBackground(), 10));
    add(mainPanel, BorderLayout.CENTER);

    GridBagConstraints labelConstraints = new GridBagConstraints();
    labelConstraints.gridx = 0;
    labelConstraints.anchor = GridBagConstraints.WEST;
    labelConstraints.insets = new Insets(5, 5, 5, 5);

    GridBagConstraints inputConstraints = new GridBagConstraints();
    inputConstraints.gridx = 1;
    inputConstraints.anchor = GridBagConstraints.EAST;
    inputConstraints.weightx = 1;
    inputConstraints.insets = new Insets(5, 5, 5, 5);

    JPanel evolutionOptionsPanel = new JPanel();
    evolutionOptionsPanel.setBorder(new TitledBorder("Evolution"));
    evolutionOptionsPanel.setLayout(new BoxLayout(evolutionOptionsPanel, BoxLayout.Y_AXIS));
    mainPanel.add(evolutionOptionsPanel);

    // world size
    JPanel worldSizePanel = new JPanel(new GridBagLayout());
    evolutionOptionsPanel.add(worldSizePanel);
    JLabel worldSizeLabel = new JLabel("World Size");
    worldSizeLabel.setToolTipText("Size of the world in pixels. Width x Height.");
    worldSizePanel.add(worldSizeLabel, labelConstraints);
    JPanel worldSizeInputPanel = new JPanel();
    worldSizeInputPanel.setLayout(new GridBagLayout());
    final AutoSelectOnFocusSpinner worldSizeWidthSpinner =
        new AutoSelectOnFocusSpinner(
            new SpinnerNumberModel(config.getDimension().width, 1, Integer.MAX_VALUE, 1));
    final AutoSelectOnFocusSpinner worldSizeHeightSpinner =
        new AutoSelectOnFocusSpinner(
            new SpinnerNumberModel(config.getDimension().height, 1, Integer.MAX_VALUE, 1));
    worldSizeInputPanel.add(worldSizeWidthSpinner);
    JLabel separatorLabel = new JLabel("x");
    GridBagConstraints c = new GridBagConstraints();
    c.insets = new Insets(0, 5, 0, 5);
    worldSizeInputPanel.add(separatorLabel, c);
    worldSizeInputPanel.add(worldSizeHeightSpinner);
    worldSizePanel.add(worldSizeInputPanel, inputConstraints);

    // starting energy
    JPanel startingEnergyPanel = new JPanel(new GridBagLayout());
    evolutionOptionsPanel.add(startingEnergyPanel);
    JLabel startingEnergyLabel = new JLabel("Starting Energy");
    startingEnergyLabel.setToolTipText(
        "<html>The amount of energy all newly painted pixels start out with.<br />Note that changing this will not affect already painted pixels.</html>");
    startingEnergyPanel.add(startingEnergyLabel, labelConstraints);
    final AutoSelectOnFocusSpinner startingEnergySpinner =
        new AutoSelectOnFocusSpinner(
            new SpinnerNumberModel(config.startingEnergy, 1, Integer.MAX_VALUE, 1));
    startingEnergyPanel.add(startingEnergySpinner, inputConstraints);

    // mutation rate
    JPanel mutationRatePanel = new JPanel(new GridBagLayout());
    evolutionOptionsPanel.add(mutationRatePanel);
    JLabel mutationRateLabel = new JLabel("Mutation Rate");
    mutationRateLabel.setToolTipText(
        "<html>Chance for a mutation to occur during copy or mixing operations.<br />A value of 0.01 means a 1% chance, a value of 0 disables mutation.</html>");
    mutationRatePanel.add(mutationRateLabel, labelConstraints);
    final JSpinner mutationRateSpinner =
        new JSpinner(new SpinnerNumberModel(config.mutationRate, 0.0, 1.0, 0.01));
    mutationRateSpinner.setEditor(
        new JSpinner.NumberEditor(mutationRateSpinner, "#.##############"));
    mutationRateSpinner.setPreferredSize(
        new Dimension(180, mutationRateSpinner.getPreferredSize().height));
    final JFormattedTextField mutationRateSpinnerText =
        ((JSpinner.NumberEditor) mutationRateSpinner.getEditor()).getTextField();
    mutationRateSpinnerText.addFocusListener(
        new FocusListener() {
          public void focusGained(FocusEvent e) {
            SwingUtilities.invokeLater(
                new Runnable() {
                  public void run() {
                    mutationRateSpinnerText.selectAll();
                  }
                });
          }

          public void focusLost(FocusEvent e) {}
        });
    mutationRatePanel.add(mutationRateSpinner, inputConstraints);

    JPanel guiOptionsPanel = new JPanel();
    guiOptionsPanel.setBorder(new TitledBorder("GUI"));
    guiOptionsPanel.setLayout(new BoxLayout(guiOptionsPanel, BoxLayout.Y_AXIS));
    mainPanel.add(guiOptionsPanel);

    // background color
    JPanel backgroundColorPanel = new JPanel(new GridBagLayout());
    guiOptionsPanel.add(backgroundColorPanel, labelConstraints);
    JLabel backgroundColorLabel = new JLabel("Background Color");
    backgroundColorLabel.setToolTipText(
        "<html>Pick the background color.<br />If you have a lot of dark pixels, you might want to set this to a light color.</html>");
    backgroundColorPanel.add(backgroundColorLabel, labelConstraints);
    backgroundColor = new PixelColor(config.backgroundColor);
    JPanel backgroundColorAlignmentPanel = new JPanel();
    backgroundColorAlignmentPanel.setLayout(new GridBagLayout());
    backgroundColorAlignmentPanel.setPreferredSize(mutationRateSpinner.getPreferredSize());
    final ColorChooserLabel backgroundColorChooserLabel = new ColorChooserLabel(backgroundColor);
    backgroundColorAlignmentPanel.add(backgroundColorChooserLabel);
    backgroundColorPanel.add(backgroundColorAlignmentPanel, inputConstraints);

    // FPS
    JPanel fpsPanel = new JPanel(new GridBagLayout());
    guiOptionsPanel.add(fpsPanel);
    JLabel fpsLabel = new JLabel("FPS");
    fpsLabel.setToolTipText(
        "<html>The repaint interval in frames per second (FPS).<br />Set this to a lower value to save a few CPU cycles.</html>");
    fpsPanel.add(fpsLabel, labelConstraints);
    final AutoSelectOnFocusSpinner fpsSpinner =
        new AutoSelectOnFocusSpinner(new SpinnerNumberModel(config.fps, 1, Integer.MAX_VALUE, 1));
    fpsPanel.add(fpsSpinner, inputConstraints);

    // paint history size
    JPanel paintHistorySizePanel = new JPanel(new GridBagLayout());
    guiOptionsPanel.add(paintHistorySizePanel);
    JLabel paintHistorySizeLabel = new JLabel("Paint-History Size");
    paintHistorySizeLabel.setToolTipText(
        "<html>Sets the number of entries in the paint history.<br />In case you have not found it yet: the paint history is the little menu that appears when you right-click on the image.</html>");
    paintHistorySizePanel.add(paintHistorySizeLabel, labelConstraints);
    final AutoSelectOnFocusSpinner paintHistorySizeSpinner =
        new AutoSelectOnFocusSpinner(
            new SpinnerNumberModel(config.paintHistorySize, 1, Integer.MAX_VALUE, 1));
    paintHistorySizePanel.add(paintHistorySizeSpinner, inputConstraints);

    JPanel videoOptionsPanel = new JPanel();
    videoOptionsPanel.setBorder(new TitledBorder("Video Recording"));
    videoOptionsPanel.setLayout(new BoxLayout(videoOptionsPanel, BoxLayout.Y_AXIS));
    mainPanel.add(videoOptionsPanel);

    // FPS video
    JPanel fpsVideoPanel = new JPanel(new GridBagLayout());
    videoOptionsPanel.add(fpsVideoPanel);
    JLabel fpsVideoLabel = new JLabel("FPS of videos");
    fpsVideoLabel.setToolTipText("The number of frames per second (FPS) in recorded videos.");
    fpsVideoPanel.add(fpsVideoLabel, labelConstraints);
    final AutoSelectOnFocusSpinner fpsVideoSpinner =
        new AutoSelectOnFocusSpinner(
            new SpinnerNumberModel(config.fpsVideo, 1, Integer.MAX_VALUE, 1));
    fpsVideoPanel.add(fpsVideoSpinner, inputConstraints);

    // video encoder command
    JPanel videoEncoderPanel = new JPanel(new GridBagLayout());
    videoOptionsPanel.add(videoEncoderPanel);
    JLabel videoEncoderLabel = new JLabel("Video Encoder");
    videoEncoderLabel.setToolTipText(
        "<html>The command to invoke your video encoder.<br />Use the tokens INPUT_FILE and OUTPUT_FILE to denote input and output files of your encoder.</html>");
    videoEncoderPanel.add(videoEncoderLabel, labelConstraints);
    final JTextArea videoEncoderTextArea = new JTextArea(Configuration.ENCODER_COMMAND);
    videoEncoderTextArea.setLineWrap(true);
    videoEncoderTextArea.setWrapStyleWord(true);
    JScrollPane videoEncoderScrollPane =
        new JScrollPane(
            videoEncoderTextArea,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    videoEncoderScrollPane.setViewportBorder(null);
    videoEncoderScrollPane.setPreferredSize(
        new Dimension(worldSizeInputPanel.getPreferredSize().width, 100));
    videoEncoderPanel.add(videoEncoderScrollPane, inputConstraints);

    JPanel controlPanel = new JPanel();
    add(controlPanel, BorderLayout.SOUTH);

    JButton okButton = new JButton("OK");
    okButton.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {

            new Thread() {

              @Override
              public void run() {
                config.world.addChangeListener(
                    new IChangeListener() {

                      public void changed() {
                        int i, j;
                        double d;
                        String s;

                        // evolution

                        i = (Integer) worldSizeWidthSpinner.getValue();
                        j = (Integer) worldSizeHeightSpinner.getValue();
                        if (config.getDimension().width != i || config.getDimension().height != i) {
                          config.setDimension(new Dimension(i, j));
                        }

                        i = (Integer) startingEnergySpinner.getValue();
                        if (config.startingEnergy != i) {
                          config.startingEnergy = i;
                        }

                        d = (Double) mutationRateSpinner.getValue();
                        if (config.mutationRate != d) {
                          config.mutationRate = d;
                        }

                        // gui

                        i = backgroundColor.getInteger();
                        if (config.backgroundColor != i) {
                          config.backgroundColor = i;
                        }

                        i = (Integer) fpsSpinner.getValue();
                        if (config.fps != i) {
                          config.fps = i;
                        }

                        i = (Integer) paintHistorySizeSpinner.getValue();
                        if (config.paintHistorySize != i) {
                          config.paintHistorySize = i;
                        }

                        // video recording

                        i = (Integer) fpsVideoSpinner.getValue();
                        if (config.fpsVideo != i) {
                          config.fpsVideo = i;
                        }

                        s = videoEncoderTextArea.getText();
                        if (false == Configuration.ENCODER_COMMAND.equals(s)) {
                          Configuration.ENCODER_COMMAND = s;
                        }

                        dispose();
                      }
                    });
              }
            }.start();
          }
        });
    controlPanel.add(okButton);
    JButton cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            dispose();
          }
        });
    controlPanel.add(cancelButton);

    pack();
  }
Beispiel #6
0
  Liqui(Connection LoginCN) {
    cn = LoginCN;
    liquiwindow = new JFrame("Liquistatus");
    liquiwindow.setSize(800, 560);
    liquiwindow.setLocation(200, 200);
    liquiwindow.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    liquiwindow.setLayout(null);
    liquiwindow.setResizable(false);

    // schriftenfestlegungen
    fontTxtFields = new Font("Arial", Font.PLAIN, 16);
    fontCmbBoxes = new Font("Arial", Font.PLAIN, 16);
    fontLists = new Font("Arial", Font.PLAIN, 10);

    pnlAbrMonat = new JPanel();
    pnlAbrMonat.setLayout(null);
    pnlAbrMonat.setBounds(30, 30, 150, 60);
    pnlAbrMonat.setBorder(new TitledBorder("Abrechnungsmonat"));
    // inhalt fuer Panel AbrMonat erstellen
    try {
      txtAbrMonat = new JFormattedTextField(new MaskFormatter("01-##-20##"));
    } catch (ParseException e1) {
      e1.printStackTrace();
    }
    txtAbrMonat.setBounds(20, 25, 110, 25);
    txtAbrMonat.setHorizontalAlignment(JFormattedTextField.RIGHT);
    txtAbrMonat.setFont(fontTxtFields);
    txtAbrMonat.addKeyListener(
        new KeyListener() {
          @Override
          public void keyTyped(KeyEvent ke) {}

          @Override
          public void keyReleased(KeyEvent ke) {
            if (ke.getKeyCode() == KeyEvent.VK_ENTER
                && Pattern.matches("\\d{2}.\\d{2}.[1-9]{1}\\d{3}", txtAbrMonat.getText())) {
              txtHinweis.setText(""); // clear txtHinweis Field
              lstModelAllIncome.clear(); // clear form old values from the previos call
              cmbModelPerson.removeAllElements(); // clear befor put new elements in to it
              calculate_profit(BigOneTools.datum_wandeln(txtAbrMonat.getText(), 0));
              putPersonNameToCmbPerson();
              putIncomeToListAllIncome(BigOneTools.datum_wandeln(txtAbrMonat.getText(), 0));

              // check if the actual liquimonth is already fix and it is so, then set the buttons,
              // who put and remove
              // incomes to and from persons, inactive
              if (is_liqui_fix(BigOneTools.datum_wandeln(txtAbrMonat.getText(), 0))) {
                btnAdd.setEnabled(false);
                btnRemove.setEnabled(false);
              } else {
                btnAdd.setEnabled(true);
                btnRemove.setEnabled(true);
              }
            }
          }

          @Override
          public void keyPressed(KeyEvent ke) {}
        });
    // inhalte fuer das Panel AbrMonat auf selbiges legen
    pnlAbrMonat.add(txtAbrMonat);

    pnlRestwert = new JPanel();
    pnlRestwert.setLayout(null);
    pnlRestwert.setBounds(30, 115, 150, 60);
    pnlRestwert.setBorder(new TitledBorder("Monatsrestwert"));
    // inhalt fuer Panel Restwert erstellen
    txtNutzBetr = new JFormattedTextField(new NumberFormatter(new DecimalFormat("#,##0.00")));
    txtNutzBetr.setBounds(20, 25, 110, 25);
    txtNutzBetr.setHorizontalAlignment(JFormattedTextField.RIGHT);
    txtNutzBetr.setFont(fontTxtFields);
    txtNutzBetr.setText("0,00");
    txtNutzBetr.addFocusListener(
        new FocusListener() {
          public void focusLost(FocusEvent fe) {}

          public void focusGained(FocusEvent fe) {
            txtNutzBetr.selectAll();
          }
        });
    // inhalte fuer das Panel AbrMonat auf selbiges legen
    pnlRestwert.add(txtNutzBetr);

    // Textfeld fuer Hinweise zum errechneten Betrag
    txtHinweis = new JTextArea();
    txtHinweis.setBounds(195, 30, 230, 205);
    txtHinweis.setBorder(BorderFactory.createEtchedBorder());
    txtHinweis.setEditable(false); // infos sollen nur vom Programm gesetzt werden

    // Bereich fuer die Einnahmenaufteilung anlegen
    pnlEinahmenAufteilung = new JPanel();
    pnlEinahmenAufteilung.setLayout(null);
    pnlEinahmenAufteilung.setBounds(30, 240, 640, 300);
    pnlEinahmenAufteilung.setBorder(new TitledBorder("Einnahmenaufteilung"));
    // elemente fuer die Einnahmenaufteilung anlegen
    lblPerson = new JLabel("Person");
    lblPerson.setBounds(20, 25, 110, 25);

    cmbModelPerson = new DefaultComboBoxModel<String>();
    cmbPerson = new JComboBox<String>(cmbModelPerson);
    cmbPerson.setBounds(130, 25, 170, 25);
    cmbPerson.setFont(fontCmbBoxes);
    cmbPerson.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == 1) {
              // clear the List IncomePerPerson when Person is changed (to another or to nothing)
              lstModelIncomePerPerson.clear();

              if (cmbPerson.getSelectedIndex() > 0) {
                // extract personen_id from selected Value
                String selectedValue = cmbPerson.getSelectedItem().toString();
                Integer personen_id =
                    Integer.valueOf(
                        selectedValue.substring(
                            selectedValue.indexOf("(") + 1, selectedValue.indexOf(")")));

                // fill lstIncomePerPerson
                getIncomeForSelectedPerson(
                    personen_id, BigOneTools.datum_wandeln(txtAbrMonat.getText(), 0));
              }
            }
          }
        });

    // Scrollliste der gesammten Einnahmen
    lstModelAllIncome = new DefaultListModel<String>();

    lstAllIncome = new JList<String>(lstModelAllIncome);
    lstAllIncome.setFont(fontLists);
    lstAllIncome.addMouseListener(
        new MouseListener() {
          @Override
          public void mouseReleased(MouseEvent e) {}

          @Override
          public void mousePressed(MouseEvent e) {}

          @Override
          public void mouseExited(MouseEvent e) {}

          @Override
          public void mouseEntered(MouseEvent e) {}

          @Override
          public void mouseClicked(MouseEvent e) {
            // do someone only when elements exist
            if (lstModelAllIncome.getSize() > 0) {
              String elementValue = lstModelAllIncome.getElementAt(lstAllIncome.getSelectedIndex());
              lblBuchtext.setToolTipText(
                  getBuchText(
                      elementValue.substring(
                          elementValue.indexOf("(") + 1, elementValue.indexOf(")"))));

              // chek if a splitted part of the transaktions_id of the selectet Value is already put
              // to a
              // person, if it is so, the checkbox split must checked and protect against unchecked
              if (existSplittedPartInIpp(
                  elementValue.substring(
                      elementValue.indexOf("(") + 1, elementValue.indexOf(")")))) {
                chkAufteilung.setSelected(true);
                chkAufteilung.setEnabled(false);
              } else {
                chkAufteilung.setSelected(false);
                chkAufteilung.setEnabled(true);
              }
            }
          }
        });

    spAllIncome = new JScrollPane(lstAllIncome);
    spAllIncome.setBounds(20, 65, 100, 205);

    // scrollliste der einnahmen pro Person
    lstModelIncomePerPerson = new DefaultListModel<String>();

    lstIncomPerPerson = new JList<String>(lstModelIncomePerPerson);
    lstIncomPerPerson.setFont(fontLists);

    spIncomePerPerson = new JScrollPane(lstIncomPerPerson);
    spIncomePerPerson.setBounds(220, 65, 100, 205);

    // checkbox fuer die Aufteilungskennzeichnung
    chkAufteilung = new JCheckBox("Split", false);
    chkAufteilung.setBounds(145, 70, 60, 30);

    // Buttons fuer das hinzufuegen und entfernen der Betraege zu den Personen
    btnAdd = new JButton(">>");
    btnAdd.setBounds(145, 130, 60, 20);
    btnAdd.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            Integer AllIncomeSelectedIndex;
            Integer PersonSelectedIndex;

            // note important selected Index
            AllIncomeSelectedIndex = lstAllIncome.getSelectedIndex();
            PersonSelectedIndex = cmbPerson.getSelectedIndex();

            // move the selected field from lstAllIncome to lstIncomePerPerson
            if (AllIncomeSelectedIndex >= 0 && PersonSelectedIndex >= 1) {
              // note some selected Values
              String selectedValue = cmbPerson.getSelectedItem().toString();
              Integer personen_id =
                  Integer.valueOf(
                      selectedValue.substring(
                          selectedValue.indexOf("(") + 1, selectedValue.indexOf(")")));

              // get Selected Value from the AllIncomeList
              String selectedAmountWithKey = lstModelAllIncome.getElementAt(AllIncomeSelectedIndex);

              // extract transaktions_id from the selected Amountvalue
              Integer transaktions_id =
                  Integer.valueOf(
                      selectedAmountWithKey.substring(
                          selectedAmountWithKey.indexOf("(") + 1,
                          selectedAmountWithKey.indexOf(")")));
              String sAmount =
                  selectedAmountWithKey.substring(0, selectedAmountWithKey.indexOf(" ("));

              // check if Amount have to split and get the Person_id who get the splited Amount
              if (chkAufteilung.isSelected()) {
                String AmountPart =
                    JOptionPane.showInputDialog(
                        "Bitte den Teilbetrag von " + sAmount + " eingeben:", sAmount);
                AmountPart = AmountPart.replace(",", ".");
                if (AmountPart.matches("^[0-9]+(\\.[0-9]{1,2})?$")) {
                  lstModelIncomePerPerson.insertElementAt(
                      AmountPart + " (" + transaktions_id + ")", lstModelIncomePerPerson.getSize());

                  // remove old Amount Value from List AllIncome
                  lstModelAllIncome.remove(AllIncomeSelectedIndex);

                  // calculate the diffrence between Old Amount and the AmountPart
                  Float AmountAllIncomeNew = Float.valueOf(sAmount) - Float.valueOf(AmountPart);

                  // put difference in the List AllIncome if it greater then zero
                  if (AmountAllIncomeNew > 0)
                    lstModelAllIncome.insertElementAt(
                        AmountAllIncomeNew.toString() + " (" + transaktions_id + ")",
                        lstModelAllIncome.getSize());

                  // put AmountPart in the IPP Table
                  pushAmountToTableIPP(AmountPart, transaktions_id, personen_id, "true");
                } else {
                  JOptionPane.showMessageDialog(
                      liquiwindow,
                      "Eingabe ist kein gültiger Zahlwert! Der Gesamtbetrag wird genommen.");
                  lstModelIncomePerPerson.insertElementAt(
                      selectedAmountWithKey, lstModelIncomePerPerson.getSize());
                  lstModelAllIncome.remove(AllIncomeSelectedIndex);
                  pushAmountToTableIPP(sAmount, transaktions_id, personen_id, "false");
                }
              } else {
                lstModelIncomePerPerson.insertElementAt(
                    selectedAmountWithKey, lstModelIncomePerPerson.getSize());
                lstModelAllIncome.remove(AllIncomeSelectedIndex);
                pushAmountToTableIPP(sAmount, transaktions_id, personen_id, "false");
              }
            }
          }
        });

    btnRemove = new JButton("<<");
    btnRemove.setBounds(145, 175, 60, 20);
    btnRemove.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            Integer IncomePerPersonSelectedIndex;
            Integer PersonSelectedIndex;
            Boolean transaktions_id_is_in_elements = false;
            int eID =
                0; // counter for the elements in the Enumeration to find an element with the same
                   // transaktions_id

            // note important selected Indexes
            IncomePerPersonSelectedIndex = lstIncomPerPerson.getSelectedIndex();
            PersonSelectedIndex = cmbPerson.getSelectedIndex();

            // move the selected field from lstIncomePerPerson to lstAllIncome
            if (IncomePerPersonSelectedIndex >= 0 && PersonSelectedIndex >= 1) {
              String selectedPersonAmountWithKey =
                  lstModelIncomePerPerson.getElementAt(IncomePerPersonSelectedIndex);

              // note the transaktions_id from the selectet Value at the right site
              String transaktions_id_right_site =
                  selectedPersonAmountWithKey.substring(
                      selectedPersonAmountWithKey.indexOf("(") + 1,
                      selectedPersonAmountWithKey.indexOf(")"));

              // check if the transaktions_id from the element that remove from the
              // IncomPerPerson List at the right site, is alredy in the list AllIncome at the
              // left Site. If it is so, then we must add the amount of the elements at the left
              // side to the right
              // where the transaktions_id is the same
              Enumeration<String> e = lstModelAllIncome.elements();

              while (e.hasMoreElements() && !transaktions_id_is_in_elements) {
                // note the actual Elemant in the Enumeration
                String actualElement = e.nextElement().toString();

                // note the transaktions_id from the actual element at the left site
                String transaktions_id_left_site =
                    actualElement.substring(
                        actualElement.indexOf("(") + 1, actualElement.indexOf(")"));

                if (transaktions_id_right_site.equals(transaktions_id_left_site)) {
                  // we need not look further and set transaktions_id_is_in_elements to true
                  // that will break the while loop
                  transaktions_id_is_in_elements = true;
                } else {
                  transaktions_id_is_in_elements = false;
                  eID++;
                }
              }

              if (transaktions_id_is_in_elements) {
                // if found an element with the same id in the left field, add the amount of the
                // removed
                // element at the right site, to the amount of the found element and put the result
                // at the end of the listAllIncome

                // note the two Amounts that have to add
                String AmountFromRightSite =
                    selectedPersonAmountWithKey.substring(
                        0, selectedPersonAmountWithKey.indexOf(" ("));
                String AmountFromLeftSite =
                    lstModelAllIncome
                        .getElementAt(eID)
                        .substring(0, lstModelAllIncome.getElementAt(eID).indexOf(" ("));
                Float newAmount =
                    Float.valueOf(AmountFromRightSite) + Float.valueOf(AmountFromLeftSite);

                // remove the element at the right and the left site
                lstModelIncomePerPerson.remove(IncomePerPersonSelectedIndex);
                lstModelAllIncome.remove(eID);

                // put the new build Element to the left site
                lstModelAllIncome.insertElementAt(
                    newAmount + " (" + transaktions_id_right_site + ")",
                    lstModelAllIncome.getSize());
              } else {
                // if not found, only put the removed Elemnt to the end of the List at the left site
                lstModelAllIncome.insertElementAt(
                    selectedPersonAmountWithKey, lstModelAllIncome.getSize());
                lstModelIncomePerPerson.remove(IncomePerPersonSelectedIndex);
              }

              // delete the moved Amount in the Table ipp for the selected Person
              String selectedValue = cmbPerson.getSelectedItem().toString();
              Integer personen_id =
                  Integer.valueOf(
                      selectedValue.substring(
                          selectedValue.indexOf("(") + 1, selectedValue.indexOf(")")));
              deleteAmountFromTableIPP(selectedPersonAmountWithKey, personen_id);
            }
          }
        });

    lblBuchtext = new JLabel("Buchungstext (Tooltip)");
    lblBuchtext.setBounds(20, 275, 300, 20);

    btnCalcPercentualPortion = new JButton("Anteilberechnung");
    btnCalcPercentualPortion.setBounds(330, 65, 160, 20);
    btnCalcPercentualPortion.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent arg0) {
            int personCount;
            double[] PersonAmount;
            double TotalPersonAmount = 0;

            // clear the infotextfield
            txtHinweisAufteilung.setText("");

            // note the amount of person in the cmb box person
            // the first entry is not a person
            personCount = cmbModelPerson.getSize() - 1;

            // sum up the acounts of each person if there are one
            if (personCount > 0) {
              PersonAmount = new double[personCount];
              double dResidualValue = Double.valueOf(txtNutzBetr.getText().replace(",", "."));

              for (int PersonCounter = 1; PersonCounter <= personCount; PersonCounter++) {
                String selectedValue = cmbPerson.getItemAt(PersonCounter).toString();
                Integer personen_id =
                    Integer.valueOf(
                        selectedValue.substring(
                            selectedValue.indexOf("(") + 1, selectedValue.indexOf(")")));

                PersonAmount[PersonCounter - 1] =
                    getPersonAcountSumPerLiqui(
                        personen_id, BigOneTools.datum_wandeln(txtAbrMonat.getText(), 0));
                TotalPersonAmount =
                    roundScale2(TotalPersonAmount + PersonAmount[PersonCounter - 1]);
              }

              // hint the total sum of all person
              txtHinweisAufteilung.append("Gesammtsumme:\n");
              txtHinweisAufteilung.append(
                  Double.toString(TotalPersonAmount).replace(".", ",") + "\n");

              // calc the proportion of the sums in percent, to the total Sum of all persons
              txtHinweisAufteilung.append(
                  "Sparbetrag: " + Double.toString(dResidualValue).replace(".", ",") + "\n");
              for (int PersonCounter = 0; PersonCounter < PersonAmount.length; PersonCounter++) {
                double percent =
                    roundScale2((PersonAmount[PersonCounter] * 100) / TotalPersonAmount);
                double dValue = roundScale2((percent * dResidualValue) / 100);
                txtHinweisAufteilung.append(
                    Double.toString(percent).replace(".", ",")
                        + "% / "
                        + Double.toString(dValue).replace(".", ",")
                        + "\n");
              }
            }
          }
        });

    // Textfeld fuer Hinweise zum errechneten Betrag
    txtHinweisAufteilung = new JTextArea();
    txtHinweisAufteilung.setBounds(330, 90, 180, 180);
    txtHinweisAufteilung.setBorder(BorderFactory.createEtchedBorder());
    txtHinweisAufteilung.setEditable(false); // infos sollen nur vom Programm gesetzt werden

    // zuweisen der Elemente fuer das Panel Einnahmenaufteilung
    pnlEinahmenAufteilung.add(lblPerson);
    pnlEinahmenAufteilung.add(cmbPerson);
    pnlEinahmenAufteilung.add(spAllIncome);
    pnlEinahmenAufteilung.add(spIncomePerPerson);
    pnlEinahmenAufteilung.add(chkAufteilung);
    pnlEinahmenAufteilung.add(btnAdd);
    pnlEinahmenAufteilung.add(btnRemove);
    pnlEinahmenAufteilung.add(lblBuchtext);
    pnlEinahmenAufteilung.add(btnCalcPercentualPortion);
    pnlEinahmenAufteilung.add(txtHinweisAufteilung);

    liquiwindow.add(pnlAbrMonat);
    liquiwindow.add(pnlRestwert);
    liquiwindow.add(txtHinweis);
    liquiwindow.add(pnlEinahmenAufteilung);

    liquiwindow.setVisible(true);
  }
  @Override
  public JComponent createControl() {
    layerCanvasModelChangeChangeHandler = new LayerCanvasModelChangeHandler();
    productNodeChangeHandler = createProductNodeListener();
    cursorSynchronizer = new CursorSynchronizer(VisatApp.getApp());

    final DecimalFormatSymbols decimalFormatSymbols = new DecimalFormatSymbols(Locale.ENGLISH);
    scaleFormat = new DecimalFormat("#####.##", decimalFormatSymbols);
    scaleFormat.setGroupingUsed(false);
    scaleFormat.setDecimalSeparatorAlwaysShown(false);

    zoomInButton =
        ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/ZoomIn24.gif"), false);
    zoomInButton.setToolTipText("Zoom in."); /*I18N*/
    zoomInButton.setName("zoomInButton");
    zoomInButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(final ActionEvent e) {
            zoom(getCurrentView().getZoomFactor() * 1.2);
          }
        });

    zoomOutButton =
        ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/ZoomOut24.gif"), false);
    zoomOutButton.setName("zoomOutButton");
    zoomOutButton.setToolTipText("Zoom out."); /*I18N*/
    zoomOutButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(final ActionEvent e) {
            zoom(getCurrentView().getZoomFactor() / 1.2);
          }
        });

    zoomDefaultButton =
        ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/ZoomPixel24.gif"), false);
    zoomDefaultButton.setToolTipText("Actual Pixels (image pixel = view pixel)."); /*I18N*/
    zoomDefaultButton.setName("zoomDefaultButton");
    zoomDefaultButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(final ActionEvent e) {
            zoomToPixelResolution();
          }
        });

    zoomAllButton =
        ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/ZoomAll24.gif"), false);
    zoomAllButton.setName("zoomAllButton");
    zoomAllButton.setToolTipText("Zoom all."); /*I18N*/
    zoomAllButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(final ActionEvent e) {
            zoomAll();
          }
        });

    syncViewsButton =
        ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/SyncViews24.png"), true);
    syncViewsButton.setToolTipText("Synchronise compatible product views."); /*I18N*/
    syncViewsButton.setName("syncViewsButton");
    syncViewsButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(final ActionEvent e) {
            maybeSynchronizeCompatibleProductViews();
          }
        });

    syncCursorButton =
        ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/SyncCursor24.png"), true);
    syncCursorButton.setToolTipText("Synchronise cursor position."); /*I18N*/
    syncCursorButton.setName("syncCursorButton");
    syncCursorButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(final ActionEvent e) {
            cursorSynchronizer.setEnabled(syncCursorButton.isSelected());
          }
        });

    AbstractButton helpButton =
        ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Help24.gif"), false);
    helpButton.setToolTipText("Help."); /*I18N*/
    helpButton.setName("helpButton");

    final JPanel eastPane = GridBagUtils.createPanel();
    final GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 0.0;
    gbc.weighty = 0.0;

    gbc.gridy = 0;
    eastPane.add(zoomInButton, gbc);

    gbc.gridy++;
    eastPane.add(zoomOutButton, gbc);

    gbc.gridy++;
    eastPane.add(zoomDefaultButton, gbc);

    gbc.gridy++;
    eastPane.add(zoomAllButton, gbc);

    gbc.gridy++;
    eastPane.add(syncViewsButton, gbc);

    gbc.gridy++;
    eastPane.add(syncCursorButton, gbc);

    gbc.gridy++;
    gbc.weighty = 1.0;
    gbc.fill = GridBagConstraints.VERTICAL;
    eastPane.add(new JLabel(" "), gbc); // filler
    gbc.fill = GridBagConstraints.NONE;
    gbc.weighty = 0.0;

    gbc.gridy++;
    eastPane.add(helpButton, gbc);

    zoomFactorField = new JTextField();
    zoomFactorField.setColumns(8);
    zoomFactorField.setHorizontalAlignment(JTextField.CENTER);
    zoomFactorField.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(final ActionEvent e) {
            handleZoomFactorFieldUserInput();
          }
        });
    zoomFactorField.addFocusListener(
        new FocusAdapter() {
          @Override
          public void focusLost(final FocusEvent e) {
            handleZoomFactorFieldUserInput();
          }
        });

    rotationAngleSpinner = new JSpinner(new SpinnerNumberModel(0.0, -1800.0, 1800.0, 5.0));
    final JSpinner.NumberEditor editor = (JSpinner.NumberEditor) rotationAngleSpinner.getEditor();
    rotationAngleField = editor.getTextField();
    final DecimalFormat rotationFormat;
    rotationFormat = new DecimalFormat("#####.##", decimalFormatSymbols);
    rotationFormat.setGroupingUsed(false);
    rotationFormat.setDecimalSeparatorAlwaysShown(false);
    rotationAngleField.setFormatterFactory(
        new JFormattedTextField.AbstractFormatterFactory() {
          @Override
          public JFormattedTextField.AbstractFormatter getFormatter(JFormattedTextField tf) {
            return new NumberFormatter(rotationFormat);
          }
        });
    rotationAngleField.setColumns(6);
    rotationAngleField.setEditable(true);
    rotationAngleField.setHorizontalAlignment(JTextField.CENTER);
    rotationAngleField.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            handleRotationAngleFieldUserInput();
          }
        });
    rotationAngleField.addFocusListener(
        new FocusAdapter() {
          @Override
          public void focusLost(FocusEvent e) {
            handleRotationAngleFieldUserInput();
          }
        });
    rotationAngleField.addPropertyChangeListener(
        "value",
        new PropertyChangeListener() {

          @Override
          public void propertyChange(PropertyChangeEvent evt) {
            handleRotationAngleFieldUserInput();
          }
        });

    zoomSlider = new JSlider(JSlider.HORIZONTAL);
    zoomSlider.setValue(0);
    zoomSlider.setMinimum(MIN_SLIDER_VALUE);
    zoomSlider.setMaximum(MAX_SLIDER_VALUE);
    zoomSlider.setPaintTicks(false);
    zoomSlider.setPaintLabels(false);
    zoomSlider.setSnapToTicks(false);
    zoomSlider.setPaintTrack(true);
    zoomSlider.addChangeListener(
        new ChangeListener() {
          @Override
          public void stateChanged(final ChangeEvent e) {
            if (!inUpdateMode) {
              zoom(sliderValueToZoomFactor(zoomSlider.getValue()));
            }
          }
        });

    final JPanel zoomFactorPane = new JPanel(new BorderLayout());
    zoomFactorPane.add(zoomFactorField, BorderLayout.WEST);

    final JPanel rotationAnglePane = new JPanel(new BorderLayout());
    rotationAnglePane.add(rotationAngleSpinner, BorderLayout.EAST);
    rotationAnglePane.add(new JLabel(" "), BorderLayout.CENTER);

    final JPanel sliderPane = new JPanel(new BorderLayout(2, 2));
    sliderPane.add(zoomFactorPane, BorderLayout.WEST);
    sliderPane.add(zoomSlider, BorderLayout.CENTER);
    sliderPane.add(rotationAnglePane, BorderLayout.EAST);

    canvas = createNavigationCanvas();
    canvas.setBackground(new Color(138, 133, 128)); // image background
    canvas.setForeground(new Color(153, 153, 204)); // slider overlay

    final JPanel centerPane = new JPanel(new BorderLayout(4, 4));
    centerPane.add(BorderLayout.CENTER, canvas);
    centerPane.add(BorderLayout.SOUTH, sliderPane);

    final JPanel mainPane = new JPanel(new BorderLayout(8, 8));
    mainPane.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    mainPane.add(centerPane, BorderLayout.CENTER);
    mainPane.add(eastPane, BorderLayout.EAST);

    mainPane.setPreferredSize(new Dimension(320, 320));

    if (getDescriptor().getHelpId() != null) {
      HelpSys.enableHelpOnButton(helpButton, getDescriptor().getHelpId());
      HelpSys.enableHelpKey(mainPane, getDescriptor().getHelpId());
    }

    setCurrentView(VisatApp.getApp().getSelectedProductSceneView());

    updateState();

    // Add an internal frame listener to VISAT so that we can update our
    // navigation window with the information of the currently activated
    // product scene view.
    //
    VisatApp.getApp().addInternalFrameListener(new NavigationIFL());

    return mainPane;
  }
  protected void initSizePane() {
    sizepn = new JPanel();

    int size = getParticlePicker().getSize();
    sizepn.add(new JLabel("Size:"));
    sizesl = new JSlider(10, ParticlePicker.sizemax, size);
    sizesl.setPaintTicks(true);
    sizesl.setMajorTickSpacing(100);
    int height = (int) sizesl.getPreferredSize().getHeight();
    sizesl.setPreferredSize(new Dimension(50, height));
    sizepn.add(sizesl);
    sizetf = new JFormattedTextField(NumberFormat.getIntegerInstance());
    sizetf.setColumns(3);
    sizetf.setValue(size);
    sizepn.add(sizetf);
    sizetf.addFocusListener(
        new FocusListener() {

          @Override
          public void focusGained(FocusEvent fe) {}

          @Override
          public void focusLost(FocusEvent fe) {
            // event from sizes
            try {
              if (!fe.isTemporary()) {

                sizetf.commitEdit();
                readSizeFromTextField();
              }
            } catch (Exception ex) {
              XmippDialog.showError(
                  ParticlePickerJFrame.this,
                  XmippMessage.getIllegalValueMsg("size", sizetf.getText()));
              Logger.getLogger(ParticlePickerJFrame.class.getName()).log(Level.SEVERE, null, ex);
            }
          }
        });
    sizetf.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            // event from sizes
            readSizeFromTextField();
          }
        });

    sizesl.addChangeListener(
        new ChangeListener() {

          @Override
          public void stateChanged(ChangeEvent e) {
            if (sizesl.getValueIsAdjusting()) return;
            int size = sizesl.getValue();
            if (size == getParticlePicker().getSize()) return;

            if (!getParticlePicker().isValidSize(ParticlePickerJFrame.this, size)) {
              sizesl.dispatchEvent( // trick to repaint slider after changing value
                  new MouseEvent(sizesl, MouseEvent.MOUSE_RELEASED, 0, 0, 0, 0, 1, false));
              int prevsize = getParticlePicker().getSize();
              sizesl.setValue(prevsize);
              return;
            }
            updateSize(size);
          }
        });
  }
  @Override
  public void installUI(JComponent c) {
    super.installUI(c);

    textFormattedField = (JFormattedTextField) c;

    textFormattedField.setFocusable(true);
    textFormattedField.setOpaque(false);
    textFormattedField.setMargin(new Insets(0, 0, 0, 0));
    textFormattedField.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    textFormattedField.setFont(AdobeLookAndFeel.fontBold);
    textFormattedField.setForeground(AdobeLookAndFeel.colorText);
    textFormattedField.setSelectionColor(new Color(100, 100, 100));
    textFormattedField.setCaretColor(AdobeLookAndFeel.colorText);

    mouseAdapter =
        new MouseAdapter() {
          @Override
          public void mouseReleased(MouseEvent e) {
            textFormattedField.repaint();
          }

          @Override
          public void mousePressed(MouseEvent e) {
            textFormattedField.repaint();
          }

          @Override
          public void mouseClicked(MouseEvent e) {
            textFormattedField.repaint();
          }
        };
    textFormattedField.addMouseListener(mouseAdapter);

    keyAdapter =
        new KeyAdapter() {
          @Override
          public void keyPressed(KeyEvent e) {
            textFormattedField.repaint();
          }
        };
    textFormattedField.addKeyListener(keyAdapter);

    focusListener =
        new FocusAdapter() {
          @Override
          public void focusGained(FocusEvent e) {
            textFormattedField.repaint();
          }

          @Override
          public void focusLost(FocusEvent e) {
            textFormattedField.repaint();
          }
        };
    textFormattedField.addFocusListener(focusListener);

    propertyChangeListener =
        new PropertyChangeListener() {
          @Override
          public void propertyChange(PropertyChangeEvent evt) {
            textFormattedField.repaint();
          }
        };
    textFormattedField.addPropertyChangeListener(
        AccessibleContext.ACCESSIBLE_STATE_PROPERTY, propertyChangeListener);
  }