This discussion is archived
9 Replies Latest reply: Sep 12, 2012 4:44 AM by 918178 RSS

How to get jframe instance from a jpanel

918178 Newbie
Currently Being Moderated
Hi,

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..

REgards

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points