To get the border color:
((LineBorder)JTextField.getBorder()).getLineColor();
and this is just a thought on how to get the size of the border, if you assume that the size of the border is the same as the size of the component, you can impose a JTextField on the JComponent and get the size of the JTextField:
((JComponent)JTextField).getSize();
but you have to use it after putting the JTextField in your container, otherwise it will return (0,0).
Billydan
source share