• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

fillRect method, can't call it properly

 
Greenhorn
Posts: 23
Eclipse IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i m writing a java applet that accepts 4 parameters to draw a rectangle - x, y, width, height

my problem is, i don't know how to call it in another method - square of asterisks,

it needs a variable Graphics g to be supplied, but i don't know where to give this "g" variable!



here is the problem, how to initialize Graphics g variable?

 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

it needs a variable Graphics g to be supplied, but i don't know where to give this "g" variable!


By calling that method from an appropriate painting method override. Here's where to learn more about that: Performing Custom Painting

Edit: Moving this thread to the GUIs section.
reply
    Bookmark Topic Watch Topic
  • New Topic