2 Replies - 201 Views - Last Post: 09 January 2013 - 09:18 AM Rate Topic: -----

#1 sellas  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 09-January 13

How use Event handler to collect data from a jframe into the datab

Posted 09 January 2013 - 07:23 AM

i started a project at school but not sure of what am doing
am designing a shop records system, that takes item name and price from the shop attendant
and when enter is hit this 2 data goes into the database.
the project also include, a calculation of balance button. with few menu and menu items
apparently, i have developed the interface but finding it difficult to come out with the event handlers
PLEAS HELP ME
Is This A Good Question/Topic? 0
  • +

Replies To: How use Event handler to collect data from a jframe into the datab

#2 darek9576  Icon User is online

  • D.I.C Lover

Reputation: 198
  • View blog
  • Posts: 1,689
  • Joined: 13-March 10

Re: How use Event handler to collect data from a jframe into the datab

Posted 09 January 2013 - 07:55 AM

When you have the button object, you need to attach a listener to it and then create a method that will be executed when button is pressed.

e.g.

JButton button = new JButton("Add to database");
        button.addActionListener(new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent event){
                //add the things to the database in here
            }
        });


Was This Post Helpful? 1
  • +
  • -

#3 farrell2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 841
  • View blog
  • Posts: 2,576
  • Joined: 29-July 11

Re: How use Event handler to collect data from a jframe into the datab

Posted 09 January 2013 - 09:18 AM

You need to start from the beginning. Practice your Swing!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1