I'm usung now Eclipse t开发者_开发问答o develop a Java application. My problem is when I pass from interface I1 to interface I2. I want to hide I1 and show I2 when I click a button in I2.
I tried to use this instruction in NetBeans:
I2 interface = new I2();
this.setVisible(false);
interface.setVisible(true);
But trying this in Eclipse ann error occur, Eclipse ask me to create a mrthod 'setVisible' .. Now I use eclipse ...
Why ?? and what can I do?? Thanks in advance. Best regards, Ali
The two pieces of code are not the same. In the Eclipse example this
refers to the anonymous inner class of type ActionListener
which I assume doesn't have a setVisible
method. I guess you're trying to call the setVisible method of the parent class, try removing this
, then it should automatically refer to the parent class' method, like so:
ws.setVisible(true);
setVisible(false);
Yes, the first snapshot is for the project that I work on and the second is for an old project. Thanks for replying! It worked finally... :)
I confirm:
setVisible(false);
for Eclipse and this.setVisible(false);
for NetBeans.
精彩评论