How to draw in class from uot side it ??? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How to draw in class from uot side it ???

NCS_OneNCS_One Posts: 170Member
Hi

Im trying to create :

class MySomething extends Component {

public MySomething() {}

public void paint(Graphics g) {
g.drawString("MySomething",10,10);
}
}

but when i call it from a applet it doesnt draw in the applet.

Thanks for all the help

Comments

  • NCS_OneNCS_One Posts: 170Member
    Sorry my mistake.
    With the paint() i can do it but how do i do it
    without the paint() ???
  • moomoo Posts: 147Member
    : Sorry my mistake.
    : With the paint() i can do it but how do i do it
    : without the paint() ???
    :
    don't know, did not try it, but how about Component.getGraphics().drawString(...)
    greetings
    mo
  • NCS_OneNCS_One Posts: 170Member
    : don't know, did not try it, but how about Component.getGraphics().drawString(...)
    : greetings
    : mo
    :

    Hi

    I tryed that and it throws a nullpointerexception.
  • dogtag1dogtag1 Posts: 30Member
    : Hi
    :
    : Im trying to create :
    : [red]import javax.swing.JApplet[/red]
    : class MySomething extends [red]JApplet[/red] {
    :
    : public MySomething() {}
    :
    : public void paint(Graphics g) {
    : g.drawString("MySomething",10,10);
    : }
    : }
    :
    you can try that.
  • NCS_OneNCS_One Posts: 170Member
    Hi

    Yes like that it works,drawing from a class
    japplet, but how can i from a
    class component draw in a class Applet ???

    Thanks
Sign In or Register to comment.