Java Code Examples for javax.swing.event.ListSelectionListener

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project codjo-segmentation, under directory /codjo-segmentation-gui/src/test/java/net/codjo/segmentation/gui/editor/.

Source file: EditorEventManagerTest.java

  21 
vote

@Override protected void setUp() throws Exception {
  editorMainPanelLogic=new EditorMainPanelLogic(new HashMap(),new ArrayList<FunctionHelp>(),new WaitingPanel());
  editorEventManager=new EditorEventManager(editorMainPanelLogic);
  listSelectionListener=new ListSelectionListener(){
    public void valueChanged(    ListSelectionEvent evt){
    }
    @Override public String toString(){
      return "THIS IS THE LISTENER ADDED";
    }
  }
;
}
 

Example 2

From project jMemorize, under directory /src/jmemorize/gui/swing/dialogs/.

Source file: PreferencesDialog.java

  21 
vote

/** 
 * Attach listeners to font combobox and to font lists.
 */
private void attachListeners(){
  m_fontSideBox.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      m_changingFont=true;
      updateListFromFont();
      m_changingFont=false;
      updateFontPreview();
    }
  }
);
  ListSelectionListener fontUpdater=new ListSelectionListener(){
    public void valueChanged(    ListSelectionEvent e){
      if (!m_changingFont)       updateFontFromList();
      updateFontPreview();
    }
  }
;
  m_fontList.addListSelectionListener(fontUpdater);
  m_sizeList.addListSelectionListener(fontUpdater);
  m_alignList.addListSelectionListener(fontUpdater);
  m_verticalAlignBox.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      if (!m_changingFont)       updateFontFromList();
      updateFontPreview();
    }
  }
);
}
 

Example 3

From project Maimonides, under directory /src/com/codeko/apps/maimonides/seneca/operaciones/envioFicherosFaltas/.

Source file: PanelDebugEnvioFicheros.java

  21 
vote

/** 
 * Creates new form PanelDebugEnvioFicheros 
 */
public PanelDebugEnvioFicheros(){
  initComponents();
  lista.addListSelectionListener(new ListSelectionListener(){
    @Override public void valueChanged(    ListSelectionEvent lse){
      setElementoSeleccionado(lista.getSelectedIndex() > -1);
    }
  }
);
  MaimonidesUtil.addMenuTabla(tabla,"Alumnos con problemas de env?o de faltas");
}
 

Example 4

From project sikuli, under directory /sikuli-ide/src/main/java/org/sikuli/ide/sikuli_test/.

Source file: FailureRunView.java

  21 
vote

public FailureRunView(TestRunContext context){
  fRunContext=context;
  fFailureList=new JList(fRunContext.getFailures());
  fFailureList.setFont(new Font("Dialog",Font.PLAIN,12));
  fFailureList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  fFailureList.setCellRenderer(new FailureListCellRenderer());
  fFailureList.setVisibleRowCount(5);
  fFailureList.addListSelectionListener(new ListSelectionListener(){
    public void valueChanged(    ListSelectionEvent e){
      testSelected();
    }
  }
);
}
 

Example 5

From project Valkyrie-RCP, under directory /valkyrie-rcp-integrations/valkyrie-rcp-jideoss/src/main/java/org/valkyriercp/form/binding/jide/.

Source file: CheckBoxListBinding.java

  21 
vote

@Override protected JComponent doBindControl(){
  list=createList();
  list.getCheckBoxListSelectionModel().addListSelectionListener(new ListSelectionListener(){
    @Override public void valueChanged(    ListSelectionEvent e){
      controlValueChanged(getSelected(list));
    }
  }
);
  if (isScrollPaneNeeded())   return new JScrollPane(list);
 else   return list;
}
 

Example 6

From project autopsy, under directory /HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/.

Source file: HashDbManagementPanel.java

  20 
vote

private void customizeComponents(){
  setName("Hash Database Configuration");
  this.ingestWarningLabel.setVisible(false);
  this.hashSetTable.setModel(hashSetTableModel);
  this.hashSetTable.setTableHeader(null);
  hashSetTable.getParent().setBackground(hashSetTable.getBackground());
  hashSetTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  hashSetTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
    @Override public void valueChanged(    ListSelectionEvent e){
      ListSelectionModel listSelectionModel=(ListSelectionModel)e.getSource();
      if (!listSelectionModel.isSelectionEmpty()) {
        int index=listSelectionModel.getMinSelectionIndex();
        listSelectionModel.setSelectionInterval(index,index);
        HashDbXML loader=HashDbXML.getCurrent();
        HashDb current=loader.getAllSets().get(index);
        initUI(current);
      }
 else {
        initUI(null);
      }
    }
  }
);
}
 

Example 7

From project codjo-broadcast, under directory /codjo-broadcast-gui/src/main/java/net/codjo/broadcast/gui/.

Source file: BroadcastSectionsWindow.java

  20 
vote

public BroadcastSectionsWindow(GuiContext ctxt) throws Exception {
  translationNotifier=InternationalizationUtil.retrieveTranslationNotifier(ctxt);
  translationManager=InternationalizationUtil.retrieveTranslationManager(ctxt);
  jbInit();
  columnsTable.setPreference(PreferenceFactory.getPreference("BroadcastColumnsWindow"));
  sectionTable.setPreference(PreferenceFactory.getPreference("BroadcastSectionsWindow"));
  sectionTable.load();
  sectionToolBar.setHasExcelButton(true);
  sectionToolBar.init(ctxt,sectionTable);
  columnsToolBar.setHasExcelButton(true);
  columnsToolBar.init(ctxt,columnsTable);
  columnsToolBar.setFather(sectionTable,"sectionId","selectBroadcastColumnsBySectionId",ctxt);
  sectionTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
    public void valueChanged(    ListSelectionEvent event){
      if (event.getValueIsAdjusting()) {
        return;
      }
      setRenderers();
    }
  }
);
  translationNotifier.addInternationalizableContainer(this);
}
 

Example 8

From project codjo-data-process, under directory /codjo-data-process-gui/src/main/java/net/codjo/dataprocess/gui/launcher/configuration/.

Source file: ConfigurationDialog.java

  20 
vote

private void initLeftPanel(){
  initGuiTreatmentList();
  leftPanel.setLayout(new BorderLayout());
  TitledBorder leftTitledBorder=new TitledBorder(" Traitements ");
  leftPanel.setBorder(leftTitledBorder);
  leftPanel.add(trtScrollPane,BorderLayout.CENTER);
  guiTreatmentList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  trtScrollPane.getViewport().add(guiTreatmentList,null);
  guiTreatmentList.addListSelectionListener(new ListSelectionListener(){
    public void valueChanged(    ListSelectionEvent evt){
      if (!evt.getValueIsAdjusting()) {
        guiTreatmentListSelectionned();
      }
    }
  }
);
}
 

Example 9

From project CommunityCase, under directory /src/org/community/intellij/plugins/communitycase/history/wholeTree/.

Source file: LogUI.java

  20 
vote

private JComponent createRepositoryBrowserDetails(){
  myRepoLayout=new CardLayout();
  myRepoPanel=new JPanel(myRepoLayout);
  myRepositoryChangesBrowser=new RepositoryChangesBrowser(myProject,Collections.<CommittedChangeList>emptyList(),Collections.<Change>emptyList(),null);
  myRepositoryChangesBrowser.getDiffAction().registerCustomShortcutSet(CommonShortcuts.getDiff(),myJBTable);
  myJBTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
    @Override public void valueChanged(    ListSelectionEvent e){
      if (!myDataBeingAdded) {
        selectionChanged();
      }
    }
  }
);
  myRepoPanel.add("main",myRepositoryChangesBrowser);
  myRepoPanel.add("loading",panelWithCenteredText("Loading..."));
  myRepoPanel.add("tooMuch",panelWithCenteredText("Too many rows selected"));
  myRepoPanel.add("empty",panelWithCenteredText("Nothing selected"));
  myRepoLayout.show(myRepoPanel,"empty");
  return myRepoPanel;
}
 

Example 10

From project Cours-3eme-ann-e, under directory /Java/FerryInpres/src/mail_client/.

Source file: MainForm.java

  20 
vote

/** 
 * Creates new form MainForm 
 */
public MainForm(String serveurPop,String serveurSMTP,String utilisateur,String motDePasse,String email) throws NoSuchProviderException, MessagingException, KeyStoreException, NoSuchAlgorithmException, IOException, CertificateException, UnrecoverableKeyException, NoSuchPaddingException, InvalidKeyException {
  Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
  loadSymetricKey();
  this._email=email;
  this._serveurPop=serveurPop;
  this._utilisateur=utilisateur;
  this._motDePasse=motDePasse;
  Properties property=System.getProperties();
  property.put("mail.smtp.host",serveurSMTP);
  property.put("file.encoding","iso-8859-1");
  this._session=Session.getDefaultInstance(property,null);
  initComponents();
  new Thread(new Runnable(){
    @Override public void run(){
      try {
        for (; ; ) {
          listerMessages();
          System.out.println("Actualisation des messages");
          Thread.sleep(REFRESH_RATE);
        }
      }
 catch (      Exception ex) {
        ex.printStackTrace();
      }
    }
  }
).start();
  ListSelectionModel selectionModel=this.messagesList.getSelectionModel();
  selectionModel.addListSelectionListener(new ListSelectionListener(){
    @Override public void valueChanged(    ListSelectionEvent lse){
      messageSelected(lse);
    }
  }
);
}
 

Example 11

From project css-x-fire, under directory /src/com/github/cssxfire/.

Source file: ProjectSettingsConfigurable.java

  20 
vote

public JComponent createComponent(){
  routesTable=new FileTreeTable();
  routesTable.getColumnModel().getColumn(0).setPreferredWidth(260);
  routesTable.getColumnModel().getColumn(1).setPreferredWidth(240);
  routesScrollPane.setViewportView(routesTable);
  routesTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
    public void valueChanged(    ListSelectionEvent e){
      updateWebRootButton();
    }
  }
);
  buttonSetRoot.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      updateWebRoot();
    }
  }
);
  reset();
  updateWebRootButton();
  return myPanel;
}
 

Example 12

From project drools-planner, under directory /drools-planner-examples/src/main/java/org/drools/planner/examples/common/swingui/.

Source file: ConstraintScoreMapDialog.java

  20 
vote

public void resetContentPanel(){
  final List<ScoreDetail> scoreDetailList=solutionBusiness.getScoreDetailList();
  if (scoreDetailList == null) {
    setContentPane(new JLabel("Score details not support with this ScoreDirector."));
  }
 else {
    JSplitPane splitPane=new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    final JTable table=new JTable(new ScoreDetailTableModel(scoreDetailList));
    JScrollPane tableScrollPane=new JScrollPane(table);
    tableScrollPane.setPreferredSize(new Dimension(700,300));
    splitPane.setTopComponent(tableScrollPane);
    final JTextArea detailTextArea=new JTextArea(10,80);
    JScrollPane detailScrollPane=new JScrollPane(detailTextArea);
    splitPane.setBottomComponent(detailScrollPane);
    table.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
      public void valueChanged(      ListSelectionEvent event){
        int selectedRow=table.getSelectedRow();
        if (selectedRow < 0) {
          detailTextArea.setText("");
        }
 else {
          ScoreDetail scoreDetail=scoreDetailList.get(selectedRow);
          detailTextArea.setText(scoreDetail.buildConstraintOccurrenceListText());
        }
      }
    }
);
    splitPane.setResizeWeight(1.0);
    setContentPane(splitPane);
  }
  pack();
  setLocationRelativeTo(getParent());
}
 

Example 13

From project FScape, under directory /src/main/java/de/sciss/fscape/gui/.

Source file: BatchDlg.java

  20 
vote

private void initBatchTable(){
  TableColumn column;
  BatchCellEditor batchCE;
  int i;
  batchTM=new BatchTableModel(batchVector);
  batchTable=new JTable(batchTM);
  batchCR=new BatchCellRenderer();
  int[] prefWidth={16,64,256,48,48};
  for (i=0; i < prefWidth.length; i++) {
    column=batchTable.getColumnModel().getColumn(i);
    column.setPreferredWidth(prefWidth[i]);
    column.setCellRenderer(batchCR);
  }
  batchTable.getTableHeader().setReorderingAllowed(false);
  JComboBox cmdCombo=new JComboBox();
  for (i=0; i < BatchCellRenderer.CMD_NAMES.length; i++) {
    cmdCombo.addItem(BatchCellRenderer.CMD_NAMES[i]);
  }
  JComboBox errCombo=new JComboBox();
  for (i=0; i < BatchCellRenderer.ERR_NAMES.length; i++) {
    errCombo.addItem(BatchCellRenderer.ERR_NAMES[i]);
  }
  batchCE=new BatchCellEditor();
  batchTable.getColumnModel().getColumn(1).setCellEditor(new DefaultCellEditor(cmdCombo));
  batchTable.getColumnModel().getColumn(2).setCellEditor(batchCE);
  batchTable.getColumnModel().getColumn(3).setCellEditor(new DefaultCellEditor(errCombo));
  batchTable.getColumnModel().getColumn(4).setCellEditor(batchCE);
  batchTable.setShowHorizontalLines(true);
  batchTable.setShowVerticalLines(true);
  batchTable.setIntercellSpacing(new Dimension(1,1));
  batchTable.setGridColor(Color.lightGray);
  batchTM.addTableModelListener(tml);
  batchTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
    public void valueChanged(    ListSelectionEvent e){
      updateParamTable();
    }
  }
);
}
 

Example 14

From project GenericKnimeNodes, under directory /com.genericworkflownodes.knime.base_plugin/src/com/genericworkflownodes/knime/nodes/io/listimporter/.

Source file: DialogComponentMultiFileChooser.java

  20 
vote

/** 
 * Adds the event listeners to all gui elements.
 */
private void addListeners(){
  addButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    final ActionEvent arg0){
      final int returnVal=chooser.showDialog(getComponentPanel().getParent(),null);
      if (returnVal == JFileChooser.APPROVE_OPTION) {
        File[] files=chooser.getSelectedFiles();
        ((FileListModel)listbox.getModel()).updateFileList(files);
      }
    }
  }
);
  removeButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    final ActionEvent event){
      if (listbox.getSelectedIndex() == -1) {
      }
 else {
        int[] selectedIndices=listbox.getSelectedIndices();
        ((FileListModel)listbox.getModel()).remove(selectedIndices);
      }
    }
  }
);
  clearButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    final ActionEvent event){
      ((FileListModel)listbox.getModel()).clear();
    }
  }
);
  listbox.addListSelectionListener(new ListSelectionListener(){
    @Override public void valueChanged(    final ListSelectionEvent event){
      if (!event.getValueIsAdjusting()) {
        removeButton.setEnabled(listbox.getSelectedIndex() != -1);
      }
    }
  }
);
}
 

Example 15

From project ISAvalidator-ISAconverter-BIImanager, under directory /val_conv_manager_gui/src/main/java/org/isatools/gui/datamanager/studyaccess/.

Source file: StudyOwnershipUI.java

  20 
vote

public void createGUI(){
  instantiateStudyToUserMap();
  studyList=new ExtendedJList();
  createListContents(studyList,studies);
  studyList.setOpaque(false);
  studyList.addListSelectionListener(new ListSelectionListener(){
    public void valueChanged(    ListSelectionEvent listSelectionEvent){
      if (!studyList.isSelectionEmpty()) {
        updateSelectedStudyItems();
      }
 else {
        createListContents(availableUsersList,users);
        createListContents(selectedUsers,new String[]{});
      }
      updateButtonActivity();
    }
  }
);
  availableUsersList=new JList();
  availableUsersList.setOpaque(false);
  createListContents(availableUsersList,users);
  selectedUsers=new JList();
  selectedUsers.setOpaque(false);
  add(UIHelper.createListContainer(studyList,"studies",new ColumnFilterRenderer(UIHelper.VER_11_BOLD,UIHelper.LIGHT_GREEN_COLOR,UIHelper.VER_11_PLAIN,UIHelper.LIGHT_GREY_COLOR,Globals.LIST_ICON_STUDY)));
  add(UIHelper.createListContainer(availableUsersList,"available users",new ColumnFilterRenderer(UIHelper.VER_11_BOLD,UIHelper.LIGHT_GREEN_COLOR,UIHelper.VER_11_PLAIN,UIHelper.LIGHT_GREY_COLOR,Globals.LIST_ICON_USER)));
  add(createControlPanel());
  add(UIHelper.createListContainer(selectedUsers,"selected users",new ColumnFilterRenderer(UIHelper.VER_11_BOLD,UIHelper.LIGHT_GREEN_COLOR,UIHelper.VER_11_PLAIN,UIHelper.LIGHT_GREY_COLOR,Globals.LIST_ICON_USER)));
  selectFirstItemInList(studyList);
  selectFirstItemInList(availableUsersList);
}
 

Example 16

From project Java3DTest, under directory /Java3D/src/.

Source file: CurrentShapesPanel.java

  20 
vote

public CurrentShapesPanel(JPanel panel){
  panel.setLayout(new BorderLayout());
  JLabel resize_title=new JLabel("S H A P E S");
  resize_title.setOpaque(true);
  resize_title.setBackground(Color.lightGray);
  panel.add(resize_title,BorderLayout.PAGE_START);
  JPanel currentShapesPanel=new JPanel();
  panel.add(currentShapesPanel);
  listModel=new DefaultListModel();
  list=new JList(listModel);
  list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  list.addListSelectionListener(this);
  list.addKeyListener(this);
  list.addListSelectionListener(new ListSelectionListener(){
    public void valueChanged(    ListSelectionEvent evt){
      Enumeration e=GUI_3D.getSwingTest().getSceneBranchGroup().getAllChildren();
      int index=0;
      while (e.hasMoreElements() != false) {
        Object sgObject=((SceneGraphObject)(e.nextElement()));
        if (((String)((Group)((Group)(((Group)sgObject).getChild(0))).getChild(0)).getChild(0).getUserData()).equalsIgnoreCase((String)list.getSelectedValue())) {
          GUI_3D.getSwingTest().setShapeClicked(((Group)((Group)(((Group)sgObject).getChild(0))).getChild(0)).getChild(0));
          System.out.println(GUI_3D.getSwingTest().getShapeClicked());
        }
      }
    }
  }
);
  JScrollPane listScroll=new JScrollPane(list);
  listScroll.setBorder(BorderFactory.createMatteBorder(0,0,0,0,Color.GRAY));
  listScroll.setPreferredSize(new Dimension(147,143));
  currentShapesPanel.add(listScroll);
  currentShapesPanel.add(Box.createVerticalGlue());
  list.setFixedCellHeight(27);
}
 

Example 17

From project medsavant, under directory /medsavant/MedSavantClient/src/org/ut/biolab/medsavant/plugin/.

Source file: PluginBrowser.java

  20 
vote

public PluginBrowser(){
  tableModel=new ProgramTableModel();
  pluginController.addListener(tableModel);
  setModel(tableModel);
  setPreferredScrollableViewportSize(new Dimension(600,400));
  setHierarchicalColumn(-1);
  setSingleExpansion(true);
  setName("Program Table");
  setShowGrid(false);
  setRowHeight(24);
  getTableHeader().setPreferredSize(new Dimension(0,0));
  getColumnModel().getColumn(0).setPreferredWidth(500);
  setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  HierarchicalTableComponentFactory factory=new HierarchicalTableComponentFactory(){
    @Override public Component createChildComponent(    HierarchicalTable table,    Object value,    int row){
      if (value instanceof PluginDescriptor) {
        return new ProgramPanel((PluginDescriptor)value);
      }
      return null;
    }
    @Override public void destroyChildComponent(    HierarchicalTable table,    Component component,    int row){
    }
  }
;
  setComponentFactory(factory);
  getSelectionModel().addListSelectionListener(new ListSelectionListener(){
    @Override public void valueChanged(    ListSelectionEvent e){
      int row=getSelectedRow();
      if (row != -1) {
        expandRow(row);
      }
    }
  }
);
}
 

Example 18

From project Moneychanger, under directory /src/main/java/com/moneychanger/ui/dialogs/.

Source file: PathDialog.java

  20 
vote

private void initValues(){
  jList_Paths.setModel(_javaPaths.getAbstractListModel());
  jList_Paths.addListSelectionListener(new ListSelectionListener(){
    @Override public void valueChanged(    ListSelectionEvent e){
      _javaPaths.setSelectedElement(e.getFirstIndex());
    }
  }
);
  _javaPaths.setRemoveReturnAction(new Utility.ReturnAction(){
    @Override public String getAction(){
      throw new UnsupportedOperationException("Not supported yet.");
    }
    @Override public void returnAction(    String returnValue){
      if (null != returnValue) {
        if (returnValue.contentEquals("Enabled")) {
          jButton_Remove.setEnabled(Boolean.TRUE);
        }
 else {
          jButton_Remove.setEnabled(Boolean.FALSE);
        }
      }
    }
  }
);
  pathFolderChooser=new JFileChooser();
  pathFolderChooser.setCurrentDirectory(new java.io.File("."));
  pathFolderChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
  pathFolderChooser.setFileHidingEnabled(Boolean.FALSE);
}
 

Example 19

From project OWASP-WebScarab, under directory /src/org/owasp/webscarab/plugin/fuzz/swing/.

Source file: FuzzerPanel.java

  20 
vote

private void addTableListeners(){
  _showAction=new ShowConversationAction(_model.getConversationModel());
  conversationTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
    public void valueChanged(    ListSelectionEvent e){
      _logger.info("Selection changed");
      if (e.getValueIsAdjusting())       return;
      int row=conversationTable.getSelectedRow();
      TableModel tm=conversationTable.getModel();
      if (row > -1) {
        ConversationID id=(ConversationID)tm.getValueAt(row,0);
        _showAction.putValue("CONVERSATION",id);
        _logger.info("Conversation " + id + " selected");
      }
 else {
        _showAction.putValue("CONVERSATION",null);
      }
    }
  }
);
  conversationTable.addMouseListener(new MouseAdapter(){
    public void mouseClicked(    MouseEvent e){
      _logger.info("Mouse clicked in the table");
      int row=conversationTable.rowAtPoint(e.getPoint());
      conversationTable.getSelectionModel().setSelectionInterval(row,row);
      if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) {
        ActionEvent evt=new ActionEvent(conversationTable,0,(String)_showAction.getValue(Action.ACTION_COMMAND_KEY));
        if (_showAction.isEnabled())         _showAction.actionPerformed(evt);
      }
    }
  }
);
}
 

Example 20

From project syncany, under directory /syncany/src/org/syncany/gui/settings/.

Source file: FoldersTablePanel.java

  20 
vote

private void initTable(){
  tblFolders.setModel(new FolderTableModel());
  tblFolders.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
  TableColumn colActive=tblFolders.getColumnModel().getColumn(FolderTableModel.COLUMN_INDEX_ACTIVE);
  colActive.setPreferredWidth(50);
  colActive.setMaxWidth(50);
  colActive.setResizable(false);
  TableColumn colRemote=tblFolders.getColumnModel().getColumn(FolderTableModel.COLUMN_INDEX_REMOTE);
  colRemote.setPreferredWidth(70);
  TableColumn colLocal=tblFolders.getColumnModel().getColumn(FolderTableModel.COLUMN_INDEX_LOCAL);
  colLocal.setPreferredWidth(320);
  tblFolders.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  tblFolders.setShowHorizontalLines(false);
  tblFolders.setShowVerticalLines(false);
  tblFolders.setBorder(BorderFactory.createEmptyBorder());
  tblFolders.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
    @Override public void valueChanged(    ListSelectionEvent e){
      btnEdit.setEnabled(e.getFirstIndex() >= 0);
    }
  }
);
  tblFolders.addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      if (e.getClickCount() == 2 && tblFolders.getSelectedRow() >= 0) {
        btnEditActionPerformed(null);
      }
    }
  }
);
}
 

Example 21

From project VisiCut, under directory /src/com/t_oster/visicut/gui/beans/.

Source file: ImageListableList.java

  20 
vote

public ImageListableList(){
  this.setModel(mappingListModel);
  this.setCellRenderer(cellrenderer);
  this.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  this.addListSelectionListener(new ListSelectionListener(){
    int oldSelectedIndex=-1;
    public void valueChanged(    ListSelectionEvent lse){
      if (ImageListableList.this.isDisabled(ImageListableList.this.getSelectedValue())) {
        ImageListableList.this.setSelectedIndex(oldSelectedIndex);
      }
 else {
        oldSelectedIndex=ImageListableList.this.getSelectedIndex();
      }
    }
  }
);
}
 

Example 22

From project Zypr-Reference-Client---Java, under directory /source/net/zypr/gui/windows/.

Source file: ContactListWindow.java

  20 
vote

private void jbInit() throws Exception {
  _logger.trace("ContactListWindow init");
  this.setSize(new Dimension(560,300));
  setTitle("Contacts");
  MigLayout layout=new MigLayout("ins 5, fill");
  _panelContent.setLayout(layout);
  _panelContent.add(_scrollPaneContactList,"grow");
  _listContactList.setOpaque(false);
  _listContactList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  _listContactList.setCellRenderer(new ContactListRenderer());
  _listContactList.addListSelectionListener(new ListSelectionListener(){
    public void valueChanged(    ListSelectionEvent listSelectionEvent){
      _listContactList_valueChanged(listSelectionEvent);
    }
  }
);
  _listContactList.setVisibleRowCount(JLIST_VISIBLE_ROW_COUNT);
  _scrollPaneContactList.addScrollUpButtonActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent actionEvent){
      _scrollPaneContactList_scrollUp(actionEvent);
    }
  }
);
  _scrollPaneContactList.addScrollDownButtonActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent actionEvent){
      _scrollPaneContactList_scrollDown(actionEvent);
    }
  }
);
  _scrollPaneContactList.addToViewport(_listContactList);
}
 

Example 23

From project SwingOSC, under directory /src/main/java/de/sciss/swingosc/.

Source file: ListView.java

  19 
vote

public void setValue(int idx){
  final ListSelectionListener[] l=this.getListSelectionListeners();
  for (int i=0; i < l.length; i++) {
    removeListSelectionListener(l[i]);
  }
  try {
    this.setSelectedIndex(idx);
  }
  finally {
    for (int i=0; i < l.length; i++) {
      addListSelectionListener(l[i]);
    }
  }
}