Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem calling setVisible(true) ?  RSS feed

 
Sumeet Gaikwad
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All;
In my application, I am using JFrame and added some component. At last I called setVisible(true); method. But it cann't works.
Then I tried with show() method. but the result is same.
Then I tried with isDisplayable() method, but strange ,it is returning fasle.
Now my problem is why it is hanging on calling the setVisible() method. or why it is returning false for isDisplayable().
Can anybody guide me to solve the problem.
Thanks in advance.
 
Manish Hatwalne
Ranch Hand
Posts: 2596
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post some of your code here?
Just few priliminary checks -
have you called frameName.setSize(x,y); or frameName.pack(); before calling setVisible(true)?
(I am sure, you must have, but just in case....)
- Manish
 
Sumeet Gaikwad
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Manish,
Thanks for your reply. but I am unable to post the code because of 2550 lines.
Yes, I called the setSize method

but i never called pack method in my code.
Still facing the same problem. One more thing I am using jdk1.3.1 because of some reason.
Plz reply to hang out of this.
 
Younes Essouabni
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I don't get why it is not working, but there is something in this line: setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
From what I understand, screenSize.width and frameSize.width are equals. So (screenSize.width - frameSize.width) / 2, should give you 0/2 . Isn't it a problem?
 
Sumeet Gaikwad
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

So (screenSize.width - frameSize.width) / 2, should give you 0/2 . Isn't it a problem?

Thanks for reply but that is not a problme. ??
Any more suggetions.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!