Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Help me Please!!!  RSS feed

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!