Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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

Advertisements