I created a titledBorder. How can I change the size and the color of my border?
Thanks in advance
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
I created a titledBorder. How can I change the size and the color of my border?
Thanks in advance
As always, the API is your best friend: BorderFactory (Java Platform SE 7 )
Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
Lotus2013 (January 28th, 2014)
Thank you. I checked it but there's something that I don't understand. for creating a TitledBorder, there are 6 ways:
1: createTitledBorder(Border border)
2: createTitledBorder(Border border, String title)
3: createTitledBorder(Border border, String title, int titleJustification, int titlePosition)
4: createTitledBorder(Border border, String title, int titleJustification, int titlePosition, Font titleFont, Color titleColor)
5: createTitledBorder(String title)
6: createTitledBorder(String title)
but none of these specifies the thickness of the border itself.
--- Update ---
I did this to make it work but it doesn't work :
Border title = BorderFactory.createLineBorder(myColor, 2);
headerPanel.setBorder(BorderFactory.createTitledBo rder(title, "ورود", TitledBorder.RIGHT, TitledBorder.DEFAULT_JUSTIFICATION, myFont, myColor));
What do you mean when you say it doesn't work? What happens if you user a thicker line, like 10?
Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
Lotus2013 (January 28th, 2014)
I don't know why the last time I tried, It didn't show the title. Then I changed the code and again pasted this code and it worked. Everything was OK. Thankssssss