Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #31169

Re: paintComponent(Graphics graphics)

From Brixomatic <brixomatic@yahoo.com>
Newsgroups comp.lang.java.programmer
Subject Re: paintComponent(Graphics graphics)
Date 2015-02-21 18:55 +0100
Organization Aioe.org NNTP Server
Message-ID <MPG.2f52e503ae9028639896a1@news.aioe.org> (permalink)
References <3dba8d3b-34bb-4bd3-8768-78b138daca92@googlegroups.com> <mc8i00$qk7$1@dont-email.me>

Show all headers | View raw


In article <mc8i00$qk7$1@dont-email.me>, Jeff Higgins 
(jeff@invalid.invalid) says...

> >
> > paintComponent(Graphics graphics){
> >    Graphics2D g = (Graphics2D)graphics.create();
> >    g.drawImage(image, 200, 200, null);
> >    g.dispose
> > }
> >
> 
> Why are you creating and disposing of a Graphics object?

It's generally the right way to do it.

Using the provided graphics object and altering its state should, but 
could potentially cause problems with objects relying on the fact that 
it's unchanged by child components.

Kind regards,
Wanja

-- 
..Alesi's problem was that the back of the car was jumping up and down 
dangerously - and I can assure you from having been teammate to 
Jean Alesi and knowing what kind of cars that he can pull up with, 
when Jean Alesi says that a car is dangerous - it is. [Jonathan Palmer]

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

paintComponent(Graphics graphics) Doug Mika <dougmmika@gmail.com> - 2015-02-20 11:13 -0800
  Re: paintComponent(Graphics graphics) Jeff Higgins <jeff@invalid.invalid> - 2015-02-20 18:58 -0500
    Re: paintComponent(Graphics graphics) Brixomatic <brixomatic@yahoo.com> - 2015-02-21 18:55 +0100
  Re: paintComponent(Graphics graphics) Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2015-02-20 16:15 -0800
    Re: paintComponent(Graphics graphics) Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2015-02-20 16:42 -0800
      Re: paintComponent(Graphics graphics) Jeff Higgins <jeff@invalid.invalid> - 2015-02-20 19:55 -0500
        Re: paintComponent(Graphics graphics) Jeff Higgins <jeff@invalid.invalid> - 2015-02-20 20:14 -0500

csiph-web