Results 1 to 2 of 2

Thread: JAVA button problems

  1. #1
    Join Date
    Jan 2003
    Cardiff, Wales, UK

    JAVA button problems

    We're currently developing an applet for editing web pages, and we've come across a problem.

    The user has previously chosen a colour scheme and as such has an arbitrary number of colours they can select for text. We create the interface for the pallette with buttons, which are created via a loop. However, the event listener does not accept the button as a valid object from which to display the value.

    Basically, how do we create an unfixed number of buttons with listeners thereon?

  2. #2
    Join Date
    Dec 2002
    Calgary, Canada
    If I understand it correctly,what you can do is create a generic class that has psecific(custome) methods for your possible events and then when you create any button you can do something like this

    JButton xButton = new JButton();
    xButton.addActionListener(new CustomEventClass());

    something along these lines


    Message Posting Guidelines In These Forums, Please read these before posting any question.
    Web site: webapplikations.com
    Web Resources Page:Web Resources

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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