27 de novembro de 2012

Flores Randômicas

Thomas e eu fizemos o programa abaixo que desenha flores com posições, tamanhos e cores aleatórias:




package zap;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.util.Random;

import javax.swing.JFrame;


public class Zap extends JFrame { private static final long serialVersionUID = 1L;

public static void main(String[] args) {
new Zap();
}


Zap() {
setTitle("Zap - Oi Galera!");
setResizable(true);
   setBounds(100, 50, 500, 400);
   setExtendedState(JFrame.MAXIMIZED_BOTH);
   setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

repaint();
}


@Override
public void paint(Graphics g) {


/////////////////////////////
/////////////////////////////
g.clearRect(0, 0, 5000, 4000);


     
        Random ran = new Random();
        flower(g, ran.nextInt(1000), ran.nextInt(350));
        flower(g, ran.nextInt(1000), ran.nextInt(350));
        flower(g, ran.nextInt(1000), ran.nextInt(350));
        flower(g, ran.nextInt(1000), ran.nextInt(350));
        flower(g, ran.nextInt(1000), ran.nextInt(350));
        flower(g, ran.nextInt(1000), ran.nextInt(350));
      /////////////////////////////////

      /////////////////////////////////

}


void flower(Graphics g, int x, int y) {
Random ran = new Random();
int size = ran.nextInt(5)+1;
randomColor(g);
g.fillRect(x, y, 9*size, 200*size);
          g.fillRect(x, y + 90*size, 80*size,30*size);
  randomColor(g);
          g.fillOval(x - 10*size,y -10*size, 40*size, 38*size);
  randomColor(g);
      g.fillOval(x - 10*size,y -46*size, 40*size, 38*size);
      g.fillOval(x - 10*size,y + 23*size, 40*size, 38*size);
      g.fillOval(x - 50*size,y -10*size, 40*size, 38*size);
      g.fillOval(x + 30*size,y -10*size, 40*size, 38*size);
}


private void randomColor(Graphics g) {
Random ran = new Random();
g.setColor(new Color(ran.nextInt(256),ran.nextInt(256),ran.nextInt(256)));
}



}

24 de novembro de 2012

ADORO!!!

Eu e Puppy fomos assistir uma palestra do Afgh hoje pela manhã!
Começando a  palestra, Afgh pede aos participantes para fazerem perguntas sobre a questão mais F*#@ (é o nome da palestra, inclusive) . 
Demorou um pouco, um cara levantou a mão, depois de um tempo outro... e em pouco tempo vieram várias perguntas!
Eu falei p Puppy: - Puppy eles são como alunos, têm medo de perguntar, mas depois que o primeiro levanta a mão os outros criam coragem e perguntam também.
Puppy concordou.
Depois continuei: - Puppy vc é o tipo de aluno que levanta a mão para fazer perguntas?
e Puppy na lata: - Eu não sou aquele que faz perguntas, Claudia, eu sou aquele que tem as respostas!

é mole???