This week's book giveaway is in the Design and Architecture forum. We're giving away four copies of Communication Patterns: A Guide for Developers and Architects and have Jacqui Read on-line! See this thread for details.
I have a Java program which has only one main which will launch the other JFrames with set.visible() command.
This program connects to MySQL database for inserting images. The inserting process is via GUI (JFrame) where the time of the image has to be typed in a JTextField. I would like to avoid duplication in the database.
The data contain Time data and I would like to check if the given Time still exists on the table. If the Time still exists I would like to stop the data inserting and dispose of the JFrame. I tried the following code but it does not stop the process:
This part of the Jframe is inside a jButtonActionPerformed which will insert the image to the table. Can someone suggest me a solution to stop the action and dispose the JFrame if the condition is true?
I would appreciate any help!
Beata Szabo-Takacs wrote:. . . launch the other JFrames with set.visible() command.
Why would yoiu want multiple frames? There are several better ways for multiple displays including desktop panes and dialogue windows.
This program connects to MySQL database for inserting images. The inserting process is via GUI . . .
I am afraid that doesn't sound like good design. Create an app that inserts images (or as people have discussed in the last week, references to images) without a GUI. The GUI is not your app, but simply an interface between the app and the user. Get the insertion working without a GUI fist.
What does that line do? What are you calling dispose() on? I can foresee threading problems because you still have to execute all that code on the event dispatch thread.