Win a copy of Secure Financial Transactions with Ansible, Terraform, and OpenSCAP this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

java.awt.IllegalComponentStateException: The window is showing on screen.

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would like to show a running process stage with a pop-up frame. The created a javax.swing.JFrame is:



The input String text is produced in a for loop like:



When I use  this.setLocationByPlatform(true) in the Frame it will produce the correct Frame but I will get the error after the first step of the loop:
java.awt.IllegalComponentStateException: The window is showing on screen.
at java.awt.Window.setLocationByPlatform(Window.java:3450)

If I skip the setLocationByPlatform it will produce an empty Frame. Could someone suggest me a way for getting one Frame where the string will change according to the loop?


 
Master Rancher
Posts: 4256
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

If I skip the setLocationByPlatform


Did you read the API doc for that method?  It says:


IllegalComponentStateException - if the window is showing on screen and locationByPlatfom is true.



Note: Having a method with the same exact spelling as the class name is confusing.  Java conventions require method names begin with a lowercase letter.
 
The moth suit and wings road is much more exciting than taxes. Or this tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic