CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2008
    Posts
    49

    drawing to a paint component?

    basically i have called in an instance of the paintComponent on my form... as follows...

    Code:
    MyPanel tester = new MyPanel();
    tester.setSize(800,600);
    the MyPanel object is just a painComponent, but i need to draw into it... from within my current class, without hard coding it into the MyPanel class, can anyone help?

  2. #2
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: drawing to a paint component?

    Quote Originally Posted by Slippy View Post
    basically i have called in an instance of the paintComponent on my form... as follows...
    'paintComponent' is a method, not a class, so you can't have an instance of it, but you can call it...

    the MyPanel object is just a painComponent, but i need to draw into it... from within my current class, without hard coding it into the MyPanel class, can anyone help?
    It's not clear what MyPanel is, but it's probably a subclass of JPanel - it isn't a paintComponent, there is no paintComponent class.

    If you can explain in plain English what you are trying to achieve, perhaps we can help.

    Precise language is not the problem. Clear language is the problem...
    R. Feynman
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured