This is my Second Week coding in Java, I'm not sure how or why this works, but it works some how. According to several sites, Java does not support ByRef, but works with ByVal instead. According to what I have just done it seems to be the exact opposite.
On the upside this seems to use 1/4 of the resources than drawing a buffered image does, text, colors and everything works.
public class GraphicFunctions {
public void DrawingA(Graphics2D g2d){
gfx2d.DrawLine(1,2,3,4);
gfx2d.DrawLine(5,6,7,8);
}
public void DrawingB(Graphics2D g2d){
gfx2d.DrawLine(4,3,2,1);
gfx2d.DrawLine(9,10,11,12);
}
}
Public class GenerateDrawing {
GraphicFunctions Gf = new GraphicFunctions();
private void doDrawing(Graphics g){
Graphics2D g2d = (Graphics2D) g;
g2d.setColor(Color.blue);
Gf.DrawingA(g2d);
Gf.DrawingB(g2d);
}
}