public Component getTreeCellRendererComponent(
      JTree tree,
      Object value,
      boolean selected,
      boolean expanded,
      boolean leaf,
      int row,
      boolean hasFocus) {
    installMouseHandler();
    TreePath path = getPathForRow(row);
    state = UNCHECKABLE;
    if (path != null) {
      if (isChecked(path)) {
        state = FULLCHECKED;
      } else if (isPartiallyChecked(path)) {
        state = PARTIALCHECKED;
      } else if (isSelectable(path)) {
        state = UNCHECKED;
      }
    }
    checkBox.setSelected(state == FULLCHECKED);
    checkBox.getModel().setArmed(mouseRow == row && pressedRow == row && mouseInCheck);
    checkBox.getModel().setPressed(pressedRow == row && mouseInCheck);
    checkBox.getModel().setRollover(mouseRow == row && mouseInCheck);

    Component c =
        renderer.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
    checkBox.setForeground(c.getForeground());
    if (c instanceof JLabel) {
      JLabel label = (JLabel) c;
      // Augment the icon to include the checkbox
      setAppropriateLabelAndIcon(value, label, selected, expanded);
    }
    return c;
  }
    @Override
    public Component getTreeCellRendererComponent(
        JTree tree,
        Object value,
        boolean sel,
        boolean expanded,
        boolean leaf,
        int row,
        boolean hasFocus) {
      super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);

      if (!(value instanceof File)) {
        labelRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, false, row, false);
        labelRenderer.setIcon(null);
        return labelRenderer;
      }

      File file = (File) value;
      checkBox.setText(RecursiveLibraryDirectoryPanel.this.getText(file));
      // setColors(compTemp, tree, tree.getPathForRow(row), checkBox, sel);
      checkBox.setBackground(this.getBackground());
      checkBox.setForeground(this.getForeground());

      if (isExcluded(file)) {
        checkBox.setSelected(false);
        checkBox.setIcon(null);
      } else if (isFullyIncluded(file)) {
        checkBox.setSelected(true);
        checkBox.setIcon(null);
      } else {
        checkBox.setSelected(true);
        checkBox.setIcon(partiallyIncludedIcon);
      }
      return checkBox;
    }
  private JPanel getClickableTagsPanel() {
    JPanel pnl = new JPanel();

    pnl.setLayout(new GridLayout(0, 3));

    ArrayList<Commontags> listTags = new ArrayList<>(mapAllTags.values());
    Collections.sort(listTags);

    for (final Commontags ctag : listTags) {
      JCheckBox cb = new JCheckBox(ctag.getText());

      cb.setForeground(GUITools.getColor(ctag.getColor()));
      cb.setFont(ctag.getType() == 0 ? SYSConst.ARIAL12 : SYSConst.ARIAL12BOLD);

      cb.setSelected(listSelectedTags.contains(ctag));

      cb.addItemListener(
          e -> {
            if (e.getStateChange() == ItemEvent.SELECTED) {
              listSelectedTags.add(ctag);
              add(createButton(ctag));
            } else {
              listSelectedTags.remove(ctag);
              mapButtons.remove(ctag);
            }
            notifyListeners(ctag);
          });

      pnl.add(cb);
    }
    return pnl;
  }
  private void newComps() {
    ta = new JTextArea();
    // ta.setLineWrap(true);
    ta.setWrapStyleWord(true);
    ta.setFocusable(false);
    ta.setEditable(false);
    ta.setFont(new Font("Courier New", Font.BOLD, 20));
    ta.setBackground(Color.black);
    ta.setForeground(Color.GREEN);

    sc = new JScrollPane();
    sc.setViewportView(ta);

    btnExport = new JButton("Export");
    btnExport.setOpaque(false);
    btnExport.setFont(ta.getFont());
    btnExport.setFocusable(false);

    ckWrap = new JCheckBox("Wrap text");
    ckWrap.setOpaque(false);
    ckWrap.setForeground(Color.white);
    ckWrap.setFont(ta.getFont());
    ckWrap.setFocusable(false);

    chooser = new JFileChooser();
  }
    public MyJObject(int i) {
      CourseCheckBox = new JCheckBox(DataTransfer.Courses.elementAt(i));
      CourseCheckBox.setForeground(Color.WHITE);
      CourseCheckBox.setFont(new Font("SERRIF", Font.BOLD + Font.ITALIC, 13));
      CourseCheckBox.setHorizontalAlignment(SwingConstants.LEFT);
      CourseCheckBox.setOpaque(false);
      CourseCheckBox.setSelected(true);

      TotalMarks =
          new JLabel(
              Float.toString(
                  Float.valueOf(
                      TwoDecimal.format(Float.parseFloat(DataTransfer.Total.elementAt(i))))),
              SwingConstants.CENTER);
      TotalMarks.setForeground(Color.WHITE);
      TotalMarks.setFont(new Font("SERRIF", Font.BOLD + Font.ITALIC, 13));

      GradePoint = new JLabel(DataTransfer.GradePoint.elementAt(i), SwingConstants.LEFT);
      GradePoint.setForeground(Color.WHITE);
      GradePoint.setFont(new Font("SERRIF", Font.ITALIC, 13));

      LetterGrade = new JLabel(DataTransfer.LetterGrade.elementAt(i), SwingConstants.LEFT);
      LetterGrade.setForeground(Color.WHITE);
      LetterGrade.setFont(new Font("SERRIF", Font.PLAIN, 13));

      CreditLabel = new JLabel(Credit.elementAt(i), SwingConstants.LEFT);
      CreditLabel.setForeground(Color.WHITE);
      CreditLabel.setFont(new Font("SERRIF", Font.PLAIN, 13));

      ExamTypeLabel = new JLabel(DataTransfer.ExamType.elementAt(i), SwingConstants.LEFT);
      ExamTypeLabel.setForeground(Color.WHITE);
      ExamTypeLabel.setFont(new Font("SERRIF", Font.PLAIN, 12));
    }
Exemple #6
0
    private Component getCell(
        JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
      checkBox.setSelected(((Boolean) value).booleanValue());
      checkBox.setFont(table.getFont());

      if (isSelected) {
        checkBox.setBackground(table.getSelectionBackground());
        checkBox.setForeground(table.getSelectionForeground());
      } else {
        checkBox.setBackground(table.getBackground());
        checkBox.setForeground(table.getForeground());
      }

      checkBox.setBorder(
          (hasFocus) ? UIManager.getBorder("Table.focusCellHighlightBorder") : noFocusBorder);

      return checkBox;
    }
 public void actionPerformed(ActionEvent event) {
   if (event.getSource() == bShowNodeName) {
     if (!checksEnabled) {
       iNodeNameRotation.setEnabled(bShowNodeName.isSelected());
       iNodeNameDistance.setEnabled(bShowNodeName.isSelected());
       iNodeNameSize.setEnabled(bShowNodeName.isSelected());
       if (bShowNodeName.isSelected()) {
         NodeNameDistance.setForeground(Color.BLACK);
         NodeNameRotation.setForeground(Color.BLACK);
         Info.setForeground(Color.BLACK);
         NodeNameSize.setForeground(Color.BLACK);
       } else {
         NodeNameDistance.setForeground(Color.GRAY);
         NodeNameRotation.setForeground(Color.GRAY);
         Info.setForeground(Color.GRAY);
         NodeNameSize.setForeground(Color.GRAY);
       }
     }
   } else if (event.getSource() == bChShowNodeName) {
     bShowNodeName.setEnabled(bChShowNodeName.isSelected());
     if (bChShowNodeName.isSelected()) bShowNodeName.setForeground(Color.BLACK);
     else bShowNodeName.setForeground(Color.GRAY);
   } else if (event.getSource() == bChNodeNameRotation) {
     iNodeNameRotation.setEnabled(bChNodeNameRotation.isSelected());
     if (bChNodeNameRotation.isSelected()) {
       NodeNameRotation.setForeground(Color.BLACK);
       Info.setForeground(Color.BLACK);
     } else {
       NodeNameRotation.setForeground(Color.GRAY);
       Info.setForeground(Color.GRAY);
     }
   } else if (event.getSource() == bChNodeNameDistance) {
     iNodeNameDistance.setEnabled(bChNodeNameDistance.isSelected());
     if (bChNodeNameDistance.isSelected()) NodeNameDistance.setForeground(Color.BLACK);
     else NodeNameDistance.setForeground(Color.GRAY);
   } else if (event.getSource() == bChNodeNameSize) {
     iNodeNameSize.setEnabled(bChNodeNameSize.isSelected());
     if (bChNodeNameSize.isSelected()) NodeNameSize.setForeground(Color.BLACK);
     else NodeNameSize.setForeground(Color.GRAY);
   }
 }
Exemple #8
0
  /**
   * <i>Description:</i>
   *
   * <p>see <a href=https://en.wikipedia.org/wiki/Hostname>https://en.wikipedia.org
   * /wiki/Hostname</a> for valid hostname
   *
   * @return
   */
  @SuppressWarnings("unchecked")
  protected JPanel getHostEntryPanel() {
    if (pnlHostEntry == null) {
      pnlHostEntry = new JPanel(new BorderLayout(5, 5));
      pnlHostEntry.setOpaque(false);

      JPanel panel = new JPanel(new GridLayout(1, 2, 10, 5));
      panel.setOpaque(false);
      String hostNameChars = UIConstants.DIGITS + UIConstants.LETTERS + "-.";
      txtFldHostName = new SafeTextField(false, 253);
      ((SafeTextField) txtFldHostName).setValidChars(hostNameChars);
      for (DocumentListener listener : hostInfoListener.getDocumentListeners()) {
        txtFldHostName.getDocument().addDocumentListener(listener);
      }
      FieldPair<JFormattedTextField> fp =
          new FieldPair<JFormattedTextField>(STLConstants.K0051_HOST.getValue(), txtFldHostName);
      panel.add(fp);

      txtFldPortNum =
          new SafeNumberField<Integer>(new DecimalFormat("###"), 0, false, 65535, false);
      // only positive integer
      ((SafeNumberField<Integer>) txtFldPortNum).setValidChars(UIConstants.DIGITS);
      for (DocumentListener listener : hostInfoListener.getDocumentListeners()) {
        txtFldPortNum.getDocument().addDocumentListener(listener);
      }
      txtFldPortNum.setText(STLConstants.K3015_DEFAULT_PORT.getValue());
      fp =
          new FieldPair<JFormattedTextField>(
              STLConstants.K1035_CONFIGURATION_PORT.getValue(), txtFldPortNum);
      panel.add(fp);
      pnlHostEntry.add(panel, BorderLayout.CENTER);

      chkboxSecureConnect =
          ComponentFactory.getIntelCheckBox(STLConstants.K2003_SECURE_CONNECT.getValue());
      chkboxSecureConnect.setFont(UIConstants.H5_FONT.deriveFont(Font.BOLD));
      chkboxSecureConnect.setForeground(UIConstants.INTEL_DARK_GRAY);
      chkboxSecureConnect.setHorizontalAlignment(JLabel.TRAILING);
      chkboxSecureConnect.setSelected(false);
      chkboxSecureConnect.addItemListener(
          new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
              hostInfoListener.setDirty();
              boolean isSecureConnect = chkboxSecureConnect.isSelected();
              enableCerts(isSecureConnect);
            }
          });
      pnlHostEntry.add(chkboxSecureConnect, BorderLayout.EAST);
    }
    return pnlHostEntry;
  }
 public Component getListCellRendererComponent(
     JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
   JCheckBox checkbox = (JCheckBox) value;
   if (!UIUtil.isUnderNimbusLookAndFeel()) {
     checkbox.setBackground(getBackground(isSelected, checkbox));
     checkbox.setForeground(getForeground(isSelected, checkbox));
   }
   checkbox.setEnabled(isEnabled());
   checkbox.setFont(getFont(checkbox));
   checkbox.setFocusPainted(false);
   checkbox.setBorderPainted(true);
   checkbox.setBorder(isSelected ? mySelectedBorder : myBorder);
   adjustRendering(checkbox, isSelected, cellHasFocus);
   return checkbox;
 }
    public Component getListCellRendererComponent(
        JList<? extends JCheckBox> list,
        JCheckBox value,
        int index,
        boolean isSelected,
        boolean cellHasFocus) {
      JCheckBox checkbox = value;

      // Drawing checkbox, change the appearance here
      checkbox.setBackground(isSelected ? getSelectionBackground() : getBackground());
      checkbox.setForeground(isSelected ? getSelectionForeground() : getForeground());
      checkbox.setEnabled(isEnabled());
      checkbox.setFont(getFont());
      checkbox.setFocusPainted(false);
      checkbox.setBorderPainted(true);
      checkbox.setBorder(
          isSelected ? UIManager.getBorder("List.focusCellHighlightBorder") : noFocusBorder);
      return checkbox;
    }
 public Component getListCellRendererComponent(
     JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
   if (containerBox == null) {
     containerBox = Box.createHorizontalBox();
     checkBox = new JCheckBox();
     checkBox.setEnabled(isEnabled());
     checkBox.setFont(getFont());
     checkBox.setFocusPainted(false);
     checkBox.setBorderPainted(true);
     checkBox.setBorder(
         isSelected ? UIManager.getBorder("List.focusCellHighlightBorder") : noFocusBorder);
     containerBox.add(checkBox);
   }
   checkBox.setBackground(isSelected ? getSelectionBackground() : getBackground());
   checkBox.setForeground(isSelected ? getSelectionForeground() : getForeground());
   if (value != null) {
     ListItem item = (ListItem) value;
     checkBox.setText(item.dataItem.toString());
     checkBox.setSelected(item.selected);
   }
   return containerBox;
 }
Exemple #12
0
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;
    bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

    btgMode = new javax.swing.ButtonGroup();
    lblLastModification = new javax.swing.JLabel();
    panSearch = new javax.swing.JPanel();
    txtSearch = new javax.swing.JTextField();
    lblSuche = new javax.swing.JLabel();
    btnSearch = new javax.swing.JButton();
    panKZValues = new javax.swing.JPanel();
    lblKassenzeichen = new javax.swing.JLabel();
    lblErfassungsdatum = new javax.swing.JLabel();
    lblBemerkung = new javax.swing.JLabel();
    lblSperre = new javax.swing.JLabel();
    txtErfassungsdatum = new javax.swing.JTextField();
    chkSperre = new javax.swing.JCheckBox();
    scpBemerkung = new javax.swing.JScrollPane();
    txtBemerkung = new javax.swing.JTextArea();
    txtKassenzeichen = new javax.swing.JTextField();
    txtSperreBemerkung = new javax.swing.JTextField();
    jPanel2 = new javax.swing.JPanel();
    jLabel2 = new javax.swing.JLabel();
    togRegenMode = new javax.swing.JToggleButton();
    togWDSRMode = new javax.swing.JToggleButton();
    togInfoMode = new javax.swing.JToggleButton();
    sepTitle1 = new javax.swing.JSeparator();
    sepTitle2 = new javax.swing.JSeparator();

    lblLastModification.setIcon(
        new javax.swing.ImageIcon(
            getClass().getResource("/de/cismet/verdis/res/images/titlebars/goto.png"))); // NOI18N

    org.jdesktop.beansbinding.Binding binding =
        org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
            this,
            org.jdesktop.beansbinding.ELProperty.create("${cidsBean.letzte_aenderung_von}"),
            lblLastModification,
            org.jdesktop.beansbinding.BeanProperty.create("toolTipText"));
    bindingGroup.addBinding(binding);

    setLayout(new java.awt.GridBagLayout());

    panSearch.setLayout(new java.awt.GridBagLayout());

    txtSearch.addActionListener(
        new java.awt.event.ActionListener() {

          @Override
          public void actionPerformed(final java.awt.event.ActionEvent evt) {
            txtSearchActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3);
    panSearch.add(txtSearch, gridBagConstraints);

    lblSuche.setText("Kassenzeichen");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 10);
    panSearch.add(lblSuche, gridBagConstraints);

    btnSearch.setMnemonic('s');
    btnSearch.setText("suchen");
    btnSearch.addActionListener(
        new java.awt.event.ActionListener() {

          @Override
          public void actionPerformed(final java.awt.event.ActionEvent evt) {
            btnSearchActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
    gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3);
    panSearch.add(btnSearch, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(7, 7, 7, 7);
    add(panSearch, gridBagConstraints);

    panKZValues.setLayout(new java.awt.GridBagLayout());

    lblKassenzeichen.setText("Kassenzeichen");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    panKZValues.add(lblKassenzeichen, gridBagConstraints);

    lblErfassungsdatum.setText("Datum der Erfassung");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    panKZValues.add(lblErfassungsdatum, gridBagConstraints);

    lblBemerkung.setText("Bemerkung");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    panKZValues.add(lblBemerkung, gridBagConstraints);

    lblSperre.setText("Veranlagung gesperrt");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    panKZValues.add(lblSperre, gridBagConstraints);

    binding =
        org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
            this,
            org.jdesktop.beansbinding.ELProperty.create("${cidsBean.datum_erfassung}"),
            txtErfassungsdatum,
            org.jdesktop.beansbinding.BeanProperty.create("text"),
            KassenzeichenPropertyConstants.PROP__DATUM_ERFASSUNG);
    binding.setConverter(new SqlDateToStringConverter());
    bindingGroup.addBinding(binding);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(3, 6, 3, 0);
    panKZValues.add(txtErfassungsdatum, gridBagConstraints);

    chkSperre.setForeground(java.awt.Color.red);
    chkSperre.setEnabled(false);
    chkSperre.setFocusPainted(false);

    binding =
        org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
            this,
            org.jdesktop.beansbinding.ELProperty.create("${cidsBean.sperre}"),
            chkSperre,
            org.jdesktop.beansbinding.BeanProperty.create("selected"));
    bindingGroup.addBinding(binding);

    chkSperre.addActionListener(
        new java.awt.event.ActionListener() {

          @Override
          public void actionPerformed(final java.awt.event.ActionEvent evt) {
            chkSperreActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(3, 6, 3, 0);
    panKZValues.add(chkSperre, gridBagConstraints);

    scpBemerkung.setHorizontalScrollBarPolicy(
        javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scpBemerkung.setVerticalScrollBarPolicy(
        javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
    scpBemerkung.setMinimumSize(new java.awt.Dimension(6, 36));

    txtBemerkung.setColumns(3);
    txtBemerkung.setLineWrap(true);
    txtBemerkung.setRows(3);
    txtBemerkung.setMinimumSize(new java.awt.Dimension(0, 36));

    binding =
        org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
            this,
            org.jdesktop.beansbinding.ELProperty.create("${cidsBean.bemerkung}"),
            txtBemerkung,
            org.jdesktop.beansbinding.BeanProperty.create("text"),
            KassenzeichenPropertyConstants.PROP__BEMERKUNG);
    bindingGroup.addBinding(binding);

    scpBemerkung.setViewportView(txtBemerkung);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(3, 6, 3, 0);
    panKZValues.add(scpBemerkung, gridBagConstraints);

    txtKassenzeichen.setEditable(false);

    binding =
        org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
            this,
            org.jdesktop.beansbinding.ELProperty.create("${cidsBean.kassenzeichennummer8}"),
            txtKassenzeichen,
            org.jdesktop.beansbinding.BeanProperty.create("text"),
            KassenzeichenPropertyConstants.PROP__KASSENZEICHENNUMMER);
    bindingGroup.addBinding(binding);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 6, 3, 0);
    panKZValues.add(txtKassenzeichen, gridBagConstraints);

    txtSperreBemerkung.setBackground(getBackground());
    txtSperreBemerkung.setEditable(false);
    txtSperreBemerkung.setForeground(java.awt.Color.red);
    txtSperreBemerkung.setBorder(null);

    binding =
        org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
            this,
            org.jdesktop.beansbinding.ELProperty.create("${cidsBean.bemerkung_sperre}"),
            txtSperreBemerkung,
            org.jdesktop.beansbinding.BeanProperty.create("text"),
            KassenzeichenPropertyConstants.PROP__BEMERKUNG_SPERRE);
    bindingGroup.addBinding(binding);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 0);
    panKZValues.add(txtSperreBemerkung, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(7, 7, 7, 7);
    add(panKZValues, gridBagConstraints);

    jPanel2.setLayout(new java.awt.GridBagLayout());

    jLabel2.setText("Modus");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    jPanel2.add(jLabel2, gridBagConstraints);

    btgMode.add(togRegenMode);
    togRegenMode.setIcon(
        new javax.swing.ImageIcon(
            getClass().getResource("/de/cismet/verdis/res/regen_gr.png"))); // NOI18N
    togRegenMode.setToolTipText("Versiegelte Flächen");
    togRegenMode.setFocusable(false);
    togRegenMode.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    togRegenMode.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    togRegenMode.addActionListener(
        new java.awt.event.ActionListener() {

          @Override
          public void actionPerformed(final java.awt.event.ActionEvent evt) {
            togRegenModeActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    jPanel2.add(togRegenMode, gridBagConstraints);

    btgMode.add(togWDSRMode);
    togWDSRMode.setIcon(
        new javax.swing.ImageIcon(
            getClass().getResource("/de/cismet/verdis/res/esw_gr.png"))); // NOI18N
    togWDSRMode.setToolTipText("ESW");
    togWDSRMode.setFocusable(false);
    togWDSRMode.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    togWDSRMode.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    togWDSRMode.addActionListener(
        new java.awt.event.ActionListener() {

          @Override
          public void actionPerformed(final java.awt.event.ActionEvent evt) {
            togWDSRModeActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
    jPanel2.add(togWDSRMode, gridBagConstraints);

    btgMode.add(togInfoMode);
    togInfoMode.setIcon(
        new javax.swing.ImageIcon(
            getClass().getResource("/de/cismet/verdis/res/info_gr.png"))); // NOI18N
    togInfoMode.setSelected(true);
    togInfoMode.setToolTipText("Info");
    togInfoMode.setFocusable(false);
    togInfoMode.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    togInfoMode.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    togInfoMode.addActionListener(
        new java.awt.event.ActionListener() {

          @Override
          public void actionPerformed(final java.awt.event.ActionEvent evt) {
            togInfoModeActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 0;
    jPanel2.add(togInfoMode, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(3, 7, 3, 7);
    add(jPanel2, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
    gridBagConstraints.weightx = 1.0;
    add(sepTitle1, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
    gridBagConstraints.weightx = 1.0;
    add(sepTitle2, gridBagConstraints);

    bindingGroup.bind();
  } // </editor-fold>//GEN-END:initComponents
Exemple #13
0
  public void createGUI() {
    setLayout(new BorderLayout());
    toolBar = new JToolBar("options", JToolBar.HORIZONTAL);
    toolBar.setFloatable(false);
    toolBar.setOpaque(true);
    toolBar.setBackground(new Color(154, 12, 12));
    toolBar.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 15));
    selectAllCB = new JCheckBox("Select All");
    selectAllCB.setVisible(false);
    selectAllCB.setForeground(Color.white);
    selectAllCB.addActionListener(this);
    refreshBut = new JButton(new ImageIcon(this.getClass().getResource("/images/reloadIcon.png")));
    refreshBut.setVisible(false);
    refreshBut.setToolTipText("Refresh");
    refreshBut.setForeground(new Color(20, 88, 49));
    refreshBut.addActionListener(this);
    backBut = new JButton(new ImageIcon(this.getClass().getResource("/images/backIcon.png")));
    backBut.setVisible(false);
    backBut.setToolTipText("Back");
    backBut.setForeground(new Color(20, 88, 49));
    backBut.addActionListener(this);
    deleteBut = new JButton(new ImageIcon(this.getClass().getResource("/images/trashIcon.png")));
    deleteBut.setToolTipText("Delete");
    deleteBut.setForeground(Color.red);
    deleteBut.setVisible(false);
    deleteBut.addActionListener(this);
    deleteBut.setBackground(Color.red);
    restoreBut = new JButton(new ImageIcon(this.getClass().getResource("/images/restoreIcon.png")));
    restoreBut.setToolTipText("Restore");
    restoreBut.setForeground(Color.blue);
    restoreBut.setVisible(false);
    restoreBut.addActionListener(this);
    toolBar.addSeparator(new Dimension(10, 5));
    toolBar.add(selectAllCB);
    toolBar.add(backBut);
    toolBar.add(refreshBut);
    toolBar.add(deleteBut);
    toolBar.add(restoreBut);
    add(toolBar, "North");
    JPanel centPan = new JPanel(new GridBagLayout());
    centPan.setBackground(new Color(52, 86, 70));
    JLabel label = new JLabel("Select A Category From Left Pane");
    label.setFont(new Font("arial", Font.BOLD, 35));
    label.setForeground(Color.yellow);
    centPan.add(label);
    contentPan = new JScrollPane(centPan);
    contentPan.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    add(contentPan, "Center");
    contentPan.repaint();

    db = new Database();
    //        inboxSet = db.getData("SELECT * FROM messages WHERE tag='inbox' ORDER BY msg_id
    // desc");
    //        sentmailSet = db.getData("SELECT * FROM messages WHERE tag='sentmail' ORDER BY msg_id
    // desc");
    //        draftSet = db.getData("SELECT * FROM messages WHERE tag='draft' ORDER BY msg_id
    // desc");
    //        outboxSet = db.getData("SELECT * FROM messages WHERE tag='outbox' ORDER BY msg_id
    // desc");
    //        trashSet = db.getData("SELECT * FROM messages,trash WHERE messages.tag='trash' and
    // messages.msg_id=trash.msg_id ORDER BY deleted_at desc");

  }
  /** Sets up the GUI (panels, buttons, etc) and displays it on the screen. */
  private void init() {
    DecimalFormat df;
    int xUnits;
    String unitStr;
    String distStr;
    setForeground(Color.black);
    setTitle("Center Distances version 2  07/14/08");

    df = new DecimalFormat("0.000E0");

    GridBagConstraints gbc = new GridBagConstraints();
    int yPos = 0;
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.weightx = 1;
    gbc.insets = new Insets(3, 3, 3, 3);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridx = 0;
    gbc.gridy = yPos++;

    JPanel mainPanel = new JPanel(new GridBagLayout());
    mainPanel.setForeground(Color.black);
    mainPanel.setBorder(buildTitledBorder("Input parameters"));

    blueMinLabel = new JLabel("Minimum number of blue pixels per nucleus");
    blueMinLabel.setForeground(Color.black);
    blueMinLabel.setFont(serif12);
    gbc.gridx = 0;
    gbc.gridy = yPos;
    mainPanel.add(blueMinLabel, gbc);

    blueMinText = new JTextField(5);
    if (image.getNDims() == 2) {
      blueMinText.setText("1000");
    } else {
      blueMinText.setText("20000");
    }
    blueMinText.setFont(serif12);
    gbc.gridx = 1;
    gbc.gridy = yPos++;
    mainPanel.add(blueMinText, gbc);

    redMinLabel = new JLabel("Minimum red pixel count");
    redMinLabel.setForeground(Color.black);
    redMinLabel.setFont(serif12);
    gbc.gridx = 0;
    gbc.gridy = yPos;
    mainPanel.add(redMinLabel, gbc);

    redMinText = new JTextField(5);
    redMinText.setText("50");
    redMinText.setFont(serif12);
    gbc.gridx = 1;
    gbc.gridy = yPos++;
    mainPanel.add(redMinText, gbc);

    redFractionLabel = new JLabel("Fraction of red pixels to consider");
    redFractionLabel.setForeground(Color.black);
    redFractionLabel.setFont(serif12);
    gbc.gridx = 0;
    gbc.gridy = yPos;
    mainPanel.add(redFractionLabel, gbc);

    redFractionText = new JTextField(5);
    redFractionText.setText("0.15");
    redFractionText.setFont(serif12);
    gbc.gridx = 1;
    gbc.gridy = yPos++;
    mainPanel.add(redFractionText, gbc);

    xUnits = image.getFileInfo(0).getUnitsOfMeasure()[0];
    if (xUnits != Unit.UNKNOWN_MEASURE.getLegacyNum()) {
      unitStr = (Unit.getUnitFromLegacyNum(xUnits)).toString();
      greenMergingLabel = new JLabel("Green merging radius around peak (" + unitStr + ")");
    } else {
      greenMergingLabel = new JLabel("Green merging radius around peak");
    }
    greenMergingLabel.setForeground(Color.black);
    greenMergingLabel.setFont(serif12);
    gbc.gridx = 0;
    gbc.gridy = yPos;
    mainPanel.add(greenMergingLabel, gbc);

    if (image.getNDims() == 2) {
      // mergingDistance = 8.0f * image.getFileInfo(0).getResolutions()[0];
      mergingDistance = 0.0f;
    } else {
      // mergingDistance = 4.0f * image.getFileInfo(0).getResolutions()[0];
      mergingDistance = 0.0f;
    }
    distStr = df.format(mergingDistance);
    greenMergingText = new JTextField(10);
    greenMergingText.setText(distStr);
    greenMergingText.setFont(serif12);
    gbc.gridx = 1;
    gbc.gridy = yPos++;
    mainPanel.add(greenMergingText, gbc);

    greenMinLabel = new JLabel("Minimum green pixel count");
    greenMinLabel.setForeground(Color.black);
    greenMinLabel.setFont(serif12);
    gbc.gridx = 0;
    gbc.gridy = yPos;
    mainPanel.add(greenMinLabel, gbc);

    greenMinText = new JTextField(5);
    greenMinText.setText("10");
    greenMinText.setFont(serif12);
    gbc.gridx = 1;
    gbc.gridy = yPos++;
    mainPanel.add(greenMinText, gbc);

    greenFractionLabel = new JLabel("Fraction of green pixels to consider");
    greenFractionLabel.setForeground(Color.black);
    greenFractionLabel.setFont(serif12);
    gbc.gridx = 0;
    gbc.gridy = yPos;
    mainPanel.add(greenFractionLabel, gbc);

    greenFractionText = new JTextField(5);
    greenFractionText.setText("0.01");
    greenFractionText.setFont(serif12);
    gbc.gridx = 1;
    gbc.gridy = yPos++;
    mainPanel.add(greenFractionText, gbc);

    greenRegionsLabel = new JLabel("Green regions per cell");
    greenRegionsLabel.setForeground(Color.black);
    greenRegionsLabel.setFont(serif12);
    gbc.gridx = 0;
    gbc.gridy = yPos;
    mainPanel.add(greenRegionsLabel, gbc);

    JPanel buttonPanel = new JPanel(new GridBagLayout());

    greenGroup = new ButtonGroup();

    oneButton = new JRadioButton("1", false);
    oneButton.setForeground(Color.black);
    oneButton.setFont(serif12);
    greenGroup.add(oneButton);
    gbc.gridx = 0;
    gbc.gridy = 0;
    buttonPanel.add(oneButton, gbc);

    twoButton = new JRadioButton("2", true);
    twoButton.setForeground(Color.black);
    twoButton.setFont(serif12);
    greenGroup.add(twoButton);
    gbc.gridx = 1;
    gbc.gridy = 0;
    buttonPanel.add(twoButton, gbc);

    threeButton = new JRadioButton("3", false);
    threeButton.setForeground(Color.black);
    threeButton.setFont(serif12);
    greenGroup.add(threeButton);
    gbc.gridx = 2;
    gbc.gridy = 0;
    buttonPanel.add(threeButton, gbc);

    fourButton = new JRadioButton("4", false);
    fourButton.setForeground(Color.black);
    fourButton.setFont(serif12);
    greenGroup.add(fourButton);
    gbc.gridx = 3;
    gbc.gridy = 0;
    buttonPanel.add(fourButton, gbc);

    gbc.gridx = 1;
    gbc.gridy = yPos++;
    mainPanel.add(buttonPanel, gbc);

    twoBox = new JCheckBox("Use 2 top gray levels in green segmentation", true);
    twoBox.setForeground(Color.black);
    twoBox.setFont(serif12);
    gbc.gridx = 0;
    gbc.gridy = yPos++;
    mainPanel.add(twoBox, gbc);

    blueValueLabel =
        new JLabel("Fraction of blue transition from image min to max at nucleus boundary");
    blueValueLabel.setForeground(Color.black);
    blueValueLabel.setFont(serif12);
    gbc.gridx = 0;
    gbc.gridy = yPos;
    mainPanel.add(blueValueLabel, gbc);

    blueValueText = new JTextField(5);
    blueValueText.setText("0.15");
    blueValueText.setFont(serif12);
    gbc.gridx = 1;
    gbc.gridy = yPos++;
    mainPanel.add(blueValueText, gbc);

    blueSmoothBox = new JCheckBox("Smooth blue VOI contours with AlgorithmBSmooth", true);
    blueSmoothBox.setForeground(Color.black);
    blueSmoothBox.setFont(serif12);
    blueSmoothBox.addActionListener(this);
    gbc.gridx = 0;
    gbc.gridy = yPos++;
    mainPanel.add(blueSmoothBox, gbc);

    interpolationLabel = new JLabel("Number of interpolation points determined by divisor (> 1.0)");
    interpolationLabel.setForeground(Color.black);
    interpolationLabel.setFont(serif12);
    gbc.gridx = 0;
    gbc.gridy = yPos;
    mainPanel.add(interpolationLabel, gbc);

    interpolationText = new JTextField(5);
    interpolationText.setText("24.0");
    interpolationText.setFont(serif12);
    gbc.gridx = 1;
    gbc.gridy = yPos++;
    mainPanel.add(interpolationText, gbc);

    getContentPane().add(mainPanel, BorderLayout.CENTER);
    getContentPane().add(buildButtons(), BorderLayout.SOUTH);

    pack();
    setVisible(true);
    setResizable(false);
    System.gc();
  } // end init()
Exemple #15
0
  public TaskList() {
    GridBagLayout layout = new GridBagLayout();
    this.setLayout(layout);
    this.setBackground(Color.BLACK);

    taskListLabel = new JLabel("Task List");
    taskListLabel.setHorizontalAlignment(SwingConstants.HORIZONTAL);
    taskListLabel.setForeground(Color.WHITE);

    newTaskTextField = new JTextField();

    addButton = new JButton("Add task");
    deleteButton = new JButton("Change completeness");
    refreshButton = new JButton("Refresh");

    deleteCompletedButton = new JButton("Delete completed tasks");

    deleteButton.setBackground(Color.BLACK);
    deleteButton.setForeground(Color.ORANGE);
    deleteCompletedButton.setBackground(Color.BLACK);
    deleteCompletedButton.setForeground(Color.RED);
    addButton.setBackground(Color.BLACK);
    addButton.setForeground(Color.GREEN);
    refreshButton.setBackground(Color.BLACK);
    refreshButton.setForeground(Color.GREEN);

    completedCheckBox = new JCheckBox("Show completed tasks");
    notCompletedCheckBox = new JCheckBox("Show not completed tasks");
    completedCheckBox.setBackground(Color.BLACK);
    completedCheckBox.setForeground(Color.WHITE);
    notCompletedCheckBox.setBackground(Color.BLACK);
    notCompletedCheckBox.setForeground(Color.WHITE);
    notCompletedCheckBox.setSelected(true);

    taskTableModel = new TaskTableModel();
    taskTableView = new TaskTableView(taskTableModel);

    taskTableModel.refresh(2);

    addButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (newTaskTextField.getText().equals("")) {
              JOptionPane.showMessageDialog(null, "No text in the field! Write something...");
            } else {
              Date date = new Date();
              String dateString = date.toString();
              String task = newTaskTextField.getText();
              try {
                taskTableModel.add(dateString, task, false);
              } catch (FileNotFoundException e1) {
                e1.printStackTrace();
              }
              newTaskTextField.setText("");
            }
          }
        });

    deleteButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            int pos = taskTableView.getSelectedRow();
            if (pos > -1) {
              try {
                taskTableModel.delete(pos);
              } catch (FileNotFoundException e1) {
                e1.printStackTrace();
              }
            }
          }
        });

    deleteCompletedButton.addActionListener(
        new AbstractAction() {
          @Override
          public void actionPerformed(ActionEvent e) {
            try {
              taskTableModel.deleteCompleted();
            } catch (FileNotFoundException e1) {
              e1.printStackTrace();
            }
          }
        });

    refreshButton.addActionListener(
        new AbstractAction() {
          @Override
          public void actionPerformed(ActionEvent e) {
            int count = 0;
            if ((completedCheckBox.isSelected()) && (notCompletedCheckBox.isSelected())) {
              count = 3;
            }
            if ((!completedCheckBox.isSelected()) && (notCompletedCheckBox.isSelected())) {
              count = 2;
            }
            if ((completedCheckBox.isSelected()) && (!notCompletedCheckBox.isSelected())) {
              count = 1;
            }
            if ((!completedCheckBox.isSelected()) && (!notCompletedCheckBox.isSelected())) {
              count = 0;
            }
            taskTableModel.refresh(count);
          }
        });

    this.add(
        taskListLabel,
        new GridBagConstraints(
            0,
            0,
            GridBagConstraints.REMAINDER,
            1,
            1,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(2, 2, 2, 2),
            0,
            0));
    this.add(
        taskTableView,
        new GridBagConstraints(
            0,
            1,
            GridBagConstraints.REMAINDER,
            1,
            1,
            1,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(2, 2, 2, 2),
            0,
            0));
    this.add(
        completedCheckBox,
        new GridBagConstraints(
            0,
            2,
            1,
            1,
            1,
            1,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(2, 2, 2, 2),
            0,
            0));
    this.add(
        notCompletedCheckBox,
        new GridBagConstraints(
            1,
            2,
            1,
            1,
            1,
            1,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(2, 2, 2, 2),
            0,
            0));
    this.add(
        refreshButton,
        new GridBagConstraints(
            2,
            2,
            GridBagConstraints.REMAINDER,
            1,
            1,
            1,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(2, 2, 2, 2),
            0,
            0));
    this.add(
        deleteButton,
        new GridBagConstraints(
            0,
            3,
            GridBagConstraints.REMAINDER,
            1,
            1,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(2, 2, 2, 2),
            0,
            0));
    this.add(
        deleteCompletedButton,
        new GridBagConstraints(
            0,
            4,
            GridBagConstraints.REMAINDER,
            1,
            1,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(2, 2, 2, 2),
            0,
            0));
    this.add(
        newTaskTextField,
        new GridBagConstraints(
            0,
            5,
            2,
            1,
            1,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(2, 2, 2, 2),
            0,
            0));
    this.add(
        addButton,
        new GridBagConstraints(
            3,
            5,
            1,
            1,
            0,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(2, 2, 2, 2),
            0,
            0));
  }
  public void createDialogBox(String Roll, String ExamYear) {
    RPS = new JDialog();

    this.NumberOfCourses = DataTransfer.Courses.size();
    this.Roll = Roll;
    this.ExamYear = ExamYear;
    this.Session = setSession();
    final int Final = NumberOfCourses;
    final int Height = (Final * 40 + 270 > 600) ? Final * 40 + 270 : 600;

    Panel =
        new JPanel() {
          protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            g.drawImage(
                new ImageIcon(getClass().getResource("/Icons/8.jpg")).getImage(),
                0,
                0,
                950,
                Height,
                null);
            ButtonBorder.paintBorder(this, g, 284, 84 + Final * 40 + 60 + 60, 252, 32);
          }
        };

    Panel.setPreferredSize(
        new Dimension(
            600,
            NumberOfCourses * 40
                + 150
                + 60
                + 60)); // 50+(100*5+3*5)+50, 120+NumberOfCourses*30+(NumberOfCourses-1)*10+50+60
    Panel.setLayout(null);

    RollLabel = new JLabel("Roll  :  " + this.Roll, SwingConstants.CENTER);
    RollLabel.setForeground(Color.WHITE);
    RollLabel.setFont(new Font("SERRIF", Font.BOLD, 15));
    RollLabel.setBounds(112, 20, 615, 20);
    Panel.add(RollLabel);

    SessionLabel = new JLabel("Session  :  " + this.Session, SwingConstants.CENTER);
    SessionLabel.setForeground(Color.WHITE);
    SessionLabel.setFont(new Font("SERRIF", Font.BOLD, 15));
    SessionLabel.setBounds(112, 40, 615, 20);
    Panel.add(SessionLabel);

    ColumnName = new JLabel("", SwingConstants.LEFT);
    ColumnName.setText(
        "     COURSE NO.        TOTAL MARKS      GRADE POINT      LETTER GRADE        COURSE CREDIT                 EXAM-TYPE");
    ColumnName.setForeground(Color.WHITE);
    ColumnName.setFont(new Font("SERRIF", Font.BOLD, 10));
    ColumnName.setBounds(112, 80, 635, 30);
    Panel.add(ColumnName);

    TakenLabel1 = new JLabel("Credit Hour Taken  :  ", SwingConstants.RIGHT);
    TakenLabel1.setForeground(Color.WHITE);
    TakenLabel1.setFont(new Font("SERRIF", Font.ITALIC, 12));
    TakenLabel1.setBounds(112, 85 + NumberOfCourses * 40 + 60, 130, 20);
    Panel.add(TakenLabel1);

    TakenLabel2 = new JLabel("", SwingConstants.LEFT);
    TakenLabel2.setForeground(Color.WHITE);
    TakenLabel2.setFont(new Font("SERRIF", Font.ITALIC, 12));
    TakenLabel2.setBounds(242, 85 + NumberOfCourses * 40 + 60, 50, 20);
    Panel.add(TakenLabel2);

    CompletedLabel1 = new JLabel("Credit Hour Completed  :  ", SwingConstants.RIGHT);
    CompletedLabel1.setForeground(Color.WHITE);
    CompletedLabel1.setFont(
        new Font("SERRIF", Font.ITALIC, 12)); // 50,85+NumberOfCourses*40+60+20,150,20
    CompletedLabel1.setBounds(342, 85 + NumberOfCourses * 40 + 60, 150, 20);
    Panel.add(CompletedLabel1);

    CompletedLabel2 = new JLabel("opps", SwingConstants.LEFT);
    CompletedLabel2.setForeground(Color.WHITE);
    CompletedLabel2.setFont(new Font("SERRIF", Font.ITALIC, 12));
    CompletedLabel2.setBounds(492, 85 + NumberOfCourses * 40 + 60, 50, 20);
    Panel.add(CompletedLabel2);

    GPALabel1 = new JLabel("GPA  :  ", SwingConstants.RIGHT);
    GPALabel1.setForeground(Color.WHITE);
    GPALabel1.setFont(new Font("SERRIF", Font.ITALIC, 12));
    GPALabel1.setBounds(552, 85 + NumberOfCourses * 40 + 60, 80, 20);
    Panel.add(GPALabel1);

    GPALabel2 = new JLabel("36.25", SwingConstants.LEFT);
    GPALabel2.setForeground(Color.WHITE);
    GPALabel2.setFont(new Font("SERRIF", Font.ITALIC, 12));
    GPALabel2.setBounds(632, 85 + NumberOfCourses * 40 + 60, 50, 20);
    Panel.add(GPALabel2);

    DocButton = new JButton("Create Document");
    DocButton.setFont(new Font("SERRIF", Font.BOLD, 15));
    DocButton.setBounds(
        285,
        85 + NumberOfCourses * 40 + 60 + 60,
        250,
        30); // 50+NumberOfCourses*30+(NumberOfCourses-1)*10+35
    DocButton.addActionListener(this);
    Panel.add(DocButton);

    CheckAll = new JCheckBox("Uncheck all");
    CheckAll.setForeground(Color.WHITE);
    CheckAll.setFont(new Font("SERRIF", Font.BOLD + Font.ITALIC, 12));
    CheckAll.setOpaque(false);
    CheckAll.setSelected(true);
    CheckAll.addActionListener(this);

    setComponentsOnTheGrid();

    Scroll =
        new JScrollPane(
            Panel,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    RPS.add(Scroll);

    RPS.setModal(true);
    RPS.setTitle(" Result : Particular Student ");
    RPS.setResizable(false);
    RPS.setSize(840, 565);
    RPS.setLocation(
        250, 100 + (565 - RPS.getHeight()) / 2); // setiing RPS dialogbox in the middle of MenuFrame
    RPS.setVisible(true);
  }
Exemple #17
0
  private void showSettingsMenu() {
    JCheckBox snd = new JCheckBox("Музыка");
    snd.setSize(310, 75);
    snd.setSelected(Commons.PLAY_MUSIC);
    snd.setLocation(Commons.WIDTH / 2 - 310 / 2, 230);
    snd.setForeground(Color.GREEN);
    snd.setFont(new Font("arial", 0, 40));
    snd.setBorderPainted(false);
    snd.setFocusPainted(false);
    snd.setContentAreaFilled(false);
    snd.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            Commons.PLAY_MUSIC = snd.isSelected();
          }
        });

    String[] items = {"Легкая", "Средняя", "Сложная", "Невозможная"};
    JComboBox<String> list = new JComboBox<String>(items);
    switch (Commons.DIFFICULTY) {
      case Commons.EASY_DIFFICULTY_CLOUDS_CNT:
        list.setSelectedIndex(0);
        break;
      case Commons.MEDIUM_DIFFICULTY_CLOUDS_CNT:
        list.setSelectedIndex(1);
        break;
      case Commons.HARD_DIFFICULTY_CLOUDS_CNT:
        list.setSelectedIndex(2);
        break;
      case Commons.IMPOSSIBLE_DIFFICULTY_CLOUDS_CNT:
        list.setSelectedIndex(3);
        break;
    }
    list.setSize(310, 40);
    list.setLocation(Commons.WIDTH / 2 - 310 / 2, 430);
    list.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            int st = list.getSelectedIndex();
            switch (st) {
              case 0:
                Commons.DIFFICULTY = Commons.EASY_DIFFICULTY_CLOUDS_CNT;
                break;
              case 1:
                Commons.DIFFICULTY = Commons.MEDIUM_DIFFICULTY_CLOUDS_CNT;
                break;
              case 2:
                Commons.DIFFICULTY = Commons.HARD_DIFFICULTY_CLOUDS_CNT;
                break;
              case 3:
                Commons.DIFFICULTY = Commons.IMPOSSIBLE_DIFFICULTY_CLOUDS_CNT;
                break;
            }
          }
        });
    add(list);

    JLabel diff_lbl = new JLabel();
    diff_lbl.setText("Сложность:");
    diff_lbl.setFont(new Font("serif", 0, 40));
    diff_lbl.setForeground(Color.GREEN);
    diff_lbl.setSize(300, 75);
    diff_lbl.setLocation(list.getLocation().x, list.getLocation().y - 100);
    add(diff_lbl);

    JButton back = new JButton("Назад");
    back.setSize(190, 75);
    back.setLocation(Commons.WIDTH / 2 - 190 / 2, Commons.HEIGHT - 150);
    back.setForeground(Color.GREEN);
    back.setBorderPainted(false);
    back.setFocusPainted(false);
    back.setContentAreaFilled(false);
    back.setFont(new Font("serif", 0, 40));
    back.addActionListener(ev -> showMainMenu());
    add(back);
    add(snd);
  }
  /** Create the frame. */
  public MultipleResultDisplay(final ScanPackage frame, final List<Person> results) {
    this.results = (ArrayList<Person>) results;
    setBackground(new Color(0, 128, 0));
    setTitle("Multiple Results");
    setResizable(false);
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setBounds(100, 100, 412, 232);
    contentPane = new JPanel();
    contentPane.setForeground(new Color(255, 255, 255));
    contentPane.setBackground(new Color(0, 128, 0));
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JLabel lblNewLabel = new JLabel("There were multiple results to your search.");
    lblNewLabel.setForeground(new Color(255, 255, 255));
    lblNewLabel.setBounds(73, 11, 434, 37);
    contentPane.add(lblNewLabel);

    JLabel lblrnPleaseSelect = new JLabel("Please select the person you would like to use.");
    lblrnPleaseSelect.setForeground(new Color(255, 255, 255));
    lblrnPleaseSelect.setBounds(73, 59, 361, 14);
    contentPane.add(lblrnPleaseSelect);

    JButton btnSelect = new JButton("OK");
    btnSelect.setBounds(307, 175, 89, 23);
    contentPane.add(btnSelect);

    JPanel resultPanel = new JPanel();
    JScrollPane scrollPane =
        new JScrollPane(
            resultPanel,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setBounds(21, 84, 361, 80);
    contentPane.add(scrollPane);

    // scrollPane.setViewportView(resultPanel);
    resultPanel.setForeground(Color.WHITE);
    resultPanel.setBackground(new Color(51, 204, 0));
    resultPanel.setLayout(new GridLayout(0, 2, 0, 0));

    final ButtonGroup group = new ButtonGroup();

    for (Person p : results) {
      String s = p.getLastName() + " " + p.getFirstName() + " " + p.getBox();
      JCheckBox c = new JCheckBox(s);
      c.setBackground(new Color(51, 204, 0));
      c.setForeground(Color.WHITE);
      checkBoxes.add(c);
      group.add(c);
      resultPanel.add(c);
    }

    btnSelect.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent arg0) {
            JCheckBox ch = null;
            for (JCheckBox c : checkBoxes) {
              if (c.isSelected()) {
                ch = c;
              }
            }
            int i = checkBoxes.indexOf(ch);
            Person selected = results.get(i);
            frame.getBoxText().setText(selected.getBox());
            frame.getComboBox().setSelectedItem(selected.getStop());
            frame.getNameText().setText(selected.getFirstName());
            frame.getLastNameText().setText(selected.getLastName());
            frame.selectedPerson = selected;
            dispose();
          }
        });
    this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setVisible(true);
  }
Exemple #19
0
  private void makeMenuScreen() {
    menu = new JPanel();
    menu.setBackground(Color.BLACK);
    menu.setLayout(null);
    menu.setBounds(0, 0, width, height);

    try {
      BufferedImage menuIMG =
          ImageIO.read(this.getClass().getResource("/Resources/MenuBackground.png"));
      // BufferedImage menuIMG = ImageIO.read(new
      // File("M:/ComputerProgrammingJava/InsaneMouse_03/src/Resources/MenuBackground.png"));
      menuIMGL =
          new JLabel(
              new ImageIcon(
                  menuIMG.getScaledInstance(
                      (int) (width * 0.8), (int) (height * 0.8), Image.SCALE_SMOOTH)));
      menuIMGL.setBounds(0, 0, width, height);
    } catch (Exception e) {
    }

    highscoreL = new JLabel(String.valueOf(highscore));
    highscoreL.setBackground(Color.darkGray);
    highscoreL.setBounds((width / 2) + 100, (height / 2) + 70, 500, 100);
    highscoreL.setForeground(Color.white);

    easy = new JButton("Easy");
    hard = new JButton("Hard");

    easy.addActionListener(this);
    hard.addActionListener(this);

    easy.setBounds((width / 2) - 60, (height / 2) - 50, 120, 20);
    hard.setBounds((width / 2) - 60, height / 2 - 10, 120, 20);

    onePlayerRB = new JRadioButton("One Player");
    twoPlayerRB = new JRadioButton("Two Player");
    mouseRB = new JRadioButton("Mouse (Player 1)");
    keyboardRB = new JRadioButton("Keyboard (Player 1)");
    keyboardSpeedS1 = new JSlider(JSlider.HORIZONTAL, 10, 300, 50);
    keyboardSpeedS2 = new JSlider(JSlider.HORIZONTAL, 10, 300, 50);
    musicCB = new JCheckBox("Music");

    onePlayerRB.setBackground(null);
    twoPlayerRB.setBackground(null);
    mouseRB.setBackground(null);
    keyboardRB.setBackground(null);
    keyboardSpeedS1.setBackground(null);
    keyboardSpeedS2.setBackground(null);
    musicCB.setBackground(null);

    onePlayerRB.setForeground(Color.WHITE);
    twoPlayerRB.setForeground(Color.WHITE);
    mouseRB.setForeground(Color.WHITE);
    keyboardRB.setForeground(Color.WHITE);
    keyboardSpeedS1.setForeground(Color.WHITE);
    keyboardSpeedS2.setForeground(Color.WHITE);
    musicCB.setForeground(Color.WHITE);

    ButtonGroup playerChoice = new ButtonGroup();
    playerChoice.add(onePlayerRB);
    playerChoice.add(twoPlayerRB);
    onePlayerRB.setSelected(true);

    ButtonGroup peripheralChoice = new ButtonGroup();
    peripheralChoice.add(mouseRB);
    peripheralChoice.add(keyboardRB);
    mouseRB.setSelected(true);

    musicCB.setSelected(true);

    onePlayerRB.setBounds((width / 2) + 100, (height / 2) - 50, 100, 20);
    twoPlayerRB.setBounds((width / 2) + 100, (height / 2) - 30, 100, 20);
    mouseRB.setBounds((width / 2) + 100, (height / 2), 200, 20);
    keyboardRB.setBounds((width / 2) + 100, (height / 2) + 20, 200, 20);
    keyboardSpeedS1.setBounds(width / 2 - 120, height / 2 + 100, 200, 50);
    keyboardSpeedS2.setBounds(width / 2 - 120, height / 2 + 183, 200, 50);
    musicCB.setBounds((width / 2) + 100, (height / 2) + 50, 100, 20);

    keyboardSpeedL1 = new JLabel("Keyboard Speed (Player One)");
    keyboardSpeedL1.setForeground(Color.WHITE);
    keyboardSpeedL1.setBounds(width / 2 - 113, height / 2 + 67, 200, 50);

    keyboardSpeedL2 = new JLabel("Keyboard Speed (Player Two)");
    keyboardSpeedL2.setForeground(Color.WHITE);
    keyboardSpeedL2.setBounds(width / 2 - 113, height / 2 + 150, 200, 50);

    howTo = new JButton("How To Play");
    howTo.addActionListener(this);
    howTo.setBounds((width / 2) - 60, height / 2 + 30, 120, 20);

    try {
      BufferedImage howToIMG = ImageIO.read(this.getClass().getResource("/Resources/HowTo.png"));
      // BufferedImage howToIMG = ImageIO.read(new
      // File("M:/ComputerProgrammingJava/InsaneMouse_03/src/Resources/HowTo.png"));
      howToIMGL = new JLabel(new ImageIcon(howToIMG));
      howToIMGL.setBounds(
          width / 2 - howToIMG.getWidth() / 2,
          height / 2 - howToIMG.getHeight() / 2,
          howToIMG.getWidth(),
          howToIMG.getHeight());
    } catch (Exception e) {
    }

    howToBack = new JButton("X");
    howToBack.setBounds(
        (int) (width / 2 + width * 0.25) - 50, (int) (height / 2 - height * 0.25), 50, 50);
    howToBack.setBackground(Color.BLACK);
    howToBack.setForeground(Color.WHITE);
    howToBack.addActionListener(this);

    menu.add(easy);
    menu.add(hard);
    menu.add(howTo);
    menu.add(highscoreL);
    menu.add(onePlayerRB);
    menu.add(twoPlayerRB);
    menu.add(mouseRB);
    menu.add(keyboardRB);
    menu.add(keyboardSpeedL1);
    menu.add(keyboardSpeedL2);
    menu.add(keyboardSpeedS1);
    menu.add(keyboardSpeedS2);
    menu.add(musicCB);
    menu.add(menuIMGL);

    back = new JButton("Back");
    back.setBounds(width / 2 - 40, height / 2, 100, 20);
    back.addActionListener(this);
    back.setVisible(false);
    this.add(back);
  }