Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void paint(Graphics g) {
- long start = System.currentTimeMillis();
- for (int i = 0; i < 100; i++) {
- red = Math.abs(r.nextInt() % 255);
- green = Math.abs(r.nextInt() % 255);
- blue = Math.abs(r.nextInt() % 255);
- System.out.println(red +", " + green
- + ", " + blue);
- g.setColor(red, green, blue);
- g.fillTriangle((int)(this.getWidth()*r.nextFloat()), (int)(this.getHeight()*r.nextFloat()), (int)(this.getWidth()*r.nextFloat()), (int)(this.getHeight()*r.nextFloat()), (int)(this.getWidth()*r.nextFloat()), (int)(this.getHeight()*r.nextFloat()));
- }
- long stop = System.currentTimeMillis();
- napis = "Czas wykonania: " + (stop-start) + "ms";
- g.setColor(255, 255, 255);
- g.setFont(Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_PLAIN, Font.SIZE_SMALL));
- g.drawString(napis, this.getWidth()/2, this.getHeight()/2, Graphics.BASELINE | Graphics.HCENTER);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement