Results 1 to 3 of 3
  1. #1
    java_learner is offline Member
    Join Date
    Jul 2012
    Posts
    1
    Rep Power
    0

    Smile Modify button to call method from from different class

    Hi i created this button in netbean to output student objects entered into a text field by the user.....





    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    String id,name;
    id = (txtid.getText());
    name = (txtname.getText());
    Student s = new Student(name,id);
    System.out.println(s);


    Now i am asked to modify this button to save the student object by calling the relevant method from the StudentDAO


    public interface StudentDAO {
    public void saveStudent(Student student);
    public List<Student> getStudents();




    I an extreemly new to java so i would appreciate any help very much

  2. #2
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    757
    Rep Power
    8

    Default Re: Modify button to call method from from different class

    First you need to create an implementation of StudentDAO interface, that will implements all the methods defined in the interface. And the next question is where do you want to save this student information? If you want to save it in a file for instance then you need to learn to work with the java.io package. If you want to save it into a database then learn some JDBC programming.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,184
    Rep Power
    19

    Default Re: Modify button to call method from from different class

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. How can I call a method of this Inner Class?
    By fatabass in forum New To Java
    Replies: 1
    Last Post: 02-05-2012, 01:38 AM
  2. How to call a class when push Button?
    By Lund01 in forum New To Java
    Replies: 3
    Last Post: 03-17-2011, 06:38 AM
  3. Inner class method call
    By d915172 in forum New To Java
    Replies: 3
    Last Post: 11-11-2010, 09:40 PM
  4. Replies: 2
    Last Post: 05-01-2010, 08:59 AM
  5. How to call a method from another class?
    By jboy in forum New To Java
    Replies: 8
    Last Post: 09-09-2009, 07:29 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •