Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Getting information from a other class

  1. #1
    Member
    Join Date
    Sep 2012
    Posts
    30
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Getting information from a other class

    Hello i'm trying to call my login class from my main to run the program, but i don't know what i'm doing wrong :/
    i get this error here:
    Bank.java:24: error: constructor testlogin in class testlogin cannot be applied to given types;

    and here is my main code if it helps
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
     
    public class Bank extends JFrame {
     
     
    	final static String[] labelStr = {"Just a test", "Dummy label", "to fill", "the form"};
     
            // this the master frame... we just fill it with labels an button to show how it works
            Bank() {
              super("Bank");
     
              // build a dummy panel with dummy labels just to fill the GUI
              JPanel panel = new JPanel(new GridLayout(labelStr.length, 2));
              for(int i = 0; i < labelStr.length; i++) {
                      panel.add(new JLabel(labelStr[i]));
                      panel.add(new JButton("Button " + i));
              }
              add(panel);
              setSize(400, 200);
              // create and show the Login form
              new testlogin(this);
            }
     
            // to test the whole thing
            public static void main(String[] args) {
                    new Bank();
            }
    }

    Can someone please help me get past this error?


  2. #2
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: Getting information from a other class

    Please post your testlogin class's code here as well so that we could see what you are doing wrong .

    For a hint:
    1. Are you sure, you have a constructor in your testlogin class that accepts JFrame as a parameter?
    Anyone who stops learning is old, whether at twenty or eighty. Anyone who keeps learning stays young. The greatest thing in life is to keep your mind young.

    - Henry Ford

  3. #3
    Member
    Join Date
    Sep 2012
    Posts
    30
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Getting information from a other class

    i'm pretty sure i have done that

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    18,562
    Thanks
    45
    Thanked 1,954 Times in 1,928 Posts

    Default Re: Getting information from a other class

    Where is the constructor for testlogin that takes one argument?
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: Getting information from a other class

    You only have a default (non parametrized) constructor and no other constructor. Please write an appropriate constructor.
    Anyone who stops learning is old, whether at twenty or eighty. Anyone who keeps learning stays young. The greatest thing in life is to keep your mind young.

    - Henry Ford

  6. The Following User Says Thank You to Mr.777 For This Useful Post:

    lf2killer (November 26th, 2012)

Similar Threads

  1. Getting information from an array
    By andresfelquintero in forum Algorithms & Recursion
    Replies: 2
    Last Post: May 3rd, 2011, 04:53 PM
  2. I cannot get to print out all my information.
    By kl2eativ in forum What's Wrong With My Code?
    Replies: 4
    Last Post: January 25th, 2011, 12:46 PM
  3. [SOLVED] Class not passing information
    By DiPep in forum What's Wrong With My Code?
    Replies: 6
    Last Post: July 26th, 2010, 10:04 AM
  4. Getting information from a folder
    By shadihrr in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: February 23rd, 2010, 03:13 PM
  5. Having trouble printing object information in main class
    By KingLane in forum Object Oriented Programming
    Replies: 1
    Last Post: October 11th, 2009, 06:53 PM