Пример #1
0
  public void valueChanged(ListSelectionEvent e) {
    if (e.getSource() == fontList) {
      tempValue = (String) fontList.getSelectedValue();
      if (tempValue != null) {
        fontBox.setText(tempValue);
      } else fontBox.setText("");
    } else if (e.getSource() == styleList) {
      tempValue = (String) styleList.getSelectedValue();
      if (tempValue != null) {
        styleBox.setText(tempValue);
      } else styleBox.setText("");
    } else if (e.getSource() == sizeList) {
      tempValue = (String) sizeList.getSelectedValue();
      if (tempValue != null) {
        sizeBox.setText(tempValue);
      } else sizeBox.setText("");
    }

    if (fontValid()) {
      this.lastFont = new Font(getFontName(), getFontStyle(), getFontSize());
      this.lastColor = colorChooser.getColor();

      updatePreview();
    }
  }
  // Implementation of valueChanged
  public void valueChanged(ListSelectionEvent e) {
    if (e.getSource() == table.getSelectionModel()) {
      ListSelectionModel ls = table.getSelectionModel();

      int index = ls.getMinSelectionIndex();
      long id = (long) table.getValueAt(index, 0);

      updateFeesData(id);
    } else {
      ListSelectionModel ls = feestable.getSelectionModel();

      int index = ls.getMinSelectionIndex();

      float feespayed = (float) feestable.getValueAt(index, 1);
      float totalfees = (float) feestable.getValueAt(index, 2);

      feespayedlabel.setText("Fees Payed: " + feespayed);
      totalfeeslabel.setText("Total Fees: " + totalfees);

      if (totalfees - feespayed > 0) {
        feesduelabel.setText("Fees Due: " + (totalfees - feespayed));
      }

      panel_6.revalidate();
    }
  }
    public void valueChanged(ListSelectionEvent e) {
      ListSelectionModel lsm = (ListSelectionModel) e.getSource();

      int firstIndex = e.getFirstIndex();
      int lastIndex = e.getLastIndex();
      boolean isAdjusting = e.getValueIsAdjusting();
      output.append(
          "Event for indexes "
              + firstIndex
              + " - "
              + lastIndex
              + "; isAdjusting is "
              + isAdjusting
              + "; selected indexes:");

      if (lsm.isSelectionEmpty()) {
        output.append(" <none>");
      } else {
        // Find out which indexes are selected.
        int minIndex = lsm.getMinSelectionIndex();
        int maxIndex = lsm.getMaxSelectionIndex();
        for (int i = minIndex; i <= maxIndex; i++) {
          if (lsm.isSelectedIndex(i)) {
            output.append(" " + i);
          }
        }
      }
      output.append(newline);
      output.setCaretPosition(output.getDocument().getLength());
    }
Пример #4
0
    public void valueChanged(ListSelectionEvent e) {
      ListSelectionModel lsm = (ListSelectionModel) e.getSource();

      int index = list.getSelectedIndex();
      Directory dir = directoryList.getDirectory(index);

      waitField.setValue(dir.getWaitInterval());
      checkField.setValue(dir.getInterval());
      if (dir.copy) {
        copyButton.setSelected(true);
      } else {
        moveButton.setSelected(true);
      }
      if (dir.destination != null) {

        destination.setText("Destination Directory: " + dir.destination.toString());
        startButton.setEnabled(true);
        if (dir.backupNumber == 0) {
          startButton.setEnabled(true);
          stopButton.setEnabled(false);
        } else {
          startButton.setEnabled(false);
          stopButton.setEnabled(true);
        }
      } else {
        destination.setText("Destination Directory: ");
        startButton.setEnabled(false);
      }
    }
Пример #5
0
  public void valueChanged(ListSelectionEvent evt) {
    if (evt.getSource() == mYParamList.getJList()) {
      mSelYParam = mYParamList.getJList().getSelectedIndex();
      setAdvancedValues();
    }

    generatePlotName();
  }
Пример #6
0
    public void valueChanged(ListSelectionEvent evt) {
      if (!evt.getValueIsAdjusting()) {
        JFileChooser chooser = getFileChooser();
        FileSystemView fsv = chooser.getFileSystemView();
        JList list = (JList) evt.getSource();

        int fsm = chooser.getFileSelectionMode();
        boolean useSetDirectory = usesSingleFilePane && (fsm == JFileChooser.FILES_ONLY);

        if (chooser.isMultiSelectionEnabled()) {
          File[] files = null;
          Object[] objects = list.getSelectedValues();
          if (objects != null) {
            if (objects.length == 1
                && ((File) objects[0]).isDirectory()
                && chooser.isTraversable(((File) objects[0]))
                && (useSetDirectory || !fsv.isFileSystem(((File) objects[0])))) {
              setDirectorySelected(true);
              setDirectory(((File) objects[0]));
            } else {
              ArrayList<File> fList = new ArrayList<File>(objects.length);
              for (Object object : objects) {
                File f = (File) object;
                boolean isDir = f.isDirectory();
                if ((chooser.isFileSelectionEnabled() && !isDir)
                    || (chooser.isDirectorySelectionEnabled() && fsv.isFileSystem(f) && isDir)) {
                  fList.add(f);
                }
              }
              if (fList.size() > 0) {
                files = fList.toArray(new File[fList.size()]);
              }
              setDirectorySelected(false);
            }
          }
          chooser.setSelectedFiles(files);
        } else {
          File file = (File) list.getSelectedValue();
          if (file != null
              && file.isDirectory()
              && chooser.isTraversable(file)
              && (useSetDirectory || !fsv.isFileSystem(file))) {

            setDirectorySelected(true);
            setDirectory(file);
            if (usesSingleFilePane) {
              chooser.setSelectedFile(null);
            }
          } else {
            setDirectorySelected(false);
            if (file != null) {
              chooser.setSelectedFile(file);
            }
          }
        }
      }
    }
    /// Pass user's interaction with list to appropriate handler
    public void valueChanged(ListSelectionEvent e) {
      if (e.getSource() == sourceList) {
        if (!e.getValueIsAdjusting()) {
          int indexS = sourceList.getSelectedIndex();
          srcID = indexS + 1;
          drawTest.repaint();
        }
      }

      if (e.getSource() == destList) {
        if (!e.getValueIsAdjusting()) {
          int indexD = destList.getSelectedIndex();
          dstID = indexD + 17;
          drawTest.repaint();
        }
      }

      if (e.getSource() == routerList) {
        if (!e.getValueIsAdjusting()) {
          indexR = routerList.getSelectedIndex();

          Router temp = statMux.getRouter(indexR);
          int[] pList = temp.getPriorityList();
          audioVal.setText(String.valueOf(pList[0]));
          videoVal.setText(String.valueOf(pList[1]));
          textVal.setText(String.valueOf(pList[2]));
        }
      }

      if (e.getSource() == packTypeList) {
        if (!e.getValueIsAdjusting()) {
          int temp = packTypeList.getSelectedIndex();
          if (temp == 0) {
            type = PacketType.AUDIO;
          } else if (temp == 1) {
            type = PacketType.VIDEO;
          } else {
            type = PacketType.TEXT;
          }
          drawTest.repaint();
        }
      }
    }
Пример #8
0
 @Override
 public void valueChanged(ListSelectionEvent event) {
   Object source = event.getSource();
   if (source.equals(gui.getFontName())) {
     gui.getTestText()
         .setFont(
             new Font(
                 gui.getFontName().getSelectedValue(),
                 Font.PLAIN,
                 (int) gui.getSizeSpinner().getValue()));
   }
 }
Пример #9
0
    public void valueChanged(ListSelectionEvent evt) {
      Object source = evt.getSource();
      if (source == familyList) {
        String family = (String) familyList.getSelectedValue();
        if (family != null) familyField.setText(family);
      } else if (source == sizeList) {
        String size = (String) sizeList.getSelectedValue();
        if (size != null) sizeField.setText(size);
      } else if (source == styleList) {
        String style = (String) styleList.getSelectedValue();
        if (style != null) styleField.setText(style);
      }

      updatePreview();
    }
 public void valueChanged(ListSelectionEvent evt) {
   ardoise.changerEtat((String) ((JList) evt.getSource()).getSelectedValue());
   ardoise.repaint();
   ardoise.donnePere().elementModified();
 }
Пример #11
0
 // Listens to the list
 public void valueChanged(ListSelectionEvent e) {
   JList list = (JList) e.getSource();
   updateLabel(imageNames[list.getSelectedIndex()]);
 }
Пример #12
0
 public void valueChanged(ListSelectionEvent e) {
   Object[] values = ((JList) e.getSource()).getSelectedValues();
   String txtItem = "";
   for (int i = 0; i < values.length; i++) txtItem += values[i].toString();
   texta.setText(lblName.getText() + text0.getText() + '\n' + lblPlace.getText() + txtItem);
 }