@Override public void drawShape() { Graphics2D graphics = (Graphics2D) getGraphics(); Color oldFg = graphics.getColor(); Table table = getDbModel(); if (null != table) { Point location = getLocation(); Dimension size = getSize(); // draw the border graphics.setColor(DbexColorConstants.TABLE_BORDER_COLOR); graphics.drawRect(location.x, location.y, size.width, size.height); graphics.setColor(DbexColorConstants.COLUMN_NAMES_BG_COLOR); graphics.fillRect(location.x + 1, location.y + 1, size.width - 1, size.height - 1); // draw the header graphics.setColor(DbexColorConstants.TABLE_BORDER_COLOR); graphics.drawRect( location.x, location.y, size.width, DesignUtil.calculateCellHeight(graphics)); graphics.setColor(DbexColorConstants.TABLE_HEADER_BG_COLOR); graphics.fillRect( location.x + 1, location.y + 1, size.width - 1, DesignUtil.calculateCellHeight(graphics) - 1); graphics.setColor(DbexColorConstants.TABLE_HEADER_FG_COLOR); graphics.drawString( table.getModelName(), location.x + 2, location.y + DesignUtil.calculateCellHeight(graphics) - 4); // draw the left margin graphics.setColor(DbexColorConstants.TABLE_BORDER_COLOR); graphics.drawRect( location.x, location.y + DesignUtil.calculateCellHeight(graphics), DbexDesignConstants.TABLE_LEFT_MARGIN_WIDTH, size.height - DesignUtil.calculateCellHeight(graphics)); graphics.setColor(DbexColorConstants.TABLE_LEFT_MARGIN_BG_COLOR); graphics.fillRect( location.x + 1, location.y + DesignUtil.calculateCellHeight(graphics) + 1, DbexDesignConstants.TABLE_LEFT_MARGIN_WIDTH - 1, size.height - 1 - DesignUtil.calculateCellHeight(graphics)); // draw columns if (null != columnDbShapes) { for (int i = 0; i < columnDbShapes.size(); i++) { ColumnDbShape columnDbShape = columnDbShapes.get(i); columnDbShape.drawShape(); if (i < columnDbShapes.size() - 1) { graphics.setColor(DbexColorConstants.TABLE_BORDER_COLOR); graphics.drawLine( columnDbShape.getX() + DbexDesignConstants.TABLE_LEFT_MARGIN_WIDTH + 2, columnDbShape.getY() + columnDbShape.getHeight() + 2, location.x + size.width, columnDbShape.getY() + columnDbShape.getHeight() + 2); } } } } graphics.setColor(oldFg); }