- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to set border color for SoftBevelBorder in Java?
To set the border color for SoftBevelBorder in Java, use the Color class and set the color while creating the border −
SoftBevelBorder border = new SoftBevelBorder( BevelBorder.RAISED, Color.ORANGE, Color.ORANGE.darker(), Color.BLUE, Color.magenta.brighter());
We have set the following colors above as parameters −
highlightOuterColor: color to use for the bevel outer highlight highlightInnerColor : color to use for the bevel inner highlight shadowOuterColor : color to use for the bevel outer shadow shadowInnerColor : color to use for the bevel inner shadow
The following is an example to set border color for SoftBevelBorde in Java −
Example
package my; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.border.BevelBorder; import javax.swing.border.SoftBevelBorder; public class SwingDemo { public static void main(String args[]) { JFrame frame = new JFrame("Demo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); SoftBevelBorder border = new SoftBevelBorder( BevelBorder.RAISED, Color.ORANGE, Color.ORANGE.darker(), Color.BLUE, Color.magenta.brighter()); JLabel label = new JLabel("This is a demo label with Soft Bevel Border"); label.setBorder(border); Container contentPane = frame.getContentPane(); contentPane.add(label, BorderLayout.CENTER); frame.setSize(550, 300); frame.setVisible(true); } }
Output
- Related Articles
- How to set raised and lowered SoftBevelBorder for components in Java. Also set the border color.
- How to set Line Border color and width with Java?
- How to set border width, border style, and border color in one declaration with JavaScript?
- How to set default background color for JTextPane in Java?
- How to set the border color of certain Tkinter widgets?
- How to set the color of the bottom border in JavaScript DOM?
- How to set the color of the top border with JavaScript?
- How to set the color of an elements border with JavaScript?
- How to set the color of the right border with JavaScript?
- How to set the color of the left border with JavaScript?
- How to set color to MatteBorder in Java?
- Set the color of the border with CSS
- How to set the border color of the dots in matplotlib's scatterplots?
- How to set font face, style, size and color for JTextPane text in Java
- Set the color of the right border using CSS

Advertisements