/**
  * This method initializes jTextFieldEingebauteMenge
  *
  * @return javax.swing.JTextField
  */
 private JFormattedTextField getJTextFieldEingebauteMenge() {
   if (jTextFieldEingebauteMenge == null) {
     jTextFieldEingebauteMenge =
         new JFormattedTextField(
             new LagerEmptyNumberFormatter(1, 100, "Gültige Werte: 1 bis 100"));
     jTextFieldEingebauteMenge.setInputVerifier(LagerFormate.getInputVerifier());
     //			jTextFieldEingebauteMenge.addPropertyChangeListener("value", this);
     jTextFieldEingebauteMenge.setPreferredSize(new Dimension(20, 20));
     //			jTextFieldEingebauteMenge.setEditable(false);
     jTextFieldEingebauteMenge.addKeyListener(this);
   }
   return jTextFieldEingebauteMenge;
 }
Esempio n. 2
0
  /**
   * Affiche les cases de la grille grâce à des JTextField pour les cases à remplir et des JLabel
   * pour les indices de somme dans le JPanel pan
   *
   * @param pan
   * @throws NumberFormatException
   */
  public void affichCase(JPanel pan) throws NumberFormatException {
    if (this.n != 0) {
      bloc.setValue(null);
      try {
        MaskFormatter format = new MaskFormatter("#");
        bloc = new JFormattedTextField(format);
      } catch (ParseException e2) {

      }
      pan.add(bloc);
      bloc.setHorizontalAlignment(SwingConstants.CENTER);
      bloc.addKeyListener(
          new KeyAdapter() {
            public void keyReleased(KeyEvent e) {
              try {
                if (Integer.valueOf(bloc.getText()) == n) {
                  Utilitaire.score -= juste;
                  juste = 1;
                  Utilitaire.score += juste;
                } else {
                  Utilitaire.score -= juste;
                  juste = 0;
                  Utilitaire.score += juste;
                }
              } catch (NumberFormatException e1) {

              }
            }
          });
    } else {
      Utilitaire.score -= juste;
      juste = 1;
      Utilitaire.score += juste;
      if (sX != 0)
        if (sY != 0) block.setText(String.format("%2d\\%2d", sX, sY));
        else block.setText(String.format("%2d\\  ", sX));
      else if (sY != 0) block.setText(String.format("  \\%2d", sY));

      block.setHorizontalAlignment(SwingConstants.CENTER);
      block.setBorder(null);
      block.setOpaque(true);
      block.setBackground(Color.BLACK);
      block.setForeground(Color.WHITE);
      pan.add(block);
    }
  }
Esempio n. 3
0
  private void initGUI() {
    setLayout(new BorderLayout());

    tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    add(tabbedPane);

    {
      final JPanel panelIntroduction = new JPanel();
      tabbedPane.addTab("Intro", null, panelIntroduction, null);
      panelIntroduction.setLayout(null);

      final JLabel lblCrownwearingNucleiTracker = new JLabel("Crown-Wearing Nuclei Segmenter");
      lblCrownwearingNucleiTracker.setFont(BIG_FONT);
      lblCrownwearingNucleiTracker.setHorizontalAlignment(SwingConstants.CENTER);
      lblCrownwearingNucleiTracker.setBounds(10, 11, 268, 30);
      panelIntroduction.add(lblCrownwearingNucleiTracker);

      final JLabel labelIntro = new JLabel(INTRO_TEXT);
      labelIntro.setFont(SMALL_FONT.deriveFont(11f));
      labelIntro.setBounds(10, 52, 268, 173);
      panelIntroduction.add(labelIntro);

      final JButton btnTestParamtersLive =
          new JButton("<html><div align=\"center\">Live test parameters</dic></html>");
      btnTestParamtersLive.setBounds(10, 292, 103, 72);
      btnTestParamtersLive.setFont(FONT);
      liveLaunched = false;
      btnTestParamtersLive.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent e) {
              if (liveLaunched) {
                stopLive();
                btnTestParamtersLive.setText(
                    "<html><div align=\"center\">Live test parameters</div></html>");
                liveLaunched = false;
              } else {
                launchLive();
                btnTestParamtersLive.setText(
                    "<html><div align=\"center\">Stop live test</div></html>");
                liveLaunched = true;
              }
            }
          });
      panelIntroduction.add(btnTestParamtersLive);

      final String segFrameButtonText = "<html><CENTER>Segment current frame</center></html>";
      final JButton segFrameButton = new JButton(segFrameButtonText);
      segFrameButton.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent e) {
              new Thread("CWNT thread") {
                @Override
                public void run() {
                  segFrameButton.setText("Segmenting...");
                  segFrameButton.setEnabled(false);
                  try {
                    launchSingleFrameSegmentation();
                  } finally {
                    segFrameButton.setEnabled(true);
                    segFrameButton.setText(segFrameButtonText);
                  }
                }
              }.start();
            }
          });
      segFrameButton.setFont(FONT);
      segFrameButton.setBounds(175, 292, 103, 72);
      panelIntroduction.add(segFrameButton);

      labelDurationEstimate = new JLabel();
      labelDurationEstimate.setBounds(10, 375, 268, 14);
      panelIntroduction.setFont(FONT);
      panelIntroduction.add(labelDurationEstimate);
    }

    final JPanel panelParams1 = new JPanel();
    {
      tabbedPane.addTab("Param set 1", null, panelParams1, null);
      panelParams1.setLayout(null);

      final JLabel lblFiltering = new JLabel("1. Filtering");
      lblFiltering.setFont(BIG_FONT);
      lblFiltering.setBounds(10, 11, 268, 29);
      panelParams1.add(lblFiltering);

      {
        final JLabel lblGaussianFilter = new JLabel("Gaussian filter \u03C3:");
        lblGaussianFilter.setFont(SMALL_FONT);
        lblGaussianFilter.setBounds(10, 51, 268, 14);
        panelParams1.add(lblGaussianFilter);

        gaussFiltSigmaSlider =
            new DoubleJSlider(0, 5 * scale, (int) (maskingParams[0] * scale), scale);
        gaussFiltSigmaSlider.setBounds(10, 76, 223, 23);
        panelParams1.add(gaussFiltSigmaSlider);

        gaussFiltSigmaText = new JFormattedTextField(new Double(maskingParams[0]));
        gaussFiltSigmaText.setHorizontalAlignment(SwingConstants.CENTER);
        gaussFiltSigmaText.setBounds(243, 76, 35, 23);
        gaussFiltSigmaText.setFont(FONT);
        panelParams1.add(gaussFiltSigmaText);

        link(gaussFiltSigmaSlider, gaussFiltSigmaText);
        gaussFiltSigmaSlider.addChangeListener(step1ChangeListener);
        gaussFiltSigmaText.addKeyListener(step1KeyListener);
      }

      final JLabel lblAnisotropicDiffusion = new JLabel("2. Anisotropic diffusion");
      lblAnisotropicDiffusion.setFont(BIG_FONT);
      lblAnisotropicDiffusion.setBounds(10, 128, 268, 29);
      panelParams1.add(lblAnisotropicDiffusion);

      {
        final JLabel lblNumberOfIterations = new JLabel("Number of iterations:");
        lblNumberOfIterations.setFont(SMALL_FONT);
        lblNumberOfIterations.setBounds(10, 168, 268, 14);
        panelParams1.add(lblNumberOfIterations);

        aniDiffNIterText = new JFormattedTextField(new Integer((int) maskingParams[1]));
        aniDiffNIterText.setHorizontalAlignment(SwingConstants.CENTER);
        aniDiffNIterText.setFont(FONT);
        aniDiffNIterText.setBounds(243, 193, 35, 23);
        panelParams1.add(aniDiffNIterText);

        aniDiffNIterSlider = new DoubleJSlider(0, 10, (int) maskingParams[1], 1);
        aniDiffNIterSlider.setBounds(10, 193, 223, 23);
        panelParams1.add(aniDiffNIterSlider);

        link(aniDiffNIterSlider, aniDiffNIterText);
        aniDiffNIterSlider.addChangeListener(step2ChangeListener);
        aniDiffNIterText.addKeyListener(step2KeyListener);
      }

      {
        final JLabel lblGradientDiffusionThreshold =
            new JLabel("Gradient diffusion threshold \u03BA:");
        lblGradientDiffusionThreshold.setFont(SMALL_FONT);
        lblGradientDiffusionThreshold.setBounds(10, 227, 268, 14);
        panelParams1.add(lblGradientDiffusionThreshold);

        aniDiffKappaText = new JFormattedTextField(new Double(maskingParams[2]));
        aniDiffKappaText.setHorizontalAlignment(SwingConstants.CENTER);
        aniDiffKappaText.setFont(FONT);
        aniDiffKappaText.setBounds(243, 252, 35, 23);
        panelParams1.add(aniDiffKappaText);

        aniDiffKappaSlider = new DoubleJSlider(1, 100, (int) maskingParams[2], 1);
        aniDiffKappaSlider.setBounds(10, 252, 223, 23);
        panelParams1.add(aniDiffKappaSlider);

        link(aniDiffKappaSlider, aniDiffKappaText);
        aniDiffKappaSlider.addChangeListener(step2ChangeListener);
        aniDiffKappaText.addKeyListener(step2KeyListener);
      }

      final JLabel lblDerivativesCalculation = new JLabel("3. Derivatives calculation");
      lblDerivativesCalculation.setFont(BIG_FONT);
      lblDerivativesCalculation.setBounds(10, 298, 268, 29);
      panelParams1.add(lblDerivativesCalculation);

      {
        final JLabel lblGaussianGradient = new JLabel("Gaussian gradient \u03C3:");
        lblGaussianGradient.setFont(FONT);
        lblGaussianGradient.setBounds(10, 338, 268, 14);
        panelParams1.add(lblGaussianGradient);

        gaussGradSigmaText = new JFormattedTextField(new Double(maskingParams[3]));
        gaussGradSigmaText.setFont(FONT);
        gaussGradSigmaText.setHorizontalAlignment(SwingConstants.CENTER);
        gaussGradSigmaText.setBounds(243, 363, 35, 23);
        panelParams1.add(gaussGradSigmaText);

        gaussGradSigmaSlider =
            new DoubleJSlider(0, 5 * scale, (int) (maskingParams[3] * scale), scale);
        gaussGradSigmaSlider.setBounds(10, 363, 223, 23);
        panelParams1.add(gaussGradSigmaSlider);

        link(gaussGradSigmaSlider, gaussGradSigmaText);
        gaussGradSigmaSlider.addChangeListener(step3ChangeListener);
        gaussGradSigmaText.addKeyListener(step3KeyListener);
      }
    }

    final JPanel panelParams2 = new JPanel();
    {
      tabbedPane.addTab("Param set 2", panelParams2);
      panelParams2.setLayout(null);

      final JLabel lblMasking = new JLabel("4. Masking");
      lblMasking.setFont(BIG_FONT);
      lblMasking.setBounds(10, 11, 268, 29);
      panelParams2.add(lblMasking);

      {
        final JLabel gammeLabel = new JLabel("\u03B3: tanh shift");
        gammeLabel.setFont(SMALL_FONT);
        gammeLabel.setBounds(10, 51, 268, 14);
        panelParams2.add(gammeLabel);

        gammaSlider =
            new DoubleJSlider(-5 * scale, 5 * scale, (int) (maskingParams[4] * scale), scale);
        gammaSlider.setBounds(10, 76, 223, 23);
        panelParams2.add(gammaSlider);

        gammaText = new JFormattedTextField(new Double(maskingParams[4]));
        gammaText.setFont(FONT);
        gammaText.setBounds(243, 76, 35, 23);
        panelParams2.add(gammaText);

        link(gammaSlider, gammaText);
        gammaSlider.addChangeListener(step4ChangeListener);
        gammaSlider.addKeyListener(step4KeyListener);
      }
      {
        final JLabel lblNewLabel_3 = new JLabel("\u03B1: gradient prefactor");
        lblNewLabel_3.setFont(SMALL_FONT);
        lblNewLabel_3.setBounds(10, 110, 268, 14);
        panelParams2.add(lblNewLabel_3);

        alphaSlider = new DoubleJSlider(0, 20 * scale, (int) (maskingParams[5] * scale), scale);
        alphaSlider.setBounds(10, 135, 223, 23);
        panelParams2.add(alphaSlider);

        alphaText = new JFormattedTextField(new Double(maskingParams[5]));
        alphaText.setFont(FONT);
        alphaText.setBounds(243, 135, 35, 23);
        panelParams2.add(alphaText);

        link(alphaSlider, alphaText);
        alphaSlider.addChangeListener(step4ChangeListener);
        alphaText.addKeyListener(step4KeyListener);
      }
      {
        final JLabel betaLabel = new JLabel("\u03B2: positive laplacian magnitude prefactor");
        betaLabel.setFont(SMALL_FONT);
        betaLabel.setBounds(10, 169, 268, 14);
        panelParams2.add(betaLabel);

        betaSlider = new DoubleJSlider(0, 20 * scale, (int) (maskingParams[6] * scale), scale);
        betaSlider.setBounds(10, 194, 223, 23);
        panelParams2.add(betaSlider);

        betaText = new JFormattedTextField(new Double(maskingParams[6]));
        betaText.setFont(FONT);
        betaText.setBounds(243, 194, 35, 23);
        panelParams2.add(betaText);

        link(betaSlider, betaText);
        betaSlider.addChangeListener(step4ChangeListener);
        betaText.addKeyListener(step4KeyListener);
      }
      {
        final JLabel epsilonLabel = new JLabel("\u03B5: negative hessian magnitude");
        epsilonLabel.setFont(SMALL_FONT);
        epsilonLabel.setBounds(10, 228, 268, 14);
        panelParams2.add(epsilonLabel);

        epsilonSlider = new DoubleJSlider(0, 20 * scale, (int) (scale * maskingParams[7]), scale);
        epsilonSlider.setBounds(10, 253, 223, 23);
        panelParams2.add(epsilonSlider);

        epsilonText = new JFormattedTextField(new Double(maskingParams[7]));
        epsilonText.setFont(FONT);
        epsilonText.setText("" + maskingParams[7]);
        epsilonText.setBounds(243, 253, 35, 23);
        panelParams2.add(epsilonText);

        link(epsilonSlider, epsilonText);
        epsilonSlider.addChangeListener(step4ChangeListener);
        epsilonText.addKeyListener(step4KeyListener);
      }
      {
        final JLabel deltaLabel = new JLabel("\u03B4: derivatives sum scale");
        deltaLabel.setFont(SMALL_FONT);
        deltaLabel.setBounds(10, 287, 268, 14);
        panelParams2.add(deltaLabel);

        deltaText = new JFormattedTextField(new Double(maskingParams[8]));
        deltaText.setFont(FONT);
        deltaText.setText("" + maskingParams[8]);
        deltaText.setBounds(243, 312, 35, 23);
        panelParams2.add(deltaText);

        deltaSlider = new DoubleJSlider(0, 5 * scale, (int) (maskingParams[8] * scale), scale);
        deltaSlider.setBounds(10, 312, 223, 23);
        panelParams2.add(deltaSlider);

        link(deltaSlider, deltaText);
        deltaSlider.addChangeListener(step4ChangeListener);
        deltaText.addKeyListener(step4KeyListener);
      }

      final JLabel lblEquation =
          new JLabel(
              "<html>M = \u00BD ( 1 + <i>tanh</i> ( \u03B3 - ( \u03B1 G + \u03B2 L + \u03B5 H ) / \u03B4 ) )</html>");
      lblEquation.setHorizontalAlignment(SwingConstants.CENTER);
      lblEquation.setFont(FONT.deriveFont(12f));
      lblEquation.setBounds(10, 364, 268, 35);
      panelParams2.add(lblEquation);
    }

    {
      final JPanel panel = new JPanel();
      tabbedPane.addTab("Param set 3", null, panel, null);
      panel.setLayout(null);

      final JLabel labelThresholding = new JLabel("5. Thresholding");
      labelThresholding.setBounds(10, 11, 268, 28);
      labelThresholding.setFont(BIG_FONT);
      panel.add(labelThresholding);

      final JLabel labelThresholdFactor = new JLabel("Threshold factor:");
      labelThresholdFactor.setFont(SMALL_FONT);
      labelThresholdFactor.setBounds(10, 50, 268, 14);
      panel.add(labelThresholdFactor);

      thresholdFactorSlider =
          new DoubleJSlider(0, 5 * scale, (int) (thresholdFactor * scale), scale);
      thresholdFactorSlider.setBounds(10, 75, 223, 23);
      panel.add(thresholdFactorSlider);

      thresholdFactorText = new JFormattedTextField(new Double(thresholdFactor));
      thresholdFactorText.setFont(FONT);
      thresholdFactorText.setBounds(243, 75, 35, 23);
      panel.add(thresholdFactorText);

      link(thresholdFactorSlider, thresholdFactorText);
      thresholdFactorSlider.addChangeListener(step5ChangeListener);
      thresholdFactorText.addKeyListener(step5KeyListener);
    }
  }
Esempio n. 4
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 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);
  }