how to derive from JButton

Discussion in 'Java' started by Andreas Böhme, Nov 30, 2003.

  1. hi all!

    i want to create some buttons for a video-application (start, stop, ...).
    i tried to derive from jbutton, and override paintComponent(Graphics g), but
    it didn't work.
    what's wrong? has anyone any sample-code?

    thanks for your help

    burny
    Andreas Böhme, Nov 30, 2003
    #1
    1. Advertising

  2. "Andreas Böhme" <> wrote in message
    news:bqcene$dfp$07$-online.com...
    > hi all!
    >
    > i want to create some buttons for a video-application
    > (start, stop, ...). i tried to derive from jbutton, and
    >override paintComponent(Graphics g), but it didn't work.
    > what's wrong?
    >


    May I ask *how* you expect anyone here to diagnose your problems without you
    posting any code ?

    >
    > has anyone any sample-code?
    >


    Check out:

    http://java.sun.com/docs/books/tutorial/uiswing/index.html

    for all your GUI code sample needs :) !

    I hope this helps.

    Anthony Borla
    Anthony Borla, Nov 30, 2003
    #2
    1. Advertising

  3. "Anthony Borla" <> wrote in message
    news:kGjyb.33592$...
    > "Andreas Böhme" <> wrote in message
    > news:bqcene$dfp$07$-online.com...

    ....
    > > what's wrong?

    ....
    > May I ask *how* you expect anyone here to diagnose your problems without

    you
    > posting any code ?


    I 'spose the OP is expecting us to use the group's
    crystal ball.

    Problem is, we loaned it to the folks over at
    c.l.j.gui and they won't give it back.. ;-)

    --
    Andrew Thompson
    * http://www.PhySci.org/ PhySci software suite
    * http://www.1point1C.org/ 1.1C - Superluminal!
    * http://www.AThompson.info/andrew/ personal site
    Andrew Thompson, Nov 30, 2003
    #3
  4. sorry - i forgot to paste in the code...
    the link seems usefull - thank you!


    "Anthony Borla" <> schrieb im Newsbeitrag
    news:kGjyb.33592$...
    > "Andreas Böhme" <> wrote in message
    > news:bqcene$dfp$07$-online.com...
    > > hi all!
    > >
    > > i want to create some buttons for a video-application
    > > (start, stop, ...). i tried to derive from jbutton, and
    > >override paintComponent(Graphics g), but it didn't work.
    > > what's wrong?
    > >

    >
    > May I ask *how* you expect anyone here to diagnose your problems without

    you
    > posting any code ?
    >
    > >
    > > has anyone any sample-code?
    > >

    >
    > Check out:
    >
    > http://java.sun.com/docs/books/tutorial/uiswing/index.html
    >
    > for all your GUI code sample needs :) !
    >
    > I hope this helps.
    >
    > Anthony Borla
    >
    >
    Andreas Böhme, Nov 30, 2003
    #4
  5. Andreas Böhme

    Tim Ward Guest

    "Anthony Borla" <> wrote in message
    news:kGjyb.33592$...
    > "Andreas Böhme" <> wrote in message
    > news:bqcene$dfp$07$-online.com...
    > > hi all!
    > >
    > > i want to create some buttons for a video-application
    > > (start, stop, ...). i tried to derive from jbutton, and
    > >override paintComponent(Graphics g), but it didn't work.
    > > what's wrong?

    >
    > May I ask *how* you expect anyone here to diagnose your problems without

    you
    > posting any code ?


    Come on, that was a perfectly reasonable initial question, inviting an
    answer that would split the problem space at least in half: either "no, you
    can't do it that way, because of yyy, you need to look at xxx instead" or
    "yes, you can do it that way, you must have a bug in your code" or even
    "yes, you can do it that way, but you should be aware of the following
    bog-standard gotcha".

    --
    Tim Ward
    Brett Ward Limited - www.brettward.co.uk
    Tim Ward, Dec 1, 2003
    #5
  6. "Tim Ward" <> wrote in message
    news:bqfd9s$2115sc$-berlin.de...
    > "Anthony Borla" <> wrote in message
    > news:kGjyb.33592$...
    > > "Andreas Böhme" <> wrote in message
    > > news:bqcene$dfp$07$-online.com...
    > > > hi all!
    > > >
    > > > i want to create some buttons for a video-application
    > > > (start, stop, ...). i tried to derive from jbutton, and
    > > >override paintComponent(Graphics g), but it didn't work.
    > > > what's wrong?

    > >
    > > May I ask *how* you expect anyone here to diagnose
    > > your problems without you posting any code ?

    >
    > Come on, that was a perfectly reasonable initial question,
    > inviting an answer that would split the problem space at least
    > in half: either "no, you can't do it that way, because of yyy,
    > you need to look at xxx instead" or "yes, you can do it that
    > way, you must have a bug in your code" or even "yes, you
    > can do it that way, but you should be aware of the following
    > bog-standard gotcha".
    >


    Unfortunately the OP didn't mention quite basic things as whether it was
    compilation or runtime problems that were experienced, or, assuming
    successful compilation, elaborate on what 'didn't work' - e.g. the button
    wasn't visible, or the wrong colour, or didn't respond to events, and so on.
    The failure to provide more specific details, or post the relevant 'problem'
    code, makes it impossible to diagnose the problem, and honestly answer [as
    opposed to guess at] the question:

    'What's wrong ?'

    In hindsight I do admit that I could have been less abrupt and sought
    additional details. In fact, when answering queries containing fairly
    sketchy details, I often do do this, or make a 'best guess' attempt, and
    reply with some sample code snippets. I believe, however, being asked to
    answer such a fundamental question [i.e. 'What's wrong ?'] without being
    given enough of the facts [IMO] with which to do so caused momentary
    annoyance, hence the curtness of my reply.

    My client relationship skills are [usually] excellent :) !

    Cheers,

    Anthony Borla
    Anthony Borla, Dec 2, 2003
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Amil
    Replies:
    1
    Views:
    358
    Teemu Keiski
    Nov 20, 2003
  2. Henke
    Replies:
    4
    Views:
    433
    Scott Allen
    Aug 13, 2004
  3. JC
    Replies:
    0
    Views:
    416
  4. Brian Takita
    Replies:
    5
    Views:
    682
    Brian Takita
    May 27, 2005
  5. ABC
    Replies:
    1
    Views:
    2,625
    Larry
    Oct 4, 2005
Loading...

Share This Page