How to dynamicly add a component to a panel

when I click a button, I want to add a component to a panel, how can I do ?
I try to do this:
public void actionPerformed(ActionEvent e)
contentPane.add(label,"north");
contentPane.repaint;
but there is no effect. Could u help me?

Could you tell me why the repaint method doesn't work?repaint() does some low level validation and its more often suits for refreshing JList,TextFields etc etc...
JPanel is somehow a more weighted component compared to JLabel,JTextFields etc,etc and hence it needs some heavy refreshing and these heavy refreshing can be obtained by doLayout() and validate() and some times both.
when I add a component into another component, how can I get the new performace of the updated component?Is there a universal way? Pls put ur question more clearly.

Similar Messages

  • How to dynamically add new components in a panel when a button is clicked

    Hi,
    I am building a gui which is used to create a new database schema, the panel now contains 6 entries and if i want to include more fields i press add more field button, how to write the event handler for the button which adds more fields. please help
    thank you.
    Edited by: rahul_ram on Sep 30, 2009 10:59 PM
    Edited by: rahul_ram on Sep 30, 2009 11:02 PM

    To get better help sooner, post a [_SSCCE_|http://mindprod.com/jgloss/sscce.html] that clearly demonstrates your problem.
    Use code tags to post codes -- [code]CODE[/code] will display asCODEOr click the CODE button and paste your code between the {code} tags that appear.
    db

  • How to Dynamically add Search Criteria in Advance Search Region.

    Hi All,
    I want to understand how can we add Search Criteria dynamically in the Advance Search Region.
    The Requirement is to add 4 additional search criteria for an org_id in a multi org structure. For other business those fields should not be visible.
    I did try this with the form personalization but could not Show/hide the additional search criteria programatically for the business as we can only see 4 search criteria at the time of page load and other criteria comes in the drop down list to add which can not be show/hide after page load.
    I thought of a solution to add search criterias dynamically for my org through extending controller.
    I found the OAAdvanceSearchBean (advance search Region in controller) object for my Advance Search but could you tell me how can I add the Criteria Row in that Advance Search (createWebBean function) and then add the item in criteria Row dynamically.
    Also please tell me how we can increase the showed criteria from default 4 to more, setDisplayedCriteriaCount(int) is not allowed and it is not working also.
    Thanks.
    Regards,
    Ashish Bansal

    Hi,
    As Lars said The "Search Option Set" and the "Search Component Set" offer you quite some flexibility.
    You can configure both of these component to customize your search.
    Once you did it, you can create a new basic search iview and set these components.
    On the other hand, you also customize the layout use to show result of search.
    Dont'f forget that you need to configure Trex and create an index.
    For instance, I configured the search criteria, the system only asked me some metadatas (created by us,whose value are dependents). Each time that you upload a document you set these attributes.
    Then when you want to search, appear a screen with these values
    Country :
    City:
    search field:
    Patricio.

  • How to dynamically add column

    Hi folks,
    Plz tell me if u know how can i add column dynamically
    in oracle content management SDK webstarterapp.I am stucked here for quite sometimes.plz tell me ASAP.
    Regards
    Prasenjit

    Take a look at:
    http://download-east.oracle.com/docs/html/B12187_02/toc.htm
    You should use OMBALTER TABLE command.
    Regards,
    Marcos

  • Newbie question with Netbeans: How do I get a component in a panel

    I've made a class called PatternComponent that extends JComponent which draws some patterns and stuff that I specify. I've been using a very basic GUI that I threw together in eclipse, but I need to clean it up and I've decided that NetBeans is more apt for the job.
    I've figured out how to get my buttons to work, but I can't find how to add my PatternComponent to the panel I want to stick it in.

    This is not a Netbeans forum.

  • How can I add alternate component in same BOM

    Hi Experts,
    One of my requirement like this , in same alternative BOM I want to add alternative components with existing components.So please advise how to do.
    With Regards
    Aravind

    Hi,
    This is discussed before in SCN. Please go through below links for your query,
    Alternative component in BOM
    alternative materials in PP
    Alternate Item in BOM
    Re: PR( purchase requ) for Alternative material in BOM
    Regards,
    Narresh

  • How to dynamically add Nodes to JTree?

    How to add nodes to a Jtree by getting the information into a specific file
    For example, in JList:
    DefaultListModel workgroups;
    workgroups = new DefaultListModel();
    List<String> workgroupsList = new ArrayList<String>();
    workgroupsList = ParserUtils.getWorkgroupList(ParserUtils.getConfigPath() + "\\.workgroup.properties");
    if (!workgroupsList.isEmpty()){
         for (String workgroup : workgroupsList){
              workgroups.addElement(workgroup.toString().trim());
    workgroupList = new JList(workgroups); //adds the list workgroupsThe output of this will be a JList displaying the list of workgroups per line. The list could be found in a file name "workgroup.properties"
    Question is, is it possible to adapt this same method in JTree. The information per line will serve as one node in the tree. For example, I have 3 workgroups in the list, there will also be 3 nodes to be found in the tree.
    Any suggestions?
    THanks.

    There's a huge JTree example in the Swing tutorial. It's a bit of a beast to use.

  • How to dynamically add new line series to the line chart in flex?

    i need to add line series dynamically..and each line  series should have a different data provider...

    A chart can have only 1 dataProvider which in my case is an ArrayCollection.
    The chart will update every time the dataProvider changes if you use binding.
    So you have to write a function that periodically populates the ArrayCollection with data from the server and the chart will update automatically.
    'Using line charts' tutorial from Adobe: http://livedocs.adobe.com/flex/3/html/charts_types_08.html#243339

  • How to dynamically add/remove a button from the ribbon based on some condition? (Ribbon XML)

    Hi,
    I have a ribbon (done using ribbon XML) with menu options. I need to remove few buttons from the menu dynamically based on some condition. Also, I want to change the label of another button. How to achieve this programmatically? (C#)
    Thanks in advance.
    Thanks Prasad

    Hello Prasad,
    Use callbacks for populating Ribbon controls such as menu, dropDown, gallery and etc. Then you can use the
    Invalidate or
    InvalidateControl methods of the
    IRibbonUI interface to get your callbacks invoked when required. Thus, you will be able to delete the required item(s).
    You will find the following articles in MSDN helpful:
    Chapter 11: Creating Dynamic Ribbon Customizations (1 of 2)
    Chapter 11: Creating Dynamic Ribbon Customizations (2 of 2)
    To change the label of your controls at runtime you need to use the getLabel callback and call the Invalidate or InvalidateControl methods of the IRibbonUI interface. The following series of articles describe the Fluent UI in depth:
    Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
    Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
    Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)

  • How to dynamically add field name in where clause of select query in web dynpro?

    Hello,
    Can any body tell me how i can use select query with dynamic wheere condition.
    i have a requirement like there are multiple input fields  and i want to select data from two database
    and condition may vary .

    Hi
    In the where clause you need to write like
    WHERE NAME LIKE 'DE%'
    Regards
    Sudheer

  • How to dynamically add text (i.e. subclip 'metadata') to an ImageElement

    In short what I would like to achieve:
    Put several VideoElements in a SerialElement, but prepend each video with an ImageElement to which text is added (text as in 'metadata' of the subclip being displayed). This as an announcement of what is coming up next (by displaying that image for 2 seconds or so).
    This image should be created dynamically, as the video's (in fact subclips) aren't defined upfront (and thus the images can not be defined upfront).
    I was wondering if it is possible to manipulate an ImageElement (combining text and images into a new image, or adding text to an existing image), and provide an ImageElement with such a dynamically created image? I couldn't find anything useful around the Graphics drawing object, like drawText or something. And besides that it seems ImageElements can only be created via an ImageLoader and a URL (and not via an image that is available as embedded asset).
    I hope my question is clear enough and someone has some ideas how to implement this (or if it is possible at all with OSMF).
    Thanx in advance.
    Wout

    Thanks for your extensive reply.
    I had a look at the options you suggested.
    With the captioning you define a file with all the captions defined. But as I only wat to display some descriptive text prepended to each videoElement in a SerialElement, captioning did not fit my needs.
    But with your prototype using a TextElement as MediaElement did fit, almost exactly.
    With this function I define what text to display and for how long. It creates a ParallelElement, and puts in a background image, and 'overlays' the text I enter.
                private function showText(text:String, duration:int):void {
                    var parallelElement:ParallelElement = new ParallelElement();
                    var image:ImageElement = new ImageElement(new ImageLoader(), new URLResource(new URL(BACKGROUND_IMAGE)));
                    parallelElement.addChild(new TemporalProxyElement(duration, image));
                    var textElement:TextElement = new TextElement(text)
                    parallelElement.addChild(new TemporalProxyElement(duration, textElement));
                    serialElement.addChild(parallelElement);
                    applyAdjacentLayout(parallelElement, image, textElement);
    The TextElement is taken from your example (including the TextViewTrait). In the TextElement the format and styling can be defined. With the applyAdjacentLayout function (as used in the ExamplePlayer - 'Parallel Composition (Adjacent)') I make sure the placement is as I want.
    So now I can dynamically display some descriptive text about a subclip before displaying that specific subclip.
    Thnx!
    Wout

  • How to dynamically add button to a movie/stage?

    I am using Flex Developer and I am designing a Flash Lite app
    which uses AS2. However I cant find anyway of adding a control such
    as a button to the stage from code. Do I need to buy a tool to do
    that or can I add controls/containers from code?
    E.g. in AS3 you create the button object then do an
    addChild(button) and it adds.
    Any sample docs apprecietd..

    You would create a movie clip button and from your library
    make sure the linkage identifier is set then call a function in
    your action script to attach the button(s) to the stage, the code
    should look something like such:

  • How to dynamically add an object into flex and animate it.

    im planning to implement a dynamic animation which can be used to show some trend of a variable
    this is my case..
    suppose i have data in a table
    Y      |      X
    12       |     3
    32       |     5
    34       |      10
    what i want to do is i want to insert a circle to (3,12) i.e. the first point.. then animate it with the time to next points
    (3,12) --> (5,32) --> (10,34)
    this process hv to be totally dynamic.. becos im planning to fetch data from a table.. so the no of rows also can be any amount.
    is thr a method to do those stuff in flex. ?
    thanks in advance

    Anyone got any suggestions?

  • How to dynamic add a case to a switcher ?

    Hi,
    IIf there anyone know how to a case to a switcher in CO?
    Thanks & Regards
    Binghao

    Have a look at javadoc of OASwitcherBean though chances are less for a similar api.
    Another option is to have all the possible cases exist in page and then at runtime use render property to show/hide them as per requirement.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How do I add "a:hover" into CSS panel? DW says "no punctuation" allowed....

    When I use "Create a new CSS rule" and attempt to add "a:hover" tag rule into my CSS panel, DW gives me an error message that no puntucation is allowed in the name. But if I manually create the rule in the CSS style sheet itself, then it works just fine, and the rule will then appear in the CSS panel.
    What the heck am I missing? Is this just something that has to be lived with? Or is there a way to create the "a:hover" rule by using the "Create a new CSS rule"?
    Thanks for any help........................

    It's not the most intuitive CSS panel.
    In the Selector Type dropdown for Class/ID/Tag/Compound, select Compound
    In the Selector Name dropdown, you'll then see body, a:link, a:visited, a:hover, a:active.
    Select a:hover and you're on your way.

Maybe you are looking for

  • Datablock from a custom view

    Hello, I have created a datablock manually which has the source as view. Added all the items which are to be displayed. when i run the form, the block shows me a message that Query caused no records to retrieve.( i have added execute query in the for

  • Problems with youtube, Problems with youtube

    I wasnt really sure where to post it, but I use 10.7.5, so I thought to post it here. I cannot play YouTube videos and sometimes if I get lucky, then I can by refreshing the page for many times. Otherwise mostly times the player looks like this: The

  • Unable to copy file using Zen 4 Console One

    Hi, I get the following error message: 'Could not configure workstation for application [SPSS Activator license update.spss 14.Testing.PSM Applications.Applications.Resources.CF] (id=2). Problem: Unable to copy file \\MAINCF5G\apps\appwinxp\SPSS14\li

  • FB05 clearing item

    Hi, is it possible with FB05 to run clearing for a single line item of a FI document or do I have to run clearing for the all document? If it possible to run clearing for a single line item, how can I do it? Regards and thank you for your time Norber

  • How to use EntityManager in a thread inside a J2EE container

    Hi, I'm looking for a usage pattern to use an EntityManager inside a thread of J2EE container. I used injection to inject an EntityManager in a EJB3 service and I can use the em with no problem. But the problem occurs when the service spin a thread a