Java Code Examples for javax.swing.JTable#isEnabled()
The following examples show how to use
javax.swing.JTable#isEnabled() .
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: QueryBuilderInputTable.java From netbeans with Apache License 2.0 | 6 votes |
private void maybeShowPopup(MouseEvent e) { if (e.isPopupTrigger()) { JTable source = (JTable)(e.getSource()); if ( ! source.isEnabled () ) return; _inputTablePopupRow = source.rowAtPoint(new Point (e.getX(), e.getY())); _inputTablePopupColumn = source.columnAtPoint(new Point (e.getX(), e.getY())); // Make sure the row where click occurred is selected. if (_inputTablePopupRow != -1) { source.setRowSelectionInterval (_inputTablePopupRow, _inputTablePopupRow); } // if ( _inputTablePopupColumn != Criteria_COLUMN ) // { // // return without showing popup // return; // } _inputTablePopup.show(e.getComponent(), e.getX(), e.getY()); } }
Example 2
Source File: ClassNameList.java From netbeans with Apache License 2.0 | 5 votes |
@Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { TableCellRenderer def = table.getDefaultRenderer(table.getColumnClass(column)); if (!table.isEnabled()) { isSelected = hasFocus = false; } JComponent c = (JComponent)def.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); c.setEnabled(table.isEnabled()); return c; }
Example 3
Source File: QueryBuilderInputTable.java From netbeans with Apache License 2.0 | 5 votes |
/** Handle the key pressed event and change the focus if a particular * key combination is pressed. */ public void keyPressed(KeyEvent e) { if( e.isShiftDown() ) { int code = e.getKeyCode(); switch(code) { // diagram pane case KeyEvent.VK_F10: JTable source = (JTable)(e.getSource()); if (DEBUG) System.out.println( "QBIT : keyPressed called Shift+F10 Down source.isEnabled() returns : " + source.isEnabled() + "\n" ); if ( ! source.isEnabled () ) return; // _inputTablePopupRow = source.getEditingRow(); _inputTablePopupRow = source.getSelectedRow(); _inputTablePopupColumn = source.getEditingColumn(); if (_inputTablePopupColumn == (Criteria_COLUMN-1)) { source.setEditingColumn(Column_COLUMN); } if (DEBUG) System.out.println( "QBIT : keyPressed called\n" + " inputTablePopupRow = " + _inputTablePopupRow // NOI18N + " inputTablePopupColumn == Criteria_COLUMN " + (_inputTablePopupRow == Criteria_COLUMN ) // NOI18N + " inputTablePopupColumn = " + _inputTablePopupColumn ); // NOI18N // Make sure the row where click occurred is selected. if (_inputTablePopupRow != -1) { source.setRowSelectionInterval (_inputTablePopupRow, _inputTablePopupRow); } _inputTablePopup.show ( source, source.getWidth() / 2, source.getHeight() / 2 ); break; } } _queryBuilder.handleKeyPress(e); }
Example 4
Source File: MosaicExpressionsPanel.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
@Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { final boolean enabled = table.isEnabled(); setText((String) value); if (isSelected) { super.setForeground(table.getSelectionForeground()); super.setBackground(table.getSelectionBackground()); } else if (!enabled) { super.setForeground(UIManager.getColor("TextField.inactiveForeground")); super.setBackground(table.getBackground()); } else { super.setForeground(table.getForeground()); super.setBackground(table.getBackground()); } setFont(table.getFont()); if (hasFocus) { setBorder(UIManager.getBorder("Table.focusCellHighlightBorder")); if (table.isCellEditable(row, column)) { super.setForeground(UIManager.getColor("Table.focusCellForeground")); super.setBackground(UIManager.getColor("Table.focusCellBackground")); } } else { setBorder(noFocusBorder); } setValue(value); return this; }