How can I change the border color created by BorderFactory?
import java.awt.Dimension;
import java.awt.GridBagLayout;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JPanel;
public class BordaTitulo extends JDialog {
public BordaTitulo() {
setTitle("Teste Dialog");
add(criaBorda());
setSize(500, 320);
setLocationRelativeTo(null);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
}
public JComponent criaBorda() {
JPanel painelPrincipal = new JPanel();
painelPrincipal.setLayout(new GridBagLayout());
JPanel painelBorda = new JPanel();
painelBorda.setLayout(new GridBagLayout());
painelBorda.setBorder(BorderFactory.createTitledBorder("Teste"));
painelBorda.setPreferredSize(new Dimension(350, 70));
painelPrincipal.add(painelBorda);
return painelPrincipal;
}
public static void main(String[] args) {
BordaTitulo t = new BordaTitulo();
t.setVisible(true);
}
}