private void initPainterSupport() { foregroundPainter = new AbstractPainter<JXLabel>() { @Override protected void doPaint(Graphics2D g, JXLabel label, int width, int height) { Insets i = getInsets(); g = (Graphics2D) g.create(-i.left, -i.top, width, height); try { label.paint(g); } finally { g.dispose(); } } //if any of the state of the JButton that affects the foreground has changed, //then I must clear the cache. This is really hard to get right, there are //bound to be bugs. An alternative is to NEVER cache. @Override protected boolean shouldUseCache() { return false; } @Override public boolean equals(Object obj) { return obj != null && this.getClass().equals(obj.getClass()); } }; ((AbstractPainter<?>) foregroundPainter).setAntialiasing(false); }
private void initPainterSupport() { foregroundPainter = new AbstractPainter<JXLabel>() { @Override protected void doPaint(Graphics2D g, JXLabel label, int width, int height) { Insets i = getInsets(); g = (Graphics2D) g.create(-i.left, -i.top, width, height); try { label.paint(g); } finally { g.dispose(); } } //if any of the state of the JButton that affects the foreground has changed, //then I must clear the cache. This is really hard to get right, there are //bound to be bugs. An alternative is to NEVER cache. @Override protected boolean shouldUseCache() { return false; } @Override public boolean equals(Object obj) { return obj != null && this.getClass().equals(obj.getClass()); } }; ((AbstractPainter<?>) foregroundPainter).setAntialiasing(false); }
private void initPainterSupport() { foregroundPainter = new AbstractPainter<JXLabel>() { @Override protected void doPaint(Graphics2D g, JXLabel label, int width, int height) { Insets i = getInsets(); g = (Graphics2D) g.create(-i.left, -i.top, width, height); try { label.paint(g); } finally { g.dispose(); } } //if any of the state of the JButton that affects the foreground has changed, //then I must clear the cache. This is really hard to get right, there are //bound to be bugs. An alternative is to NEVER cache. @Override protected boolean shouldUseCache() { return false; } @Override public boolean equals(Object obj) { return obj != null && this.getClass().equals(obj.getClass()); } }; ((AbstractPainter<?>) foregroundPainter).setAntialiasing(false); }
private void initPainterSupport() { foregroundPainter = new AbstractPainter<JXLabel>() { @Override protected void doPaint(Graphics2D g, JXLabel label, int width, int height) { Insets i = getInsets(); g = (Graphics2D) g.create(-i.left, -i.top, width, height); try { label.paint(g); } finally { g.dispose(); } } //if any of the state of the JButton that affects the foreground has changed, //then I must clear the cache. This is really hard to get right, there are //bound to be bugs. An alternative is to NEVER cache. @Override protected boolean shouldUseCache() { return false; } @Override public boolean equals(Object obj) { return obj != null && this.getClass().equals(obj.getClass()); } }; ((AbstractPainter<?>) foregroundPainter).setAntialiasing(false); }