javax.swing.JTable#isEnabled ( )源码实例Demo

下面列出了javax.swing.JTable#isEnabled ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: netbeans   文件: QueryBuilderInputTable.java
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());
            }
        }
 
源代码2 项目: netbeans   文件: ClassNameList.java
@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;
}
 
源代码3 项目: netbeans   文件: QueryBuilderInputTable.java
/** 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);
}
 
源代码4 项目: snap-desktop   文件: MosaicExpressionsPanel.java
@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;
}
 
 方法所在类
 同类方法