No, but it's pretty easy to do your own:
import java.awt.*;
import javax.swing.border.AbstractBorder;
import javax.swing.*;
public class RoundedBorder extends AbstractBorder {
private final static int MARGIN = 10;
public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) {
g.drawRoundRect( x, y, width - 1, height - 1, MARGIN, MARGIN );
}
public Insets getBorderInsets( Component c ) {
return new Insets( MARGIN, MARGIN, MARGIN, MARGIN );
}
public Insets getBorderInsets( Component c, Insets insets ) {
insets.left = insets.top = insets.right = insets.bottom = MARGIN;
return insets;
}
private static void createUI() {
JPanel p = new JPanel( new BorderLayout() );
p.setBorder( BorderFactory.createEmptyBorder( MARGIN, MARGIN, MARGIN, MARGIN ) );
JLabel l = new JLabel( "Label" );
l.setBorder( new RoundedBorder() );
p.add( l, BorderLayout.CENTER );
JFrame f = new JFrame( "RoundedBorder" );
f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
f.getContentPane().add( p );
f.pack();
f.setVisible( true );
}
public static void main( String[] args ) {
Runnable doRun = new Runnable() {
public void run() { createUI(); }
};
SwingUtilities.invokeLater( doRun );
}
}
If the color of the frame and then panel is different, draw a round rect will not work as needed.
For example:
JPanel p = new JPanel( new BorderLayout() );
p.setBorder( BorderFactory.createEmptyBorder( MARGIN, MARGIN, MARGIN, MARGIN ) );
p.setBackground(new Color.red);
JLabel l = new JLabel( "Label" );
l.setBorder( new RoundedBorder() );
p.add( l, BorderLayout.CENTER );
JFrame f = new JFrame( "RoundedBorder" );
f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
f.getContentPane().add( p );
f.setBackground(new Color.yellow);
f.pack();
f.setVisible( true );