• 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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
Bartender
Posts: 7333
66
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: 70344
283
  • 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: 7108
184
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.
 
Master Rancher
Posts: 4669
49
  • 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?
 
expectation is the root of all heartache - shakespeare. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic