• Post Reply Bookmark Topic Watch Topic
  • New Topic

joptionpane paramater (using a class that extends JFrame as a parameter)

 
Nikolas Nikolaou
Ranch Hand
Posts: 101
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
I've been looking at a class that extends JFrame that is used as a JOptionPane parameter



what difference will this make compared to using:


 
Campbell Ritchie
Marshal
Posts: 52578
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure you should be subclassing Swing components, but to get to the actual question:-
If you pass null the dialogue will appear wherever it wants to (usually the centre of the screen).
If you pass myFrame as a parameter the dialogue will appear in the centre of the frame on screen.
More about that in the Java Tutorials. Use ctrl‑F‑“Component parentComponent”

I shall move this discussion to our GUIs forum.
 
Nikolas Nikolaou
Ranch Hand
Posts: 101
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks.
I thought It might be something like that but when I use the class as a parameter It still appears In the centre of the screen and not In the centre of the frame.
 
Campbell Ritchie
Marshal
Posts: 52578
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are not using a class. You are using an object. MyClass.this is a reference to an object.
 
Nikolas Nikolaou
Ranch Hand
Posts: 101
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Object , sorry.
Still,why does It not appear In the centre ?
 
Darryl Burke
Bartender
Posts: 5154
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To get better help sooner, post a SSCCE (Short, Self Contained, Correct (Compilable), Example) that demonstrates the problem.
 
Nikolas Nikolaou
Ranch Hand
Posts: 101
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't included the jdbc jar file because the popup message occurs when It's not found so It's not needed.
The JOptionPane message is on line 75



 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!