Example usage for javax.swing JTable getBorder

List of usage examples for javax.swing JTable getBorder

Introduction

In this page you can find the example usage for javax.swing JTable getBorder.

Prototype

public Border getBorder() 

Source Link

Document

Returns the border of this component or null if no border is currently set.

Usage

From source file:de.mprengemann.intellij.plugin.androidicons.forms.AndroidBatchScaleImporter.java

private void initExportNameValidator() {
    table.getColumnModel().getColumn(5).setCellEditor(new DefaultCellEditor(new JTextField()) {
        @Override//from   w w  w  .jav  a  2 s.c om
        public boolean stopCellEditing() {
            boolean result = super.stopCellEditing();
            if (!result) {
                return false;
            }
            String value = (String) getCellEditorValue();
            value = value.trim();
            if ((StringUtils.isNotEmpty(value) && value.matches("[a-z0-9_.]*"))) {
                return super.stopCellEditing();
            }
            ((JComponent) this.getComponent()).setBorder(new LineBorder(JBColor.RED));
            return false;
        }

        @Override
        public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row,
                int column) {
            ((JComponent) this.getComponent()).setBorder(table.getBorder());
            return super.getTableCellEditorComponent(table, value, isSelected, row, column);
        }
    });
}