List of utility methods to do Graphics Draw Grid
void | drawBrickGrid(Color color, Graphics2D g, int size, int maxX, int maxY) draw Brick Grid if (size < 1) { throw new IllegalArgumentException("size = " + size); g.setColor(color); int doubleSize = size * 2; int y = size; int verticalCount = 0; while (y < maxY) { ... |
void | drawGrid(Color color, Graphics2D g, int maxX, int maxY, int hWidth, int hSpacing, int vWidth, int vSpacing, boolean emptyIntersections) draw Grid if (hWidth < 0) { throw new IllegalArgumentException("hWidth = " + hWidth); if (vWidth < 0) { throw new IllegalArgumentException("vWidth = " + vWidth); if (hSpacing <= 0) { throw new IllegalArgumentException("hSpacing = " + hSpacing); ... |
void | drawGrid(Graphics2D g, double lowerX, double upperX, int numX, double lowerY, double upperY, int numY) draws a grid covering a rectangular area on the screen. GeneralPath gp = grid(lowerX, upperX, numX, lowerY, upperY, numY); g.draw(gp); |
void | drawIntegralCoordinateGrid(Graphics2D g, Component comp, int delta) draws a coordinate grid with one length unit distance in each direction. AffineTransform at = g.getTransform(); AffineTransform bt = new AffineTransform(); try { bt = at.createInverse(); } catch (Exception e) { System.out.println("Non-invertible transform"); Container c = comp.getParent(); ... |
void | paintGrid(Graphics g, int width, int height, Color darkColor, Color brightColor) paint Grid g.setColor(darkColor); g.fillRect(0, 0, width, height); g.setColor(brightColor); int inc = 5; for (int x = 0; x < width; x += inc * 2) { for (int y = 0; y < height; y += inc * 2) { g.fillRect(x, y, inc, inc); g.fillRect(x + inc, y + inc, inc, inc); ... |