JButton myButton = new JButton("Click Me"); Border border = UIManager.getBorder("Button.border"); myButton.setBorder(border);
JTextField myTextField = new JTextField(); Border border = UIManager.getBorder("TextField.border"); myTextField.setBorder(border);In this example, we retrieve the default border for a JTextField using the UIManager.getBorder method and then set it as the border for our text field. The package library for javax.swing.UIManager is JavaSE.