Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Main Thread and Swing Thread  RSS feed

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

Recently I am focus designing a "filter" into a program, the process is as following:
1. pass an Array of String into Filter class
Filter filter = new Filter(String[] array)

2. use method chooseArray() to choose some string from the Array, and return
String[] newArray = filter.chooseArray()

For the choosing process, I want to use Swing to create a ScrollPane with CheckBoxs and a "Comfirm" button on it. Each CheckBox represent a string in the Array. then user can choose the items they needed in the array. When finish choosing, user can click the "Comfirm" button. Then the newArray could return to the main theard to continue.

However, my program perferm as this:
after start the Swing thread by using show() method, the program immediately return to the main thread and all operations to the ScrollPane are useless.

How could I solve this issue?

Thanks in advance.
[ November 30, 2005: Message edited by: Xiangdong Xu ]
Posts: 59742
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can be yourself, but I shall be myself

What class are you calling the .show() method on? You know .show() is deprecated, and you ought to use .setVisible(true) instead?
Are you calling .show() on the JScrollPane? You can't make a JScrollPane visible without a container for it to fit inside, usually a JFrame.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!