|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.awt.*;
import java.awt.image.*;
/**
*
* @author Matthew
*/
public class RenderClock extends Thread
{
public double Round(double numero, int cifre)
{
bd = bd. setScale(cifre, java. math. BigDecimal. ROUND_HALF_UP);
return bd.doubleValue();
}
int width, height;
{
width = 336;
height = 336;
}
public @Override void run()
{
g0 = bi.createGraphics();
g0. setBackground(Color. WHITE);
double h, hg, volume;
try
{
for(;;)
{
g0.clearRect(0, 0, width, height);
volume = Bicchiere.volume;
h=volume/Bicchiere.S;
hg=274*h*10;
hg=284-hg;
g0. setColor(Color. DARK_GRAY);
g0.fillRect(0, 300, 336, 18);
g0.fillRect(0, 0, 18, 318);
g0.fillRect(318, 0, 18, 318);
g0.fillRect(18, 0, 300, 300);
//g0.drawString(String.valueOf(Round(Bicchiere.pressione*Bicchiere.S/9.806,3))+" kg",36, (int)hg-20);
for(int i=0; i<Bicchiere.npart; i++)
{
g0.fillOval(Bicchiere.molecola[i].getXg(), Bicchiere.molecola[i].getYg(), 4,4);
}
Bicchiere. txtTempo. setText(String. valueOf(Round (Bicchiere. tempo, 8 )));
Bicchiere. txtV. setText(String. valueOf(volume ));
Bicchiere. txtP. setText(String. valueOf(Bicchiere. P));
Bicchiere. txtN. setText(String. valueOf(Round (Bicchiere. moli, 3 )));
g0p.drawImage(bi, null,0,0);
}
}
{
}
}
}
|
|