• 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 ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Create a Java error message with jOptionPane

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello! I’ve been struggling with creating a Java program which displays a login form.Basically, I want to retreive a database which contains about users and their password. At this moment, I am at the point where I need to display an error message using jOptionPane, but it seems like not working. When I run the file and I click Login button, nothing is displayed.

Here is a part of the code:

                                 
Thank you

 
Diane Branco
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even if I delete them, the result is the same: no dialog is shown. I debugged it, nothing seems wrong
 
Carey Brown
Saloon Keeper
Posts: 6419
60
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is from the JOptionPane docs:
It uses null for a parent and specifies that it is an error dialog.
 
Diane Branco
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Carey Brown wrote:This is from the JOptionPane docs:
It uses null for a parent and specifies that it is an error dialog.



I typed it, nothing works. However, if I use the code that you provided me with, on a distinct JForm, clicking the so-called Login button retreives the necessary result. Therefore, it might be a problem with the code that indicates the connection with MySql Database. What do you think?
 
Diane Branco
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found out what the problem is: the server cannot connect to the MySql database. Basically, the code is not properly run because of the lack of connection. Well, I try to connect to the database, but I am prompted with the following error (in the attachement). The paths seem to be correct, but still I cannot connect to the DB. What can I do?
error.jpg
[Thumbnail for error.jpg]
 
Marshal
Posts: 66190
250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to our databases forum.

Please avoid Screenshots, which can be difficult to read.
 
Sheriff
Posts: 6363
172
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think MySQL has Workbench as its administrator tool.  Try connecting with that, then transfer the properties to your Java program.
 
Rancher
Posts: 4318
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I peer at that screenshot, it shows that it can't find the MySQL JDBC driver.

Do you have the MySQL JDBC jar file in the correct place for you app?
 
I'm a lumberjack and I'm okay, I sleep all night and work all day. Lumberjack ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!