protected void paintComponent (Graphics g) { if (g!=null) super.paintComponent (g); Insets insets = getInsets (); int currentWidth = getWidth () - insets.left - insets.right-10; int currentHeight = getHeight () - insets.top - insets.bottom-5; int currX=insets.left+5;int lastX=0;int lastY=0; int maxX=0;int maxY=0;float scaleX; float scaleY; for (int i=0;i<nodes.length;i++) { maxX+=nodes[i].maxX; if ((nodes[i].maxY+nodes[i].baseY>maxY) && (nodes[i].maxY!=5000)) maxY=nodes[i].maxY+nodes[i].baseY; };
protected void paintComponent(Graphics g) { if (g != null) super.paintComponent(g); Insets insets = getInsets(); int currentWidth = getWidth() - insets.left - insets.right - 10; int currentHeight = getHeight() - insets.top - insets.bottom - 5; int currX = insets.left + 5; int lastX = 0; int lastY = 0; int maxX = 0; int maxY = 0; float scaleX; float scaleY; for (int i = 0; i < nodes.length; i++) { maxX += nodes[i].maxX; if ((nodes[i].maxY + nodes[i].baseY > maxY) && (nodes[i].maxY != 5000)) maxY = nodes[i].maxY + nodes[i].baseY; }
        protected void paintComponent (Graphics g)        {            if (g!=null) super.paintComponent (g);            Insets insets = getInsets ();            int currentWidth = getWidth () - insets.left - insets.right-10;            int currentHeight = getHeight () - insets.top - insets.bottom-5;            int currX=insets.left+5;int lastX=0;int lastY=0;            int maxX=0;int maxY=0;float scaleX; float scaleY;            for (int i=0;i<nodes.length;i++)            {                maxX+=nodes[i].maxX;                if ((nodes[i].maxY+nodes[i].baseY>maxY) && (nodes[i].maxY!=5000)) maxY=nodes[i].maxY+nodes[i].baseY;            };                        scaleX=(float)currentWidth/(float)maxX;            scaleY=(float)(currentHeight-5)/(float)maxY;                        for (int i=0;i<nodes.length;i++)            {                int x; int y;                x=getX (i);                y=getY (i);                                if (g!=null)g.fillRect ((int)((currX+x)*scaleX)-3,currentHeight-((int)(y*scaleY))-3,6,6);                nodeX[i]= (int)((currX+x)*scaleX);                nodeY[i]=currentHeight-((int)(y*scaleY));                if ((i>0) &&(g!=null)) g.drawLine ((int)((currX+x)*scaleX),currentHeight-((int)(y*scaleY)),                (int)((lastX)*scaleX),currentHeight-((int)(lastY*scaleY)));                lastX=x+currX;lastY=y;                currX+=x;            }        }