Replacement of a JComboBox by another

i have 2 jcomboboxes on a jpanel,on a jframe
the selection from the first combobox is used to create the second
when the selection on the first changes, a new second jcombobox is created (is indeed created - i watched it while debugging), but i haven't so far managed to replace the original second jcombobox with the newly created one
i tried
panel.validate();
panel,repaint();
also tried 2ndcombobox.validate(); ...
and jframe.validate(); but still nothing
anyone any ideas?

see if this helps. And, dukes, oh ...no thanks please! ;)
+= KRR
/* simple combobox program
* @author: K R Rajesh
public class ComboBoxDemo extends JFrame 
     JComboBox comboBox1, comboBox2;
     JLabel lbl = null;
    public ComboBoxDemo()
         String[] values1 = {"combo1", "combo2", "combo3"};
        comboBox1 = new JComboBox(values1);
        String[] values2 = {"bacon & cheese", "no cheese", "no bacon", "include all junks"};   
        comboBox2 = new JComboBox(values2);
        comboBox1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                JComboBox c = (JComboBox) e.getSource();
                System.out.println("" + c.getSelectedItem());
                showDetails();
        JPanel panel = new JPanel();
        panel.add(new JLabel("Select ur combo:"));
        panel.add(comboBox1);
        lbl = new JLabel("Select ur preference:");
        panel.add(lbl);
        panel.add(comboBox2);
        lbl.setVisible(false);
        comboBox2.setVisible(false);
        Container contentPane = getContentPane();
        contentPane.add(panel);
    public void showDetails()
           lbl.setVisible(true);
        comboBox2.setVisible(true);
    public static void main(String[] args)
         ComboBoxDemo frame = new ComboBoxDemo();
        frame.setTitle("Burger Queen Menu!!");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(200, 200);
        frame.setVisible(true);
}

Similar Messages

  • Replace one itunes account with another

    I have the itunes application downloaded on my laptop but i recently made another itunes account and i want the new one to be on the Itunes application. So i uninstalled the application thinking that if i downloaded it again it would ask me for an account. Except all it did was restore the old account. I am wondering if anyone knows how to replace one itunes account with another. If you know anything that can be useful comment.

    Store > Sign Out
    Store > Sign In
    All purchases remain tied to the account used to buy them, but you can authorize iTunes to multiple accounts and put protected content from up to five on your devices. Generally best to stick to one account if possible. More so once you get to iOS devices as managing app updates over multiple devices is a chore.
    tt2

  • Susbtitution Variables in rules file to replace a member name with another

    Hi everybody,
    Can I use substitution variables to replace a member name with another name in rules file?
    Please let me know if we can use substitution vars.
    Essbase version :11.1.2
    Thanks,
    K.as

    Are you the same guy?
    http://www.network54.com/Forum/58296/thread/1287447433/Susbtitution+Variables+in+rules+file+to+replace+a+member+name+with+another+name
    The answer is still, "No".
    Regards,
    Cameron Lackpour

  • How to replace a particular striing with another string in jtextpane

    how to get replace a particular string with another string of a jtextpane without taking the text in a variable using getText() method .

    Thanks for your answer,
    "relevant object" means for you datasources, transfer rules and transformations ?
    With the grouping option "Save for system copy" I can't take easily all datasources, and others objects
    Will I have to pick all object one by one ?
    What would be the adjustement in table RSLOGSYSMAP ? For the moment it's empty.
    Regards
    Guillaume P.

  • How to replace an audio clip by another one in a Aperture slideshow?

    Hello,
    Is it possible to replace an audio clip by another one in a slideshow in Aperture? This clip is between two other audio clips.
    Thank you

    Is it a secondary audio clip?
    Then just select and press the delete key ⌫.
    And drag a different audio clip from the Audio Browser there. The trim the clip by adjusting the start and beginning.

  • Replace one preset effect with another

    Is it possible to replace one preset effect with another withouth having to undo a prior preset effect? 
    When I used Aperture, holding down the Option key would allow me to replace one preset with another.

    Store > Sign Out
    Store > Sign In
    All purchases remain tied to the account used to buy them, but you can authorize iTunes to multiple accounts and put protected content from up to five on your devices. Generally best to stick to one account if possible. More so once you get to iOS devices as managing app updates over multiple devices is a chore.
    tt2

  • How can I remove replace my primary address to another address?

    How can I remove replace my primary address to another address? I have problem...it seems someone used my primary for their personalities and I just want to delete this primary account. Thank you in advance!

    Hi AnaMusic,
    The problem is that the button "Edit" doesn't exists at "Apple ID and Primary Email Address" section. Do you know how to make this happen? I absolutely need help!
    Apple ID and Primary Email Address

  • Replacing a Regular Expression by another

    I want to replace a regular expression by another regular expression..i.e
    if my input is : <tag>-1
    output should be : <tag-1>
    as the integer value changes for each tag I cannot hard code.I am able to match it using regular expression ">-\\d" but how do i replace it??
    Any workarounds would also be appreciated.
    Thanks in advance

    It's not totally clear what you're asking for, but it sounds like something like this:
    str = str.replaceAll("<tag>-(\\d+)", "<tag-$1>");Test it, and let me know if you have questions about what it's doing.
    Check out [http://www.regular-expressions.info] for a great regex tutorial.

  • Replacing one NIDAQPad-6016 by another

    When replacing one NIDAQPad-6016 by another one it is not possible to take over the once installed DAQmx-Tasks. Why?

    That's expected and normal behavior. As long as you don't remove the first DAQPad from MAX another DAQPad will be recognized as a different device and the driver assigns a new device ID (Dev2). You need to go to MAX and change the name if needed or you need to make your software try various device IDs until no error occurrs anymore.
    Best regards,
    Jochen Klier
    National Instruments Germany

  • Replace an iView dynamically by another one by portal navigation service

    Hi all,
    A portal page to integrate several kinds of contents is in general the best way.
    But how can you handle dynamic replacement of an iView of a page (the page contains more than one iView) by another one by using the Portal navigation service? If I navigate to the target application with mode WDPortalNavigationMode.SHOW_INPLACE, the content of the page at all is replaced by the target iView. Is there a possibility to access/replace only the desired iView of the page?
    Thanks.
    Cemal

    See for the solution the following post.
    Replace an iView dynamically by another one by portal navigating service
    Cemal

  • Does Aus Post deliver my Iphone replacement back to me or another service??

    Hi I am just wondering. I have sent my Iphone 4 to Applecare for the repair and replace service. Will they send my replacement via Aus Post or another postal service?
    Thanks

    I cant really say if this will work or not. But you can try and see, plug in your phone to your computer and restore your phone (WARNING: this will remove all your data so back up your phone prior to this) then itll download all the software and restore your phone. Once its complete go on the phone and set up the phone (WITHOUT A BACK UP; set it up as a new iphone when it asks you). Now power off the phone and take out the sim for about 5 min and leave the phone off, then put the sim back in and power it on. If the problem keeps happening, you might need to call your carrier or go to a carrier store and get a new sim card and if the problem keeps happening then you need to go to an apple store for a replacement of the phone. Also would you mind telling me the carrier your on? This will help me be able to find more things to help you and try.

  • I had two files named graphics and I replaced one graphics file with another which was the wrong one.  Can I undo my replacement?  I move the wrong one, which was on my desktop into another one and that is when it as me if I wanted to replace the file.

    I accidently replaced a file with another.  Can I undo my action? 
    I had two files named graphics.  One was on my desktop and another was within another file called solitarie.  I move the one on my desktop (wrong file) into the solitarie file and was asked if I wanted to replace the graphics file in the solitarie folder (the correct one).  I said yes accidently and then remembered that I had made a mistake.  If I use undo, it only move the wrong file back to the desktop.  Is there an undo of replace?

    Sorry, but's that's why you get the warning. "Replace" means just that - the new file over-writes the old one. There is no undo.

  • Replace a paragraph format with another in the every page

    I am doing some cleanup before exporting and I don't know much about FrameMaker....
    I want to replace the paragraph format ABC with XYZ in every page, how would I do this? 
    I  also have a paragraph format I want to delete and make it just a Normal paragraph  in every page, I image it will be the same process as 1?
    Your help is appreciated

    Try this …
    make a back-up just in case
    find a paragraph with the style you want to apply (XYZ, in your example)
    select Edit > Copy special > Paragraph formatthis copies the format to the clipboard
    open the Find/Change dialogue
    put the cursor in a paragraph using the format you want to replace (ABC in your example) and select Paragraph tag from the Find pulldownif you're in luck, FM may well read the current format from the cursor position; if not, type it in
    select By pasting from the the Change pulldown
    click [Change] to see whether the result is what you expect
    click [Change all] once you're feeling confident
    Use the same technique to replace all occurrences of the style you want to delete (PQR, f'r instance) with another style, then delete PQR using the paragraph designer

  • Replace one swf movie with another

    I have a flash movie on my web page and I have made some of
    the text inside the movie into buttons. The movie only takes up a
    portion of the page. I would like to replace the movie with another
    movie when somebody clicks the button.
    I'm sorry if this is a really basic question but I have spent
    ages trying to find out how to do it and I keep getting an error
    when I try to search this forum.
    Thanks for your help.

    Thanks for your help so far. I seem to be having more and
    more trouble though!
    I have a swf file (sunnyserv.swf) that contains a pre-loader
    and then opens another swf file (downturn.swf). The downturn.swf
    contains the buttons that I want to listen to, and swap out the
    movies.
    If I open sunnyserv.fla in flash and test the movie, it loads
    downturn.swf, listens to the mouse click and runs the
    communication.swf movie (although it doesn't clear all of the
    children from downturn.swf).
    However, if I export all three movies and open my web page
    nothing happens! If I change the xhtml to load downturn.swf that
    works ok. Any idea why it would work in test movie but not when
    loaded into an xhtml page?
    Also, can you see a reason why all of the children are not
    being removed in the commClickHandler function?
    Code below:
    sunnyserv.swf (container)
    var l:Loader = new Loader();
    l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,
    loop);
    l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
    l.load(new URLRequest("downturn.swf"));
    function loop(e:ProgressEvent):void
    var perc:Number = e.bytesLoaded / e.bytesTotal;
    percent.text = Math.ceil(perc*100).toString();
    function done(e:Event):void
    addChild(l);
    removeChildAt(0);
    percent = null;
    downturn.swf
    import flash.events.MouseEvent;
    import flash.events.EventDispatcher;
    import flash.display.MovieClip;
    var l:Loader = new Loader();
    // add listeners for each button
    btn_communication.addEventListener(MouseEvent.CLICK,
    commClickHandler);
    function commClickHandler(event:MouseEvent):void {
    for(var i:int = 0; i < numChildren; i++){
    removeChildAt(i);
    l.load(new URLRequest("communication.swf"));
    addChild(l);
    stop();
    Hope somebody can help!

  • I want to replace a MS-7646M1 with another MSI motherboard

    Hello,
    I want to replace my MS-7646M1 (Medion) motherboard with another MSI motherboard, does someone knows the best replacement with te same connectors (front panel)?
    Manual of the motherboard: http://www.medionowners.be/downloads/0MB_MS7646%5B1%5D.pdf
    Thanks
    KingWolf

    If you're using the existing case, then any MSI m-ATX Socket AM3 board will fit, and you should be able to use your existing CPU and RAM. But be warned, these Medion PCs usually come with junk PSUs, so you may want to replace that also.
    Better to just buy a new case, then you can use any size board and PSU you like.

Maybe you are looking for

  • Unable to install iCloud on Windows 7 Outlook 2010

    Up until recently iCloud calendars were syncing well with Outlook but had for some reason stopped.  2.1 was issued and tried uninstalling and reinstalling the update.  Able to download and install CP2.1.  Able to log onto my iCloud account.  Setting

  • Can we get Adobe InDesign CS6 and use CS5?

    Hi There, We currently have 4 license of InDesign CS5 that comes with Adobe Creative Suite CS5. Also an Adobe Product Premium CS5.5. We now need to get an extra license for InDesign CS5 for the Adobe Product Premium CS5.5 machine. I noticed Adobe now

  • Brightness lost on iDVD creation

    I have made my first dvd using iDVD. Everything seems to playback fine, but the image is real dark, much darker than playing the MiniDV straight into the TV and darker than the iMovies before they are moved into iDVD. Actually, the playback in iDVD i

  • When can we expect fully working drive

    When those function will work under vista * Decoding of Dolby? Digital and DTS? signals * DVD-Audio * DirectSound?-based EAX games * 6. speaker mode Its been months that vista is out, i doubt you guys didn't find a way ?

  • Check if help id exists in map

    Hi, Can anyone help me find a way to check if a help id exists in the helpset? Thanks