List of usage examples for javax.swing ListSelectionModel MULTIPLE_INTERVAL_SELECTION
int MULTIPLE_INTERVAL_SELECTION
To view the source code for javax.swing ListSelectionModel MULTIPLE_INTERVAL_SELECTION.
Click Source Link
From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositPresenter.java
private void setJobQueueTableDefaults(JTable jobQueueTable, JobQueueTableModel jobQueueTableModel) { jobQueueTableModel.addTableModelListener(new JobQueueTableModelListener()); jobQueueTable.setModel(jobQueueTableModel); jobQueueTable.setSurrendersFocusOnKeystroke(true); jobQueueTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); jobQueueTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); jobQueueTable.setColumnSelectionAllowed(true); jobQueueTable.setRowSelectionAllowed(true); TableRenderer renderer = new TableRenderer(); TableColumn col = jobQueueTable.getColumnModel().getColumn(0); int width = 200; col.setPreferredWidth(width);//www.j a v a 2 s.com col.setWidth(width); col.setCellRenderer(renderer); col = jobQueueTable.getColumnModel().getColumn(1); width = 1400; col.setPreferredWidth(width); col.setWidth(width); col.setCellRenderer(renderer); }
From source file:op.care.nursingprocess.DlgNursingProcess.java
private void reloadInterventions() { tblPlanung.setModel(new TMPlan(nursingProcess)); tblPlanung.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); tblPlanung.getColumnModel().getColumn(TMPlan.COL_TXT).setCellRenderer(new RNDHTML()); tblPlanung.getColumnModel().getColumn(TMPlan.COL_TXT) .setHeaderValue(SYSTools.xx("nursingrecords.nursingprocess.interventions")); }
From source file:org.accretegb.modules.phenotype.PhenotypeInfoPanel.java
/** * populates field table data/*w w w . j ava 2 s.c o m*/ */ public void populateFieldTable() { try { List<Object[]> results = FieldDAO.getInstance().findByLocation(); getFieldTablePanel().getTable().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); if (results.size() > 0) { Utils.removeAllRowsFromTable((DefaultTableModel) getFieldTablePanel().getTable().getModel()); } DefaultTableModel model = (DefaultTableModel) getFieldTablePanel().getTable().getModel(); for (Object[] obj : results) { obj[0] = new Boolean(false); obj[1] = Integer.toString((Integer) obj[1]); model.addRow(obj); } getFieldTablePanel().getTable().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); getFieldTablePanel().getTable().setSingleSelection(true); getFieldTablePanel().getTable().setModel(model); getFieldTablePanel().getTable().getSelectionModel() .addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting() && getFieldTablePanel().getTable().getSelectedRow() != -1) { subsetListComboBox.setSelectedIndex(0); tagname.setText(""); } } }); } catch (Exception e) { } }
From source file:org.apache.cayenne.modeler.editor.AbstractCallbackMethodsTab.java
private CayenneTable createTable(CallbackType callbackType) { final CayenneTable cayenneTable = new CayenneTable(); // drag-and-drop initialization cayenneTable.setDragEnabled(true);/* ww w .java 2 s. c o m*/ cayenneTable.setRowHeight(25); cayenneTable.setRowMargin(3); cayenneTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); cayenneTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); cayenneTable.setTransferHandler(new CallbackImportableHandler(cayenneTable)); cayenneTable.getSelectionModel().addListSelectionListener(new CallbackListSelectionListener(cayenneTable)); cayenneTable.getColumnModel().addColumnModelListener(new CallbackTableColumnModelListener(cayenneTable)); cayenneTable.getTableHeader().addMouseListener(new CallbackMouseAdapter(cayenneTable)); cayenneTable.getTableHeader().addMouseMotionListener(new CallbackMouseMotionListener(cayenneTable)); TablePopupHandler.install(cayenneTable, popupMenu); addButtonAtHeader(cayenneTable, getCreateCallbackMethodAction().buildButton(), new ButtonListener(callbackType), ModelerUtil.buildIcon("icon-create-method.gif")); return cayenneTable; }
From source file:org.apache.jmeter.config.gui.ArgumentsPanel.java
/** * Create the main GUI panel which contains the argument table. * * @return the main GUI panel/*from w ww .j a v a2 s. com*/ */ private Component makeMainPanel() { initializeTableModel(); table = new JTable(tableModel); table.getTableHeader().setDefaultRenderer(new HeaderAsPropertyRenderer()); table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); if (this.background != null) { table.setBackground(this.background); } JMeterUtils.applyHiDPI(table); return makeScrollPane(table); }
From source file:org.eurocarbdb.application.glycoworkbench.plugin.s3.Cockpit.java
/** * Initialises the application's GUI elements. */// w w w .j av a 2s . co m private void initGui() { initMenus(); JPanel appContent = new JPanel(new GridBagLayout()); this.getContentPane().add(appContent); // Buckets panel. JPanel bucketsPanel = new JPanel(new GridBagLayout()); JButton bucketActionButton = new JButton(); bucketActionButton.setToolTipText("Bucket actions menu"); guiUtils.applyIcon(bucketActionButton, "/images/nuvola/16x16/actions/misc.png"); bucketActionButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JButton sourceButton = (JButton) e.getSource(); bucketActionMenu.show(sourceButton, 0, sourceButton.getHeight()); } }); bucketsPanel.add(new JHtmlLabel("<html><b>Buckets</b></html>", this), new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); bucketsPanel.add(bucketActionButton, new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); bucketTableModel = new BucketTableModel(false); bucketTableModelSorter = new TableSorter(bucketTableModel); bucketsTable = new JTable(bucketTableModelSorter); bucketTableModelSorter.setTableHeader(bucketsTable.getTableHeader()); bucketsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); bucketsTable.getSelectionModel().addListSelectionListener(this); bucketsTable.setShowHorizontalLines(true); bucketsTable.setShowVerticalLines(false); bucketsTable.addMouseListener(new ContextMenuListener()); bucketsPanel.add(new JScrollPane(bucketsTable), new GridBagConstraints(0, 1, 2, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsZero, 0, 0)); bucketsPanel.add(new JLabel(" "), new GridBagConstraints(0, 2, 2, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsDefault, 0, 0)); // Filter panel. filterObjectsPanel = new JPanel(new GridBagLayout()); filterObjectsPrefix = new JTextField(); filterObjectsPrefix.setToolTipText("Only show objects with this prefix"); filterObjectsPrefix.addActionListener(this); filterObjectsPrefix.setActionCommand("RefreshObjects"); filterObjectsDelimiter = new JComboBox(new String[] { "", "/", "?", "\\" }); filterObjectsDelimiter.setEditable(true); filterObjectsDelimiter.setToolTipText("Object name delimiter"); filterObjectsDelimiter.addActionListener(this); filterObjectsDelimiter.setActionCommand("RefreshObjects"); filterObjectsPanel.add(new JHtmlLabel("Prefix:", this), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0)); filterObjectsPanel.add(filterObjectsPrefix, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); filterObjectsPanel.add(new JHtmlLabel("Delimiter:", this), new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsDefault, 0, 0)); filterObjectsPanel.add(filterObjectsDelimiter, new GridBagConstraints(3, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0)); filterObjectsPanel.setVisible(false); // Objects panel. JPanel objectsPanel = new JPanel(new GridBagLayout()); int row = 0; filterObjectsCheckBox = new JCheckBox("Filter objects"); filterObjectsCheckBox.addActionListener(this); filterObjectsCheckBox.setToolTipText("Check this option to filter the objects listed"); objectsPanel.add(new JHtmlLabel("<html><b>Objects</b></html>", this), new GridBagConstraints(0, row, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); objectsPanel.add(filterObjectsCheckBox, new GridBagConstraints(1, row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); JButton objectActionButton = new JButton(); objectActionButton.setToolTipText("Object actions menu"); guiUtils.applyIcon(objectActionButton, "/images/nuvola/16x16/actions/misc.png"); objectActionButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JButton sourceButton = (JButton) e.getSource(); objectActionMenu.show(sourceButton, 0, sourceButton.getHeight()); } }); objectsPanel.add(objectActionButton, new GridBagConstraints(2, row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); objectsPanel.add(filterObjectsPanel, new GridBagConstraints(0, ++row, 3, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); objectsTable = new JTable(); objectTableModel = new ObjectTableModel(); objectTableModelSorter = new TableSorter(objectTableModel); objectTableModelSorter.setTableHeader(objectsTable.getTableHeader()); objectsTable.setModel(objectTableModelSorter); objectsTable.setDefaultRenderer(Long.class, new DefaultTableCellRenderer() { private static final long serialVersionUID = 301092191828910402L; public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { String formattedSize = byteFormatter.formatByteSize(((Long) value).longValue()); return super.getTableCellRendererComponent(table, formattedSize, isSelected, hasFocus, row, column); } }); objectsTable.setDefaultRenderer(Date.class, new DefaultTableCellRenderer() { private static final long serialVersionUID = 7285511556343895652L; public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Date date = (Date) value; return super.getTableCellRendererComponent(table, yearAndTimeSDF.format(date), isSelected, hasFocus, row, column); } }); objectsTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); objectsTable.getSelectionModel().addListSelectionListener(this); objectsTable.setShowHorizontalLines(true); objectsTable.setShowVerticalLines(true); objectsTable.addMouseListener(new ContextMenuListener()); objectsTableSP = new JScrollPane(objectsTable); objectsPanel.add(objectsTableSP, new GridBagConstraints(0, ++row, 3, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsZero, 0, 0)); objectsSummaryLabel = new JHtmlLabel("Please select a bucket", this); objectsSummaryLabel.setHorizontalAlignment(JLabel.CENTER); objectsSummaryLabel.setFocusable(false); objectsPanel.add(objectsSummaryLabel, new GridBagConstraints(0, ++row, 3, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); // Combine sections. JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, bucketsPanel, objectsPanel); splitPane.setOneTouchExpandable(true); splitPane.setContinuousLayout(true); appContent.add(splitPane, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsDefault, 0, 0)); // Set preferred sizes int preferredWidth = 800; int preferredHeight = 600; this.setBounds(new Rectangle(new Dimension(preferredWidth, preferredHeight))); splitPane.setResizeWeight(0.30); // Initialize drop target. initDropTarget(new JComponent[] { objectsTableSP, objectsTable }); objectsTable.getDropTarget().setActive(false); objectsTableSP.getDropTarget().setActive(false); }
From source file:org.genedb.jogra.plugins.TermRationaliser.java
/** * Return a new JFrame which is the main interface to the Rationaliser. *///from ww w . j a va 2 s.c o m public JFrame getMainPanel() { /* JFRAME */ frame.setTitle(WINDOW_TITLE); frame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); frame.setLayout(new BorderLayout()); /* MENU */ JMenuBar menuBar = new JMenuBar(); JMenu actions_menu = new JMenu("Actions"); JMenuItem actions_mitem_1 = new JMenuItem("Refresh lists"); actions_mitem_1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { initModels(); } }); actions_menu.add(actions_mitem_1); JMenu about_menu = new JMenu("About"); JMenuItem about_mitem_1 = new JMenuItem("About"); about_mitem_1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { JOptionPane.showMessageDialog(null, "Term Rationaliser \n" + "Wellcome Trust Sanger Institute, UK \n" + "2009", "Term Rationaliser", JOptionPane.PLAIN_MESSAGE); } }); about_menu.add(about_mitem_1); menuBar.add(about_menu); menuBar.add(actions_menu); frame.add(menuBar, BorderLayout.NORTH); /* MAIN BOX */ Box center = Box.createHorizontalBox(); //A box that displays contents from left to right center.add(Box.createHorizontalStrut(5)); //Invisible fixed-width component /* FROM LIST AND PANEL */ fromList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); //Allow multiple products to be selected fromList.addKeyListener(new KeyListener() { @Override public void keyPressed(KeyEvent arg0) { if (arg0.getKeyCode() == KeyEvent.VK_RIGHT) { synchroniseLists(fromList, toList); //synchronise from left to right } } @Override public void keyReleased(KeyEvent arg0) { } @Override public void keyTyped(KeyEvent arg0) { } }); Box fromPanel = this.createRationaliserPanel(FROM_LIST_NAME, fromList); //Box on left hand side fromPanel.add(Box.createVerticalStrut(55)); //Add some space center.add(fromPanel); //Add to main box center.add(Box.createHorizontalStrut(3)); //Add some space /* MIDDLE PANE */ Box middlePane = Box.createVerticalBox(); ClassLoader classLoader = this.getClass().getClassLoader(); //Needed to access the images later on ImageIcon leftButtonIcon = new ImageIcon(classLoader.getResource("left_arrow.gif")); ImageIcon rightButtonIcon = new ImageIcon(classLoader.getResource("right_arrow.gif")); leftButtonIcon = new ImageIcon(leftButtonIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH)); //TODO: Investigate simpler way to resize an icon! rightButtonIcon = new ImageIcon(rightButtonIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH)); //TODO: Investigate simpler way to resize an icon! JButton rightSynch = new JButton(rightButtonIcon); rightSynch.setToolTipText("Synchronise TO list. \n Shortcut: Right-arrow key"); rightSynch.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { synchroniseLists(fromList, toList); } }); JButton leftSynch = new JButton(leftButtonIcon); leftSynch.setToolTipText("Synchronise FROM list. \n Shortcut: Left-arrow key"); leftSynch.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { synchroniseLists(toList, fromList); } }); middlePane.add(rightSynch); middlePane.add(leftSynch); center.add(middlePane); //Add middle pane to main box center.add(Box.createHorizontalStrut(3)); /* TO LIST AND PANEL */ toList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); //Single product selection in TO list toList.addKeyListener(new KeyListener() { @Override public void keyPressed(KeyEvent arg0) { if (arg0.getKeyCode() == KeyEvent.VK_LEFT) { synchroniseLists(toList, fromList); //synchronise from right to left } } @Override public void keyReleased(KeyEvent arg0) { } @Override public void keyTyped(KeyEvent arg0) { } }); Box toPanel = this.createRationaliserPanel(TO_LIST_NAME, toList); Box newTerm = Box.createVerticalBox(); textField = new JTextArea(1, 1); //textfield to let the user edit the name of an existing term textField.setMaximumSize(new Dimension(Toolkit.getDefaultToolkit().getScreenSize().height, 10)); textField.setForeground(Color.BLUE); JScrollPane jsp = new JScrollPane(textField); //scroll pane so that there is a horizontal scrollbar jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); newTerm.add(jsp); TitledBorder editBorder = BorderFactory.createTitledBorder("Edit term name"); editBorder.setTitleColor(Color.DARK_GRAY); newTerm.setBorder(editBorder); toPanel.add(newTerm); //add textfield to panel center.add(toPanel); //add panel to main box center.add(Box.createHorizontalStrut(5)); frame.add(center); //add the main panel to the frame initModels(); //load the lists with data /* BOTTOM HALF OF FRAME */ Box main = Box.createVerticalBox(); TitledBorder border = BorderFactory.createTitledBorder("Information"); border.setTitleColor(Color.DARK_GRAY); /* INFORMATION BOX */ Box info = Box.createVerticalBox(); Box scope = Box.createHorizontalBox(); scope.add(Box.createHorizontalStrut(5)); scope.add(scopeLabel); //label showing the scope of the terms scope.add(Box.createHorizontalGlue()); Box productCount = Box.createHorizontalBox(); productCount.add(Box.createHorizontalStrut(5)); productCount.add(productCountLabel); //display the label showing the number of terms productCount.add(Box.createHorizontalGlue()); info.add(scope); info.add(productCount); info.setBorder(border); /* ACTION BUTTONS */ Box actionButtons = Box.createHorizontalBox(); actionButtons.add(Box.createHorizontalGlue()); actionButtons.add(Box.createHorizontalStrut(10)); JButton findFix = new JButton(new FindClosestMatchAction()); actionButtons.add(findFix); actionButtons.add(Box.createHorizontalStrut(10)); RationaliserAction ra = new RationaliserAction(); // RationaliserAction2 ra2 = new RationaliserAction2(); JButton go = new JButton(ra); actionButtons.add(go); actionButtons.add(Box.createHorizontalGlue()); /* MORE INFORMATION TOGGLE */ Box buttonBox = Box.createHorizontalBox(); final JButton toggle = new JButton("Hide information <<"); buttonBox.add(Box.createHorizontalStrut(5)); buttonBox.add(toggle); buttonBox.add(Box.createHorizontalGlue()); Box textBox = Box.createHorizontalBox(); final JScrollPane scrollPane = new JScrollPane(information); scrollPane.setPreferredSize(new Dimension(frame.getWidth(), 100)); scrollPane.setVisible(true); textBox.add(Box.createHorizontalStrut(5)); textBox.add(scrollPane); ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { if (toggle.getText().equals("Show information >>")) { scrollPane.setVisible(true); toggle.setText("Hide information <<"); frame.setPreferredSize(new Dimension(frame.getWidth(), frame.getHeight() + 100)); frame.pack(); } else if (toggle.getText().equals("Hide information <<")) { scrollPane.setVisible(false); toggle.setText("Show information >>"); frame.setPreferredSize(new Dimension(frame.getWidth(), frame.getHeight() - 100)); frame.pack(); } } }; toggle.addActionListener(actionListener); main.add(Box.createVerticalStrut(5)); main.add(info); main.add(Box.createVerticalStrut(5)); main.add(Box.createVerticalStrut(5)); main.add(actionButtons); main.add(Box.createVerticalStrut(10)); main.add(buttonBox); main.add(textBox); frame.add(main, BorderLayout.SOUTH); frame.pack(); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); frame.setVisible(true); //initModels(); return frame; }
From source file:org.geworkbench.components.lincs.LincsInterface.java
private JScrollPane buildJListPanel(List<String> dataList, JList aJlist) { aJlist.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); aJlist.setSelectionModel(new LincsListSelectionModel()); aJlist.setModel(new LincsListModel(dataList)); JScrollPane jScrollPane1 = new javax.swing.JScrollPane(aJlist, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); jScrollPane1.setPreferredSize(new java.awt.Dimension(200, 70)); return jScrollPane1; }
From source file:org.geworkbench.components.lincs.LincsInterface.java
private JScrollPane buildFilterJListPanel(List<String> dataList, FilteredJList filteredJList) { filteredJList.setSelectionModel(new LincsListSelectionModel()); filteredJList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); for (int i = 0; i < dataList.size(); i++) filteredJList.addItem(dataList.get(i)); JScrollPane jScrollPane1 = new javax.swing.JScrollPane(filteredJList, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); jScrollPane1.setPreferredSize(new java.awt.Dimension(200, 70)); return jScrollPane1; }
From source file:org.isatools.isacreator.filechooser.FileChooserUI.java
/** * Creates the FileSelection panel containing the list of selected files, and the toolbar to modify the list * * @return JPanel containing a selection pane *///w ww .j a v a 2 s .c om private JPanel createFilesSelectedPanel() { JPanel selectionContainer = new JPanel(new BorderLayout()); selectionContainer.setBackground(UIHelper.BG_COLOR); selectionContainer.setBorder( new TitledBorder(UIHelper.GREEN_ROUNDED_BORDER, "selection(s)", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR)); selectedFiles = new DirectoryFileList(); listModel = (DefaultListModel) selectedFiles.getModel(); selectedFiles.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); selectedFiles.setDragEnabled(false); JScrollPane selectedFileScroller = new JScrollPane(selectedFiles, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); selectedFileScroller.setPreferredSize(new Dimension(200, 175)); selectedFileScroller.setBorder(new EmptyBorder(0, 0, 0, 0)); IAppWidgetFactory.makeIAppScrollPane(selectedFileScroller); selectionContainer.add(selectedFileScroller, BorderLayout.CENTER); // add list modification toolbar to sort, move, and delete files from the list. JPanel optionsPanel = new JPanel(); optionsPanel.setLayout(new BoxLayout(optionsPanel, BoxLayout.LINE_AXIS)); optionsPanel.setBackground(UIHelper.BG_COLOR); final JLabel moveDown = new JLabel(downIcon); moveDown.setOpaque(false); moveDown.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { moveDown.setIcon(downIcon); if (!selectedFiles.isSelectionEmpty()) { int toMoveDown = selectedFiles.getSelectedIndex(); if (toMoveDown != (listModel.getSize() - 1)) { swapElements(toMoveDown, toMoveDown + 1); } } } public void mouseEntered(MouseEvent event) { moveDown.setIcon(downIconOver); } public void mouseExited(MouseEvent event) { moveDown.setIcon(downIcon); } }); optionsPanel.add(moveDown); optionsPanel.add(Box.createHorizontalStrut(5)); final JLabel moveUp = new JLabel(upIcon); moveUp.setOpaque(false); moveUp.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { moveUp.setIcon(upIcon); if (!selectedFiles.isSelectionEmpty()) { int toMoveUp = selectedFiles.getSelectedIndex(); if (toMoveUp != 0) { swapElements(toMoveUp, toMoveUp - 1); } } } public void mouseEntered(MouseEvent event) { moveUp.setIcon(upIconOver); } public void mouseExited(MouseEvent event) { moveUp.setIcon(upIcon); } }); optionsPanel.add(moveUp); optionsPanel.add(Box.createHorizontalStrut(5)); final JLabel deleteItem = new JLabel(deleteIcon); deleteItem.setOpaque(false); deleteItem.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { deleteItem.setIcon(deleteIcon); if (selectedFiles.getSelectedValues() != null) { for (Object o : selectedFiles.getSelectedValues()) { listModel.removeElement(o); } } } public void mouseEntered(MouseEvent event) { deleteItem.setIcon(deleteIconOver); } public void mouseExited(MouseEvent event) { deleteItem.setIcon(deleteIcon); } }); optionsPanel.add(deleteItem); optionsPanel.add(Box.createHorizontalStrut(5)); final JLabel sortAsc = new JLabel(sortAscIcon); sortAsc.setOpaque(false); sortAsc.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { sortAsc.setIcon(sortAscIcon); if (listModel.getSize() > 0) { sort(true); } } public void mouseEntered(MouseEvent event) { sortAsc.setIcon(sortAscIconOver); } public void mouseExited(MouseEvent event) { sortAsc.setIcon(sortAscIcon); } }); optionsPanel.add(sortAsc); optionsPanel.add(Box.createHorizontalStrut(5)); final JLabel sortDesc = new JLabel(sortDescIcon); sortDesc.setOpaque(false); sortDesc.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { sortDesc.setIcon(sortDescIcon); if (listModel.getSize() > 0) { sort(false); } } public void mouseEntered(MouseEvent event) { sortDesc.setIcon(sortDescIconOver); } public void mouseExited(MouseEvent event) { sortDesc.setIcon(sortDescIcon); } }); optionsPanel.add(sortDesc); optionsPanel.add(Box.createHorizontalStrut(5)); selectionContainer.add(optionsPanel, BorderLayout.SOUTH); return selectionContainer; }