- 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
Java Program to use Soft Bevel Border in Swing
Here, we are creating soft beven border on JComboBox:
JComboBox comboBox = new JComboBox(list);
Now, set bevel border:
comboBox.setBorder(new SoftBevelBorder(BevelBorder.LOWERED));
The following is an example to use soft bevel border in Swing:
Example
import java.awt.Font; import java.awt.GridBagLayout; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.BevelBorder; import javax.swing.border.SoftBevelBorder; public class SwingDemo { static final String list[] = { "One", "Two", "Three", "Four", "Five", "Six" }; public static void main(String[] args) { JFrame window = new JFrame("ComboBox Example"); JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); JComboBox comboBox = new JComboBox(list); comboBox.setBorder(new SoftBevelBorder(BevelBorder.LOWERED)); panel.add(comboBox); window.add(panel); window.setSize(600, 400); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setVisible(true); } }
Output
- Related Articles
- Java Program to add Titled Border to Panel in Swing
- How to change Button Border in Java Swing
- Java Program to create rounded borders in Swing
- Java Program to create JCheckBox from text in Swing
- Java Program to append a row to a JTable in Java Swing
- Program to combine BorderLayout, GridLayout and FlowLayout in Java Swing?
- How to maximize JFrame in Java Swing
- How to make a canvas in Java Swing?
- How to add JTable to Panel in Java Swing?
- Create translucent windows in Java Swing
- Create shaped windows in Java Swing
- Is Swing thread-safe in Java?
- Explain the architecture of Java Swing in Java?
- How to display row count in Java Swing JList
- How to leave space with EmptyBorder in Java Swing

Advertisements