How to add clear option to this whiteboard?
Posted
by swift
on Stack Overflow
See other posts from Stack Overflow
or by swift
Published on 2010-04-26T10:37:20Z
Indexed on
2010/04/26
11:03 UTC
Read the original article
Hit count: 194
i have to add clear screen option to my whiteboard application, usual procedure is to draw a fill rect to the sizeof the image. But in my app i have transparent panels added one above the other i.e as layers, if i follow the usual procedure the drawing from the underlying panel wont be visible. please tell me any logic to do this.
public void createFrame()
{
JFrame frame = new JFrame();
JLayeredPane layerpane=frame.getLayeredPane();
board= new Whiteboard(client); //board is a transparent panel
// tranparent image:
board.image = new BufferedImage(590,690, BufferedImage.TYPE_INT_ARGB);
board.setBounds(74,23,590,690);
board.setImage(image);
virtualboard.setImage(image); //virtualboardboard is a transparent panel
virtualboard.setBounds(74,23,590,690);
JPanel background=new JPanel();
background.setBackground(Color.white);
background.setBounds(74,25,590,685);
layerpane.add(board,new Integer(5));
layerpane.add(virtualboard,new Integer(4));//Panel where remote user draws
layerpane.add(background,new Integer(3));
layerpane.add(board.colourButtons(),new Integer(2));
layerpane.add(board.shapeButtons(),new Integer(1));
layerpane.add(board.createEmptyPanel(),new Integer(0));
}
© Stack Overflow or respective owner