I do a code, but this dont work well...... i need some help...
package teoria;
import java.awt.Color;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
/**
*
* @author Usuário
*/
public class Main {
public int cord = 10;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// JFrame frame =
// new JFrame( "TEORIA" );
// frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
Desenho linhas =
new Desenho();
// Desenho linhas2 =
// new Desenho();
ExecutorService threadExe = Executors.newFixedThreadPool(1);
threadExe.execute( linhas );
threadExe.shutdown();
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package teoria;
import java.awt.Color;
import java.awt.Graphics;
import java.util.Random;
import javax.swing.JPanel;
/**
*
* @author Usuário
*/
public class PixelClasse extends JPanel {
private int cordX;
private int cordY;
Random alea = new Random();
public void dados(int xx,int yy) {
cordX = xx;
cordY = yy;
}
public void paint(Graphics g) {
// Desenho novoD = new Desenho();
// ExecutorService threadExe = Executors.newFixedThreadPool(1);
// threadExe.execute( novoD );
// SwingUtilities.invokeLater(novoD);
// paint(g);
//threadExe.shutdown();
/// for (int i = 0; i < 200; i++) {
// cordX = i + 30;
// for (int y = 0; y < 200; y++) {
// cordY = y + 30;
boolean rand = alea.nextBoolean();
if (rand) {
g.setColor(Color.BLACK);
} else {
g.setColor(Color.WHITE);
}
// for(int jo = 0;jo < 1000000;jo++);
g.drawLine(cordX, cordY, cordX, cordY);
// g.drawLine(x, y, x, y);
// }
// }
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package teoria;
import java.awt.Color;
import java.awt.Paint;
import javax.swing.JFrame;
/**
*
* @author Usuário
*/
public class Desenho implements Runnable {
// private Graphics gra;
public Desenho() {
}
public void run() {
// SwingUtilities.invokeLater(new Runnable() {
JFrame frame =
new JFrame( "PQp" );
// public void run() {
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.setSize( 400,400 ); // configura o tamanho do frame
//frame.setVisible( true );
PixelClasse d = new PixelClasse() ;
try {
// d.setBackground( Color.WHITE );
Thread.sleep(0,001);
for (int i = 0; i < 200; i++) {
for (int y = 0; y < 200; y++) {
// PixelClasse d = new PixelClasse() ;
d.dados(i,y);
d.repaint();
// frame.add( d );
frame.add( d ); // adiciona painel ao frame
// frame.setSize( 400,400 ); // configura o tamanho do frame
frame.setVisible( true );
}
}
} catch (InterruptedException exception) {
exception.printStackTrace();
}
// frame.add( d ); // adiciona painel ao frame
// frame.setSize( 400,400 ); // configura o tamanho do frame
frame.setVisible( true );
}
// });
// }
}
[Message sent by forum member 'jonathan_46' (jonathan_46)]
http://forums.java.net/jive/thread.jspa?messageID=272624
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".