(Graphics screen)
| 194 | |
| 195 | |
| 196 | public void paintComponent(Graphics screen) { |
| 197 | if (screen == null) return; |
| 198 | |
| 199 | SketchController sketch = editor.getSketchController(); |
| 200 | if (sketch == null) return; // ?? |
| 201 | |
| 202 | Dimension size = getSize(); |
| 203 | if ((size.width != sizeW) || (size.height != sizeH)) { |
| 204 | // component has been resized |
| 205 | |
| 206 | if ((size.width > imageW) || (size.height > imageH)) { |
| 207 | // nix the image and recreate, it's too small |
| 208 | offscreen = null; |
| 209 | |
| 210 | } else { |
| 211 | // who cares, just resize |
| 212 | sizeW = size.width; |
| 213 | sizeH = size.height; |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | if (offscreen == null) { |
| 218 | sizeW = size.width; |
| 219 | sizeH = size.height; |
| 220 | imageW = sizeW; |
| 221 | imageH = sizeH; |
| 222 | offscreen = createImage(imageW, imageH); |
| 223 | } |
| 224 | |
| 225 | Graphics2D g = Theme.setupGraphics2D(offscreen.getGraphics()); |
| 226 | if (font == null) { |
| 227 | font = Theme.getFont("header.text.font"); |
| 228 | } |
| 229 | g.setFont(font); // need to set this each time through |
| 230 | metrics = g.getFontMetrics(); |
| 231 | fontAscent = metrics.getAscent(); |
| 232 | |
| 233 | // set the background for the offscreen |
| 234 | g.setColor(backgroundColor); |
| 235 | g.fillRect(0, 0, imageW, imageH); |
| 236 | |
| 237 | List<EditorTab> tabs = editor.getTabs(); |
| 238 | |
| 239 | int codeCount = tabs.size(); |
| 240 | if ((tabLeft == null) || (tabLeft.length < codeCount)) { |
| 241 | tabLeft = new int[codeCount]; |
| 242 | tabRight = new int[codeCount]; |
| 243 | } |
| 244 | |
| 245 | int x = scale(6); // offset from left edge of the component |
| 246 | int i = 0; |
| 247 | for (EditorTab tab : tabs) { |
| 248 | SketchFile file = tab.getSketchFile(); |
| 249 | String filename = file.getPrettyName(); |
| 250 | |
| 251 | // if modified, add the li'l glyph next to the name |
| 252 | String text = " " + filename + (file.isModified() ? " \u00A7" : " "); |
| 253 |
nothing calls this directly
no test coverage detected