I made an Applet with some Panels on it.
I draw something on a panel with specific methods I created, they use a graphics object to draw.
To draw I use commands like:
gr = this.getGraphics;
gr.drawString... etc
Then I call these methods from the applet class.
My problem is the following: After I minimize or resize the browser window the panel does not
show anything, I suppose it's because I didn't implement anything in the paint()
method of the panel.
Is there an way to fix that problem without changing all my methods?
Some of my methods are like that:
//paint a node with coords x,y and nodeNumber in the center of the node
public void paintNode(int x,int y,Integer numberOfNode){
gr = this.getGraphics();
gr.setColor(ShowGUI.getPanelColor());
gr.fillOval(x,y,40,40);
gr.setColor(Color.BLACK);
gr.drawOval(x,y,40,40);
gr.drawString(numberOfNode.toString(),x+17,y+25);
}
//marks red the processing edge
public void markEdge(int x1,int y1,int x2,int y2,Integer numberOfNode1,Integer numberOfNode2,int weight){
gr.setColor(Color.red);
this.paintEdge(x1,y1,x2,y2,numberOfNode1,numberOfNode2,weight);
this.paintNode(x1, y1, numberOfNode1);
this.paintNode(x2, y2, numberOfNode2);
}