- 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
Can we disable JComboBox arrow button in Java?
Yes, we can do that using removeArrow() method.
The following is an example to disable JComboBox arrow button:
Example
import java.awt.Component; import java.awt.Container; import javax.swing.*; public class SwingDemo { public static void main(String[] args) { String[] strValues = {"One", "Two"}; JComboBox<String> comboBox = new JComboBox<String>(strValues); removeArrow(comboBox); JOptionPane.showMessageDialog(null, comboBox); } private static void removeArrow(Container container) { Component[] c = container.getComponents(); for (Component res : c) { if (res instanceof AbstractButton) { container.remove(res); } } } }
Output
- Related Articles
- How can we disable the maximize button of a JFrame in Java?
- How can we implement editable JComboBox in Java?
- How can we implement auto-complete JComboBox in Java?\n
- How can we set the border to JComboBox items in Java?
- How can we sort the items of a JComboBox in Java?
- Java Program to disable the first item on a JComboBox
- Java Program to create Arrow Button positioning North
- How can we disable the leaf of JTree in Java?
- How can we set the foreground and background color to JComboBox items in Java?
- How can we set Mnemonic Key Radio Button in Java?
- How can we disable the cell editing inside a JTable in Java?
- How to disable close button on a JFrame in Java?
- Disable a Bootstrap Button
- How can we show a popup menu when the user right-clicks on a JComboBox in Java?
- Disable a button with Bootstrap

Advertisements