Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature may not be available in some browsers.
class TestPaint extends JPanel {
private int offset = 10;
public TestPaint() {
setBackground(Color.WHITE);
}
@Override
public void paintComponent(final Graphics g) {
g.drawRect(this.offset, this.offset,
getWidth() - 2 * this.offset,
getHeight() - 2 * this.offset);
}
public static void main(final String[] args) throws Exception {
final JFrame jFrame = new JFrame();
jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jFrame.setSize(300, 300);
final TestPaint comp = new TestPaint();
jFrame.add(comp);
jFrame.setVisible(true);
for (int i = 10; i < 40; i+=2) {
Thread.sleep(300);
comp.offset = i;
comp.repaint();
}
}
}
}