javax.swing.event.ListSelectionListener Java Examples

The following examples show how to use javax.swing.event.ListSelectionListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TextListInputPanel.java    From openAGV with Apache License 2.0 8 votes vote down vote up
/** 
 * Creates a new instance TextListInputPanel.
 * @param title the title of the panel
 */
private TextListInputPanel(String title) {
  super(title);
  resetable = false;
  initComponents();
  list.addListSelectionListener(new ListSelectionListener() {
    @Override
    public void valueChanged(ListSelectionEvent e) {
      if (!e.getValueIsAdjusting()) {
        Object selection = list.getSelectedValue();
        if (selection != null) {
          inputField.setText((String) selection);
        }
      }
    }
  });
}
 
Example #2
Source File: ExitDialog.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Constructs rest of dialog.
*/
private void draw () {
    list = new JList(listModel);
    list.setBorder(new EmptyBorder(2, 2, 2, 2));
    list.addListSelectionListener (new ListSelectionListener () {
        @Override
                                       public void valueChanged (ListSelectionEvent evt) {
                                           updateSaveButton ();
                                       }
                                   }
                                  );
    // bugfix 37941, select first item in list
    if (!listModel.isEmpty ()) {
        list.setSelectedIndex (0);
    } else {                              
        updateSaveButton ();
    }
    JScrollPane scroll = new JScrollPane (list);
    scroll.setBorder (new CompoundBorder (new EmptyBorder (12, 12, 11, 0), scroll.getBorder ()));
    add(scroll, BorderLayout.CENTER);
    list.setCellRenderer(new ExitDlgListCellRenderer());
    list.getAccessibleContext().setAccessibleName((NbBundle.getBundle(ExitDialog.class)).getString("ACSN_ListOfChangedFiles"));
    list.getAccessibleContext().setAccessibleDescription((NbBundle.getBundle(ExitDialog.class)).getString("ACSD_ListOfChangedFiles"));
    this.getAccessibleContext().setAccessibleDescription((NbBundle.getBundle(ExitDialog.class)).getString("ACSD_ExitDialog"));
}
 
Example #3
Source File: Outline.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void init() {
    initialized = true;
    setDefaultRenderer(Object.class, new DefaultOutlineCellRenderer());
    ActionMap am = getActionMap();
    //make rows expandable with left/rigt arrow keys
    Action a = am.get("selectNextColumn"); //NOI18N
    am.put("selectNextColumn", new ExpandAction(true, a)); //NOI18N
    a = am.get("selectPreviousColumn"); //NOI18N
    am.put("selectPreviousColumn", new ExpandAction(false, a)); //NOI18N
    getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (getSelectedRowCount() == 1) {
                selectedRow = getSelectedRow();
            } else {
                selectedRow = -1;
            }
        }
    });
}
 
Example #4
Source File: InstructionList.java    From Cafebabe with GNU General Public License v3.0 6 votes vote down vote up
public InstructionList(ClassNode cn, MethodNode mn) {
	this.mn = mn;
	this.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 13));
	this.setFocusable(false);
	this.refresh(mn);
	this.addListSelectionListener(new ListSelectionListener() {

		@Override
		public void valueChanged(ListSelectionEvent arg0) {
			InstructionNode in = getSelectedValue();
			if (!arg0.getValueIsAdjusting() && in != null) {
				Cafebabe.gui.smallEditorPanel.setViewportView(new InstructionEditorPanel(InstructionList.this, cn, mn, in.ain));
			}
		}
	});
	this.addMouseListener(new MouseAdapter() {
		@Override
		public void mousePressed(MouseEvent e) {
			if (SwingUtilities.isRightMouseButton(e)) {
				showPopupMenu();
			}
		}
	});
}
 
Example #5
Source File: RulesViewBuilder.java    From arcusplatform with Apache License 2.0 6 votes vote down vote up
protected Component createContents() {
   Table<RuleModel> ruleTable = null; //new RuleTableBuilder(rules).build();
   ruleTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   ruleTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
      @Override
      public void valueChanged(ListSelectionEvent e) {
         if(e.getValueIsAdjusting()) {
            return;
         }
         int index = ruleTable.getSelectionModel().getMinSelectionIndex();
         // TODO this should probably go through the controller
         if(index == -1) {
            toolbar.clearModel();
         }
         else {
            RuleModel model = ruleTable.getModel().getValue(index);
            toolbar.setModel(model);
         }
      }
   });
   return new JScrollPane(ruleTable);
}
 
Example #6
Source File: SiteTemplateWizard.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void initListeners() {
    // radios
    ItemListener defaultItemListener = new DefaultItemListener();
    noTemplateRadioButton.addItemListener(defaultItemListener);
    archiveTemplateRadioButton.addItemListener(defaultItemListener);
    onlineTemplateRadioButton.addItemListener(defaultItemListener);
    // online templates
    onlineTemplateList.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            setSiteTemplate(getSelectedOnlineTemplate());
            fireChange();
            updateOnlineTemplateDescription();
        }
    });
}
 
Example #7
Source File: SuiteCustomizerSources.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Creates new form SuiteCustomizerSources
 */
SuiteCustomizerSources(final SuiteProperties suiteProps, ProjectCustomizer.Category cat) {
    super(suiteProps, SuiteCustomizerSources.class, cat);
    initComponents();
    initAccesibility();
    prjFolderValue.setText(suiteProps.getProjectDirectory());
    refresh();
    moduleList.setCellRenderer(CustomizerComponentFactory.getModuleCellRenderer());
    moduleList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(javax.swing.event.ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                updateEnabled();
            } 
        }
    });
}
 
Example #8
Source File: DiffColorsPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public DiffColorsPanel() {
    initComponents ();

    setName(loc("LBL_DiffOptions_Tab")); //NOI18N
    
    lCategories.setSelectionMode (ListSelectionModel.SINGLE_SELECTION);
    lCategories.setVisibleRowCount (6);
    lCategories.addListSelectionListener (new ListSelectionListener() {
        public void valueChanged (ListSelectionEvent e) {
            if (!listen) return;
            refreshUI ();
        }
    });
    lCategories.setCellRenderer (new CategoryRenderer());
    cbBackground.addActionListener (this);
    btnResetToDefaults.addActionListener(this);
}
 
Example #9
Source File: OptionsPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Creates new form OptionsPanel */
public OptionsPanel(Object[] columnNames, List<WsimportOption> options, List<String> reservedOptions, WsimportOptions wsimportOptions) {
    initComponents();
    this.reservedOptions = reservedOptions;
    this.columnNames = columnNames;
    this.options = options;
    this.wsimportOptions = wsimportOptions;
    optionsTableModel = new OptionsTableModel(columnNames, options);
    optionsTable.setModel(optionsTableModel);
    optionsTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); // NOI18N
    ListSelectionListener listSelectionListener = new ListSelectionListenerImpl();
    optionsTable.getSelectionModel().addListSelectionListener(listSelectionListener);
    optionsTable.getColumnModel().getSelectionModel().addListSelectionListener(listSelectionListener);
    addListener = new AddButtonActionListener();
    ActionListener al = (ActionListener) WeakListeners.create(ActionListener.class, addListener,
            addBtn);
    addBtn.addActionListener(al);
    removeListener = new RemoveButtonActionListener();
    ActionListener rl = (ActionListener) WeakListeners.create(ActionListener.class, removeListener,
            removeBtn);
    removeBtn.addActionListener(rl);
    removeBtn.setEnabled(false);

}
 
Example #10
Source File: ToDoCustomizer.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Creates new form ToDoCustomizer */
public ToDoCustomizer() {
    initComponents();
    lblError.setVisible(false);
    table.getSelectionModel().setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
    table.getSelectionModel().addListSelectionListener( new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            enableButtons();
        }
    });
    table.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if ("tableCellEditor".equals(evt.getPropertyName())) { //NOI18N
                if (!table.isEditing()) { //  A cell has stopped editing
                    fireChanged();
                    firePropertyChange(OptionsPanelController.PROP_CHANGED, new Boolean(changed), Boolean.TRUE);
                    firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
                }
            }
        }
    });
    jScrollPane1.getViewport().setOpaque( false );
    enableButtons();
}
 
Example #11
Source File: AbstractFilterEditorPanel.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private Component createListPanel() {
    model = new DefaultListModel();
    list = new JList(model);

    list.setCellRenderer(new FilterRenderer());

    list.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                enableAppropriately();
            }
        }
    });

    return new JScrollPane(list);
}
 
Example #12
Source File: AbstractFilterEditorPanel.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private Component createListPanel() {
    model = new DefaultListModel();
    list = new JList(model);

    list.setCellRenderer(new FilterRenderer());

    list.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                enableAppropriately();
            }
        }
    });

    return new JScrollPane(list);
}
 
Example #13
Source File: GlobalOptionsPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Creates new form GlobalOptionsPanel */
public GlobalOptionsPanel() {
    initComponents();
    DefaultListModel dlm = new DefaultListModel();
    descMap = new HashMap<String, String>();
    int i = 0;
    String[] desc = SettingsPanel.getAvailableOptionsDescriptions();
    for (String s : SettingsPanel.AVAILABLE_OPTIONS) {
        dlm.addElement(s);
        descMap.put(s, desc[i]);
        i = i + 1;
    }
    jList1.setModel(dlm);
    jList1.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            String val = (String) jList1.getSelectedValue();
            if (val != null) {
                jTextArea1.setText(descMap.get(val));
            } else {
                jTextArea1.setText("");
            }
        }
    });
}
 
Example #14
Source File: PersistenceClientEntitySelectionVisual.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public PersistenceClientEntitySelectionVisual(String name, 
        WizardDescriptor wizard , boolean requireReferencedClasses ) 
{
    setName(name);
    initComponents();
    ListSelectionListener selectionListener = new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            updateButtons();
        }
    };
    listAvailable.getSelectionModel().addListSelectionListener(selectionListener);
    listSelected.getSelectionModel().addListSelectionListener(selectionListener);
    disableNoIdSelection = wizard.getProperty(PersistenceClientEntitySelection.DISABLENOIDSELECTION) == Boolean.TRUE;
    if ( requireReferencedClasses ){
        cbAddRelated.setSelected( true );
        cbAddRelated.setVisible( false );
    }
}
 
Example #15
Source File: SyncPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void initTableSelections() {
    itemTable.setColumnSelectionAllowed(false);
    itemTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent event) {
            if (event.getValueIsAdjusting()) {
                return;
            }
            if (selectionIsAdjusting) {
                return;
            }
            updateSyncInfo();
            setEnabledOperationButtons();
            setEnabledDiffButton();
        }
    });
}
 
Example #16
Source File: GridTable.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public GridTable(String actionName) {
  // the main delegate
  table = new JTableSorted(colName, list);

  // event management
  actionSource = new ActionSourceListener(actionName) {
    public void actionPerformed(ActionValueEvent e) {
      if (list == null)
        return;
      String want = e.getValue().toString();
      int count = 0;
      for (Row row : list) {
        if (want.equals(row.gg.getFullName())) {
          eventOK = false;
          table.setSelected(count);
          eventOK = true;
          break;
        }
        count++;
      }
    }
  };

  // send event when selected row changes
  table.addListSelectionListener(new ListSelectionListener() {
    public void valueChanged(ListSelectionEvent e) {
      if (eventOK && !e.getValueIsAdjusting()) {
        // new variable is selected
        Row row = (Row) table.getSelected();
        if (row != null) {
          if (debug)
            System.out.println(" GridTable new gg = " + row.gg.getFullName());
          actionSource.fireActionValueEvent(ActionSourceListener.SELECTED, row.gg.getFullName());
        }
      }
    }
  });
}
 
Example #17
Source File: NoSelectedServerWarning.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void initServerList() {
    serverList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    serverList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            boolean enabled = !serverList.isSelectionEmpty();
            firePropertyChange(OK_ENABLED, !enabled, enabled);
        }
    }
    );
    serverList.setCellRenderer(new ServersRenderer());
}
 
Example #18
Source File: ClassMethodSelector.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void setSelectionModel(final ListSelectionModel selection) {
    this.selection = selection;
    selection.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                int index = selection.getMinSelectionIndex();
                selected = index == -1 ? null : getElementAt(index);
            }
        }
    });
}
 
Example #19
Source File: InnerTablePanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new InnerTablePanel.
 *
 * @param model DefaultTableModel for included table
 */
public TablePanel(final AbstractTableModel model) {
    super(model);
    final JTable table = getTable();
    table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            int selectedRowCount = table.getSelectedRowCount();
            removeButton.setEnabled(selectedRowCount > 0);
            editButton.setEnabled(selectedRowCount == 1);
        }
    });
}
 
Example #20
Source File: ComboBoxTableCellEditor.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**********************************************************************
 *  Returns the renderer component of the cell.
 *
 *  @interfaceMethod javax.swing.table.TableCellEditor
 *********************************************************************/

public final Component getTableCellEditorComponent (JTable  table,
                                                    Object  value,
                                                    boolean selected,
                                                    int     row,
                                                    int     col)
{

    //add a listener to the table
    if  ( ! this.tableListenerAdded)
    {
        this.tableListenerAdded = true;
        this.table = table;
        this.table.getSelectionModel ().addListSelectionListener (new ListSelectionListener ()
        {
            public final void valueChanged (ListSelectionEvent evt)
            {
                eventTableSelectionChanged ();
            }
        });
    }
    this.currentRow = row;
    this.initialValue = value;

    return getEditorComponent (table, value, selected, row, col);

}
 
Example #21
Source File: InnerTablePanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new InnerTablePanel.
 *
 * @param model DefaultTableModel for included table
 */
public TablePanel(final AbstractTableModel model) {
    super(model);
    final JTable table = getTable();
    table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            int selectedRowCount = table.getSelectedRowCount();
            removeButton.setEnabled(selectedRowCount > 0);
            editButton.setEnabled(selectedRowCount == 1);
        }
    });
}
 
Example #22
Source File: ServerVolumeCustomizer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void postInitComponents () {
    this.content.setCellRenderer(new ContentRenderer());
    this.upButton.setEnabled (false);
    this.downButton.setEnabled (false);
    this.removeButton.setEnabled (false);
    if (!this.volumeType.equals(ServerLibraryTypeProvider.VOLUME_JAVADOC)
            && !this.volumeType.equals(ServerLibraryTypeProvider.VOLUME_SOURCE)) {
        this.addButton.setText (NbBundle.getMessage(ServerVolumeCustomizer.class,"ServerVolumeCustomizer.CTL_AddClassPath"));
        this.addButton.setMnemonic(NbBundle.getMessage(ServerVolumeCustomizer.class,"ServerVolumeCustomizer.MNE_AddClassPath").charAt(0));
        this.message.setText(NbBundle.getMessage(ServerVolumeCustomizer.class,"ServerVolumeCustomizer.CTL_ContentClassPath"));
        this.message.setDisplayedMnemonic(NbBundle.getMessage(ServerVolumeCustomizer.class,"ServerVolumeCustomizer.MNE_ContentClassPath").charAt(0));
        this.addButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ServerVolumeCustomizer.class,"ServerVolumeCustomizer.AD_AddClassPath"));
        this.message.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ServerVolumeCustomizer.class,"ServerVolumeCustomizer.AD_ContentClassPath"));
    } else if (this.volumeType.equals(ServerLibraryTypeProvider.VOLUME_JAVADOC)) {
        this.addButton.setText(NbBundle.getMessage(ServerVolumeCustomizer.class,"ServerVolumeCustomizer.CTL_AddJavadoc"));
        this.addButton.setMnemonic(NbBundle.getMessage(ServerVolumeCustomizer.class,"ServerVolumeCustomizer.MNE_AddJavadoc").charAt(0));
        this.message.setText(NbBundle.getMessage(ServerVolumeCustomizer.class,"ServerVolumeCustomizer.CTL_ContentJavadoc"));
        this.message.setDisplayedMnemonic(NbBundle.getMessage(ServerVolumeCustomizer.class,"ServerVolumeCustomizer.MNE_ContentJavadoc").charAt(0));
        this.addButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ServerVolumeCustomizer.class,"ServerVolumeCustomizer.AD_AddJavadoc"));
        this.message.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ServerVolumeCustomizer.class,"ServerVolumeCustomizer.AD_ContentJavadoc"));
    } else if (this.volumeType.equals(ServerLibraryTypeProvider.VOLUME_SOURCE)) {
        this.addButton.setText (NbBundle.getMessage(ServerVolumeCustomizer.class,"ServerVolumeCustomizer.CTL_AddSources"));
        this.addButton.setMnemonic (NbBundle.getMessage(ServerVolumeCustomizer.class,"ServerVolumeCustomizer.MNE_AddSources").charAt(0));
        this.message.setText(NbBundle.getMessage(ServerVolumeCustomizer.class,"ServerVolumeCustomizer.CTL_ContentSources"));
        this.message.setDisplayedMnemonic(NbBundle.getMessage(ServerVolumeCustomizer.class,"ServerVolumeCustomizer.MNE_ContentSources").charAt(0));
        this.addButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ServerVolumeCustomizer.class,"ServerVolumeCustomizer.AD_AddSources"));
        this.message.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ServerVolumeCustomizer.class,"ServerVolumeCustomizer.AD_ContentSources"));
    }
    this.content.addListSelectionListener(new ListSelectionListener () {
        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting())
                return;
            int[] indices = content.getSelectedIndices();
            removeButton.setEnabled(indices.length > 0);
            downButton.setEnabled(indices.length > 0 && indices[indices.length-1]<model.getSize()-1);
            upButton.setEnabled(indices.length>0 && indices[0]>0);
        }
    });
}
 
Example #23
Source File: DatabaseTablesPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public DatabaseTablesPanel() {
    initComponents();
    initInitial();
    ListSelectionListener selectionListener = new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            updateButtons();
        }
    };
    availableTablesList.getSelectionModel().addListSelectionListener(selectionListener);
    selectedTablesList.getSelectionModel().addListSelectionListener(selectionListener);
}
 
Example #24
Source File: StatusLineComponent.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public @Override void setModel(TaskModel mod) {
    model = mod;
    model.addListDataListener(new Listener());
    model.addListSelectionListener(new ListSelectionListener() {
        public @Override void valueChanged(ListSelectionEvent e) {
            pane.updateBoldFont(model.getSelectedHandle());
        }
    });
}
 
Example #25
Source File: SourceWizardPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** 
 * List content drives remove button enableness.
 */
private void initList() {
    sourcesList.getSelectionModel().addListSelectionListener(
        new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent evt) {
                removeButton.setEnabled(!sourcesList.isSelectionEmpty());
            }
        }
    );
    
    removeButton.setEnabled(!sourcesList.isSelectionEmpty());
}
 
Example #26
Source File: PhpAnnotationsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void initTable() {
    // model
    annotationsTable.setModel(tableModel);
    // columns
    annotationsTable.getTableHeader().setReorderingAllowed(false);
    // sorting
    annotationsTable.setAutoCreateRowSorter(true);
    // selections
    annotationsTable.setColumnSelectionAllowed(false);
    annotationsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent event) {
            if (event.getValueIsAdjusting()) {
                return;
            }
            setEnabledButtons(annotationsTable.getSelectedRowCount());
        }
    });
    // actions
    annotationsTable.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2
                    && editButton.isEnabled()) {
                openAnnotationPanel(annotationsTable.getSelectedRow());
            }
        }
    });
}
 
Example #27
Source File: ClassNameList.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Creates new form ClassNameList
 */
public ClassNameList() {
    initComponents();
    listClasses.setTableHeader(null);
    listClasses.getColumnModel().getColumn(0).setCellRenderer(new EnableAwareRenderer());
    listClasses.getColumnModel().getColumn(0).setCellEditor(new ValidatingCellEditor());
    listClasses.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            updateButtons();
        }
    });
    InnerPanelSupport.displayExtendedCells(listClasses);
}
 
Example #28
Source File: CategoryPanelStepFilters.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void initFilterClassesList() {
    filterClassesTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            filterRemoveButton.setEnabled(filterClassesTable.getSelectedRow() >= 0);
        }
    });
    filterRemoveButton.setEnabled(filterClassesTable.getSelectedRow() >= 0);
    filterClassesTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    filterClassesTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
}
 
Example #29
Source File: FolderList.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Creates new form FolderList */
public FolderList (String label, char mnemonic, String accessibleDesc, String fcMessage,
                   char addButtonMnemonic, String addButtonAccessibleDesc,
                   char removeButtonMnemonic,String removeButtonAccessibleDesc) {
    this.fcMessage = fcMessage;
    initComponents();
    this.jLabel1.setText(label);
    this.jLabel1.setDisplayedMnemonic(mnemonic);
    this.roots.getAccessibleContext().setAccessibleName(accessibleDesc);
    this.roots.setCellRenderer(new Renderer());
    this.roots.setModel (new DefaultListModel());
    this.roots.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                removeButton.setEnabled(roots.getSelectedIndices().length != 0);
            }
        }
    });
    this.roots.setDragEnabled(true);
    this.roots.setDropMode(DropMode.INSERT);
    this.roots.setTransferHandler(new DNDHandle());
    this.addButton.getAccessibleContext().setAccessibleDescription(addButtonAccessibleDesc);
    this.addButton.setMnemonic (addButtonMnemonic);        
    this.removeButton.getAccessibleContext().setAccessibleDescription(removeButtonAccessibleDesc);
    this.removeButton.setMnemonic (removeButtonMnemonic);
    this.removeButton.setEnabled(false);
}
 
Example #30
Source File: ConfigurationsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
ConfigurationsPanel(ModelHandle2 handle, NbMavenProjectImpl project) {
        this();
        this.handle = handle;
        this.project = project;
        
//        btnAdd.setVisible(false);
//        btnEdit.setVisible(false);
//        btnRemove.setVisible(false);
//        addProfileConfigurations();
        
        initListUI();
        checkButtonEnablement();
        lstConfigurations.setCellRenderer(new DefaultListCellRenderer() {
            @Override
            public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
                Component supers = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
                ModelHandle2.Configuration conf = (ModelHandle2.Configuration)value;
                if (conf == ConfigurationsPanel.this.handle.getActiveConfiguration()) {
                    supers.setFont(supers.getFont().deriveFont(Font.BOLD));
                }
                return supers;
            }
        });
        
        lstConfigurations.addListSelectionListener(new ListSelectionListener() {
            @Override
            public void valueChanged(ListSelectionEvent e) {
                checkButtonEnablement();
            }

        });
        createListModel();
    }