List of usage examples for javax.swing ListSelectionModel SINGLE_SELECTION
int SINGLE_SELECTION
To view the source code for javax.swing ListSelectionModel SINGLE_SELECTION.
Click Source Link
From source file:org.gumtree.vis.plot1d.Plot1DChartEditor.java
private JPanel createHelpPanel(JFreeChart chart) { JPanel wrap = new JPanel(new GridLayout(1, 1)); JPanel helpPanel = new JPanel(new GridLayout(1, 1)); helpPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); // helpPanel.setBorder(BorderFactory.createTitledBorder( // BorderFactory.createEtchedBorder(), "Help Topics")); SpringLayout spring = new SpringLayout(); JPanel inner = new JPanel(spring); inner.setBorder(BorderFactory.createEmptyBorder()); final IHelpProvider provider = new Plot1DHelpProvider(); final JList list = new JList(provider.getHelpMap().keySet().toArray()); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // list.setBorder(BorderFactory.createEtchedBorder()); JScrollPane listPane1 = new JScrollPane(list); inner.add(listPane1);/*from w ww.ja v a 2s .c o m*/ listPane1.setMaximumSize(new Dimension(140, 0)); listPane1.setMinimumSize(new Dimension(70, 0)); // JPanel contentPanel = new JPanel(new GridLayout(2, 1)); // inner.add(list); final JTextField keyField = new JTextField(); keyField.setMaximumSize(new Dimension(400, 20)); keyField.setEditable(false); // keyField.setMaximumSize(); // keyArea.setLineWrap(true); // keyArea.setWrapStyleWord(true); // keyArea.setBorder(BorderFactory.createEtchedBorder()); inner.add(keyField); // contentPanel.add(new JLabel()); // contentPanel.add(new JLabel()); final JTextArea helpArea = new JTextArea(); JScrollPane areaPane = new JScrollPane(helpArea); helpArea.setEditable(false); helpArea.setLineWrap(true); helpArea.setWrapStyleWord(true); // helpArea.setBorder(BorderFactory.createEtchedBorder()); inner.add(areaPane); // contentPanel.add(new JLabel()); // contentPanel.add(new JLabel()); // inner.add(contentPanel); spring.putConstraint(SpringLayout.WEST, listPane1, 2, SpringLayout.WEST, inner); spring.putConstraint(SpringLayout.NORTH, listPane1, 2, SpringLayout.NORTH, inner); spring.putConstraint(SpringLayout.WEST, keyField, 4, SpringLayout.EAST, listPane1); spring.putConstraint(SpringLayout.NORTH, keyField, 2, SpringLayout.NORTH, inner); spring.putConstraint(SpringLayout.EAST, inner, 2, SpringLayout.EAST, keyField); spring.putConstraint(SpringLayout.WEST, areaPane, 4, SpringLayout.EAST, listPane1); spring.putConstraint(SpringLayout.NORTH, areaPane, 4, SpringLayout.SOUTH, keyField); spring.putConstraint(SpringLayout.EAST, areaPane, -2, SpringLayout.EAST, inner); spring.putConstraint(SpringLayout.SOUTH, inner, 2, SpringLayout.SOUTH, areaPane); spring.putConstraint(SpringLayout.SOUTH, listPane1, -2, SpringLayout.SOUTH, inner); list.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { Object[] selected = list.getSelectedValues(); if (selected.length >= 0) { HelpObject help = provider.getHelpMap().get(selected[0]); if (help != null) { keyField.setText(help.getKey()); helpArea.setText(help.getDiscription()); } } } }); helpPanel.add(inner, BorderLayout.NORTH); wrap.setName("Help"); wrap.add(helpPanel, BorderLayout.NORTH); return wrap; }
From source file:DefaultsDisplay.java
protected JTable createDefaultsTable() { JTable table = new JTable(new UIDefaultsTableModel()); table.setRowHeight(rowHeight);//from w w w . j a v a 2 s .co m table.setShowHorizontalLines(false); table.setShowVerticalLines(false); table.setIntercellSpacing(new Dimension(0, 0)); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); initFilters(table); DefaultTableColumnModel columnModel = new DefaultTableColumnModel(); Color rowColors[] = new Color[2]; rowColors[0] = UIManager.getColor("Table.background"); rowColors[1] = new Color((int) (rowColors[0].getRed() * .90), (int) (rowColors[0].getGreen() * .95), (int) (rowColors[0].getBlue() * .95)); int width = 0; TableColumn column = new TableColumn(); column.setCellRenderer(new KeyRenderer(rowColors)); column.setModelIndex(UIDefaultsTableModel.KEY_COLUMN); column.setHeaderValue("Key"); column.setPreferredWidth(250); columnModel.addColumn(column); width += column.getPreferredWidth(); column = new TableColumn(); column.setCellRenderer(new RowRenderer(rowColors)); column.setModelIndex(UIDefaultsTableModel.TYPE_COLUMN); column.setHeaderValue("Type"); column.setPreferredWidth(250); columnModel.addColumn(column); width += column.getPreferredWidth(); column = new TableColumn(); column.setCellRenderer(new ValueRenderer(rowColors)); column.setModelIndex(UIDefaultsTableModel.VALUE_COLUMN); column.setHeaderValue("Value"); column.setPreferredWidth(300); columnModel.addColumn(column); width += column.getPreferredWidth(); table.setColumnModel(columnModel); table.setPreferredScrollableViewportSize(new Dimension(width, 12 * rowHeight)); return table; }
From source file:DisplayModeModel.java
private void initComponents(Container c) { setContentPane(c);//from www .j a va 2 s .com c.setLayout(new BorderLayout()); // Current DM JPanel currentPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); c.add(currentPanel, BorderLayout.NORTH); JLabel current = new JLabel("Current Display Mode : "); currentPanel.add(current); currentPanel.add(currentDM); // Display Modes JPanel modesPanel = new JPanel(new GridLayout(1, 2)); c.add(modesPanel, BorderLayout.CENTER); // List of display modes for (int i = 0; i < COLUMN_WIDTHS.length; i++) { TableColumn col = new TableColumn(i, COLUMN_WIDTHS[i]); col.setIdentifier(COLUMN_NAMES[i]); col.setHeaderValue(COLUMN_NAMES[i]); dmList.addColumn(col); } dmList.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dmList.getSelectionModel().addListSelectionListener(this); modesPanel.add(dmPane); // Controls JPanel controlsPanelA = new JPanel(new BorderLayout()); modesPanel.add(controlsPanelA); JPanel controlsPanelB = new JPanel(new GridLayout(2, 1)); controlsPanelA.add(controlsPanelB, BorderLayout.NORTH); // Exit JPanel exitPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); controlsPanelB.add(exitPanel); exitPanel.add(exit); // Change DM JPanel changeDMPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); controlsPanelB.add(changeDMPanel); changeDMPanel.add(changeDM); controlsPanelA.add(new JPanel(), BorderLayout.CENTER); }
From source file:net.sourceforge.happybank.main.BankMain.java
private void initComponents() { frame = new javax.swing.JFrame(); menuBar = new javax.swing.JMenuBar(); menuFile = new javax.swing.JMenu(); menuItemExit = new javax.swing.JMenuItem(); menuActions = new javax.swing.JMenu(); menuItemView = new javax.swing.JMenuItem(); separator2 = new javax.swing.JSeparator(); menuHelp = new javax.swing.JMenu(); separator4 = new javax.swing.JSeparator(); menuItemAbout = new javax.swing.JMenuItem(); accountEntries = new javax.swing.JTable(); accountModel = new AccountTableModel(); /*//from w w w . j a va 2s.co m * File menu */ menuFile.setMnemonic('F'); menuFile.setText("File"); // - Exit option menuItemExit.setMnemonic('X'); menuItemExit.setText("Exit"); menuItemExit.setActionCommand("Exit"); menuItemExit.addActionListener(new ActionHandler()); menuFile.add(menuItemExit); menuBar.add(menuFile); // Actions menu menuActions.setMnemonic('A'); menuActions.setText("Actions"); // - View option menuItemView.setMnemonic('V'); menuItemView .setAccelerator(KeyStroke.getKeyStroke('V', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); menuItemView.setText("View"); menuItemView.setActionCommand("View"); menuItemView.addActionListener(new ActionHandler()); menuActions.add(menuItemView); menuActions.add(separator2); // Help menu menuHelp.setMnemonic('H'); menuHelp.setText("Help"); // - About option menuHelp.add(separator4); menuItemAbout.setMnemonic('A'); menuItemAbout.setText("About"); menuItemAbout.setActionCommand("About"); menuItemAbout.addActionListener(new ActionHandler()); menuHelp.add(menuItemAbout); menuBar.add(menuHelp); /* * configure the TabListCellRenderer */ accountEntries.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); accountEntries.setAutoCreateColumnsFromModel(false); accountEntries.setModel(accountModel); accountEntries.getTableHeader().setReorderingAllowed(false); accountEntries.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); accountEntries.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { // capture single click if (evt.getClickCount() == 1 && SwingUtilities.isLeftMouseButton(evt)) { // ignore } // capture double click if (evt.getClickCount() == 2) { // edit the account int row = accountEntries.rowAtPoint(evt.getPoint()); accountEntries.setRowSelectionInterval(row, row); onViewAccount(); } } // mouseClicked }); // MouseAdapter // set the column widths and alignment for (int k = 0; k < AccountTableModel.COLUMNS.length; k++) { TableCellEditor zipper = new DefaultCellEditor(new JTextField()); DefaultTableCellRenderer textRenderer = new DefaultTableCellRenderer(); textRenderer.setHorizontalAlignment(AccountTableModel.COLUMNS[k].cAlignment); TableColumn column = new TableColumn(k, AccountTableModel.COLUMNS[k].cWidth, textRenderer, zipper); accountEntries.addColumn(column); } // set the table header JTableHeader header = accountEntries.getTableHeader(); header.setUpdateTableInRealTime(false); /* * create the selection area */ accountPanel = new JPanel(); accountPanel.setLayout(new BorderLayout()); scrollPane = new JScrollPane(accountEntries); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); scrollPane.setPreferredSize(new java.awt.Dimension(750, 300)); accountPanel.add(scrollPane); frame.getContentPane().add(accountPanel, java.awt.BorderLayout.CENTER); /* * layout the frame */ frame.setJMenuBar(menuBar); frame.setTitle(APP_NAME); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); frame.setLocation(screenSize.width / 2 - 300, screenSize.height / 2 - 200); // add a listener for the close event frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { onExit(); } }); loadAccounts(); }
From source file:FontChooser.java
/** This method is called from within the constructor to * initialize the form./*from ww w. ja v a 2s .com*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the FormEditor. */ private void initComponents() { jPanel3 = new javax.swing.JPanel(); jFont = new javax.swing.JTextField(); jScrollPane1 = new javax.swing.JScrollPane(); jFontList = new javax.swing.JList(); jPanel4 = new javax.swing.JPanel(); jStyle = new javax.swing.JTextField(); jScrollPane2 = new javax.swing.JScrollPane(); jStyleList = new javax.swing.JList(); jPanel5 = new javax.swing.JPanel(); jSize = new javax.swing.JTextField(); jScrollPane3 = new javax.swing.JScrollPane(); jSizeList = new javax.swing.JList(); jPanel1 = new javax.swing.JPanel(); jScrollPane4 = new javax.swing.JScrollPane(); jSample = new javax.swing.JTextArea(); jButtons = new javax.swing.JPanel(); jOk = new javax.swing.JButton(); jCancel = new javax.swing.JButton(); jLabel6 = new javax.swing.JLabel(); getContentPane().setLayout(new java.awt.GridBagLayout()); java.awt.GridBagConstraints gridBagConstraints1; setTitle("Font Chooser"); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); jPanel3.setLayout(new java.awt.GridBagLayout()); java.awt.GridBagConstraints gridBagConstraints2; jPanel3.setBorder(new javax.swing.border.TitledBorder(new javax.swing.border.EtchedBorder(), " Font ")); jFont.setColumns(24); jFont.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jFontActionPerformed(evt); } }); gridBagConstraints2 = new java.awt.GridBagConstraints(); gridBagConstraints2.gridwidth = 0; gridBagConstraints2.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints2.insets = new java.awt.Insets(0, 3, 0, 3); gridBagConstraints2.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints2.weightx = 1.0; jPanel3.add(jFont, gridBagConstraints2); jFontList.setModel(new DefaultListModel()); jFontList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); jFontList.addListSelectionListener(new javax.swing.event.ListSelectionListener() { public void valueChanged(javax.swing.event.ListSelectionEvent evt) { jFontListValueChanged(evt); } }); jScrollPane1.setViewportView(jFontList); gridBagConstraints2 = new java.awt.GridBagConstraints(); gridBagConstraints2.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints2.insets = new java.awt.Insets(3, 3, 3, 3); gridBagConstraints2.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints2.weightx = 1.0; gridBagConstraints2.weighty = 1.0; jPanel3.add(jScrollPane1, gridBagConstraints2); gridBagConstraints1 = new java.awt.GridBagConstraints(); gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints1.insets = new java.awt.Insets(5, 5, 0, 0); gridBagConstraints1.weightx = 0.5; gridBagConstraints1.weighty = 1.0; getContentPane().add(jPanel3, gridBagConstraints1); jPanel4.setLayout(new java.awt.GridBagLayout()); java.awt.GridBagConstraints gridBagConstraints3; jPanel4.setBorder(new javax.swing.border.TitledBorder(new javax.swing.border.EtchedBorder(), " Style ")); jStyle.setColumns(18); jStyle.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jStyleActionPerformed(evt); } }); gridBagConstraints3 = new java.awt.GridBagConstraints(); gridBagConstraints3.gridwidth = 0; gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints3.insets = new java.awt.Insets(0, 3, 0, 3); gridBagConstraints3.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints3.weightx = 1.0; jPanel4.add(jStyle, gridBagConstraints3); jStyleList.setModel(new DefaultListModel()); jStyleList.setVisibleRowCount(4); jStyleList.addListSelectionListener(new javax.swing.event.ListSelectionListener() { public void valueChanged(javax.swing.event.ListSelectionEvent evt) { jStyleListValueChanged(evt); } }); jScrollPane2.setViewportView(jStyleList); gridBagConstraints3 = new java.awt.GridBagConstraints(); gridBagConstraints3.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints3.insets = new java.awt.Insets(3, 3, 3, 3); gridBagConstraints3.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints3.weightx = 0.5; gridBagConstraints3.weighty = 1.0; jPanel4.add(jScrollPane2, gridBagConstraints3); gridBagConstraints1 = new java.awt.GridBagConstraints(); gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints1.insets = new java.awt.Insets(5, 5, 0, 0); gridBagConstraints1.weightx = 0.375; gridBagConstraints1.weighty = 1.0; getContentPane().add(jPanel4, gridBagConstraints1); jPanel5.setLayout(new java.awt.GridBagLayout()); java.awt.GridBagConstraints gridBagConstraints4; jPanel5.setBorder(new javax.swing.border.TitledBorder(new javax.swing.border.EtchedBorder(), " Size ")); jSize.setColumns(6); jSize.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jSizeActionPerformed(evt); } }); gridBagConstraints4 = new java.awt.GridBagConstraints(); gridBagConstraints4.gridwidth = 0; gridBagConstraints4.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints4.insets = new java.awt.Insets(0, 3, 0, 3); gridBagConstraints4.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints4.weightx = 1.0; jPanel5.add(jSize, gridBagConstraints4); jSizeList.setModel(new DefaultListModel()); jSizeList.setVisibleRowCount(4); jSizeList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); jSizeList.addListSelectionListener(new javax.swing.event.ListSelectionListener() { public void valueChanged(javax.swing.event.ListSelectionEvent evt) { jSizeListValueChanged(evt); } }); jScrollPane3.setViewportView(jSizeList); gridBagConstraints4 = new java.awt.GridBagConstraints(); gridBagConstraints4.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints4.insets = new java.awt.Insets(3, 3, 3, 3); gridBagConstraints4.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints4.weightx = 0.25; gridBagConstraints4.weighty = 1.0; jPanel5.add(jScrollPane3, gridBagConstraints4); gridBagConstraints1 = new java.awt.GridBagConstraints(); gridBagConstraints1.gridwidth = 0; gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints1.insets = new java.awt.Insets(5, 5, 0, 5); gridBagConstraints1.weightx = 0.125; gridBagConstraints1.weighty = 1.0; getContentPane().add(jPanel5, gridBagConstraints1); jPanel1.setLayout(new java.awt.GridBagLayout()); java.awt.GridBagConstraints gridBagConstraints5; jPanel1.setBorder(new javax.swing.border.TitledBorder(new javax.swing.border.EtchedBorder(), " Sample ")); jSample.setWrapStyleWord(true); jSample.setLineWrap(true); jSample.setColumns(20); jSample.setRows(3); jSample.setText("The quick brown fox jumped over the lazy dog."); jScrollPane4.setViewportView(jSample); gridBagConstraints5 = new java.awt.GridBagConstraints(); gridBagConstraints5.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints5.insets = new java.awt.Insets(0, 3, 3, 3); gridBagConstraints5.weightx = 1.0; gridBagConstraints5.weighty = 1.0; jPanel1.add(jScrollPane4, gridBagConstraints5); gridBagConstraints1 = new java.awt.GridBagConstraints(); gridBagConstraints1.gridwidth = 0; gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints1.insets = new java.awt.Insets(0, 5, 0, 5); gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints1.weightx = 1.0; getContentPane().add(jPanel1, gridBagConstraints1); jButtons.setLayout(new java.awt.GridBagLayout()); java.awt.GridBagConstraints gridBagConstraints6; jOk.setMnemonic(KeyEvent.VK_O); jOk.setText("OK"); jOk.setRequestFocusEnabled(false); jOk.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jOkActionPerformed(evt); } }); gridBagConstraints6 = new java.awt.GridBagConstraints(); gridBagConstraints6.insets = new java.awt.Insets(5, 5, 5, 0); gridBagConstraints6.anchor = java.awt.GridBagConstraints.WEST; jButtons.add(jOk, gridBagConstraints6); jCancel.setMnemonic(KeyEvent.VK_C); jCancel.setText("Cancel"); jCancel.setRequestFocusEnabled(false); jCancel.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jCancelActionPerformed(evt); } }); gridBagConstraints6 = new java.awt.GridBagConstraints(); gridBagConstraints6.gridwidth = 0; gridBagConstraints6.insets = new java.awt.Insets(5, 5, 5, 5); gridBagConstraints6.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints6.weightx = 1.0; jButtons.add(jCancel, gridBagConstraints6); gridBagConstraints6 = new java.awt.GridBagConstraints(); gridBagConstraints6.weightx = 1.0; jButtons.add(jLabel6, gridBagConstraints6); gridBagConstraints1 = new java.awt.GridBagConstraints(); gridBagConstraints1.gridwidth = 0; gridBagConstraints1.anchor = java.awt.GridBagConstraints.SOUTHWEST; gridBagConstraints1.weightx = 1.0; getContentPane().add(jButtons, gridBagConstraints1); }
From source file:com.hp.alm.ali.idea.ui.MultipleItemsDialog.java
public MultipleItemsDialog(Project project, String title, final MultipleItemsDialogModel<K, E> model) { super(project, title, true); this.model = model; mySelectionModel = new MySelectionModel(); myListSelectionListener = new MyListSelectionListener(); tooMany = new JLabel("Too many results, narrow your search"); tooMany.setBorder(BorderFactory.createEtchedBorder()); tooMany.setVisible(false);//w w w . j ava 2 s. c om selected = new JLabel("Showing currently selected items"); selected.setVisible(false); toggleSelected = new JToggleButton(); toggleSelected.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { model.setShowingSelected(toggleSelected.isSelected()); if (!model.isShowingSelected() && !model.getSelectedFields().isEmpty()) { updateSelectionFromModel(); } else if (model.isShowingSelected()) { header.getFilterEditor(1).setContent(""); } } }); updateSelected(); table = new JBTable() { @Override public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend) { int column = convertColumnIndexToModel(columnIndex); mySelectionModel.setFirstColumnEvent(column == 0); super.changeSelection(rowIndex, columnIndex, toggle, extend); } }; table.setRowSelectionAllowed(true); table.setColumnSelectionAllowed(false); table.setAutoCreateColumnsFromModel(false); table.setModel(model); final MyTableRowSorter sorter = new MyTableRowSorter(model); table.setRowSorter(sorter); table.setDefaultRenderer(Boolean.class, new MyRenderer()); table.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS); table.setSelectionModel(mySelectionModel); sorter.setIgnoreAddRowSorterListener(true); // prevent auto-selection (functionality not accessible via proper API) header = new TableFilterHeader(table); sorter.setIgnoreAddRowSorterListener(false); sorter.setSortKeys(Arrays.asList(new RowSorter.SortKey(1, SortOrder.ASCENDING))); JPanel panel = new JPanel(new BorderLayout()); JPanel toolbar = new JPanel(new BorderLayout()); toolbar.setBorder(BorderFactory.createEtchedBorder()); panel.add(toolbar, BorderLayout.NORTH); toolbar.add(toggleSelected, BorderLayout.EAST); if (model.isMultiple()) { table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); table.getColumnModel().addColumn(createColumn(0, model, 45, 45)); header.getFilterEditor(0).setEditable(false); header.getFilterEditor(0).setUserInteractionEnabled(false); final LinkListener selectUnselect = new LinkListener() { public void linkSelected(LinkLabel aSource, Object aLinkData) { if (model.isShowingSelected()) { if (!Boolean.TRUE.equals(aLinkData)) { List<Integer> ixs = new ArrayList<Integer>(); for (int i = 0; i < sorter.getViewRowCount(); i++) { ixs.add(sorter.convertRowIndexToModel(i)); } // make sure indexes are not affected by removal by starting from the last Collections.sort(ixs); Collections.reverse(ixs); for (int ix : ixs) { model.setValueAt(aLinkData, ix, 0); } } } else { if (Boolean.TRUE.equals(aLinkData)) { mySelectionModel.doAddSelectionInterval(0, table.getRowCount() - 1); } else { mySelectionModel.removeSelectionInterval(0, table.getRowCount() - 1); } } } }; JPanel left = new JPanel(new FlowLayout(FlowLayout.LEFT)); left.add(new LinkLabel("Select All", IconLoader.getIcon("/actions/selectall.png"), selectUnselect, true)); left.add(new LinkLabel("Unselect All", IconLoader.getIcon("/actions/unselectall.png"), selectUnselect, false)); toolbar.add(left, BorderLayout.WEST); } else { table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); } table.getColumnModel().addColumn(createColumn(1, model, 450, null)); table.getSelectionModel().addListSelectionListener(myListSelectionListener); model.addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { selected.setVisible(model.isShowingSelected()); tooMany.setVisible(model.hasMore() && !model.isShowingSelected()); updateSelected(); } }); JPanel contentPanel = new JPanel(new BorderLayout()); contentPanel.add(selected, BorderLayout.NORTH); contentPanel.add(new JBScrollPane(table), BorderLayout.CENTER); contentPanel.add(tooMany, BorderLayout.SOUTH); panel.add(contentPanel, BorderLayout.CENTER); JPanel buttons = new JPanel(); okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { ok = true; close(true); } }); buttons.add(okButton); JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { close(false); } }); buttons.add(cancel); panel.add(buttons, BorderLayout.SOUTH); getContentPane().add(panel, BorderLayout.CENTER); pack(); setResizable(false); centerOnOwner(); requestPropertyFilterFocus(header); load(true, null); }
From source file:com.mgmtp.perfload.loadprofiles.ui.dialog.SettingsDialog.java
private void initComponents() { getContentPane().setLayout(new MigLayout("", "[grow]", "[][grow][grow][grow][]")); {/*from w w w . jav a2 s . com*/ JPanel pnlConfigurations = new JPanel(); pnlConfigurations.setBorder(new TitledBorder(null, "Saved Configurations", TitledBorder.LEADING, TitledBorder.TOP, null, null)); pnlConfigurations.setName("pnlConfigurations"); getContentPane().add(pnlConfigurations, "cell 0 0, growx"); pnlConfigurations.setLayout(new MigLayout("", "[grow]", "[]")); { JLabel lblFileName = new JLabel("File Name"); lblFileName.setName("lblFileName"); pnlConfigurations.add(lblFileName, "flowx,cell 0 0"); } { cboConfigurationFile = new JComboBox() { @Override public void setSelectedItem(final Object anObject) { if (checkDirty()) { super.setSelectedItem(anObject); } } }; cboConfigurationFile.addItemListener(new CboConfigurationFileItemListener()); pnlConfigurations.add(cboConfigurationFile, "cell 0 0,growx"); cboConfigurationFile.setName("cboConfigurationFile"); } { JButton btnNewConfigurationFile = new JButtonExt("New..."); btnNewConfigurationFile.addActionListener(new BtnNewConfigurationFileActionListener()); pnlConfigurations.add(btnNewConfigurationFile, "cell 0 0, sg btns"); btnNewConfigurationFile.setName("btnNewButton"); } { JButton btnCopy = new JButtonExt("Copy..."); btnCopy.addActionListener(new BtnCopyActionListener()); btnCopy.setName("btnCopy"); pnlConfigurations.add(btnCopy, "cell 0 0, sg btns"); } { JButton btnDelete = new JButtonExt("Delete..."); btnDelete.addActionListener(new BtnDeleteActionListener()); btnDelete.setName("btnDelete"); pnlConfigurations.add(btnDelete, "cell 0 0, sg btns"); } } { JPanel pnlOperations = new JPanel(); getContentPane().add(pnlOperations, "cell 0 1, grow"); pnlOperations.setBorder( new TitledBorder(null, "Operations", TitledBorder.LEADING, TitledBorder.TOP, null, null)); pnlOperations.setName("pnlOperations"); pnlOperations.setLayout(new MigLayout("insets 4", "[grow][110!]", "[][]")); { JScrollPane spOperations = new JScrollPane(); spOperations.setName("spOperations"); pnlOperations.add(spOperations, "cell 0 0 1 2, height 180::, grow"); { tblOperations = new JTableExt(); tblOperations.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tblOperations.setFillsViewportHeight(true); tblOperations.setName("tblOperations"); spOperations.setViewportView(tblOperations); } } { JButton btnAddOperation = new JButtonExt("Add Operation"); btnAddOperation.addActionListener(new BtnAddOperationActionListener()); btnAddOperation.setMargin(new Insets(2, 2, 2, 2)); btnAddOperation.setName("btnAddOperation"); pnlOperations.add(btnAddOperation, "cell 1 0, grow"); } { JButton btnRemoveOperation = new JButtonExt("Delete Operation"); btnRemoveOperation.addActionListener(new BtnRemoveOperationActionListener()); btnRemoveOperation.setMargin(new Insets(2, 2, 2, 2)); btnRemoveOperation.setName("btnRemoveOperation"); pnlOperations.add(btnRemoveOperation, "cell 1 1, growx, top"); } } { JPanel pnlTargets = new JPanel(); getContentPane().add(pnlTargets, "cell 0 2, grow"); pnlTargets.setBorder( new TitledBorder(null, "Targets", TitledBorder.LEADING, TitledBorder.TOP, null, null)); pnlTargets.setName("pnlTargets"); pnlTargets.setLayout(new MigLayout("insets 4", "[grow][110!]", "[][]")); { JScrollPane spTargets = new JScrollPane(); spTargets.setName("spTargets"); pnlTargets.add(spTargets, "cell 0 0 1 2, height 50::, grow"); { tblTargets = new JTableExt(); tblTargets.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tblTargets.setFillsViewportHeight(true); tblTargets.setName("tblTargets"); spTargets.setViewportView(tblTargets); } } { JButton btnAddTarget = new JButtonExt("Add Target"); btnAddTarget.addActionListener(new BtnAddTargetActionListener()); btnAddTarget.setMargin(new Insets(2, 2, 2, 2)); btnAddTarget.setName("btnAddClientConfig"); pnlTargets.add(btnAddTarget, "cell 1 0, growx"); } { JButton btnRemoveTarget = new JButtonExt("Delete Target"); btnRemoveTarget.addActionListener(new BtnRemoveTargetActionListener()); btnRemoveTarget.setMargin(new Insets(2, 2, 2, 2)); btnRemoveTarget.setName("btnRemoveClientConfig"); pnlTargets.add(btnRemoveTarget, "cell 1 1, growx, top"); } } { JPanel pnlClients = new JPanel(); getContentPane().add(pnlClients, "cell 0 3, grow"); pnlClients.setBorder( new TitledBorder(null, "Clients", TitledBorder.LEADING, TitledBorder.TOP, null, null)); pnlClients.setName("pnlClientConfigs"); pnlClients.setLayout(new MigLayout("insets 4", "[grow][110!]", "[][]")); { JScrollPane spClients = new JScrollPane(); spClients.setName("spClients"); pnlClients.add(spClients, "cell 0 0 1 2, height 50::, grow"); { tblClients = new JTableExt(); tblClients.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tblClients.setFillsViewportHeight(true); tblClients.setName("tblClients"); spClients.setViewportView(tblClients); } } { JButton btnAddClient = new JButtonExt("Add Client"); btnAddClient.addActionListener(new BtnAddClientActionListener()); btnAddClient.setMargin(new Insets(2, 2, 2, 2)); btnAddClient.setName("btnAddClient"); pnlClients.add(btnAddClient, "cell 1 0, growx"); } { JButton btnRemoveClient = new JButtonExt("Delete Client"); btnRemoveClient.addActionListener(new BtnRemoveClientActionListener()); btnRemoveClient.setMargin(new Insets(2, 2, 2, 2)); btnRemoveClient.setName("btnRemoveClient"); pnlClients.add(btnRemoveClient, "cell 1 1, growx, top"); } } { JButton btnOk = new JButtonExt("OK"); getRootPane().setDefaultButton(btnOk); btnOk.addActionListener(new BtnOkActionListener()); btnOk.setName("btnOk"); getContentPane().add(btnOk, "cell 0 4,alignx right"); } { JButton btnCancel = new JButtonExt("Cancel"); btnCancel.addActionListener(new BtnCancelActionListener()); btnCancel.setName("btnCancel"); getContentPane().add(btnCancel, "cell 0 4,alignx right"); } }
From source file:com.aw.swing.mvp.binding.component.BndSJTable.java
private void configureJTable() { LookAndFeelManager.setLookAndFeel(jTable); //by default allow single line selection if (isScrollable || fixedWidth) { jTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); }/*from w ww .j av a 2 s . co m*/ if (createAutoSortCols) { jTable.setAutoCreateRowSorter(true); } jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JTableMouseProcessor jTableMouseProcessor = new JTableMouseProcessor(presenter, this, gridIndex); jTable.addMouseListener(getJTableMouseListener(jTableMouseProcessor)); JTableHeader header = jTable.getTableHeader(); header.addMouseListener(getJTableHeaderMouseListener(jTableMouseProcessor)); header.setReorderingAllowed(false); jTable.setName("grid" + gridIndex); }
From source file:com.mirth.connect.client.ui.attachments.RegexAttachmentDialog.java
private void initComponents() { regularExpressionPanel = new JPanel(new MigLayout("novisualpadding, hidemode 3, fill, insets 0")); regularExpressionPanel.setBackground(UIConstants.BACKGROUND_COLOR); regularExpressionPanel.setBorder(BorderFactory.createTitledBorder("Regular Expressions")); regexExampleTextField = new JTextField(); regexExampleTextField.setText("(?:OBX\\|(?:[^|]*\\|){4}(?:[^|^]*\\^){4})([^|^\\r\\n]*)(?:[|^\\r\\n]|$)"); regexExampleTextField.setEditable(false); regexExampleTextField.setBorder(null); regexExampleTextField.setOpaque(false); regexTable = new MirthTable(); regexTable.setModel(new RefreshTableModel(new Object[] { "Regular Expression", "MIME Type" }, 0)); regexTable.setDragEnabled(false);/* ww w . j a v a 2s. co m*/ regexTable.setRowSelectionAllowed(true); regexTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); regexTable.setRowHeight(UIConstants.ROW_HEIGHT); regexTable.setFocusable(true); regexTable.setOpaque(true); regexTable.getTableHeader().setReorderingAllowed(false); regexTable.setEditable(true); regexTable.setSortable(false); if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) { regexTable.setHighlighters(HighlighterFactory.createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR, UIConstants.BACKGROUND_COLOR)); } regexTable.getColumnExt(0).setMinWidth(105); regexTable.getColumnExt(0).setPreferredWidth(350); regexTable.getColumnExt(0).setToolTipText( "<html>The regular expression that will be used to match and extract attachments.<br>If capturing groups are used, only the last group will be extracted.</html>"); regexTable.getColumnExt(1).setMinWidth(63); regexTable.getColumnExt(1).setToolTipText( "The MIME type of the extracted attachment data. Source map variables may be used here."); regexTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent evt) { regexDeleteButton.setEnabled(regexTable.getSelectedRow() >= 0); } }); regexTableScrollPane = new JScrollPane(regexTable); regexNewButton = new JButton("New"); regexNewButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { regexNewButtonActionPerformed(); } }); regexDeleteButton = new JButton("Delete"); regexDeleteButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { regexDeleteButtonActionPerformed(); } }); regexDeleteButton.setEnabled(false); stringReplacementPanel = new JPanel(new MigLayout("novisualpadding, hidemode 3, insets 0")); stringReplacementPanel.setBackground(UIConstants.BACKGROUND_COLOR); stringReplacementPanel.setBorder(BorderFactory.createTitledBorder("String Replacement")); stringReplacementLabel = new JLabel(); stringReplacementLabel.setText( "<html>Replace strings on the matched data before storing. Do not use regular expressions in these fields or surround with quotes.<br>\nExample: Use <b>\\\\X0D0A\\\\</b> and <b>\\r\\n</b> to replace \\X0D0A\\ with actual CRLF characters. </html>"); inboundReplacementTable = new MirthTable(); inboundScrollPane = new JScrollPane(); inboundScrollPane.setViewportView(inboundReplacementTable); outboundReplacementTable = new MirthTable(); outboundScrollPane = new JScrollPane(); outboundScrollPane.setViewportView(outboundReplacementTable); inboundButtonPanel = new JPanel(new MigLayout("novisualpadding, hidemode 3, insets 0", "", "")); inboundButtonPanel.setBackground(UIConstants.BACKGROUND_COLOR); inboundNewButton = new JButton("New"); inboundNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { inboundNewButtonActionPerformed(evt); } }); inboundDeleteButton = new JButton("Delete"); inboundDeleteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { inboundDeleteButtonActionPerformed(evt); } }); outboundButtonPanel = new JPanel(new MigLayout("novisualpadding, hidemode 3, insets 0", "", "")); outboundButtonPanel.setBackground(UIConstants.BACKGROUND_COLOR); outboundNewButton = new JButton("New"); outboundNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { outboundNewButtonActionPerformed(evt); } }); outboundDeleteButton = new JButton("Delete"); outboundDeleteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { outboundDeleteButtonActionPerformed(evt); } }); separator = new JSeparator(); closeButton = new JButton("Close"); closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { closeButtonActionPerformed(evt); } }); }
From source file:edu.ku.brc.specify.tasks.subpane.ESResultsTablePanel.java
/** * Constructor of a results "table" which is really a panel * @param esrPane the parent/* ww w.java 2 s . c o m*/ * @param erTableInfo the info describing the results * @param installServices indicates whether services should be installed * @param isExpandedAtStartUp enough said * @param inclCloseBtn whether to include the close button on the bar */ public ESResultsTablePanel(final ExpressSearchResultsPaneIFace esrPane, final QueryForIdResultsIFace results, final boolean installServices, final boolean isExpandedAtStartUp, final boolean inclCloseBtn) { super(new BorderLayout()); this.esrPane = esrPane; this.results = results; this.bannerColor = results.getBannerColor(); this.isEditable = results.isEditingEnabled(); table = new JTable(); table.setShowVerticalLines(false); table.setRowSelectionAllowed(true); table.setSelectionMode(results.isMultipleSelection() ? ListSelectionModel.MULTIPLE_INTERVAL_SELECTION : ListSelectionModel.SINGLE_SELECTION); setBackground(table.getBackground()); if (isEditable) { addContextMenu(); } topTitleBar = new GradiantLabel(results.getTitle(), SwingConstants.LEFT); topTitleBar.setBGBaseColor(bannerColor); topTitleBar.setTextColor(Color.WHITE); topTitleBar.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { expandBtn.doClick(); } } }); String description = results.getDescription(); if (StringUtils.isNotEmpty(description)) { topTitleBar.setToolTipText(description); } expandBtn = new TriangleButton(); expandBtn.setToolTipText(getResourceString("CollapseTBL")); expandBtn.setForeground(bannerColor); expandBtn.setTextColor(Color.WHITE); showTopNumEntriesBtn = new GradiantButton( String.format(getResourceString("ShowTopEntries"), new Object[] { topNumEntries })); showTopNumEntriesBtn.setForeground(bannerColor); showTopNumEntriesBtn.setTextColor(Color.WHITE); showTopNumEntriesBtn.setVisible(false); showTopNumEntriesBtn.setCursor(handCursor); List<ServiceInfo> services = installServices ? getServices() : null; //System.out.println("["+tableInfo.getTableId()+"]["+services.size()+"]"); StringBuffer colDef = new StringBuffer("p,0px,p:g,0px,p,0px,"); int numCols = (installServices ? services.size() : 0) + (inclCloseBtn ? 1 : 0); colDef.append(UIHelper.createDuplicateJGoodiesDef("p", "0px", numCols)); // add additional col defs for services PanelBuilder builder = new PanelBuilder(new FormLayout(colDef.toString(), "f:p:g")); CellConstraints cc = new CellConstraints(); int col = 1; builder.add(expandBtn, cc.xy(col, 1)); col += 2; builder.add(topTitleBar, cc.xy(col, 1)); col += 2; builder.add(showTopNumEntriesBtn, cc.xy(col, 1)); col += 2; if (installServices && services.size() > 0) { serviceBtns = new Hashtable<ServiceInfo, JButton>(); //IconManager.IconSize size = IconManager. int iconSize = AppPreferences.getLocalPrefs().getInt("banner.icon.size", 20); // Install the buttons on the banner with available services for (ServiceInfo serviceInfo : services) { GradiantButton btn = new GradiantButton(serviceInfo.getIcon(iconSize)); // XXX PREF btn.setToolTipText(serviceInfo.getTooltip()); btn.setForeground(bannerColor); builder.add(btn, cc.xy(col, 1)); ESTableAction esta = new ESTableAction(serviceInfo.getCommandAction(), table, serviceInfo.getTooltip()); esta.setProperty("gridtitle", results.getTitle()); btn.addActionListener(esta); serviceBtns.put(serviceInfo, btn); col += 2; } } GradiantButton closeBtn = null; if (inclCloseBtn) { closeBtn = new GradiantButton(IconManager.getIcon("Close")); closeBtn.setToolTipText(getResourceString("ESCloseTable")); closeBtn.setForeground(bannerColor); closeBtn.setRolloverEnabled(true); closeBtn.setRolloverIcon(IconManager.getIcon("CloseHover")); closeBtn.setPressedIcon(IconManager.getIcon("CloseHover")); builder.add(closeBtn, cc.xy(col, 1)); col += 2; } add(builder.getPanel(), BorderLayout.NORTH); tablePane = new JPanel(new BorderLayout()); setupTablePane(); if (isEditable) { //delRSItems = UIHelper.createI18NButton("RESTBL_DEL_ITEMS"); delRSItems = UIHelper.createIconBtn("DelRec", "ESDelRowsTT", null); delRSItems.addActionListener(createRemoveItemAL()); delRSItems.setEnabled(false); table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { delRSItems.setEnabled(table.getSelectedRowCount() > 0); } } }); } add(tablePane, BorderLayout.CENTER); moveToRSCmd = new DragSelectedRowsBtn(IconManager.getIcon("Record_Set", IconManager.IconSize.Std16)); if (installServices) { PanelBuilder bottomBar = new PanelBuilder( new FormLayout("4px,p,4px,p,4px,p," + (delRSItems != null ? "4px,p," : "") + "f:p:g", "p")); bottomBar.add(moveToRSCmd, cc.xy(2, 1)); bottomBar.add(selectAllBtn, cc.xy(4, 1)); bottomBar.add(deselectAllBtn, cc.xy(6, 1)); if (delRSItems != null) { bottomBar.add(delRSItems, cc.xy(8, 1)); } botBtnPanel = bottomBar.getPanel(); deselectAllBtn.setEnabled(false); selectAllBtn.setEnabled(true); moveToRSCmd.setEnabled(true); deselectAllBtn.setToolTipText(getResourceString("SELALLTOOLTIP")); selectAllBtn.setToolTipText(getResourceString("DESELALLTOOLTIP")); moveToRSCmd.setToolTipText(getResourceString("MOVEROWSTOOLTIP")); selectAllBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { table.selectAll(); } }); deselectAllBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { table.clearSelection(); } }); moveToRSCmd.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { RecordSetIFace src = (RecordSetIFace) moveToRSCmd.getData(); CommandDispatcher .dispatch(new CommandAction(RecordSetTask.RECORD_SET, "AskForNewRS", src, null, null)); } }); add(botBtnPanel, BorderLayout.SOUTH); } else { botBtnPanel = null; } expandBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { expandTable(false); } }); if (!isExpandedAtStartUp) { expandTable(true); } showTopNumEntriesBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { morePanel.setVisible(true); showTopNumEntriesBtn.setVisible(false); showingAllRows = false; setDisplayRows(rowCount, topNumEntries); // If it is collapsed then expand it if (!expandBtn.isDown()) { tablePane.setVisible(true); expandBtn.setDown(true); } // Make sure the layout is updated invalidate(); doLayout(); esrPane.revalidateScroll(); } }); if (closeBtn != null) { closeBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SwingUtilities.invokeLater(new Runnable() { public void run() { removeMe(); } }); } }); } ResultSetTableModel rsm = createModel(); rsm.setPropertyListener(this); resultSetTableModel = rsm; table.setRowSorter(new TableRowSorter<ResultSetTableModel>(resultSetTableModel)); table.setRowSelectionAllowed(true); table.setModel(rsm); configColumns(); rowCount = rsm.getRowCount(); if (rowCount > topNumEntries + 2) { buildMorePanel(); setDisplayRows(rowCount, topNumEntries); } else { setDisplayRows(rowCount, Integer.MAX_VALUE); } invalidate(); doLayout(); UIRegistry.forceTopFrameRepaint(); table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { if (botBtnPanel != null) { deselectAllBtn.setEnabled(table.getSelectedRowCount() > 0); selectAllBtn.setEnabled(table.getSelectedRowCount() != table.getRowCount()); moveToRSCmd.setEnabled(table.getSelectedRowCount() > 0); } } if (propChangeListener != null) { if (!e.getValueIsAdjusting()) { propChangeListener.propertyChange( new PropertyChangeEvent(this, "selection", table.getSelectedRowCount(), 0)); } else { propChangeListener.propertyChange( new PropertyChangeEvent(this, "selection", table.getSelectedRowCount(), 0)); } } } }); table.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { //synchronized (((JTable)e.getSource()).getTreeLock()) //{ doDoubleClickOnRow(e); //} } }); // Horizontal Alignment is set later TableColumnModel tableColModel = table.getColumnModel(); for (int i = 0; i < tableColModel.getColumnCount(); i++) { tableColModel.getColumn(i).setCellRenderer(new BiColorTableCellRenderer()); } }