javax.swing.ListSelectionModel Java Examples
The following examples show how to use
javax.swing.ListSelectionModel.
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: RTableTest.java From marathonv5 with Apache License 2.0 | 6 votes |
public void selectAllCells() throws Throwable { final JTable table = (JTable) ComponentUtils.findComponent(JTable.class, frame); final LoggingRecorder lr = new LoggingRecorder(); siw(new Runnable() { @Override public void run() { table.setColumnSelectionAllowed(true); table.setRowSelectionAllowed(true); table.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); table.getColumnModel().getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); int rowCount = table.getRowCount(); int colCount = table.getColumnCount(); table.addRowSelectionInterval(0, rowCount - 1); table.addColumnSelectionInterval(0, colCount - 1); RTable rTable = new RTable(table, null, null, lr); rTable.focusLost(null); } }); Call call = lr.getCall(); AssertJUnit.assertEquals("select", call.getFunction()); AssertJUnit.assertEquals("all", call.getState()); }
Example #2
Source File: SelectInstallationPanel.java From netbeans with Apache License 2.0 | 6 votes |
@NbBundle.Messages({ "MSG_Detecting_Wait=Detecting installations, please wait..." }) private void initList() { installationList.setListData(new Object[]{ Bundle.MSG_Detecting_Wait() }); installationList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); installationList.setEnabled(false); RequestProcessor.getDefault().post(new Runnable() { @Override public void run() { final List<Installation> installations = InstallationManager.detectAllInstallations(); EventQueue.invokeLater(new Runnable() { @Override public void run() { updateListForDetectedInstallations(installations); } }); } }); }
Example #3
Source File: AnnotationPanel.java From marathonv5 with Apache License 2.0 | 6 votes |
public AnnotationPanel(final ImagePanel imagePanel, boolean readOnly) { putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); setModel(new AnnotationTableModel(imagePanel)); if (!readOnly) setDefaultEditor(Annotation.class, new AnnotationEditor()); setDefaultRenderer(Annotation.class, new AnnotationRenderer()); setSelectionMode(ListSelectionModel.SINGLE_SELECTION); getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) return; int index = getSelectedRow(); if (index == -1) return; imagePanel.setSelectedAnnotation((Annotation) imagePanel.getAnnotations().get(index), false); } }); }
Example #4
Source File: GroupEditorPanel.java From opensim-gui with Apache License 2.0 | 6 votes |
private void jRemoveItemsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRemoveItemsButtonActionPerformed ListSelectionModel lsm = jToList.getSelectionModel(); if (lsm.isSelectionEmpty()) return; // Multiple interval selection. Loop thru them int minIndex=lsm.getMinSelectionIndex(); int maxIndex=lsm.getMaxSelectionIndex(); for(int i=minIndex; i<=maxIndex; i++){ if (lsm.isSelectedIndex(i)){ String objName=(String) jToList.getModel().getElementAt(i); if (currentGroup.contains(objName)) currentGroup.remove(dSet.get(objName)); } } updateCurrentGroup(); // TODO add your handling code here: }
Example #5
Source File: ClassPathFormImpl.java From jmkvpropedit with BSD 2-Clause "Simplified" License | 6 votes |
public ClassPathFormImpl(Bindings bindings, JFileChooser fc) { bindings.addOptComponent("classPath", ClassPath.class, _classpathCheck) .add("classPath.mainClass", _mainclassField) .add("classPath.paths", _classpathList); _fileChooser = fc; ClasspathCheckListener cpl = new ClasspathCheckListener(); _classpathCheck.addChangeListener(cpl); cpl.stateChanged(null); _classpathList.setModel(new DefaultListModel()); _classpathList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); _classpathList.addListSelectionListener(new ClasspathSelectionListener()); _newClasspathButton.addActionListener(new NewClasspathListener()); _acceptClasspathButton.addActionListener( new AcceptClasspathListener(_classpathField)); _removeClasspathButton.addActionListener(new RemoveClasspathListener()); _importClasspathButton.addActionListener(new ImportClasspathListener()); _classpathUpButton.addActionListener(new MoveUpListener()); _classpathDownButton.addActionListener(new MoveDownListener()); }
Example #6
Source File: GTableColumnModel.java From ghidra with Apache License 2.0 | 6 votes |
@Override public void setSelectionModel(ListSelectionModel newModel) { if (newModel == null) { throw new IllegalArgumentException("Cannot set a null SelectionModel"); } ListSelectionModel oldModel = selectionModel; if (newModel != oldModel) { if (oldModel != null) { oldModel.removeListSelectionListener(this); } selectionModel = newModel; newModel.addListSelectionListener(this); } }
Example #7
Source File: SorterTableColumnModel.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
public SorterTableColumnModel(Sortables[] columnHeaders) { MainFrame mainFrame = MainFrame.getInstance(); int x = 0; for (Sortables c : columnHeaders) { if (!c.isAvailable(mainFrame)) { continue; } shown.add(c); TableColumn tc = makeTableColumn(x, c); columnList.add(tc); x++; } dlsm = new DefaultListSelectionModel(); dlsm.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); orderUpdate(); check(); }
Example #8
Source File: LocationReferencesPanel.java From ghidra with Apache License 2.0 | 6 votes |
private void buildPanel() { tableModel = new LocationReferencesTableModel(locationReferencesProvider); tablePanel = new GhidraThreadedTablePanel<>(tableModel, 250); table = tablePanel.getTable(); table.setHTMLRenderingEnabled(true); table.setPreferredScrollableViewportSize(new Dimension(300, 120)); table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); setLayout(new BorderLayout(10, 10)); PluginTool tool = locationReferencesProvider.getTool(); GoToService goToService = tool.getService(GoToService.class); table.installNavigation(goToService, goToService.getDefaultNavigatable()); GhidraTableFilterPanel<LocationReference> tableFilterPanel = new GhidraTableFilterPanel<>(table, tableModel); add(tablePanel, BorderLayout.CENTER); add(tableFilterPanel, BorderLayout.SOUTH); }
Example #9
Source File: Reactions.java From iBioSim with Apache License 2.0 | 6 votes |
/** * Remove a reaction */ private void removeReaction() { int index = reactions.getSelectedIndex(); if (index != -1) { String selected = ((String) reactions.getSelectedValue()).split("\\[| ")[0]; Reaction reaction = bioModel.getSBMLDocument().getModel().getReaction(selected); if (BioModel.isProductionReaction(reaction)) { modelEditor.removePromoter(SBMLutilities.getPromoterId(reaction)); } else { bioModel.removeReaction(selected); reactions.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); reacts = (String[]) Utility.remove(reactions, reacts); reactions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); if (index < reactions.getModel().getSize()) { reactions.setSelectedIndex(index); } else { reactions.setSelectedIndex(index - 1); } } modelEditor.setDirty(true); modelEditor.makeUndoPoint(); } }
Example #10
Source File: QFixMessengerFrame.java From quickfix-messenger with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void initBottomPanel() { MessagesTableModel messagesTableModel = new MessagesTableModel(); messagesTable = new JTable(messagesTableModel); messagesTable.getColumnModel().getColumn(0).setPreferredWidth(90); messagesTable.getColumnModel().getColumn(1).setPreferredWidth(5); messagesTable.getColumnModel().getColumn(2).setPreferredWidth(75); messagesTable.getColumnModel().getColumn(3).setPreferredWidth(5); messagesTable.getColumnModel().getColumn(4).setPreferredWidth(510); messagesTable.setDefaultRenderer(String.class, new MessagesTableCellRender()); messagesTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); messagesTable.addMouseListener(new MessagesTableMouseListener(this)); messenger.getApplication().addMessageListener(messagesTableModel); bottomPanelScrollPane = new JScrollPane(messagesTable); bottomPanelScrollPane.setPreferredSize(new Dimension( bottomPanelScrollPane.getPreferredSize().width, 120)); bottomPanelScrollPane.getViewport().add(messagesTable); add(bottomPanelScrollPane, BorderLayout.SOUTH); }
Example #11
Source File: ListPane.java From jdal with Apache License 2.0 | 6 votes |
public void init() { setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS)); tableIcon = FormUtils.getIcon(tableIcon, DEFAULT_TABLE_ICON); for (PanelHolder p : panels) p.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5)); list = new JList(new ListListModel(panels)); list.setBorder(BorderFactory.createEmptyBorder(5, 5 , 5, 5)); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.setVisibleRowCount(-1); list.addListSelectionListener(this); list.setCellRenderer(renderer); list.setSelectedIndex(0); if (cellHeight != 0) list.setFixedCellHeight(cellHeight); JScrollPane scroll = new JScrollPane(list); split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scroll, editorPanel); split.setResizeWeight(0); split.setDividerLocation(150); add(split); }
Example #12
Source File: ClassPathFormImpl.java From beast-mcmc with GNU Lesser General Public License v2.1 | 6 votes |
public ClassPathFormImpl(Bindings bindings, JFileChooser fc) { bindings.addOptComponent("classPath", ClassPath.class, _classpathCheck) .add("classPath.mainClass", _mainclassField) .add("classPath.paths", _classpathList); _fileChooser = fc; ClasspathCheckListener cpl = new ClasspathCheckListener(); _classpathCheck.addChangeListener(cpl); cpl.stateChanged(null); _classpathList.setModel(new DefaultListModel()); _classpathList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); _classpathList.addListSelectionListener(new ClasspathSelectionListener()); _newClasspathButton.addActionListener(new NewClasspathListener()); _acceptClasspathButton.addActionListener( new AcceptClasspathListener(_classpathField)); _removeClasspathButton.addActionListener(new RemoveClasspathListener()); _importClasspathButton.addActionListener(new ImportClasspathListener()); _classpathUpButton.addActionListener(new MoveUpListener()); _classpathDownButton.addActionListener(new MoveDownListener()); }
Example #13
Source File: SwingUtilities2.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * Set the lead and anchor without affecting selection. */ public static void setLeadAnchorWithoutSelection(ListSelectionModel model, int lead, int anchor) { if (anchor == -1) { anchor = lead; } if (lead == -1) { model.setAnchorSelectionIndex(-1); model.setLeadSelectionIndex(-1); } else { if (model.isSelectedIndex(lead)) { model.addSelectionInterval(lead, lead); } else { model.removeSelectionInterval(lead, lead); } model.setAnchorSelectionIndex(anchor); } }
Example #14
Source File: ListCategoryPane.java From OpERP with MIT License | 6 votes |
public ListCategoryPane() { pane = new JPanel(new MigLayout("fill")); table = new JTable(); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2 && table.getSelectedRow() != -1) { Category category = tableModel.getRow(table .getSelectedRow()); categoryDetailsPane.show(category, getPane()); } } }); final JScrollPane scrollPane = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); pane.add(scrollPane, "grow"); }
Example #15
Source File: BaseTextListComp.java From scelight with Apache License 2.0 | 5 votes |
/** * Builds the GUI of the tab. * * <p> * Does not finalizes the {@link #toolBar} * </p> */ protected void buildGui() { addNorth( toolBarsBox ); toolBarsBox.add( toolBar ); toolBar.addSelectInfoLabel( "Select text." ); toolBar.addSelEnabledButton( copySelectedAction ); toolBar.add( copyAllAction ); toolBar.add( new TipIcon( Tips.TEXT_SELECTION ) ); toolBar.addSeparator(); toolBar.add( searchComp ); searchComp.registerFocusHotkey( this ); searchComp.setSearcher( searcher ); toolBar.addSeparator(); toolBar.add( textSizeLabel ); textList.setCellRenderer( new DefaultListCellRenderer() { private final Border focusedBorder = BorderFactory.createMatteBorder( 1, 0, 1, 0, Color.BLACK ); @Override public Component getListCellRendererComponent( JList< ? > list, Object value, int index, boolean isSelected, boolean cellHasFocus ) { super.getListCellRendererComponent( list, value, index, isSelected, cellHasFocus ); // Default border results in big line height, set a thicker border setBorder( cellHasFocus ? focusedBorder : null ); return this; } } ); textList.setSelectionMode( ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ); addCenter( new XScrollPane( textList, true, false ) ); rebuildText(); }
Example #16
Source File: ConfigurableDialog.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
/** * Creates a new JList for a given source of a configurable * * @param source * can be null for local configurables, otherwise name of the source * @return the created JList */ private JList<Configurable> createNewConfigurableJList(String source) { final JList<Configurable> createdConfigList = new JList<>(); createdConfigList.setModel(source == null ? localConfigListModel : remoteConfigListModels.get(source)); createdConfigList.setCellRenderer(new ConfigurableRenderer()); createdConfigList.setFixedCellHeight(40); createdConfigList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); createdConfigList.setBackground(LIGHTER_GRAY); return createdConfigList; }
Example #17
Source File: ToolbarList.java From Logisim with GNU General Public License v3.0 | 5 votes |
public ToolbarList(ToolbarData base) { this.base = base; this.model = new Model(); setModel(model); setCellRenderer(new ListRenderer()); setSelectionMode(ListSelectionModel.SINGLE_SELECTION); AppPreferences.GATE_SHAPE.addPropertyChangeListener(model); base.addToolbarListener(model); base.addToolAttributeListener(model); }
Example #18
Source File: Editor.java From jclic with GNU General Public License v2.0 | 5 votes |
/** * Getter for property listSelectionModel. * * @return Value of property listSelectionModel. */ public ListSelectionModel getListSelectionModel() { ListSelectionModel result = listSelectionModel; if (result == null && getEditorParent() != null) result = getEditorParent().getListSelectionModel(); return result; }
Example #19
Source File: CustomizerFrameworks.java From netbeans with Apache License 2.0 | 5 votes |
private void initFrameworksList(WebModule webModule) { if (initialized) { return; } initialized = true; Profile j2eeProfile = Profile.fromPropertiesString(uiProperties.getProject().evaluator().getProperty(WebProjectProperties.J2EE_PLATFORM)); if (j2eeProfile == null) { j2eeProfile = Profile.JAVA_EE_6_WEB; } String serverInstanceID = uiProperties.getProject().evaluator().getProperty(WebProjectProperties.J2EE_SERVER_INSTANCE); Properties properties = controller.getProperties(); // FIXME I left string here for compatibility reasons (frameworks) properties.setProperty(ProjectServerWizardPanel.J2EE_LEVEL, j2eeProfile.toPropertiesString()); // NOI18N properties.setProperty("serverInstanceID", serverInstanceID); // NOI18N jListFrameworks.setModel(new DefaultListModel()); List<WebModuleExtender> usedExtenders = new LinkedList<WebModuleExtender>(); if (uiProperties.getCurrentFrameworks() != null) { for (WebFrameworkProvider framework : uiProperties.getCurrentFrameworks()) { usedFrameworks.add(framework); ((DefaultListModel) jListFrameworks.getModel()).addElement(framework.getName()); WebModuleExtender extender = framework.createWebModuleExtender(webModule, controller); extenders.put(framework, extender); usedExtenders.add(extender); extender.addChangeListener(new ExtenderListener(extender)); } } jListFrameworks.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jListFrameworks.addListSelectionListener(this); if (usedFrameworks.size() > 0) jListFrameworks.setSelectedIndex(0); if (WebFrameworks.getFrameworks().size() == jListFrameworks.getModel().getSize()) jButtonAdd.setEnabled(false); uiProperties.setExistingExtenders(usedExtenders); }
Example #20
Source File: TranslateGroupManuallyPopup.java From BigStitcher with GNU General Public License v2.0 | 5 votes |
public static void reSelect(final ListSelectionModel lsm) { final int maxSelectionIndex = lsm.getMaxSelectionIndex(); for (int i = 0; i <= maxSelectionIndex; i++) if (lsm.isSelectedIndex( i )) { lsm.removeSelectionInterval( i, i ); lsm.addSelectionInterval( i, i ); } }
Example #21
Source File: TripleAFrame.java From triplea with GNU General Public License v3.0 | 5 votes |
/** * Prompts the user to select the territory on which they wish to conduct a rocket attack. * * @param candidates The collection of territories on which the user may conduct a rocket attack. * @param from The territory from which the rocket attack is conducted. * @return The selected territory or {@code null} if no territory was selected. */ public Territory getRocketAttack(final Collection<Territory> candidates, final Territory from) { messageAndDialogThreadPool.waitForAll(); mapPanel.centerOn(from); final Supplier<Territory> action = () -> { final JList<Territory> list = new JList<>(SwingComponents.newListModel(candidates)); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.setSelectedIndex(0); final JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); final JScrollPane scroll = new JScrollPane(list); panel.add(scroll, BorderLayout.CENTER); if (from != null) { panel.add(BorderLayout.NORTH, new JLabel("Targets for rocket in " + from.getName())); } final String[] options = {"OK", "Dont attack"}; final String message = "Select Rocket Target"; final int selection = JOptionPane.showOptionDialog( TripleAFrame.this, panel, message, JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, null); return (selection == 0) ? list.getSelectedValue() : null; }; return Interruptibles.awaitResult(() -> SwingAction.invokeAndWaitResult(action)) .result .orElse(null); }
Example #22
Source File: SelectionInfo.java From wandora with GNU General Public License v3.0 | 5 votes |
@Override public void doGridSelection(Wandora admin, TopicGrid grid) { setDefaultLogger(); setLogTitle("Grid selection info"); int rowsCounter = grid.getRowCount(); int colsCounter = grid.getColumnCount(); //int rowSelectionCounter = 0; //int colSelectionCounter = 0; int cellSelectionCounter = 0; TableSelectionModel selection = grid.getTableSelectionModel(); for(int c=0; c<colsCounter; c++) { ListSelectionModel columnSelectionModel = selection.getListSelectionModelAt(c); if(columnSelectionModel != null && !columnSelectionModel.isSelectionEmpty()) { for(int r=0; r<rowsCounter; r++) { if(columnSelectionModel.isSelectedIndex(r)) { cellSelectionCounter++; } } } } String message = "Grid contains " + rowsCounter + " rows"; if(colsCounter > 1) message += " and " + (rowsCounter*colsCounter) + " cells."; else message += "."; if(cellSelectionCounter == 1) message += "\nSelection contains " + cellSelectionCounter + " cell."; if(cellSelectionCounter > 1) message += "\nSelection contains " + cellSelectionCounter + " cells."; log(message); setState(WandoraToolLogger.WAIT); }
Example #23
Source File: DropDemo.java From marathonv5 with Apache License 2.0 | 5 votes |
private JPanel createList() { DefaultListModel listModel = new DefaultListModel(); for (int i = 0; i < 10; i++) { listModel.addElement("List Item " + i); } list = new JList(listModel); list.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); JScrollPane scrollPane = new JScrollPane(list); scrollPane.setPreferredSize(new Dimension(400, 100)); list.setDragEnabled(true); list.setTransferHandler(new ListTransferHandler()); dropCombo = new JComboBox(new String[] { "USE_SELECTION", "ON", "INSERT", "ON_OR_INSERT" }); dropCombo.addActionListener(this); JPanel dropPanel = new JPanel(); dropPanel.add(new JLabel("List Drop Mode:")); dropPanel.add(dropCombo); JPanel panel = new JPanel(new BorderLayout()); panel.add(scrollPane, BorderLayout.CENTER); panel.add(dropPanel, BorderLayout.SOUTH); panel.setBorder(BorderFactory.createTitledBorder("List")); return panel; }
Example #24
Source File: TubesConfigPanel.java From netbeans with Apache License 2.0 | 5 votes |
private void populateValues() { overrideDefChBox.setSelected(overrideDefaults); List<TubeFactoryConfig> tubeFacConfigs = tubeList.getTubeFactoryConfigs(); for (TubeFactoryConfig cfg : tubeFacConfigs) { tubeTableModel.addRow(new Object[]{cfg.getClassName()}); } if (tubeTableModel.getRowCount() > 0) { ((ListSelectionModel) tubeTable.getSelectionModel()).setSelectionInterval(0, 0); } enableDisable(); }
Example #25
Source File: Listener.java From tcpmon with Apache License 2.0 | 5 votes |
/** * Method remove */ public void remove() { ListSelectionModel lsm = connectionTable.getSelectionModel(); int bot = lsm.getMinSelectionIndex(); int top = lsm.getMaxSelectionIndex(); for (int i = top; i >= bot; i--) { ((Connection) connections.get(i - 1)).remove(); } if (bot > connections.size()) { bot = connections.size(); } lsm.setSelectionInterval(bot, bot); }
Example #26
Source File: MBasicTable.java From javamelody with Apache License 2.0 | 5 votes |
/** * Constructeur. * * @param dataModel * Modèle pour les données (par exemple, MTableModel) */ public MBasicTable(final TableModel dataModel) { super(dataModel); setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // setAutoCreateColumnsFromModel(false); // par défaut, on laisse AUTO_RESIZE_SUBSEQUENT_COLUMNS // setAutoResizeMode(AUTO_RESIZE_OFF); // setDragEnabled(true); addKeyListener(KEY_HANDLER); }
Example #27
Source File: SceneEditorWizard.java From arcusplatform with Apache License 2.0 | 5 votes |
private Component createTemplateSelector() { TableModel<SceneTemplateModel> templates = TableModelBuilder .builder(ServiceLocator.getInstance(SceneController.class).getTemplates()) .columnBuilder() .withName("ID") .withGetter(SceneTemplateModel::getId) .add() .columnBuilder() .withName("Name") .withGetter(SceneTemplateModel::getName) .add() .columnBuilder() .withName("Available?") .withGetter(SceneTemplateModel::getAvailable) .add() .build(); Table<SceneTemplateModel> table = new Table<>(templates); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.getSelectionModel().addListSelectionListener((e) -> { if(e.getValueIsAdjusting()) { return; } this.value = templates.getValue(table.getSelectedRow()); if(this.value != null) { nextButton.setEnabled(true); } }); return new JScrollPane(table); }
Example #28
Source File: SkillInfoTab.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void restoreModels(ModelMap models) { models.get(FilterHandler.class).install(); models.get(SkillFilterHandler.class).install(); skillpointTable.setModel(models.get(SkillPointTableModel.class)); skillpointTable.setSelectionModel(models.get(ListSelectionModel.class)); skillTable.setDefaultEditor(Float.class, models.get(SkillRankSpinnerEditor.class)); models.get(SkillTreeViewModel.class).install(skillTable); models.get(InfoHandler.class).install(); models.get(LevelSelectionHandler.class).install(); models.get(SkillSheetHandler.class).install(); }
Example #29
Source File: DuelSidebarLayoutDialog.java From magarena with GNU General Public License v3.0 | 5 votes |
private void setLookAndFeel() { jlist.setOpaque(true); jlist.setBackground(Color.WHITE); jlist.setForeground(Color.BLACK); jlist.setSelectionBackground(HIGHLIGHT_BACK); jlist.setSelectionForeground(HIGHLIGHT_FORE); jlist.setFocusable(true); jlist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); }
Example #30
Source File: Compartments.java From iBioSim with Apache License 2.0 | 5 votes |
/** * Remove a compartment */ private void removeCompartment() { int index = compartments.getSelectedIndex(); if (index != -1) { if (!Utils.compartmentInUse(bioModel.getSBMLDocument(), ((String) compartments.getSelectedValue()).split("\\[| ")[0])) { if (!SBMLutilities.variableInUse(bioModel.getSBMLDocument(), ((String) compartments.getSelectedValue()).split("\\[| ")[0], false, true, this, null)) { Compartment tempComp = bioModel.getSBMLDocument().getModel().getCompartment(((String) compartments.getSelectedValue()).split("\\[| ")[0]); ListOf<Compartment> c = bioModel.getSBMLDocument().getModel().getListOfCompartments(); for (int i = 0; i < bioModel.getSBMLDocument().getModel().getCompartmentCount(); i++) { if (c.get(i).getId().equals(tempComp.getId())) { c.remove(i); } } for (int i = 0; i < bioModel.getSBMLCompModel().getListOfPorts().size(); i++) { Port port = bioModel.getSBMLCompModel().getListOfPorts().get(i); if (port.isSetIdRef() && port.getIdRef().equals(tempComp.getId())) { bioModel.getSBMLCompModel().getListOfPorts().remove(i); break; } } compartments.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); Utility.remove(compartments); compartments.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); if (index < compartments.getModel().getSize()) { compartments.setSelectedIndex(index); } else { compartments.setSelectedIndex(index - 1); } modelEditor.setDirty(true); modelEditor.makeUndoPoint(); } } } }