r/learnjava • u/Ludlow12 • Sep 01 '19
java :new
In Java why do I need to create an object for JFrame but not for JOPTIONPANE?
1
Upvotes
1
u/Darkpolearm Sep 01 '19
You are accessing static properties of the JOptionPane class, while you are working with instance variables when you use a JFrame
15
u/desrtfx Sep 01 '19
How many times are you asking the same question?
You have been pointed to the documentation that told you that the methods of
JOptionPanearestatic, i.e, belonging to the class directly.On the other hand, you want a specific JFrame, so you need to create a new object.
You are just continuing your lowest possible effort questions that got you already banned in /r/learnprogramming. Why do you think you will get through with them here?
Again, learn to ask proper questions, use the documentation, use proper tutorials, and in general, spend more effort.