I am working on a visual sorting algorithm project and I am drawing them in a JPanel:
public void paint(Graphics g) {
super.paint(g);
g.setColor(Color.WHITE);
for (int i = 0; i < array.length; i++) {
g.fill3DRect(i * barWidth, height, barWidth, -array[i], true);
}
g.dispose();
}
I compiled my program and ran the jar on my Windows 7 computer and I get the bars drawn correctly:
I tested this on another Windows 7 computer and a Mac and it drew the bars incorrectly:
Why is this happening? How can I fix this problem?