JXButton extends JButton implements BackgroundPaintable { @Override @SuppressWarnings("rawtypes") public void setBackgroundPainter(Painter p) { Painter old = getBackgroundPainter(); this.bgPainter = p; firePropertyChange("backgroundPainter", old, getBackgroundPainter()); repaint(); } JXButton();  JXButton(String text);  JXButton(Action a);  JXButton(Icon icon);  JXButton(String text, Icon icon); @Override @SuppressWarnings("rawtypes") Painter getBackgroundPainter(); @Override @SuppressWarnings("rawtypes") void setBackgroundPainter(Painter p); @SuppressWarnings("rawtypes") Painter getForegroundPainter(); @SuppressWarnings({ "unchecked", "rawtypes" }) void setForegroundPainter(Painter p); @Override boolean isPaintBorderInsets(); @Override void setPaintBorderInsets(boolean paintBorderInsets); @Override Dimension getPreferredSize(); @Override void updateUI();  }
@Test public void ensureFontIsMaintainedAfterBackgroundPainterSet() { Font font = Font.decode("Arial-BOLDITALIC-14"); assumeThat(button.getFont(), is(not(font))); button.setFont(font); button.setBackgroundPainter(new MattePainter(Color.RED)); assertThat(button.getFont(), is(font)); }