For Programmers: Free Programming Magazines  


Home > Archive > Java Help > July 2006 > Z-depth of drawLine()









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Z-depth of drawLine()
fiziwig

2006-07-25, 7:02 pm

If I do this:

class GridPane extends JLayeredPane

public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D gc = (Graphics2D)g;
gc.setColor( new Color(0xc0c0ff));
gc.drawLine(x1, y1, x2, y2);

The lines drawn are always hidden under anything else rendered in the
pane, even though the lines are drawn after all the other rendering
takes place.

Is there a way to draw a line across the top of previously rendered
components in a pane so that it is NOT hidden by the other components?

--gary

Andrey Kuznetsov

2006-07-25, 7:02 pm

> class GridPane extends JLayeredPane
>
> public void paintComponent(Graphics g) {
> super.paintComponent(g);
> Graphics2D gc = (Graphics2D)g;
> gc.setColor( new Color(0xc0c0ff));
> gc.drawLine(x1, y1, x2, y2);
>
> The lines drawn are always hidden under anything else rendered in the
> pane, even though the lines are drawn after all the other rendering
> takes place.
>
> Is there a way to draw a line across the top of previously rendered
> components in a pane so that it is NOT hidden by the other components?


yes, do the same thing, but not in paintComponent but in paint.

Andrey

--
http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities


fiziwig

2006-07-25, 7:02 pm


Andrey Kuznetsov wrote:
>
> yes, do the same thing, but not in paintComponent but in paint.
>
> Andrey


Thank you.
--gary

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com