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