This is what I have so far, but the text in the field isn't anti-aliased. I've tried googling it for a while but couldn't find any threads discussing it (much to my surprise). Does anyone know how to do this?
public class SearchField extends JTextField{
public SearchField(){
super();
this.setOpaque(false);
this.setPreferredSize(new Dimension(fieldWidth, fieldHeight));
this.setBorder(new EmptyBorder(4,8,4,8));
this.setFont(fieldFont);
}
public void paintComponent(Graphics paramGraphics){
Graphics2D g = (Graphics2D) paramGraphics;
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g.setColor(ColorConstants.LIGHT_GRAY);
g.fillRoundRect(0,0,fieldWidth,fieldHeight,4,4);
super.paintComponent(g);
}
}