This week's giveaway is in the Threads forum.
We're giving away four copies of Java Concurrency Live Lessons and have Doug Schmidt on-line!
See this thread for details.
Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Please Help  RSS feed

 
Peter Phung
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've programmed a GUI to interact with a database, but am having a problem with it.
It allows the user to use the GUI once but then does not allow any more button clicks. Can anyone in this forum shed some light on this, cos i've had thread in the swing forum for a week and no one's been able to help.
 
aminur rashid
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi You will surely get reply in the forum But will you please elaborate your prooblem.What do u mean when u say When i use the GUI once i.e do u use some buttons to make connection to database or so.Please elaborate ur problem
 
Peter Phung
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what i mean by once is that when i click connect a second window appears to generate a query. From there another window appears to display the results. The GUI is happy to go through this sequence of events once. After the windows to generate the query and display the results are closed, the GUI should let the user open the windows again. HOwever the buttons do not respond to any mouse clicks and just beeps at me instead. The only control that it will allow me to use is the window closer.
IF you would like to see the code let me know and i'll post some of it
 
aminur rashid
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Peter
I tried to do a similar typr of work as you said.I tried out by adding just a button to a frame(say button querry) on whose action COmmand i opened a dialog Box.This new dialogBox has a text area for querry and display_result Button.The click of this button opened a third window(this time a JFrame which has a textarea with displayed reult from the database)
But i did't faced the problem specified by you.
What comes to my mind(although this is a rare possibilty) that you might be creating a modal Dialog Boxes i.e in the constructor of JDialog public queryDialog(java.awt.Frame parent,boolean modal)
you are passing true as modal.
Else why don't you paste the code of How you are handling action event of the frames.
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter
This seems to be more of a Swing/AWT/event handling thing so I'll move it to the Swing forum for you.
You are also going to have to post some code and some sort of explaination of what you've tried to solve the problem so that people know where to start.
Also, puttng a more description subject on your post would probably get more people to read it. 'Please Help' doesn't say anything about the problem or what you need help with.
 
Peter Phung
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's the init methos from my program and my variable/object declarations
Sorry about the amount of code but i'm not sure what's relevant

[ April 04, 2002: Message edited by: Peter Phung ]
 
aminur rashid
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i Am confused your code seems to be alright ..but hey u missed out the code of action listener which was the main portion to be looked at.Where u are opening a new window??You haven't send that piece of code .I think that code mut be in some action listener class.I will like to see that frnd
 
Peter Phung
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here are the two methods which open windows. One gets the password and username the other displays the frame to get search conditions. BOth use custom classes designed for this application (connectionDialog and db_queryTool).

I'm not sure how much help this will be cos i'm sure i've checked everything before, but i've also had this bug for over a month.
Thanks for any help
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is just a quick guess... but... Instead of disposing of your dialog box in the MI_Select_actionPerformed() method, try calling setVisible( false ) on it. I've had problemts before when I've called dispose() on something, I've usually had to create a new object before using it again.

-Nate
 
Peter Phung
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the suggestion but the problem was already present in the program before i added the dispose method. I actually added it to see if it would help the situation but nothing has changed.
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Move the creation of your MODAL dialogs into the actionPerformed method. Set them to null when you are through.
 
Peter Phung
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do i set the dialogs to null?
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
connectDialog = null;
Same for the other.
 
Peter Phung
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't move the creation of the dialog to the actionPerformed method because the dialog is used in another part of the application. When i try to move it i get a segmentation error.
 
Peter Phung
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have found that the problem can be resolved using the dispose method but this causes a problem in the ftpclientdialog when i try to display it for a second time. The components appear at their minimum size, even though i have set the preferred sizes of the components. If anyone can solve this or the first problem i would be very grateful.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!