How to disable auto resizing for jComboBox

Hi,
I do not know how to prevent jComboBox to be auto resized according to its content. I put a jComboBox on JPanel with IDE.
After that I use for loop to fill a jComboBox. JComboBox width depends on the content and jComboBox is autoresized. I tried to use set*Size before and after for loop but it did not work as I wish:
        jComboBoxT.setMaximumSize(new java.awt.Dimension(10, 20));
        jComboBoxT.setMinimumSize(new java.awt.Dimension(10, 20));
        jComboBoxT.setPreferredSize(new java.awt.Dimension(10, 20));
        jComboBoxT.setSize(new java.awt.Dimension(10, 20));Could you help me please? The problem is that I have three jComboBox in one row and after autoresizing one disappears...
Best regards,
Primoz

Hi,
I have created SSCCE. I do not like that jComboBox spread over the whole display. I would like that the jComboBox width is only about 2 inches (5cm). If you run example below you will see that jComboBox width auto resize.
Regards,
Primoz
import java.awt.*;
import javax.swing.*;
public class PrimozComboBox extends JPanel {
    JLabel picture;
    public PrimozComboBox() {
        String[] petStrings = { "Bird", "Cat", "Dog", "Rabbit", "Pig" };
        String[] cityStrings = { "New York", "Ljubljana", "Chicago" };
        JComboBox petList = new JComboBox(petStrings);
        petList.addItem("This is very long pet name, which could spread over many lines");
        add(petList);
        JComboBox cityList = new JComboBox(cityStrings);     
        cityList.addItem("This is very long city name, which could spread over many lines");
        add(cityList);
    private static void createAndShowGUI() {
        //Create and set up the window.
        JFrame frame = new JFrame("ComboBoxDemo");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //Create and set up the content pane.
        JComponent newContentPane = new PrimozComboBox();
        newContentPane.setOpaque(true); //content panes must be opaque
        frame.setContentPane(newContentPane);
        //Display the window.
        frame.pack();
        frame.setVisible(true);
    public static void main(String[] args) {
        //Schedule a job for the event-dispatching thread:
        //creating and showing this application's GUI.
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
}

Similar Messages

  • How to disable auto-sort for AdvancedDataGrid

    Hello,
    I am using Flex 4, ActionScript 3.
    I want to disable auto-sort. Meaning I want the sort to be executed only when the user clicks the column header, not when new rows are added to the binded collection or when values are changed.
    So far, I've found only this on the Internet:
    http://]http://tomek.me/disable-sort-on-datagrid-edit-update/
    I'd like to avoid doing that if possible.
    Many months ago, I found a solution that involved using event.preventDefault() placed somewhere. I thought I wouldn't have a problem finding it again, but I am.
    Can someone please help? Thanks!
    Bon :-D

    Hi,
    I have created SSCCE. I do not like that jComboBox spread over the whole display. I would like that the jComboBox width is only about 2 inches (5cm). If you run example below you will see that jComboBox width auto resize.
    Regards,
    Primoz
    import java.awt.*;
    import javax.swing.*;
    public class PrimozComboBox extends JPanel {
        JLabel picture;
        public PrimozComboBox() {
            String[] petStrings = { "Bird", "Cat", "Dog", "Rabbit", "Pig" };
            String[] cityStrings = { "New York", "Ljubljana", "Chicago" };
            JComboBox petList = new JComboBox(petStrings);
            petList.addItem("This is very long pet name, which could spread over many lines");
            add(petList);
            JComboBox cityList = new JComboBox(cityStrings);     
            cityList.addItem("This is very long city name, which could spread over many lines");
            add(cityList);
        private static void createAndShowGUI() {
            //Create and set up the window.
            JFrame frame = new JFrame("ComboBoxDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Create and set up the content pane.
            JComponent newContentPane = new PrimozComboBox();
            newContentPane.setOpaque(true); //content panes must be opaque
            frame.setContentPane(newContentPane);
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    }

  • How to disable auto update for corporate installation

    I've scoured the forums for this information and was not successful locating a viable answer.
    We need to update 1500 corporate clients to the latest version of QT, but we need the auto update feature turned off when the upgrade is complete. We do this for two reasons: 1) Users do not have permissions to run the installer, so even if they wanted to run the update they would be unsuccessful, and 2) we need to test any updates before they are distributed to the general population.
    For past versions we created a QTP file with the auto update turned off, then placed it into the C:\documents and settings\all users\application date\apple computer\quicktime folder. This method is no longer successful.
    Changing the settings for each individual user is not an option, we need a method that will change the setting for any past, current, or future user on all of our computers.
    Any guidance is appreciated.

    Trying to figure out the same thing. I came across the following two links but I don't think they will disable the updates to community help itself. So from what I can gather you need to do the following:
    Turn off autoupdates to AIR (See below)
    Turn off updates to Community Help (No clue how to do this)
    Install Local content (See below)
    Disables updates to AIR
    http://help.adobe.com/en_US/air/admin/WS485a42d56cd1964167ea49bd124ef17d52a-7ff5.html#WS48 5a42d56cd1964167ea49bd124ef17d52a-7ff2
    Turn off internet access/help and copy local help
    http://kb2.adobe.com/cps/849/cpsid_84992.html
    Turn off internet access (not sure if you need to do this one and the one above or just the one above)
    http://kb2.adobe.com/cps/846/cpsid_84665.html
    You can download the latest version of AIR and Community Help.
    Link to latest version of community help
    http://www.adobe.com/support/chc/
    Hopes this helps.

  • How to disable auto-complete for a text field?

    I didn't find any attribute that controls this. Thanks!

    Hi,
    Recently I needed to use this feature, and after some research I found the answer.
    Just sharing the solution.
    I am aware that the auto-complete is a browser setting. But is there a way to let APEX not save the items entered before? Write a javascript?
    Because I have implemented Google suggest for a text field. Every time the suggestions pop up, the auto-complete items will also appear at the same time, which is very annoying.Put on your Page Item > Element > HTML Form Element Attributes : autocomplete="off"
    Bytes

  • How to Disable "Auto Align" in [System Pref.] - [Display] - [Arrangement]

    Does anyone know How to Disable "Auto Align" in [System Preferences] -> [Display] -> [Arrangement]?
    It always want to align the two screens from the top when they are lined up close together and I need them to be aligned from the bottom. Since the resolution heights are so close together (1080 & 1050) it does not allow one to align side by side from the bottom as it prioritizes top alignment.
    I guess I'm looking for a script to disable this feature.

    Anyone got any ideas?

  • How to disable auto charge of iPhone via PC?

    How to disable auto charge of iPhone via PC?

    I'm thinking you may have the concern of not overcharging or messing with charge cycles of your phone, but according to apple the Li-ion batteries in iDevices work this way for example
    -Your phone has 50% battery left, you charge it
    -after using again, you're back with 50 and charging it till full once again makes it 1 charge cycle
    Doesn't work like nickel batteries.
    Here's the article:
    Www.apple.com/batteries for some
    Battery care tips.

  • How to disable auto sign in

    how to disable auto
    signin

    Hi, Dominic; yes, I tried that x2 or 3.
    Finally called Apple; eventually realized I needed to re-launch Safari after deselecting autofill users and p-words.
    But thank you for your help!

  • How to disable auto update jre-6u20 by script

    Hi,
    our users can not update java, because of domain-restrictions.
    So they should not become the notification.
    How can we disable auto update for version jre-6u20 by script?

    Trying to figure out the same thing. I came across the following two links but I don't think they will disable the updates to community help itself. So from what I can gather you need to do the following:
    Turn off autoupdates to AIR (See below)
    Turn off updates to Community Help (No clue how to do this)
    Install Local content (See below)
    Disables updates to AIR
    http://help.adobe.com/en_US/air/admin/WS485a42d56cd1964167ea49bd124ef17d52a-7ff5.html#WS48 5a42d56cd1964167ea49bd124ef17d52a-7ff2
    Turn off internet access/help and copy local help
    http://kb2.adobe.com/cps/849/cpsid_84992.html
    Turn off internet access (not sure if you need to do this one and the one above or just the one above)
    http://kb2.adobe.com/cps/846/cpsid_84665.html
    You can download the latest version of AIR and Community Help.
    Link to latest version of community help
    http://www.adobe.com/support/chc/
    Hopes this helps.

  • How to disable auto clear feature in a text box in IE10

    How to disable auto clear button in Text box in IE10
    Hi Team,
    I saw this question on Microsoft forum but I did not find any reply to this question, therefore, I am re-posting it.
    When I run web interface application on IE10, i see there is a new feature which has 'X' at the end of text box and on clicking it it clears the text.
    Are there any settings of IE10 that can be changed to disable it or some code snippet?
    I find the 'X' sign at the end of text box very annoying and would like to turn it off and make it compatible with older versions of IE and other explorers.
    Looking forward to your answer at the earliest.
    Regards
    Sakshi

    Hi,
    Please try the steps in the following thread to see whether it could help:
    Remove IE10's “clear field” X button on certain inputs?
    http://stackoverflow.com/questions/14007655/remove-ie10s-clear-field-x-button-on-certain-inputs
    Regards,
    Vincent Wang
    TechNet Community Support

  • Does Anyone Knows How To Disable The "Check For Updates" Option in Adobe Edge Code and Reflow?

    Does Anyone Knows How To Disable The "Check For Updates" Option in Adobe Edge Code and Reflow?
    Thanks in Advance

    I don't think there is a way for Edge Code. I'm not sure about Reflow.
    Why don't you just upgrade? That will stop the notifications.
    Randy

  • How to add auto play for audio in ibooks author?

    I cannot seem to get the low-down on how to add auto play for audio in ibooks author. I would like the audio to play when the reader opens the page?
    Thanks!

    There is no option for autoplay on page turn. There is no option for autoplay, only loop.

  • How do I disable auto select for the path selection tool?

    For the move tool you can choose to disable auto selection, auto select a group, or auto select a layer. By default though the path selection tool autoselects a layer. How can I disable autoselection?

    I can’t seem to reproduce what you describe.
    Please elaborate, possibly with the help of some screenshots.

  • How do I disable auto-renewal for an annual subscription?

    I would like to stop the auto renewal for an annual subscription and can find no way to do so.  If I cancel the subscription, I get charged.  If the subscription renews, I need to cancel it and will still get charged.  I'd like to have the subscription just end entirely when it expires, that way, there's no charge or hassle.

    You will be able to cancel your membership after payment for the 12th month has processed - see http://helpx.adobe.com/x-productkb/policy-pricing/cancel-membership-subscription.html
    If you have any issues with this, please let us know and I can always follow it up for you.
    Refer to: Re: How auto-renewal works
    Re: I do NOT want to auto-renew for another year!
    Re: How auto-renewal works
    Kind regards
    Rajshree

  • How can I set auto-resize for an application?

    Hi, I have created a flex application but now I have a problem: if I use it on a netbook, with little display, or I use it throught facebook the application does not auto-resize nor vertical/horizontal bar appear!
    Is there a way to let application auto-resize?I used flash builder 4 with a graphite-spark theme and no layout at all...help me please!

    Yes, but the problem are x and y : they are absolute so containers will eventually collide...you mean the only way is to use nested containers and not use coordinates in order to put elements on the application?

  • Refund amount and disable auto charge for subscrip...

    Hello , Here is my order number ****************272
    Please refund the amount and how can i disable auto recharge option ? I want it for USA but unfortunately subscribed for UK .. Please help
    Thanks

    You can use the links below to view and control any possible recurring charges:
    Subscriptions: (Cancel any subscriptions you may be a part of)
    https://secure.skype.com/account/call-phones/packages
    Usage History (6 months):
    https://secure.skype.com/account/usage
    Billings & Payments:  (If enabled, disable Auto-Recharge)
    https://secure.skype.com/account/payment/atu/entry
    Purchase History: (Every payment you've made since you had the account)
    https://secure.skype.com/wallet/account/orders
    Skype Number (Under settings, cancel any recurring number subscriptions)
    https://secure.skype.com/account?page=onlineNumber
    Once complete, request a refund for unused/unauthorised services
    https://support.skype.com/en/faq/FA297

Maybe you are looking for

  • Windows XP LAN driver needed for my Satellite A100-784

    I bought Satellite A100-784 with Windows Vista. I've removed Vista and installed Windows XP (taken from other non-Toshiba notebook)) and then SP2. Now I can't use the internet because there's no LAN driver. The drivers downloaded from this Toshiba si

  • Layout and moving forward backward

    hello, i'm beginner in report and i try to modify a complex report i would like to move in the layout editor, a field that i have created to put it in the good place in layout tree but in the menu layout, "move backward" doesn't work and when i use "

  • Hebrew characters on SW2

    hello,  i've been experiencing problems with hebrew language characters in the various sw2 apps (such as messaging app, missed calls app, gmail app etc,)  hebrew characters just shows up as question marks (??????) which makes them (and the SW2) quite

  • Setting alerts by subject

    Is there a way to set my iPhone to set off an alert based on words in the subject of a message? I belong to an emergency response group, and alerts are sent out by messaging (text). There are an changing array of people who can send out a call, but t

  • ICal just stopped working....

    iCal will not boot up for me. When I double click on the icon in my dock, nothing happens, and nothing happens when I click on the iCal icon in my hard drive's application folder. All else seems to be fine on my computer but I am LOST without iCal. I