How can I paint the grid itself (e.g. grid lines) on a Figure, which has grid layout. I think i need to paint it in another layer, but i can not figure out what exactly to do, to paint 'above' the layer with grid layout.
问问题
891 次
2 回答
1
What you can do is use a GridLayout
, and paint Rectangle figures that on top of them you paint your items. Right now I cannot think of a more elegant way to do this.
于 2012-02-07T18:25:32.887 回答
1
You can just override the paint(Graphics)
method of your figure with the grid layout:
public void paint(Graphics g)
{
super.paint(g);
// draw your grid here
}
Everything you paint where the comment is will appear above the figure and its children.
于 2012-02-10T09:32:02.647 回答