/** * Paints the form's grid lines and diagonals. * * @param g the Graphics object used to paint */ private void paintGrid(Graphics g) { if (!(getLayout() instanceof FormLayout)) { return; } FormLayout.LayoutInfo layoutInfo = FormDebugUtils.getLayoutInfo(this); int left = layoutInfo.getX(); int top = layoutInfo.getY(); int width = layoutInfo.getWidth(); int height = layoutInfo.getHeight(); g.setColor(gridColor); // Paint the column bounds. for (int col = 0; col < layoutInfo.columnOrigins.length; col++) { g.fillRect(layoutInfo.columnOrigins[col], top, 1, height); } // Paint the row bounds. for (int row = 0; row < layoutInfo.rowOrigins.length; row++) { g.fillRect(left, layoutInfo.rowOrigins[row], width, 1); } if (paintDiagonals) { g.drawLine(left, top, left + width, top + height); g.drawLine(left, top + height, left + width, top); } }
/** * Paints the form's grid lines and diagonals. * * @param g * the Graphics object used to paint */ private void paintGrid(Graphics g) { if (!(getLayout() instanceof FormLayout)) { return; } FormLayout.LayoutInfo layoutInfo = FormDebugUtils.getLayoutInfo(this); int left = layoutInfo.getX(); int top = layoutInfo.getY(); int width = layoutInfo.getWidth(); int height = layoutInfo.getHeight(); g.setColor(gridColor); // Paint the column bounds. for (int col = 0; col < layoutInfo.columnOrigins.length; col++) { g.fillRect(layoutInfo.columnOrigins[col], top, 1, height); } // Paint the row bounds. for (int row = 0; row < layoutInfo.rowOrigins.length; row++) { g.fillRect(left, layoutInfo.rowOrigins[row], width, 1); } if (paintDiagonals) { g.drawLine(left, top, left + width, top + height); g.drawLine(left, top + height, left + width, top); } }
int top = layoutInfo.getY(); int width = layoutInfo.getWidth(); int height = layoutInfo.getHeight();