(Graphics g)
| 299 | } |
| 300 | |
| 301 | @Override |
| 302 | public void draw(Graphics g) { |
| 303 | float w = getWidth(); |
| 304 | float h = getHeight(); |
| 305 | |
| 306 | g.startClip(0, 0, w, h); //start clip to ensure nothing escapes bounds |
| 307 | |
| 308 | boolean applyAlphaComposite = (opaque && !pressed && isEnabled()); |
| 309 | if (applyAlphaComposite) { |
| 310 | g.setAlphaComposite(alphaComposite); |
| 311 | } |
| 312 | |
| 313 | if (pressed) { |
| 314 | if (pressedColor != null) { |
| 315 | g.fillRect(pressedColor, 0, 0, w, h); |
| 316 | } |
| 317 | else { |
| 318 | g.fillGradientRect(getD50(), getD10(), true, 0, 0, w, h); |
| 319 | g.drawRect(BORDER_THICKNESS, getD50(), 0, 0, w, h); |
| 320 | } |
| 321 | } |
| 322 | else if (selected && (opaque || selectable)) { |
| 323 | g.fillGradientRect(getD30(), getL10(), true, 0, 0, w, h); |
| 324 | g.drawRect(BORDER_THICKNESS, getD30(), 0, 0, w, h); |
| 325 | } |
| 326 | else if (opaque) { |
| 327 | g.fillGradientRect(getD10(), getL20(), true, 0, 0, w, h); |
| 328 | g.drawRect(BORDER_THICKNESS, getD10(), 0, 0, w, h); |
| 329 | } |
| 330 | else if (selectable) { |
| 331 | g.drawRect(BORDER_THICKNESS, getL10(), 0, 0, w, h); |
| 332 | } |
| 333 | |
| 334 | drawContent(g, w, h, pressed); |
| 335 | |
| 336 | if (applyAlphaComposite) { |
| 337 | g.resetAlphaComposite(); |
| 338 | } |
| 339 | |
| 340 | g.endClip(); |
| 341 | } |
| 342 | |
| 343 | protected void drawContent(Graphics g, float w, float h, final boolean pressed) { |
| 344 | float x = insets.x; |
nothing calls this directly
no test coverage detected