@Override
public boolean mouseMove(Component component, int x, int y) {
boolean consumed = super.mouseMove(component, x, y);
if (Mouse.getCapturer() == component) {
Palette palette = (Palette)getComponent();
Display display = palette.getDisplay();
Point location = palette.mapPointToAncestor(display, x, y);
// Pretend that the mouse can't move off screen (off the display)
location = new Point(Math.min(Math.max(location.x, 0), display.getWidth() - 1),
Math.min(Math.max(location.y, 0), display.getHeight() - 1));
if (dragOffset != null) {
// Move the window
palette.setLocation(location.x - dragOffset.x, location.y - dragOffset.y);
} else {
if (resizeOffset != null) {
// Resize the frame
int preferredWidth = -1;
int preferredHeight = -1;
if (palette.isPreferredWidthSet()) {
preferredWidth = Math.max(location.x - palette.getX() + resizeOffset.x,
titleBarTablePane.getPreferredWidth(-1) + 2);
preferredWidth = Math.min(preferredWidth, palette.getMaximumWidth());
preferredWidth = Math.max(preferredWidth, palette.getMinimumWidth());
}
if (palette.isPreferredHeightSet()) {
preferredHeight = Math.max(location.y - palette.getY() + resizeOffset.y,
titleBarTablePane.getHeight() + resizeHandle.getHeight() + 7);
preferredHeight = Math.min(preferredHeight, palette.getMaximumHeight());
preferredHeight = Math.max(preferredHeight, palette.getMinimumHeight());
}
palette.setPreferredSize(preferredWidth, preferredHeight);
}
}
} else {
Cursor cursor = null;
if (resizeHandle.isVisible()