(Graphics g)
| 34 | } |
| 35 | |
| 36 | @AstroImageJ(reason = "Fix text scaling for UI scaling", modified = true) |
| 37 | public void paint(Graphics g) { |
| 38 | if (tp==null || g==null) return; |
| 39 | Dimension d = getSize(); |
| 40 | int iWidth = d.width; |
| 41 | int iHeight = d.height; |
| 42 | |
| 43 | if (iWidth<=0 || iHeight<=0) return; |
| 44 | g.setColor(Color.lightGray); |
| 45 | if (iImage==null) |
| 46 | makeImage(iWidth,iHeight); |
| 47 | if (tp.iRowHeight==0 || (tp.iColWidth.length>0 && tp.iColWidth[0]==0&&tp.iRowCount>0)) { |
| 48 | tp.iRowHeight=fMetrics.getHeight()+2; |
| 49 | for (int i=0; i<tp.iColCount; i++) |
| 50 | calcAutoWidth(i); |
| 51 | tp.adjustHScroll(); |
| 52 | tp.adjustVScroll(); |
| 53 | } |
| 54 | gImage.setColor(Color.white); |
| 55 | gImage.fillRect(0,0,iWidth,iHeight); |
| 56 | if (tp.headings) |
| 57 | drawColumnLabels(iWidth); |
| 58 | int y=tp.iRowHeight+1-tp.iY; |
| 59 | int j=0; |
| 60 | while (y<tp.iRowHeight+1) { |
| 61 | j++; |
| 62 | y+=tp.iRowHeight; |
| 63 | } |
| 64 | tp.iFirstRow=j; |
| 65 | y=tp.iRowHeight+1; |
| 66 | for (;y<iHeight && j<tp.iRowCount; j++,y+=tp.iRowHeight) { |
| 67 | int x=-tp.iX; |
| 68 | for (int i=0;i<tp.iColCount;i++) { |
| 69 | if (i>=tp.iColWidth.length) break; |
| 70 | int w = tp.iColWidth[i]; |
| 71 | Color b=Color.white,t=Color.black; |
| 72 | if (j>=tp.selStart && j<=tp.selEnd) { |
| 73 | int w2 = w; |
| 74 | if (tp.iColCount==1) |
| 75 | w2 = iWidth; |
| 76 | b=Color.black; |
| 77 | t=Color.white; |
| 78 | gImage.setColor(b); |
| 79 | gImage.fillRect(x,y,w2-1,tp.iRowHeight); |
| 80 | } |
| 81 | gImage.setColor(t); |
| 82 | char[] chars = tp.getChars(i,j); |
| 83 | if (chars!=null) |
| 84 | gImage.drawChars(chars,0,chars.length,x+2,y+tp.iRowHeight-5); |
| 85 | x+=w; |
| 86 | } |
| 87 | } |
| 88 | ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_INTERPOLATION, |
| 89 | RenderingHints.VALUE_INTERPOLATION_BICUBIC); |
| 90 | if (iImage!=null) |
| 91 | g.drawImage(iImage,0,0,null); |
| 92 | } |
| 93 |
no test coverage detected