|
>>drawingPanel = new
JPanel(){
>> public void paintComponent(Graphics g){ >> super.paintComponent(g); >> drawMap(); >> } >> }; >> >>private void drawMap(){ >> Graphics2D g2 = (Graphics2D) drawingPanel.getGraphics(); >> >>g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE >>_ANTIALIAS_ON); >> // custom paint code >> } >> >no need to call drawingPanel.getGraphics() in drawMap() because you have >alredy Graphics from paintComponent. >drawingPanel = new JPanel(){ > public void paintComponent(Graphics g){ > super.paintComponent(g); > drawMap((Graphics2D)g); > } > }; >private void drawMap(Graphics2D g2){ >g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE >ANTIALIAS_ON); > // custom paint code > } If I do this, nothing is drawn! It shouldn't have any effect
on repainting overlapping areas, which is the problem I'm having. I'm just
creating an extra Graphics object.
Walter
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help". |
Title: Re: [JAVA2D] repainting JPanel
- [JAVA2D] repainting JPanel Walter H Shirey
- Re: [JAVA2D] repainting JPanel Dmitri Trembovetski
- Re: [JAVA2D] repainting JPanel Nidel, Michael
- Re: [JAVA2D] repainting JPanel Walter H Shirey
- Re: [JAVA2D] repainting JPanel Dave Kavanagh
- Re: [JAVA2D] repainting JPanel Walter H Shirey
- Re: [JAVA2D] repainting JPanel David Eisner
- Re: [JAVA2D] repainting JPanel Andrei Kouznetsov
- Re: [JAVA2D] repainting JPanel Walter H Shirey
- Re: [JAVA2D] repainting JPanel Walter H Shirey
- Re: [JAVA2D] repainting JPanel Andrei Kouznetsov
- Re: [JAVA2D] repainting JPanel Dmitri Trembovetski
