Forums Register Login

Can't change visibility of two jPanels when calling the method from a button event in another class

+Pie Number of slices to send: Send


Let me see if I can explain what I am trying to do. I have two classes involved in this portion. CheckIn_Search (class #1) is my main UI and I am collecting search information from the user in a jPanel form. When they click "Search" it passes the search criteria to a method that contacts a web service and gets the results. These results are passed to coSearchResults (class #2) that opens a jFrame and jTable (in modal format, over the main window created by CheckIn_Search. The user selects a row in the table and that selection data is passed back to coSearchResults to populate a new jPanel form. When the data is passed from coSearchResults, I want to close its window, hide the first jPanel in CheckIn_Search and make the second jPanel visible. To accomplish this, I created a method in CheckIn_Search that simply hides/shows the panels (it will do more later). I instantiate and call the method in CoSearchResults as part of the button click event. The problem is, it doesn't work. The panels are unaffected and there are no errors. I've put in break-points and it goes into the method...ugh!
Here is the coSearch_Results code. Here is am retrieving the jtable row id and using the first value in the row to get the data from the table model as there is more data than what is displayed in the table. I'm sending that whole row of data to the method that changes visibility.


The code to show/hide the panel in CheckIn_Search is



Any help is appreciated!

+Pie Number of slices to send: Send
Too much to read in detail. I just saw a basic question that you want to hide/show a panel. In this case the commons solution is to use a CardLayout.

Read the section from the Swing tutorial for more information and working examples: How to Use Card Layout.
+Pie Number of slices to send: Send
I read a couple articles on Card Layout and it like what I was going for. Thanks for the tip.
+Pie Number of slices to send: Send
And welcome to the Ranch
What's gotten into you? Could it be this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 690 times.
Similar Threads
JTable
JTable ........
JTable
jtable
Having a JTable Selection.
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 08:31:41.