JComboBox: Background color of button different to the popup

Hello,
I want to have a combo box in wich the background color of the arrow button would be different to the color of popup menu.
I did this, but it didn't take the effect.
setUI(new MetalComboBoxUI(){
            protected javax.swing.JButton createArrowButton() {
                javax.swing.JButton button = new MetalComboBoxButton( comboBox,
                        icon,
                        comboBox.isEditable(),
                        currentValuePane,
                        popupList );
                button.setMargin( new java.awt.Insets( 0, 10, 10, 30 ) );
                button.setBorder(null);
                button.setBackground(Color.green);
                return button;
        });thanks in advance.

Try this:import java.awt.Color;
import java.awt.FlowLayout;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.basic.BasicComboBoxUI;
public class ComboWithGreenButton {
   String [] data = {"option0", "option1", "option2", "option3"};
   JComboBox combo;
   void makeUI() {
      combo = new JComboBox(data);
      combo.setUI(new BasicComboBoxUI());
      JFrame frame = new JFrame("Combo with green button");
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setSize(100, 60);
      frame.setLayout(new FlowLayout());
      frame.add(combo);
      frame.setLocationRelativeTo(null);
      frame.setVisible(true);
   public static void main(String[] args) {
      SwingUtilities.invokeLater(new Runnable() {
         public void run() {
            UIDefaults defaults = UIManager.getDefaults();
            defaults.put("ComboBox.buttonBackground",
                  new ColorUIResource(Color.GREEN));
            new ComboWithGreenButton().makeUI();
}luck, db

Similar Messages

  • How do you change the background color & font in a text-only popup?

    It has been ages since I did this and I can't seem to remember how. I tried to edit the style sheet but it only has options to change the text-only popup hotspot/link and I need to change the background color and font style within the popup itself. Tried Adobe's help but it had no answer for me. Any one out there know how to do this? I am running RoboHelp 7.

    By Popup do you mean a link that when clicked causes a separate topic to be displayed in a seperate window (popup) or Drop Down text?
    For Popups that are displayed in a new window then the font and colour is changed in the topic that is displayed. Simply open the topic and change colours / features as required
    If you are using drop down text and confusing this with a popup then the font and colour is changed when creating the drop down text. Right click the text and select Font to change colour etc.

  • How can I change fullscreen background color, so that it is the same when viewing on mac and iPad? I want this to be able to use MathType in widget text.

    How can I change fullscreen background color, so that it is the same when viewing on mac and iPad? I want this to be able to use MathType in widget text.
    As an example, html widget has white background on iPad, and black on mac. The same goes for interactive widget.
    The MathType text inserted is inserted as a image, and will have the same color when in fullscreen as when not. So I need the textcolor to be the same in both views. Anyone know how to fix this?

    We're still not communicating. This is why I wanted an example .iba.
    Here's a re-creation of my own, going off what you described. You said "all html widgets and all gallery widgets" have this problem. So I inserted a blank HTML widget and a blank Gallery widget, and typed into both. Inserted a MathType equation into both. I don't see any difference when I preview it on my Mac compared to the preview on the iPad. I want to help, but I can't help if I can't duplicate the issue.
    I've attached the screen shots and the .iba file [link to .iba file].
    Feel free to email me directly at bobm at dessci dot com. If you're uncomfortable giving some information here, tell me anything you want in email. I work for the "MathType company", Design Science.

  • Indesign problem : background color don't appears in the pdf...

    Hello,
    When I export the document to PDF, the background color doesn't appears in the pdf.
    I'm a new Indesign user. Ihave searched every where, but i have not found  tutorial about this problem...
    EM2C

    How did you implement this "background color"?
    If, as I suspect, you changed the [Paper] swatch, then you aren't seeing a malfunction. That swatch is non-printing, and will not show up anywhere but in the InDesign editing environment. To add a color in the background, you must actually fill an object with the color and position it behind the rest of the elements in your layout.

  • Can I modify a background color of a template - specifically, the navigation bar background?

    can I modify a background color of a template - specifically, the navigation bar background?

    iWeb has a great toool :
    And it's visible here :
    And google is your friend :
         http://www.google.com/search?q=what+is+a+HTML+Snippet

  • [svn:fx-gumbo_beta2] 10321: Fix SDK-23520 - Application background colors don' t work with the Wireframe theme

    Revision: 10321
    Author:   [email protected]
    Date:     2009-09-16 13:42:01 -0700 (Wed, 16 Sep 2009)
    Log Message:
    Fix SDK-23520 - Application background colors don't work with the Wireframe theme
    QE notes: Wireframe tests need new baselines. There are subtle rendering differences on the edges/corners that are not visible, but are causing test failures. Joann has excluded the wireframe tests for now.
    Doc notes: None
    Bugs: SDK-23520
    Reviewer: Chet
    Tests run: checktests, mustella gumbo/components/wireframe
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-23520
        http://bugs.adobe.com/jira/browse/SDK-23520
    Modified Paths:
        flex/sdk/branches/gumbo_beta2/frameworks/projects/wireframe/src/spark/skins/wireframe/App licationSkin.mxml

  • JComboBox Background Color

    Hi,
    When I use setBackground(Color.WHITE), the JComboBox button also changes to white. How do I set the JComboBox background to WHITE without affecting the button? Thanks.

    Thanks Michael. Actually, i did the following instead:
    setEditable(true); // Turn on the Editor (to get white background)
    getEditor().getEditorComponent().setFocusable(false); // But denied focus (thus, user can only select from dropdown)

  • Background color change question - only selecting the footer

    I use the darkroom theme and was curious about changing the page background color. Right now my settings use the darkroom theme 'right out of the box' which is 'image fill' on both the page and browser background. That is the textured look.
    When I try to change the color, selecting 'color fill' instead of 'image fill', it only changes the footer - not the entire page background.
    I'm guessing it's not possible to change a color using the 'image fill.' You get 'image fill' in black or gray as shown and that is it, except should you decide to use your own image, which I do not.
    Any way to be able to have a change apply to the entire page and not just the footer?
    Suggestions welcome.

    I tried to do the same just see what the problem was and failed. It is probably 'cos the top layer is independant of the page background or browser background. Even when I had page background none and altered the browser background it made no difference. If you want anything different try using a blank black or white theme and putting your own graphics on there. You can make quite nice backgrounds if you have a decent paint or photo program.
    Message was edited by: Hazell

  • Email background color selection - can't locate the option!

    Hi all,
      I have a BB 8830 running OS 4.2.2.148 on Verizon. I use the application BES Mailbox so I have my work BES email seperated from my personal Roadrunner email. Some time ago, I found a way to change the background color of email messages (one color for BES, a different color for the Roadrunner). Well, I'm sick of that now but I can't for the life of me figure out how to change/remove the background colors! Can any of you expert BB users help me out?
    Thanks,
    Marty
    Update!
    I found out on Crackberry forums how to do this! What a relief!!!
    Go to Options / Security Settings / General Settings / Message Background Colours...
    Message Edited by martym on 08-26-2008 04:00 PM

    I have a bold 9700 OS5.0, I do NOT have the General Settings folder under the Security Settings folder. I cannot for the life of me find the message background colors options.  help!

  • How can i change the background colors on my iphone. The new white is hard on my eyes. I dont care for the grey boxes either.

    how can i change the background colors on the new update? I find the white a bit much. Also is there anyway I can change the grey boxes they seem out of place.

    That makes me sad. thannk you

  • Background color based on day of the week?

    I have a column filled with dates going from 1-1-2007 to 12-31-2007. Using the autofill it was easy getting the dates auto-filled in. The only trouble with the overview is that's rather hard to see which days belong to the weekend, and which belong to the workweek (forgive my english..).
    Is there a way to automatically color the background of a cell, based on that specific data?
    If not, is it possible then to create a pattern? like 5cells green, 2 cells red, 5 cells green, 2cells red.. etc. you get the point.
    I thank you in advance for your help!

    I solved the problem it seems. I'll leave it for others with this trouble:
    In make case I just made the first two weekend cells Blue. I made a selection of these cells + 5 extra (the 5 days during the week). Then I just take the rightlower corner and start dragging to the lowest cell, overwriting the current cells, making them still appear the same but now with a 2 blue colored cells every 7 cells.

  • I really want to change the background color of my documents in the mobile app. ive tried to search the answer online, in blogs and other various 'life hacks' blogs or articles, but so far everyone is talking about the desktop version. i really want to fi

    please help!!

    I'm with you on the saying goodbye!
    I've gone fron having an old BB 9780 which worked perfectly to "upgrading" to a phone that doesnt work for a business user on soooo many levels.
    I'm reverting back to the old BB for a couple of months then will look at changing platforms.

  • Dynamically Set Subreport Background Color to the Same Value as Main Report Background Color

    I have a report that contains a subreport.  The main report has groupings in it.  I am dynamically setting the background color of the group rows based on an expression.  That part is working fine.  The problem that I am having is that
    I don't know how to get the subreport to "inherit" the background color of the grouping that holds it.
    Basically, I have different row shadings on my report differentiating the groupings except for the rows where the subreport shows.
    How do I go about setting the subreport background color to equal it's contaiing grouping's background color?  Thanks in advance for any and all assistance provided.

    The parameter method given by gpshukla will send the info to the subreport, but you don't need the color parameter in the main report, only the subreport. The trick is in setting the value of that parameter.
    Right-click the cell with the embedded subreport, you can select subreport properties.
    Select Parameters and add a parameter.
    The name column is the name of the parameter in the subreport (color) and value is the value to set it to.
    Set name to "color" (no quotes).
    Set Value to the same expression used to set the background color for the row.
    In the subreport, click the design surface to select the report (not header or footer).
    In the properties pane, select background color and choose expression from the dropdown.
    Type =Parameters!color.Value into the expression builder.
    This will work assuming that background color in the main report row will not change without also refreshing the subreport.
    "You will find a fortune, though it will not be the one you seek." -
    Blind Seer, O Brother Where Art Thou
    Please Mark posts as answers or helpful so that others may find the fortune they seek.

  • Spry vertical menu button shows background color instead of image in preview

    Hello All, I'm a newbie (to the forum and Dreamweaver) so my apologies if my question is not in good form.  I've searched for this issue but cannot seem to find the exact problem I have. 
    I've created a website (my first) and used the spry menu bar.  It works well using the default blue and grey colors for button and hover.  However, I decided I want to spruce it up a little and change the buttons to use a background image (rainbow pattern) instead of background color.  I internet researched this for some time and watched all the youtube videos people have posted for this process and editing the spry vertical menu bar CSS.  Using the .a and hover lines from the CSS, I was able to add my background .jpg image file.  In the design view, the button look exactly how I want them to.  However, when I attempt to preview in IE, Chrome, or FF, the buttons still have the default colors and no image.  I've gone back and deleted the default blue and grey, but then the preview just shows dark grey and white for the buttoms.  is there something that I am overlooking that would cause the background color to show instead of the image I have attached to the buttons.  I can't figure out why it looks right in DW but not in preview.
    BTW, I'm editing a template file and all the pages are updated with the new image buttons, but none of the pages show correctly in preview. 
    Thanks

    Point taken :-)
    This is my spry vertical css code.  No sub-menus. 
    DESIGN INFORMATION: describes color scheme, borders, fonts
    /* Outermost menu container has borders on all sides */
    ul.MenuBarVertical
    border: 1px solid #CCC;
    /* Submenu containers have borders on all sides */
    ul.MenuBarVertical ul
    border: 1px solid #CCC;
    /* Menu items are a light gray block with padding and no text decoration */
    ul.MenuBarVertical a
    display: block;
    cursor: pointer;
    padding: 0.5em 0.75em;
    color: #333;
    text-decoration: none;
    font-weight: bold;
    background-image: url(/Images/Rainbow_Button.jpg);
    background-color: ;
    background-repeat: no-repeat;
    background-position: center;
    /* Menu items that have mouse over or focus have a blue background and white text */
    ul.MenuBarVertical a:hover, ul.MenuBarVertical a:focus
    background-color: #666666;
    color: #333333;
    background-image: url(/Images/Rainbow_Button_Hover.jpg);
    /* Menu items that are open with submenus are set to MenuBarItemHover with a blue background and white text */
    ul.MenuBarVertical a.MenuBarItemHover, ul.MenuBarVertical a.MenuBarItemSubmenuHover, ul.MenuBarVertical a.MenuBarSubmenuVisible
    background-color: #0000FF;
    color: #FFF;

  • How can I programica​lly change the background color of one VI using another VI?

    Is it possible to change the text background color of an indicator on the front panel of one VI from a different VI? 
    Solved!
    Go to Solution.

    Hi Coutts,
    Good Morning and I hope your well today.
    Thanks for the kudos and marked answer.
    You can alter the controls/indicators fonts etc.
    You need to get a reference to Controls[] which includes all controls and indicators on a VI. 
    Then I have created an array of their Labels.Text - so we know which reference is which.
    With a single reference you can then access properties such as label.font where you can alter if the label is
    Bold, Unerline,size and colour...
    Notice I have selected to Bold and Underline the label of the controls and indicators - and they appear bold and underlined. 
    I have re-attached the modified code.
    Hope it finds you well, 
    Kind Regards
    James Hillman
    Applications Engineer 2008 to 2009 National Instruments UK & Ireland
    Loughborough University UK - 2006 to 2011
    Remember Kudos those who help!
    Attachments:
    setter.vi ‏22 KB
    other VI.vi ‏5 KB

Maybe you are looking for

  • Invoice & Accounting Document Number

    Dear Experts, We are facing number range problem. When we are saveing an invoice then Invoice number and accounting document number showing different. It should come same number. Can you pls advice why this is happening and how I can resolve this iss

  • "The evaluation period for some of your software can be extended..​."

    Installed LabVIEW 2012 for which we have a license. Apparently it installed Application Builder without my knowledge or consent. Now, -everytime- I try to launch LabVIEW I get an annoying dialog, "The evaluation period for some of your software can b

  • How to create a link between database schema?

    Hi, I have created database link between two database schema (From DBSchema2 i have created database link for DBSchema1). From DBSchema2, i have quried one table (This table is present in DBSchema1). But it throws an error says that Table or View doe

  • Wifi unable to connect to network on IOS 7.1

    I m using iphone 5s and recently updated my ios to 7.1. My wifi at office which i was able to connect to earlier is not able to connect now after the update.On the other hand, it works well with my wifi at home and anyother place. I am facing this pr

  • Do I have to erase my HD when re-installing Classic 9?

    This is going to be a little long, so I apologize for that, but I figure more information will help the experts in the world of Mac to help me. my Mac : iBook 500 MHZ power PC G3 Version loaded: OS X 10.2.1 Original (and also my discs): OS X 10.0.3 I