dispose JPanel

Hi, I created JPanel and I created instance of this JPanel, like this

MyForm my = new MyForm();
my.setFunction.......


JFrame frame = new JFrame("MyChildrenForm");
frame.setContentPane(my);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.pack();
frame.setVisible(true);


I put JButton on my JPanel and created action listener for key down and mouse click and I called my private function setEnd()
I need dispose this form. I have a problem, if I wrote this. (this + dot) - in my private function setEnd(), I didn't see functions this.dispose and this.setVisible . How I can dispose my form? Thank you for help me.

1 comment
Comment actions Permalink

Hello Aldik,

Sorry, but this forum is not a place for asking general Java development
questions which don't have anything to do with IntelliJ IDEA's features.

(dispose() is a method of JFrame, so you can't call it via an instance of
MyForm)

Hi, I created JPanel and I created instance of this JPanel, like this

MyForm my = new MyForm();
my.setFunction.......
JFrame frame = new JFrame("MyChildrenForm");
frame.setContentPane(my);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.pack();
frame.setVisible(true);
I put JButton on my JPanel and created action listener for key down
and mouse click and I called my private function setEnd()

I need dispose this form. I have a problem, if I wrote this. (this +
dot) - in my private function setEnd(), I didn't see functions
this.dispose and this.setVisible . How I can dispose my form? Thank
you for help me.

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Please sign in to leave a comment.