Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jTextField default border color  RSS feed

 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
using java6 and all defaults, i've textfields and a jTextArea; as the default textarea has no border, i added one; but i cant find out what color textfield's borders use, so that i could use the same color in my textarea border.

how can i find that out?

TiA
[ March 30, 2007: Message edited by: miguel lisboa ]
 
Campbell Ritchie
Marshal
Posts: 55772
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Go through the API specifications for whichever Border you are using. You should find methods which get the colour. They are there in LineBorder and EtchedBorder.
 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the closest i got:

gets an error msg:

Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.plaf.BorderUIResource$CompoundBorderUIResource cannot be cast to javax.swing.border.LineBorder
 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dont even need to know the color:


 
Campbell Ritchie
Marshal
Posts: 55772
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well done
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!