protected void paintEditor(Graphics g) { Component component = grid.getEditorComponent(); if (component == null) { return; } Rectangle cellBounds = grid.getCellBounds(grid.getEditingRow(), grid.getEditingColumn()); component.setBounds(cellBounds); component.validate(); component.requestFocus(); }
protected void changeBounds( Component source, int direction, Rectangle bounds, Point pressed, Point current) { // Start with original locaton and size int x = bounds.x; int y = bounds.y; int width = bounds.width; int height = bounds.height; // Resizing the West or North border affects the size and location if (WEST == (direction & WEST)) { int drag = getDragDistance(pressed.x, current.x, snapSize.width); int maximum = Math.min(width + x, maximumSize.width); drag = getDragBounded(drag, snapSize.width, width, minimumSize.width, maximum); x -= drag; width += drag; } if (NORTH == (direction & NORTH)) { int drag = getDragDistance(pressed.y, current.y, snapSize.height); int maximum = Math.min(height + y, maximumSize.height); drag = getDragBounded(drag, snapSize.height, height, minimumSize.height, maximum); y -= drag; height += drag; } // Resizing the East or South border only affects the size if (EAST == (direction & EAST)) { int drag = getDragDistance(current.x, pressed.x, snapSize.width); Dimension boundingSize = getBoundingSize(source); int maximum = Math.min(boundingSize.width - x, maximumSize.width); drag = getDragBounded(drag, snapSize.width, width, minimumSize.width, maximum); width += drag; } if (SOUTH == (direction & SOUTH)) { int drag = getDragDistance(current.y, pressed.y, snapSize.height); Dimension boundingSize = getBoundingSize(source); int maximum = Math.min(boundingSize.height - y, maximumSize.height); drag = getDragBounded(drag, snapSize.height, height, minimumSize.height, maximum); height += drag; } source.setBounds(x, y, width, height); source.validate(); }