Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8844189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:25:25+00:00 2026-06-14T11:25:25+00:00

I have to set the custom image in my dropdown for JComboBox. I was

  • 0

I have to set the custom image in my dropdown for JComboBox. I was quite successful to remove it (by overriding getWidth()) but I am not able to replace arrow with my custom image. Here is my code snippet to get better idea. I don’t know where I am doing wrong but its showing some elevated portion at button section.

    cmbYear = new JComboBox();
    cmbYear.setUI(new BasicComboBoxUI(){
        protected JButton createArrowButton() {
            return new JButton() {
                private static final long serialVersionUID = 1L;
                public void setIcon(Icon defaultIcon) {
                    defaultIcon = new ImageIcon("images/dropdown_icon.png");
                    super.setIcon(defaultIcon);
                }
   //           public int getWidth() {
   //                return 0;
   //            }
            };
        }
    });

Please help me here. Thank you very much for you time and suggestions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:25:26+00:00Added an answer on June 14, 2026 at 11:25 am

    You could override getIcon instead. Cache icon as needed.

    @Override
    public Icon getIcon() {
      Icon defaultIcon = new ImageIcon(getClass().getResource("images/dropdown_icon.png"));
      return defaultIcon;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have set onItemClicklistener on my custom list view but onItemClicklistener not working I
I'm customizing UINavigationBar and have to set a custom background image to the navigation
I have defined a UITabBar programmatically but how can I set a custom UITabBar
i am confused with custom background image in section. i have set an custom
f I have a ContentControl... and its Content is set to a custom Image...
This way i have created my custom button and set the image.I have set
I have used input type image to display my custom style buttons, but for
I have created a custom image attribute and added it to default attribute set
I have set my default-input-method variable to english-dvorak: (custom-set-variables '(default-input-method english-dvorak)) When I launch
Say I have a set myset of custom objects that may be equal although

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.