Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JFrame to Window class

i want to know which this line code it really true or is there a better way? can any one help me?

JFrame jframe=new JFrame()
Window window;
jframe.setUndecorated(true);


window=(Window)jframe; //is this line true?

thank you.

like image 888
mehdi Avatar asked May 25 '26 07:05

mehdi


1 Answers

Yes it's true but you don't need the cast. java.swing.JFrame is a child class of java.awt.Window so it's ok. And I can't find a reason why a method applied to your Window variable wouldn't apply to a JFrame variable. It's not supposed to happen as Java only uses late binding for method calls.

Try to review your code, to check if you import the right classes, because I think you're misunderstanding something.

like image 200
Joel Avatar answered May 26 '26 20:05

Joel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!