9 Replies Latest reply: Sep 12, 2012 6:44 AM by 918178 RSS

    How to get jframe instance from a jpanel


      I am working on a Java swing framework in my project. I am extending a project customized panel. For one of my requirement I need to get the frame in which the panel is fixed.

      The customized project panel extends JPanel class.

      My need is, is there any way get the instance of the frame from the panel.

      I tried , JFrame f = (JFrame) panel.getParent() and JFrame f = (JFrame) SwingUtilities.getRoot(panel); but they return only null value.

      Please help me on this..