• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Help me Please!!!

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've got three windows in my application so far. The first one is a "public" dialog window with a place for the user to enter their username and password. There are two buttons below the username and password fields labeled "Login" and "New User" respectively. I have an actioneventlistener attached to the "Login button" that, when clicked, opens the main application window if the username and password are found in the database. I got that far and every thing worked great until I attached an action listener to the "New User" button. The "New User" button should open up a dialog box that has fields to enter appropriate info., but I can't get it to compile. I get this when I compile:
bin/TST.java [141:1] No constructor in bin.NewUser matches <init>()
new NewUser().show();
^
1 error
I don't understand what I'm doing wrong.
HELP!!!
Craig Snowbarger
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks like you tried to call a no-arg constructor for the NewUser class when there isn't one. You probably wrote at least one other constructor, which means the compiler didn't supply a no-arg constructor for you. You should write one.
 
Craig Snowbarger
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'll have to forgive me, but I'm still pretty new at Java, so can you give me an example of a no-arg constructor?
 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A no-arg constructor is just a constructor with no arguments. For example:

public NewUser() {
// constructor code
}


If you don't supply any constructors for a class, a no-arg constructor is automatically created for you. If you have other constructors, though, it will not be created.
 
You showed up just in time for the waffles! And this 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