I have been tasked to make a check in/out program for my job. While I have worked with games before, I have never really done just a simple program, and I’m sure I have made a couple of mistakes.
First of all, I believe what I’m using is called passive rendering. The program doesn’t use any keyboard, or mouse input. So I decided to make it look nice with a full screen window, that have a background and a good looking list of all the employees that have checked in. (We use a card scanner to check in/out)
@Override
public void paintComponent(Graphics g){
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
//Rendering code
repaint();
}
But then I come to the thing I’m most questionable about, I have used a game loop to check in with a “in house” website now and then, to collect information. I have been thinking of adding a sleep, yield, or another kind of timer function.
public void processing(){
while(isRunning){
long now = System.currentTimeMillis();
if(now-lastHttpCheck > getSoftwareRefreshRate()){
lastHttpCheck = now;
//Resive information from a in house apache server
}
}
}