Need to get the parent frame

I am popping up a dialog box from a JScrollPane made up of a JTable and some buttons. I do not know how to specify the Frame owner part of the constructor. How do I get the parent frame in for the JDialog constructor?
Everything worked but then I realized my "dialog" was not a dialog box at all, just another frame... oops! This is an assignment so I have requirements I must adhere to. Now I am trying to convert it so it will truly be a Dialog box.
I promise you I have read ALL of the trails and API and searched forums. Can anyone assist?

try: SwingUtilities.windowForComponent( Component );
and cast the result to a JFrame
or try this link:
http://forum.java.sun.com/thread.jsp?forum=57&thread=189331
which I found by search the Swing forum using the keywords - (parent frame)

Similar Messages

  • How to get the parent Frame of a component ?

    Hi,
    I'm wondering how to get the parent JFrame (or JDialog) of a component.
    Thanks for tips

    I'm using this code:
    public Component getFrame(Component comp)
        Component frame = comp;
        while ((frame != null) && !(frame instanceof Frame))
            frame = frame.getParent();
        if (frame == null)
            frame = comp;  // no parent found
        return frame;
    }

  • How do I get a pop-up JDialog to return a result back to the parent frame?

    I have a button in a frame that opens up a JDialog with more buttons. Depending on the button pressed, the JDialog calculates an array and then closes the dialog. I'd like the results from the JDialog to be passed back to the parent frame. Is there any built in JDialog function allowing a passback upon closing to the parent frame or anything like that?
    If not, what's the best way to go about it?

    Is this a modal dialog? Then setVisible(true) blocks. The caller can retrieve the result after that call:
    dlg.setVisible(true);
    //now get result;

  • Need how to get the parent acount details in Trial balance report

    Hi All,
    I have a requirement in which i need to print the details of the parent account details as the report wont print the parent a/c details by default.
    Can any one please let me know how can i achieve this?
    Thax in advance.
    Seshu

    Generally the trial balance summary report does not fetch the parent account details.
    In my customized report , i need to get the detials of the current accounts as well as the details (initial balance,debit,credit ) for a particular period of the parent account as well.

  • I need to get the tagName after a node of the first child of the Root

    Hi All,
    I need to get the TagName of the Node immediete after the Root. I won't know what is the TagName, and based on the Tagname only I can process the records.
    For example I might receive a SALES object or a MARKETING object wrapped under the root.
    eg.
    <PARENT>
    <SALES>
    </SALES>
    </PARENT>
    or
    <PARENT>
    <MARKETING>
    </MARKETING>
    </PARENT>
    I tried to using like this
                   DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
                   File file = new File("c:/example.xml");
                   document = documentBuilder.parse(file);
                   Node node = document.getDocumentElement().getFirstChild();
                   System.out.println("node Name:" +node.getNodeName());
                   System.out.println("node Value:" +node.getNodeValue());
    It returns only something like #text, but I need the response like 'SALES'.
    Can anyone let me know if im missing something somewhere.
    thanks in advance,
    Harish

    That's because the first child of the document element is that whitespace text node between <PARENT> and <SALES>. You need to scan through the children of the document element until you find one that is an Element node.

  • I need to get the tagName of a node of the first child of the Root

    Hi All,
    I need to get the TagName of the Node immediete after the Root. I won't know what is the TagName, and based on the Tagname only I can process the records.
    For example I might receive a SALES object or a MARKETING object wrapped under the root.
    eg.
    <PARENT>
    <SALES>
    </SALES>
    </PARENT>
    or
    <PARENT>
    <MARKETING>
    </MARKETING>
    </PARENT>
    I tried to using like this
    DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
    File file = new File("c:/example.xml");
    document = documentBuilder.parse(file);
    Node node = document.getDocumentElement().getFirstChild();
    System.out.println("node Name:" +node.getNodeName());
    System.out.println("node Value:" +node.getNodeValue());
    It returns only something like #text, but I need the response like 'SALES'.
    Can anyone let me know if im missing something somewhere.
    thanks in advance,
    Harish

    Hi Blaise,
    thanks for your reply.
    but still i couldn't get the tag name even after using setIgnoringElementContentWhitespace true.
              Document document = null;
              DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
              documentBuilderFactory.setIgnoringElementContentWhitespace(true);
              try
                   DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
                   File file = new File("c:/example.xml");
                   document = documentBuilder.parse(file);
                   Node node = document.getDocumentElement().getFirstChild();
                   System.out.println("node.getNodeName: "+node.getNodeName());
                   System.out.println("node.getNodeValue: "+node.getNodeValue());
    it really confuses what im going wrong.
    can you let me know if the code that i have given is correct?
    thanks,
    Harish

  • Need to get the exact time of each picture that I saved ( maybe as a excel sheet or word )

    Hi guys,
    I am actually a new labview user. I have successfullly been able to save pictures. But unfortunately I got two problems. The first one is that I need to use two cameras at the same time. The program I have so far is for one camera. The second problem is that I need to get the exact time for each picture saved in the profile.
    I would appreciate if someone can help me with that. Anyway plz find attached the subvi.
    Regards,
    Abbas
    Attachments:
    Abbas progress.vi ‏54 KB

    Hi Abbas,
    First, I notice that you are using IMAQ for USB.  Is there any particular reason you are not using IMAQdx?  This is the newer, supported driver for use with USB cameras that supports acquiring from multiple cameras at the same time. 
    Check these two articles:
    Can I Acquire from Multiple USB Cameras Simultaneously Using IMAQdx?
    Can I Acquire from Two USB Cameras Simultaneously with NI-IMAQ for USB Cameras 1.0?
    And also this example (if you camera does not support acquiring from multiple cameras at the same time):
    Toggle Between Multiple USB Cameras
    As for timestamps, some cameras output them with the frame timing.  However, usually this is not a feature of USB cameras; if it is not, you can look into timing options within LabVIEW.  Try playing with the property node for IMAQdx and the Acquisition Attributes.
    Cheers,
    Marti C
    Applications Engineer
    National Instruments
    NI Medical

  • How to get the parent value

    Hi
    I am using jdev 11.1.1.5
    In this i had used gl_acct_classes VO and gl_accounts VO and an updatable AccountsVO
    select * from gl_acct_classes,gl_accounts from gl_acct_classes.acct = gl_accounts.acctI have the fields gacl_id , gacl_prim_id
    In this which ever gaclid has the value null in gacl_prim_id had been consider as parent
    for eg
    sno        gacl_id       gacl_prim_id
    1             a                                       //It is consider as parent since gacl_prim_id is null
    2             o                  a
    3             e                  a                  
    //In this a is parent for o and e
    4             b                                       //parent
    5             t                   b
    6             r                   b
    // b is parent for t and rI need to get the sum of all the accounts having o,e as a class id in which a is a parent and t,r as a class id in which b is a parent
    I hope that i may be clear for u..,

    I had used ParentVO GlAccountClassVO
    I had also created a viewlink
    ParentVO.cl_id = AccountClasses.GACL_ID
    Querry for ParentVO updatable
    SELECT GlAccountClasses.GACL_ACCT_TYPE,
           GlAccountClasses.GACL_BU,
           GlAccountClasses.GACL_CRE_BY,
           GlAccountClasses.GACL_CRE_DATE,
           GlAccountClasses.GACL_DESC1,
           GlAccountClasses.GACL_DESC2,
           GlAccountClasses.GACL_GP_FLAG,
           GlAccountClasses.GACL_ID,
           GlAccountClasses.GACL_OPTYPE,
           GlAccountClasses.GACL_PRIM_ID,
           GlAccountClasses.GACL_PT_SEQ_NO,
           GlAccountClasses.GACL_SCH_NO,
           GlAccountClasses.GACL_SEQ_NO,
           GlAccountClasses.GACL_UPD_BY,
           GlAccountClasses.GACL_UPD_DATE
    FROM GL_ACCOUNT_CLASSES GlAccountClasses
    WHERE GACL_PRIM_ID is nullI had created a Transient attrbute with the following groovy expression sinct it doesnt work
    AccountClass.sum("GapbDebitAmt")

  • How to get the parent name in the hierarchy

    Hi Colleagues.
    Im working on with java webdynpro by showing hierarchical data.
    When I select a leaf item, I should get the possible parent items.
    For Ex:
    A
    B
    C
         |
    D
    When I select D, I need to get the information as A-B-C-D.
    How can I acheive this?
    Thanks
    Rakesh

    Hi Rakesh
    You can go up to the root using the following methods:
    IDNode dNode = dElement.node();
    IWDNodeElement cElement = dNode.getParentElement();
    IWDNodeElement bElement = cElement.node().getParentElement();
    BR, Siarhei

  • FM for getting the Parent materials for the component material

    Hi All,
             I need to to get a list of parent materials for a given component material and that too upto 10 levels.
    i.e.
    Ist Iteration
    The material M1 is a component in 3 other materials.
    2nd iteration
    The above 3 materials will be a components of 3 other materials each i.e. now a total of 9 materials are there.
    3rd iteration
    The above 9 materials will be a component of 3  other materials each i.e. now a total of 27 materials are there.
    upto 10 iterations.
    Is there any FM which can provide me the list of parent and superparents for a given component material..upto 10 levels (or something closer if these levels exists).
    Regards
    Abhishek

    Hi,
    Check this link..Getting the Parent Material (BOM)

  • Getting the Parent JFrame or JDialog

    I am trying to get the parent JFrame or JDialog so I can change the cursor. Right now I am doing it in a stupid way by doing this:
    private void changeCursorQuestion(){
              JFrame frame=(JFrame) getParent().getParent().getParent().getParent().getParent().getParent().getParent();
              Cursor cursor=new Cursor(Cursor.HAND_CURSOR);
              frame.setCursor(cursor);
         }//end changeCursorQuestionBut is there an easier and of course better way of getting the frame or jdialog that a panel is in?

    I am trying to get the parent JFrame or JDialog so I can change the cursor. You can change the cursor of the JPanel ( in fact any Container) so why use that getParent() thing....
    Also, if you want to have quick refrence to JFrame object from JPanel, extend JPanel to make a new class and have a refrence to that JFrame/JDialog in that class, that way you can access it quickly.
    Thanks!

  • How to get the total frames

    Hai..
    I am in need of this code..
    I have n number of flash files(swf). Each file contains n number of frames. I need to get the totalframes of that flash files in Actionscript 3.0.
    Please help me through Actionscript.

    You can use the totalFrames property of a movieclip to obtain the total number of frames for a timeline.

  • [CS2 JS] Get the parent paragraph of a table

    Hi,
    Anybody here who knows how to get the parent paragraph of a selected table?
    var myTable = app.selection[0];
    var myStory = myTable.parent.paragraphs;
    The script above gives me all the paragraphs of the parent text frame. I want to know the index of the paragraph where my selected table is.
    Appreciate the help you can give. Thanks!

    from VB6 ObjectBrowser (PC):
    Property StoryOffset As InsertionPoint
    read-only
    Member of InDesign.Table
    The location of the Table in the parent story.
    so (VB6):
    myTable.StoryOffset.Paragraphs.Item(1)
    should give you paragraph
    robin
    www.adobescripts.com

  • !!! I need to get the return value from a PL/SQL in Java.. How??? !!!

    Hi
    -- I have a PL/SQL in which it return an array value and I need to get the value using Java.... any idea how?
    thanks

    Check out CallableStatement:
    http://java.sun.com/j2se/1.5.0/docs/api/java/sql/CallableStatement.html

  • I saved photos from my Macbook Pro onto my Iphone (using itunes, 4 years ago). My macbook is now dead and I need to get the photos I saved off of my iphone 3GS transferred to a pc.  Any help...  From my PC I can only access "internal storage"

    I saved photos from my Macbook Pro onto my Iphone (using itunes, 4 years ago). My macbook is now dead and I need to get the photos I saved off of my iphone 3GS transferred to a pc.  Any help...  From my PC I can only access "internal storage"

    The iphone is not a storage/backup device.  The picture sycn is one way - computer to iphone.  The photos are also reduced in size when synced to iphone so they are not of the original quality
    It has always been very basic to always maintain a backup of your computer.
    Have you failed to do this?
    If so, not good at all, you can e-mail the pics to yourself - keep in mind they will never be of the original quality

Maybe you are looking for