Catching parent.SHOW event in child

Is there a way to know in a child when a parent's show method gets called?
eg i have a JFrame and a Jpanel in it. and how can this jPnanel get to know when we call its parent's JFrame.show method?
i tried to overload JPanel's show() method but it doesn't get called!

import java.awt.event.*;
import javax.swing.*;
class ShowCatcher extends JFrame {
    public static void main(String[] args) {
        new ShowCatcher().go();
    void go() {
        init();
        try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); }
        setVisible(false);
        try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); }
        setVisible(true);
        try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); }
        setVisible(false);
        try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); }
        setVisible(true);
    void init() {
        setTitle("Show Demo");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        final MyPanel panel = new MyPanel();
        getContentPane().add(panel);
        addComponentListener(new ComponentAdapter() {
            public void componentShown(ComponentEvent e) {
                panel.notifyShown();
        setSize(300, 100);
        show();
    class MyPanel extends JPanel {
        private JTextField tf;
        private int count;
        public MyPanel() {
            tf = new JTextField(20);
            add(tf);
        void notifyShown() {
            tf.setText("JFrame has been shown " + ++count + " time(s).");
}

Similar Messages

  • Dynamic TaskFlow Gets Refreshed on Catching a Contextual Event

    Hi,
    I am using Contextual events in my application. I have 2 task flows in my parent page. One TF is raising an event and the other is catching it. As my catching TF is a dynamic TF, I have specified the event map in it only.
    Everything is working as intended only that my dynamic TF gets refreshed when it catches the event! I do not want that. I want to explicitly refresh any UI component that requires to be refreshed, not the whole TF.
    So is there any specific property of task flows that make it to refresh itself when ever it catches any contextual event?
    Also I have tried 'Refresh="ifNeeded"' and 'RefreshCondition="#{false}"' in my dynamic taskflow specification in the parent page but it does not make any difference.
    Regards,
    Rahul Saxena

    Rahul,
    there is no setting for this. If however the managed bean you setup for handling the dynamic region is in backing bean scope (or request scope) then chances are that the region is refreshed because the bean restes after the request (just assuming here). Yournot giving us much to chew on (no JDeveloper version, no implementation details etc. ) So its hard to provide further ideas. As a last resort, if you have a support contract, you can contact customer support with a test case
    Frank

  • Is it possible to call a function in a parent component from a child component in Flex 3?

    This is probably a very basic question but have been wondering this for a while.
    I need to call a function located in a parent component and make the call from its child component in Flex 3. Is there a way to access functions in a parent component from the child component? I know I can dispatch an event in the child and add a listener in the parent to call the function, but just wanted to know if could also directly call a parent function from a child (similar to how you can call a function in the main mxml file using Application.application). Thanks

    There are no performance issues, but it is ok if you are using the child component in only one class. Suppose if you want to use the same component as a child to some bunch of parents then i would do like the following
    public interface IParentImplementation{
         function callParentMethod();
    and the parent class should implement this 'IParentImplementation'
    usually like the following line
    public class parentClass extends Canvas implements IParentImplementation{
              public function callParentMethod():void{
         //code
    in the child  you should do something like this.
    (this.parent as IParentImplementation).callParentMethod();
    Here using the Interfaces, we re decoupling the parent and the child
    If this post answers your question or helps, please mark it as such.

  • Calling a Function in the Parent Window from the Child Window

    QUESTION: How do I call a function resident in the parent
    window from a child window?
    BACKGROUND
    I have a JavaScript function resident in the parent window
    that reformats information obtained from the Date object and writes
    the result to the parent window using the document.write( ) method.
    I would like to call this function from the child window and have
    it write to the child window instead. Is this possible? If not,
    must I rewrite the entire function and nest it in the below code?
    If so, what is the proper form of nesting?
    CODE: The code that creates and fills the child window is
    provided below. The highlighted area indicates where I would like
    to enter the information from the function resident in the parent
    window. I have tried every imaginable permutation of code that I
    can imagine and nearly destroyed my parent document in the process.
    I am very happy that I had a back-up copy!
    function openCitationWindow() {
    ciDow = window.open("", "", "width=450, height=175, top=300,
    left=300");
    ciDow.document.write("A proper way to cite a passage of text
    on this page:<br /><br />Stegemann, R. A. 2000.
    <cite>Imagine: Bridging a Historical Gap</cite>. " +
    document.title + ". [<a href='" + location.href + "'
    target='_blank'>online book</a>] &lt;" + location.href
    + "&gt; (");
    MISSING CODE;
    ciDow.document.write(").<br /><br /><input
    type='button' value='Close Window' onclick='window.close()'>");
    ciDow.focus();

    Never mind - I was doing something very stupid and wasn't
    calling the function as a method of a movie clip. I was simply
    calling checkTarget(event) rather than
    event.currentTarget.checkTarget(event); which seems to work.

  • Dispatch event to child of NavigatorContent

    Hi,
    I'm working on moving a project over to Flex 4 and so far I really like it, but I'm stuck on a particular issue.
    Previously I had a ViewStack where each child was a custom component.  For Flex 4, I've changed it so that each child is a NavigatorContent component that includes the custom component as in:
            <mx:ViewStack id="elementsViewStack" width="100%" height="100%" >
                <s:NavigatorContent id="retrieveDataView"><system:RetrieveDataView/></s:NavigatorContent>
                <s:NavigatorContent id="backupDataView"><system:BackupView/></s:NavigatorContent>
            </mx:ViewStack>
    Whenever I change the view, I need to update the data that is being displayed and so I would key that off of a show event.  In some cases, I had to specifically send a show event because the view would stay the same, but I needed to update the data anyway, so I would just dispatch the event to the selected child of the view stack.
    Since I now have to wrap the custom component in a navigator content component, this strategy no longer works because the show event goes to the navigator content component rather than my custom component (or at least, that's what I'm assuming is happening).  I tried to access the custom component as a child of the navigator content component, but it tells me there are zero elements, so I don't know how to dispatch the event to my custom component given this situation.
    The other approach I tried was to make my custom component a navigator content component instead of an s:group component, but for some reason that makes the states in my custom component not work correctly.  I know the state is being set correctly as a trace in actionscript shows, but the elements aren't included correctly based on the current state.
    Can someone help me figure out a way to make this work?
    Thanks for any help!
    Renee

    In response to what you say here: " I tried to access the custom component as a child of the navigator content component, but it tells me there are zero elements, so I don't know how to dispatch the event to my custom component given this situation."
    I've just come across something like this - when I try to populate my NavigatorContent, the children do not display and I had trouble accessing existing children.
    http://opensource.adobe.com/wiki/display/flexsdk/Gumbo+DOM+Tree+API
    Specifically, I think this is the most relevant passage:
    function(){return A.apply(null,[this].concat($A(arguments)))}
    What this means is that even though it looks like Panel's children should be a button, a label, and a checkbox; it's only real child is a panel skin instance. And the button, label, and checkbox get pushed down to become children of the contentGroup in the skin file. There are a few ways to access the Button in the panel: myPanel.getElementAt(0) or myPanel.contentGroup.getElementAt(0) or myPanel.skin.contentGroup.getElementAt(0).
    All SkinnableComponent's have a skin property. In an SkinnableContainer, the children of the components are actually pushed down to the skin's contentGroup. The component tree refers to the semantic tree translated from MXML. In the Panel example, this would just include, the Panel and its children: a button, a label, and a checkbox. The layout tree refers to the actual tree seen by the layout system, the layout tree due to skinning. In the Panel example, this would include the panel, the panel skin, all the panel skin's children, and all the panel's children that are actually pushed down into the contentGroup of the panel skin.
    The layout tree doesn't necessarily correlate to the display list tree that Flash sees. This is because GraphicElements are not innately display objects. Because of performance reasons, they implement display object sharing to minimize the number of display objects.
    IVisualElementContainer is the interface that defines the content APIs. In Spark, Skin, Group, and SkinnableContainer are the components for holding visual elements and implement this interface. To provide consistency, MX's Container will also implement this interface and just be a facade for addChild(), numChildren, etc....
    So, for example, you might want to try and access your custom component like this:
    MyNavContentContainer.skin.contentGroup.getChildByName("myComponent")
    Also, in order to get my new child components to display, I have set the creationPolicy of my ViewStack to:
    creationPolicy="all"
    This means that the NavigationContent containers are drawn at startup and not only when required.
    I'm not sure how relevant this is for you but it's info nevertheless - maybe it'll help.

  • How can I stop iPhoto from showing Events?

    HI Folks,
    I've used iPhoto for a long time, and I am just completely frustrated at the existence of "Events."
    Every single time I take a photo and import it, I get a new event.
    Even worse, I have hundreds of unnamed "Events" because that method of organizing my photos makes no sense at all.
    When I import, there are generally multiple "events" documented in one import.
    Now I have to spend hours breaking up Events into smaller "Events" just to have it makes sense.
    Not very useful.
    The worst usability offense with Events, is that iPhoto defaults to displaying the Events page when it opens.
    Apple...I don't EVER want to see my photos organized by Events. EVER.
    MY questions:
    1. Please please tell me how I can remove the Events page completely.
    2. If that is not possible, please tell me how I can tell iPhoto to default to showing me the Photos page, NOT the Events page.
    3. Also, how can I view my photos on the Photos page without being broken up into events? (Without losing metadata like the date)
    Thanks,
    -The Craw, former Apple Technical Writer Guy

    A good general step for strange issues is to renew the iPhoto preference file - quit iPhoto and go to "your user name" ==> library ==> preferences ==> com.apple.iPhoto.plist and trash it - launch iPhoto which creates a fresh new default preference file and reset any personal preferences you have changed and if you have moved the iPhoto library repoint to it. This may help
    This does not affect your photos or any database information (keywords, faces, places, ratings, etc) in any way - they are stored in the iPhoto library - the iPhoto preference file simply controls how iPhoto works - which is why renewing it is a good first step.
    Make sure show event titles is off
    and you can merge or split events to make them more useful - you can not "turn them off" since they are just one of several optional views of your photos
    LN 

  • HT2513 my iCal shows events in the "month" view but not in the "week" view? why is that?

    my iCal shows events in the "month" view but not in the "week" view? why is that? doesnt sync automatically all the time only sometimes

    my iCal shows events in the "month" view but not in the "week" view? why is that? doesnt sync automatically all the time only sometimes

  • Ios 7 calendar does not show events 2 years in the future

    Why does ios 7 calendar does not show events 2 years in the future?
    I've entered the events more than twice and it all shows up in the OSX calendar but not on my iphone.

    Just tested it works even 3 years ahead.
    Tap Calendars (bottom, middle) is All iCloud selected (tick mark)?

  • SQL Server 2012 Management Studio:In the Database, how to print out or export the old 3 dbo Tables that were created manually and they have a relationship for 1 Parent table and 2 Child tables?How to handle this relationship in creating a new XML Schema?

    Hi all,
    Long time ago, I manually created a Database (APGriMMRP) and 3 Tables (dbo.Table_1_XYcoordinates, dbo.Table_2_Soil, and dbo.Table_3_Water) in my SQL Server 2012 Management Studio (SSMS2012). The dbo.Table_1_XYcoordinates has the following columns: file_id,
    Pt_ID, X, Y, Z, sample_id, Boring. The dbo.Table_2_Soil has the following columns: Boring, sample_date, sample_id, Unit, Arsenic, Chromium, Lead. The dbo.Table_3_Water has the following columns: Boring, sample_date, sample_id, Unit, Benzene, Ethylbenzene,
    Pyrene. The dbo.Table_1_XYcoordinates is a Parent Table. The dbo.Table_2_Soil and the dbo.Table_3_Water are 2 Child Tables. The sample_id is key link for the relationship between the Parent Table and the Child Tables.
    Problem #1) How can I print out or export these 3 dbo Tables?
    Problem #2) If I right-click on the dbo Table, I see "Start PowerShell" and click on it. I get the following error messages: Warning: Failed to load the 'SQLAS' extension: An exception occurred in SMO while trying to manage a service. 
    --> Failed to retrieve data for this request. --> Invalid class.  Warning: Could not obtain SQL Server Service information. An attemp to connect to WMI on 'NAB-WK-02657306' failed with the following error: An exception occurred in SMO while trying
    to manage a service. --> Failed to retrieve data for this request. --> Invalid class.  .... PS SQLSERVER:\SQL\NAB-WK-02657306\SQLEXPRESS\Databases\APGriMMRP\Table_1_XYcoordinates>   What causes this set of error messages? How can
    I get this problem fixed in my PC that is an end user of the Windows 7 LAN System? Note: I don't have the regular version of Microsoft Visual Studio 2012 in my PC. I just have the Microsoft 2012 Shell (Integrated) program in my PC.
    Problem #3: I plan to create an XML Schema Collection in the "APGriMMRP" database for the Parent Table and the Child Tables. How can I handle the relationship between the Parent Table and the Child Table in the XML Schema Collection?
    Problem #4: I plan to extract some results/data from the Parent Table and the Child Table by using XQuery. What kind of JOIN (Left or Right JOIN) should I use in the XQuerying?
    Please kindly help, answer my questions, and advise me how to resolve these 4 problems.
    Thanks in advance,
    Scott Chang    

    In the future, I would recommend you to post your questions one by one, and to the appropriate forum. Of your questions it is really only #3 that fits into this forum. (And that is the one I will not answer, because I have worked very little with XSD.)
    1) Not sure what you mean with "print" or "export", but when you right-click a database, you can select Tasks from the context menu and in this submenu you find "Export data".
    2) I don't know why you get that error, but any particular reason you want to run PowerShell?
    4) If you have tables, you query them with SQL, not XQuery. XQuery is when you query XML documents, but left and right joins are SQL things. There are no joins in XQuery.
    As for left/right join, notice that these two are equivalent:
    SELECT ...
    FROM   a LEFT JOIN b ON a.col = b.col
    SELECT ...
    FROM   b RIGHT JOIN a ON a.col = b.col
    But please never use RIGHT JOIN - it gives me a headache!
    There is nothing that says that you should use any of the other. In fact, if you are returning rows from parent and child, I would expect an inner join, unless you want to cater for parents without children.
    Here is an example where you can study the different join types and how they behave:
    CREATE TABLE apple (a int         NOT NULL PRIMARY KEY,
                        b varchar(23) NOT NULL)
    INSERT apple(a, b)
       VALUES(1, 'Granny Smith'),
             (2, 'Gloster'),
             (4, 'Ingrid-Marie'),
             (5, 'Milenga')
    CREATE TABLE orange(c int        NOT NULL PRIMARY KEY,
                        d varchar(23) NOT NULL)
    INSERT orange(c, d)
       VALUES(1, 'Agent'),
             (3, 'Netherlands'),
             (4, 'Revolution')
    SELECT a, b, c, d
    FROM   apple
    CROSS  JOIN orange
    SELECT a, b, c, d
    FROM   apple
    INNER  JOIN orange ON apple.a = orange.c
    SELECT a, b, c, d
    FROM   apple
    LEFT   OUTER JOIN orange ON apple.a = orange.c
    SELECT a, b, c, d
    FROM   apple
    RIGHT  OUTER JOIN orange ON apple.a = orange.c
    SELECT a, b, c, d
    FROM   apple
    FULL OUTER JOIN orange ON apple.a = orange.c
    go
    DROP TABLE apple, orange
    Erland Sommarskog, SQL Server MVP, [email protected]

  • When I subscribe to a calendar it doesn't show events in my ical even though it is refreshed

    When I subscribe to a calendar it doesn't show events in my ical even though it is refreshed & is linked to iCloud - any ideas please?

    Is the calendar checked in the list of calendars in the popup menu in the upper left corner?

  • How to get the parent window in sub-child controller class in javafx?

    how to get the parent window in sub-child controller class in javafx?

    You can get the window in which a node is contained with
    Window window = node.getScene().getWindow();Depending when this is invoked, you might want to check the Scene is not null before calling getWindow().
    If the window is a stage that is owned by another window, you can get the "parent" or "owner" window with
    Window owner = null ;
    if (window instanceof Stage) {
      Stage stage = (Stage) window ;
      owner = stage.getOwner();
    }

  • HT4740 How can I avoid or solve the problem of Final Cut Pro crashes when trying to Show Events Library?

    When I try to Show Events Library in Final Cut Pro, it crashes each time. Please tell me how do I work around this problem?

    Try creating a new (temporary) folder and putting all your events in there - then launch FCP X.
    If you can open the Browser, then it's possible one or more of the clips in one of your events is corrupt. Close the app and move the events back into their original places one by one (re-starting FCP X each time). This will help you find the event which has the corrupt file in it.
    If isolating the events has no effect, I suggest you trash your preferences.
    Unexplained faults like this can often be fixed by clearing out FCP X's preferences (for some reason, they get knotted up from time to time).
    Download Digital Rebellion's Preference Manager (free, simple to use, and perfectly safe, both to download and use).
    http://www.digitalrebellion.com/prefman/
    With Preference Manager, you can backup the Prefs when FCP X (or any of the Apple Professional Applications) are working normally. Then when either of the applications are acting strangely, Trash the Preferences, then Restore from your backups (just a mouse-click).
    If you trash the prefs and don't restore them, you will need to manually restore all your FCP X settings again, so it's a great idea to backup Preferences from time to time when FCP X is working well, then your backups are up to date.
    Doesn't fix every problem, but it fixes a lot.
    Andy

  • Join  a Parent Table with 2 Child table based on a value

    Dear Guru's
    We have a Parent Table and 2 Child table . The Parent Table has a column like seqtype with only 2 possible values C and S . If the Value is C , then the details are available in Child 1 table and if the Value is S then the Details are in Child 2 table
    How can we query the Data from this type of arrangement ? I am little bit confused and hit a road block
    Will the following query will work ?
    Select
    from Parent P , Child C1, Child C2
    where P.seqtype = C1.Seqtype
    and P.seqtype = C2.Seqtype
    With Warm Regards
    ssr

    You didn't mention the column names in two child tables. Whether the columns are same in 2 tables of these are different.
    If the columns are same better to go and change your design to have only one child table. However if stiil business stops you having one table you can use UNION ALL (Assuming you want to fetch same column information from two child tables) like below:
    SELECT p.col1
          ,c1.col2
          ,c1.col3
          ,c1.col4
      FROM parent     p
          ,child      c1
    WHERE p.seqtype = c1.seqtype
    UNION ALL
    SELECT p.col1
          ,c2.col2
          ,c2.col3
          ,c2.col4
      FROM parent     p
          ,child      c2
    WHERE p.seqtype = c2.seqtype Regards
    Arun

  • Parent table of a child table

    I am using a child table 'CHILD_T' and in this table the column 'CHILD_FK' is the foreign key and it is pointing to some parent table. In my oracle editor I can see only synonyms but not actual tables. Is there any way to find out the parent table for this child table. Why I am asking this is because , I am getting below error while trying to execute the below script.
    Here I think my question is pretty simple but I would like to know how to find a parent table of a child table as I can see only synonyms instead actual tables.
    Script :
    INSERT INTO CHILD_T ( EM_ID, DFLT_COST_CNTR_TXT, ACCT_TYP_ID, DFLT_ORD_TYP_ID ) VALUES ('abcd', 'NA', '1', '1' );
    Error:
    SQL Error: ORA-02291: integrity constraint (AFM.USR_PROF_EM_ID) violated - parent key not found.
    Any one have any idea your help is well appreciated.

    select table_name  from user_constraints where constraint_name  in
        (select r_constraint_name from user_constraints  where constraint_name='YOUR_CONSTARINT_NAME');

  • Is it possible to put two different colors in tree parent node background and child nodes background?

    Is it possible to put two different colors in tree parent
    node background and child nodes background?
    Any help will be very helpful.
    Thanks

    Hi PanosE,
    Yes, you can set up another Standard Edition Server in child domain and then deploy pool pairing.
    You need to deploy a new Front End Pool for the new Standard Edition Server.
    A similar case for your reference.
    https://social.technet.microsoft.com/Forums/office/en-US/eca4299c-8edb-481e-b328-c7deba2a79ba/lync-2013-standard-edition-lync-fe-pools-in-multiple-domain-single-forest-senario?forum=lyncdeploy
    Best regards,
    Eric
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]

Maybe you are looking for