Draws the axis in the drawing panel. @param drawingPanel @param g
(DrawingPanel drawingPanel, Graphics g)
| 43 | * @param g |
| 44 | */ |
| 45 | @Override |
| 46 | public void draw(DrawingPanel drawingPanel, Graphics g) { |
| 47 | int pixLoc = drawingPanel.yToPix(location); |
| 48 | if(pixLoc<1) { |
| 49 | location = drawingPanel.getYMin(); |
| 50 | } |
| 51 | if(pixLoc>drawingPanel.getHeight()-1) { |
| 52 | location = drawingPanel.getYMax(); |
| 53 | } |
| 54 | Graphics2D g2 = (Graphics2D) g.create(); |
| 55 | // Shape clipShape = g2.getClip(); |
| 56 | // unclip needed here? |
| 57 | g2.clipRect(0, 0, drawingPanel.getWidth(), drawingPanel.getHeight()); |
| 58 | switch(locationType) { |
| 59 | case DRAW_AT_LOCATION : |
| 60 | case DRAW_IN_DISPLAY : |
| 61 | drawInsideDisplay(drawingPanel, g); |
| 62 | break; |
| 63 | case DRAW_IN_GUTTER : |
| 64 | drawInsideGutter(drawingPanel, g); |
| 65 | break; |
| 66 | default : |
| 67 | drawInsideDisplay(drawingPanel, g); |
| 68 | break; |
| 69 | } |
| 70 | g2.dispose();// BH 2020.02.26//setClip(clipShape); |
| 71 | } |
| 72 | |
| 73 | private void drawInsideDisplay(DrawingPanel drawingPanel, Graphics g) { |
| 74 | Color foreground = drawingPanel.getForeground(); |
nothing calls this directly
no test coverage detected