示例#1
0
 @Override
 public void valueChanged(ListSelectionEvent e) {
   if (e.getSource() == listData && listData.getSelectedValue() != null) {
     Data tmp = rssFeed.searchByTitle((String) listData.getSelectedValue());
     if (tmp != null) this.desc.setText(tmp.getDesc());
   }
 }
示例#2
0
  @Override
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == btnQAuswahl) {
      addQListBoxEintrag(dateiAuswählen());
    }
    if (e.getSource() == btnQEntfernen) {
      subQListBoxEintrag();
    }
    if (e.getSource() == btnZAuswahl) {
      addZListBoxEintrag(dateiAuswählen());
    }
    if (e.getSource() == btnZEntfernen) {
      subZListBoxEintrag();
    }
    if (e.getSource() == btnSync) {

      startCopy(
          (Path) quellJList.getSelectedValue().getValueMember(),
          (Path) zielJList.getSelectedValue().getValueMember());
    }
    if (e.getSource() == btnAbbruch) {
      setAbbruch();
    }
    if (e.getSource() == btnBackup) {
      MainNtray.bwvisible();
      this.invisible();
    }
  }
示例#3
0
文件: MoveATub.java 项目: wwake/dpij
  public void valueChanged(ListSelectionEvent e) {
    @SuppressWarnings("unchecked")
    JList<String> sender = (JList<String>) e.getSource();

    if (!sender.isSelectionEmpty()) {
      if (sender.equals(boxList())) updateTubList(sender.getSelectedValue());

      if (sender.equals(machineList())) selectedMachine = sender.getSelectedValue();

      if (sender.equals(tubList())) selectedTub = sender.getSelectedValue();
    }

    assignButton().setEnabled(!tubList().isSelectionEmpty() && !machineList().isSelectionEmpty());
  }
示例#4
0
  /* (non-Javadoc)
   * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
   */
  public void actionPerformed(ActionEvent e) {
    PopUp popup;
    if ("Add".equals(e.getActionCommand())) {
      popup = new PopUp(1, 0);
      if (popup.text != null && popup.text.length() != 0) {

        try {
          if (!control.create_user(popup.text, popup.secondText)) {
            popup = new PopUp("User Already Exists");
          }
        } catch (IOException e1) {
          // TODO Auto-generated catch block
        }
      }
      populateUsers();
    } else if ("Logout".equals(e.getActionCommand())) {
      try {
        JFrame topFrame = (JFrame) SwingUtilities.getWindowAncestor(this);
        topFrame.setVisible(false);
        popup = new PopUp(4, 0);
        if (popup.response == 0) {
          padre.logout();
        } else {
          topFrame.setVisible(true);
        }
      } catch (IOException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
      }

    } else {
      popup = new PopUp(3, 0);
      if (popup.response == 0) {
        if (userList.getSelectedValue() == null) // checks to see if the list is empty
        {
        } else // deletes the user
        {
          try {
            System.out.println(control.delete_user(userList.getSelectedValue()));
          } catch (IOException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
          }
        }
      }
      populateUsers();
    }
  }
示例#5
0
 public Macro getSelectedMacro() {
   MacroWrapper macroWrapper = (MacroWrapper) myMacrosList.getSelectedValue();
   if (macroWrapper != null) {
     return macroWrapper.myMacro;
   }
   return null;
 }
示例#6
0
 private DocumentMasterKey getSelectedLink() {
   DocumentToDocumentLink link = (DocumentToDocumentLink) mLinksList.getSelectedValue();
   String docMId = link.getToDocumentDocumentMasterId();
   String docMVersion = link.getToDocumentDocumentMasterVersion();
   String workspaceId = link.getToDocumentWorkspaceId();
   return new DocumentMasterKey(workspaceId, docMId, docMVersion);
 }
示例#7
0
 public void valueChanged(ListSelectionEvent e) {
   if (!myIsEnabled || e.getValueIsAdjusting()) {
     return;
   }
   final JList list = (JList) e.getSource();
   processListValue(list.getSelectedValue());
 }
  /**
   * Called when user selects a component in the list of configuration forms.
   *
   * @param e the <tt>ListSelectionEvent</tt>
   */
  public void valueChanged(ListSelectionEvent e) {
    if (!e.getValueIsAdjusting()) {
      ConfigurationForm configForm = (ConfigurationForm) configList.getSelectedValue();

      if (configForm != null) showFormContent(configForm);
    }
  }
 @Override
 protected void doOKAction() {
   apply((SeverityBasedTextAttributes) myOptionsList.getSelectedValue());
   final Collection<SeverityBasedTextAttributes> infoTypes =
       new HashSet<SeverityBasedTextAttributes>(
           SeverityUtil.getRegisteredHighlightingInfoTypes(mySeverityRegistrar));
   final ListModel listModel = myOptionsList.getModel();
   final List<HighlightSeverity> order = new ArrayList<HighlightSeverity>();
   for (int i = listModel.getSize() - 1; i >= 0; i--) {
     final SeverityBasedTextAttributes info =
         (SeverityBasedTextAttributes) listModel.getElementAt(i);
     order.add(info.getSeverity());
     if (!mySeverityRegistrar.isDefaultSeverity(info.getSeverity())) {
       infoTypes.remove(info);
       final Color stripeColor = info.getAttributes().getErrorStripeColor();
       mySeverityRegistrar.registerSeverity(
           info, stripeColor != null ? stripeColor : LightColors.YELLOW);
     }
   }
   for (SeverityBasedTextAttributes info : infoTypes) {
     mySeverityRegistrar.unregisterSeverity(info.getSeverity());
   }
   mySeverityRegistrar.setOrder(order);
   super.doOKAction();
 }
示例#10
0
 void jListOnlineUsers_mouseClicked(MouseEvent e) {
   if (e.getClickCount() == 2) {
     jTextFieldTargetUser.setText(((HostItem) jListOnlineUsers.getSelectedValue()).name);
     Flasher.instance().flashBackground(jTextFieldTargetUser, Color.yellow, 2);
     jTextFieldSendMessages.requestFocus();
   }
 }
示例#11
0
 private void removeTodoItem() {
   Object possibleSelection = todoItemsList.getSelectedValue();
   if (possibleSelection != null) {
     todoItems.remove(possibleSelection.toString());
     updateTodoItems();
   }
 }
示例#12
0
  // Listener method for list selection changes.
  public void valueChanged(ListSelectionEvent e) {
    if (e.getValueIsAdjusting() == false) {

      if (list.getSelectedIndex() == -1) {
        // No selection: disable delete, up, and down buttons.
        deleteButton.setEnabled(false);
        upButton.setEnabled(false);
        downButton.setEnabled(false);
        nameField.setText("");

      } else if (list.getSelectedIndices().length > 1) {
        // Multiple selection: disable up and down buttons.
        deleteButton.setEnabled(true);
        upButton.setEnabled(false);
        downButton.setEnabled(false);

      } else {
        // Single selection: permit all operations.
        deleteButton.setEnabled(true);
        upButton.setEnabled(true);
        downButton.setEnabled(true);
        nameField.setText(list.getSelectedValue().toString());
      }
    }
  }
示例#13
0
  // ボタンが押されたときのイベント処理
  public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();

    if (cmd.equals("submit")) { // 送信
      sendMessage("msg " + msgTextField.getText());
      msgTextField.setText("");
    } else if (cmd.equals("rename")) { // 名前の変更
      sendMessage("setName " + nameTextField.getText());
    } else if (cmd.equals("addRoom")) { // 部屋を作成
      String roomName = nameTextField.getText();
      sendMessage("addRoom " + roomName);
      enteredRoom(roomName);
      sendMessage("getUsers " + roomName);
    } else if (cmd.equals("enterRoom")) { // 入室
      Object room = roomList.getSelectedValue();
      if (room != null) {
        String roomName = room.toString();
        sendMessage("enterRoom " + roomName);
        enteredRoom(roomName);
      }
    } else if (cmd.equals("exitRoom")) { // 退室
      sendMessage("exitRoom " + roomName);
      exitedRoom();
    }
  }
示例#14
0
 @Override
 public void valueChanged(ListSelectionEvent lse) {
   Object o = resultList.getSelectedValue();
   if (o != null && o instanceof HelpPage) {
     dialog.displayPage((HelpPage) o);
   }
 }
 /**
  * Return the string that was entered in the text field. If the user is forced to select an item,
  * then the text of the item will be returned.
  *
  * @return text in text field
  */
 public String getText() {
   if (_force) {
     T item = _matchList.getSelectedValue();
     return (item == null) ? "" : _currentStrategy.force(item, _textField.getText());
   }
   return _textField.getText();
 }
 /** Update the information. */
 private void updateInfo() {
   if (_info == null) return;
   if (_matchList.getModel().getSize() > 0) {
     T item = _matchList.getSelectedValue();
     _infoLabel.setText("Path:   " + _info.value(item));
     _infoLabel.setToolTipText(_info.value(item));
   } else _infoLabel.setText("No file selected");
 }
示例#17
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);
            }
          }
        }
      }
    }
示例#18
0
  void doubleClicked(JComponent src) {
    if (src == lstEntities) {
      DustEntity sel = ((LabEntity) lstEntities.getSelectedValue()).entity;

      if (!mapEntityFrames.containsKey(sel)) {
        selectEntityFrame(sel, true);
      }
    }
  }
 @Override
 public void ok() {
   DataFlavor flavor = (DataFlavor) flavorList.getSelectedValue();
   if (flavor == null) {
     flavor = DataFlavor.stringFlavor;
   }
   Registers.paste(textArea, '$', flavor);
   dispose();
 }
示例#20
0
  private void mRemoveNode() {
    String old_node = (String) lstNodes.getSelectedValue();

    java.util.List remove_list =
        ConfigUtilities.getElementsWithDefinition(mBroker.getElements(mContext), old_node);
    for (int i = 0; i < remove_list.size(); i++) {
      mBroker.remove(mContext, (ConfigElement) remove_list.get(i));
    }
  }
示例#21
0
  void HireFire_actionPerformed(ActionEvent e) {
    applicant selectedEmp; // employee selected by user from jList

    if (!appList.isEmpty()) {
      // Do what you wish the selected applicant
      selectedEmp = (applicant) jList1.getSelectedValue();
      if (selectedEmp.Hired.equals("0"))
        Moo.send("hire " + selectedEmp.ApplicantID + " " + jTextFieldWage.getText());
      else Moo.send("fire");
      Moo.send("get_applicants " + jTextFieldWage.getText()); // refreshes list after changes
    }
  }
示例#22
0
 /**
  * Play the sound file currently selected in the file list. If there is no selection in the list,
  * or if the selected file is not a sound file, do nothing.
  */
 private void play() {
   String filename = (String) fileList.getSelectedValue();
   if (filename == null) { // nothing selected
     return;
   }
   // slider.setValue(0);
   boolean successful = player.play(new File(AUDIO_DIR, filename));
   if (successful) {
     showInfo(filename + " (" + player.getDuration() + " seconds)");
   } else {
     showInfo("Could not play file - unknown format");
   }
 }
  private void suggestCompletion(final boolean selectReplacedText, final boolean isExplicitCall) {
    if (isExplicitCall) {
      myAutopopup = true;
    }

    if (!getField().isFocusOwner()) return;

    final CompletionResult result = new CompletionResult();
    if (myList != null && myCurrentCompletion != null) {
      int index = myList.getSelectedIndex();
      if (index >= 0 && index < myList.getModel().getSize()) {
        result.myPreselected = (LookupFile) myList.getSelectedValue();
      }
    }

    myUiUpdater.queue(
        new Update("textField.suggestCompletion") {
          public void run() {
            final String completionBase = getCompletionBase();
            if (completionBase != null) {
              final LookupFile file = myFinder.find(completionBase);
              if (file != null && !file.isDirectory()) {
                // we've entered a complete path already, no need to autopopup completion again
                // (IDEA-78996)
                return;
              }
            }
            result.myCompletionBase = completionBase;
            if (result.myCompletionBase == null) return;
            result.myFieldText = myPathTextField.getText();
            ApplicationManager.getApplication()
                .executeOnPooledThread(
                    new Runnable() {
                      public void run() {
                        processCompletion(result);
                        SwingUtilities.invokeLater(
                            new Runnable() {
                              public void run() {
                                if (!result.myCompletionBase.equals(getCompletionBase())) return;

                                int pos = selectCompletionRemoveText(result, selectReplacedText);

                                showCompletionPopup(result, pos, isExplicitCall);
                              }
                            });
                      }
                    });
          }
        });
  }
示例#24
0
 void jList1_mouseClicked(MouseEvent e) {
   int indx = jList1.getLeadSelectionIndex();
   jTextPane2.setText(((applicant) appList.elementAt(indx)).getDescription());
   try {
     currPicture =
         new ImageIcon(
             "../Blackwood Client/src/edu/nodak/ndsu/cs/lions/blackwood/Resources/Image/people/"
                 + ((applicant) jList1.getSelectedValue()).Picture
                 + ".gif");
     repaint();
   } catch (Exception ex) {
     ex.printStackTrace();
   }
 }
示例#25
0
 private boolean validateData() {
   Object selVal = list.getSelectedValue();
   if (selVal != null) {
     try {
       URI uri = new URI(selVal.toString());
       // ((ImportWizard) getWizard()).setOntologyURI(uri);
       return true;
     } catch (URISyntaxException e) {
       return false;
     }
   } else {
     return false;
   }
 }
 public void actionPerformed(ActionEvent ae) {
   try {
     String sbuildQuantity = buildQuantity.getText();
     System.out.println(sbuildQuantity);
     int buildNumber = Integer.parseInt(sbuildQuantity);
     if (buildNumber <= 0) {
       System.out.println("Invalid kit build amount");
     } else {
       Kits selectedKit = (Kits) kitList.getSelectedValue();
       selectedKit.setBuildNumber(buildNumber);
       buildInfo.add(selectedKit);
       parent.syncBuildInfo(buildInfo);
     }
   } catch (Exception e) {
     System.out.println("Invalid kit build amount");
   }
 }
  public EtatPanelDist(
      Hashtable uneHashtable, BoiteChangementEtatSommetDist parent, String defaultValue) {
    ardoise = new EtatArdoiseDist(uneHashtable, parent);
    Vector listeItems = new Vector();
    JList liste = new JList();
    JScrollPane listeAvecAscenseur;
    listeItems.addElement("A");
    listeItems.addElement("B");
    listeItems.addElement("C");
    listeItems.addElement("D");
    listeItems.addElement("E");
    listeItems.addElement("F");
    listeItems.addElement("G");
    listeItems.addElement("H");
    listeItems.addElement("I");
    listeItems.addElement("J");
    listeItems.addElement("K");
    listeItems.addElement("L");
    listeItems.addElement("M");
    listeItems.addElement("N");
    listeItems.addElement("O");
    listeItems.addElement("P");
    listeItems.addElement("Q");
    listeItems.addElement("R");
    listeItems.addElement("S");
    listeItems.addElement("T");
    listeItems.addElement("U");
    listeItems.addElement("V");
    listeItems.addElement("W");
    listeItems.addElement("X");
    listeItems.addElement("Y");
    listeItems.addElement("Z");

    liste = new JList(listeItems);
    liste.setSelectedValue(defaultValue, true);
    ardoise.changerEtat((String) liste.getSelectedValue());
    liste.addListSelectionListener(this);
    setLayout(new FlowLayout(FlowLayout.RIGHT, 5, 5));
    add(ardoise);
    listeAvecAscenseur = new JScrollPane(liste);
    listeAvecAscenseur.setPreferredSize(new Dimension(200, 80));
    add(listeAvecAscenseur);
    setVisible(true);
  }
示例#28
0
 public void actionPerformed(ActionEvent arg0) {
   if (arg0.getActionCommand().equals("Enter Hallway")) {
     if (hallList.getSelectedValue() != null) {
       outputText(model.movePlayer(hallList.getSelectedValue().toString()));
       update();
     }
   }
   if (arg0.getActionCommand().equals("Drop Item")) {
     if (playerItemsList.getSelectedValue() != null)
       model.dropItem(playerItemsList.getSelectedValue().toString());
     update();
   }
   if (arg0.getActionCommand().equals("Pick Up")) {
     if (roomItemsList.getSelectedValue() != null)
       if (model.pickItem(roomItemsList.getSelectedValue().toString())) endGame("You Win!");
     update();
   }
 }
 public void valueChanged(ListSelectionEvent le) {
   if (!le.getValueIsAdjusting()) {
     Kits currentKit = (Kits) kitList.getSelectedValue();
     if (currentKit != null) buildKitData(currentKit);
   }
 }
示例#30
0
  private void init(Font font) {
    JPanel content = new JPanel(new BorderLayout());
    content.setBorder(new EmptyBorder(12, 12, 12, 12));
    setContentPane(content);

    JPanel listPanel = new JPanel(new GridLayout(1, 3, 6, 6));

    String[] fonts;
    try {
      fonts = getFontList();
    } catch (Exception e) {
      Log.log(Log.ERROR, this, "Broken Java implementation!");

      Log.log(Log.ERROR, this, e);

      fonts = new String[] {"Broken Java implementation!"};
    }

    JPanel familyPanel =
        createTextFieldAndListPanel(
            "font-selector.family", familyField = new JTextField(), familyList = new JList(fonts));
    listPanel.add(familyPanel);

    String[] sizes = {"9", "10", "12", "14", "16", "18", "24"};
    JPanel sizePanel =
        createTextFieldAndListPanel(
            "font-selector.size", sizeField = new JTextField(), sizeList = new JList(sizes));
    listPanel.add(sizePanel);

    String[] styles = {
      jEdit.getProperty("font-selector.plain"),
      jEdit.getProperty("font-selector.bold"),
      jEdit.getProperty("font-selector.italic"),
      jEdit.getProperty("font-selector.bolditalic")
    };

    JPanel stylePanel =
        createTextFieldAndListPanel(
            "font-selector.style", styleField = new JTextField(), styleList = new JList(styles));
    styleField.setEditable(false);
    listPanel.add(stylePanel);

    familyList.setSelectedValue(font.getFamily(), true);
    familyField.setText(font.getFamily());
    sizeList.setSelectedValue(String.valueOf(font.getSize()), true);
    sizeField.setText(String.valueOf(font.getSize()));
    styleList.setSelectedIndex(font.getStyle());
    styleField.setText((String) styleList.getSelectedValue());

    ListHandler listHandler = new ListHandler();
    familyList.addListSelectionListener(listHandler);
    sizeList.addListSelectionListener(listHandler);
    styleList.addListSelectionListener(listHandler);

    content.add(BorderLayout.NORTH, listPanel);

    preview =
        new JLabel(jEdit.getProperty("font-selector.long-text")) {
          public void paintComponent(Graphics g) {
            if (fontSelector != null) fontSelector.setAntiAliasEnabled(g);
            super.paintComponent(g);
          }
        };
    preview.setBorder(new TitledBorder(jEdit.getProperty("font-selector.preview")));

    updatePreview();

    Dimension prefSize = preview.getPreferredSize();
    prefSize.height = 50;
    preview.setPreferredSize(prefSize);

    content.add(BorderLayout.CENTER, preview);

    JPanel buttons = new JPanel();
    buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
    buttons.setBorder(new EmptyBorder(12, 0, 0, 0));
    buttons.add(Box.createGlue());

    ok = new JButton(jEdit.getProperty("common.ok"));
    ok.addActionListener(new ActionHandler());
    getRootPane().setDefaultButton(ok);
    buttons.add(ok);

    buttons.add(Box.createHorizontalStrut(6));

    cancel = new JButton(jEdit.getProperty("common.cancel"));
    cancel.addActionListener(new ActionHandler());
    buttons.add(cancel);

    buttons.add(Box.createGlue());

    content.add(BorderLayout.SOUTH, buttons);

    pack();
    setLocationRelativeTo(getParent());
    setVisible(true);
  }