Results 1 to 4 of 4
  1. #1
    TomWaits is offline Member
    Join Date
    Feb 2011
    Posts
    2
    Rep Power
    0

    Default Handle button press

    Hello,

    I'm working on a program which solves basic polynomial problems ( the addition of two polynomials , finding the roots...)
    On the GUI part, though, there's something I don't really know how to implement.
    I used the CardLayout and I have multiple cards ( for the addition of polynomials, the subtraction of polynomials and so on) each of them having a button.
    When the button is pressed, the method which does the operation should be called.
    I don't really know how to do this, how to handle the click of the button.
    If you could help me a little bit, or just give me a hint, I'd be very grateful.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

  3. #3
    TomWaits is offline Member
    Join Date
    Feb 2011
    Posts
    2
    Rep Power
    0

    Default

    Thank you very much for the tutorials. I read a little bit, but still I have a question regarding the card layout. How can I memorize the button from current card, in order to know which button was clicked?

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,000
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by TomWaits View Post
    Thank you very much for the tutorials. I read a little bit, but still I have a question regarding the card layout. How can I memorize the button from current card, in order to know which button was clicked?
    The ActionEvent passsed as a parameter to your actionPerformed( ... ) method know which button was pressed but if I were you I'd register separate ActionListeners for each button.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. open another window via button press
    By vkokaram in forum New To Java
    Replies: 6
    Last Post: 07-19-2010, 02:09 AM
  2. Replies: 10
    Last Post: 06-06-2010, 06:49 PM
  3. Replies: 0
    Last Post: 05-20-2010, 08:18 PM
  4. simulate form type=button press with java application
    By redmoonzer01 in forum Networking
    Replies: 1
    Last Post: 03-29-2008, 06:28 AM
  5. Press any key to continue/press enter
    By JT4NK3D in forum New To Java
    Replies: 1
    Last Post: 11-17-2007, 09:27 PM

Posting Permissions

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