4
How I could change the color of the border 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);
}
}
he changed only the title, the line that forms the border remains pattern.
– Java
@Java ta using Nimbus as lookandfeel?
– user28595
ta without any lookandfeel
– Java
@java now yes, see the edition.
– user28595
now yes! Thank you !
– Java