Feixa o Código Mtrix /*

5 respostas
oljr35
BOM dia  programadores! fui abençoado com o código matrix pelo Professor Tunai ele  completo.  não consigo encontrar onde fecha-lo (/*) será que posso contar com um dos senhores? leiam o mesmo e vejam o que está faltando, por gentileza corrijam e devolvam através de resposta. muito obrigado e segue abaixo o código. ps: ele tá quase todo em cinza, onde está em cinza eu destaquei, más uma vez obrigado.



/*
 * matrixteste.java
 *
 * Created on 31 de Julho de 2013, 18:06
 */

package siscontabil; [b]este trecho não  está em cinza[/b]

/**import java.awt.*;  
import java.util.*;  
import javax.swing.*;  
  
@SuppressWarnings("serial")  
public class matrixRain extends JFrame {   
private static final int FONT_SIZE = 20;  
private static final int NUMBER_OF_REPEATS = 5;  
private static final String TEXT = new String("あ     た        
ア        カ                                  サ    ザ      ジ    
ズ       ゼ       ゾ           シ    ス      セ   ソ    キ   ク   ケ   コ   イ  ウ   エ    オ   ジャ な");  
private static JPanel panel = new JPanel(null);  
private static Random random = new Random();  
private static JLabel label[] = new JLabel[NUMBER_OF_REPEATS];  
  
public matrixRain() {          
   this.add(panel);  
   panel.setBackground(Color.BLACK);  
}  
public void scroll() {  
      //array to hold x coordinates for the labels  
    int[] random_x = new int[NUMBER_OF_REPEATS];  
    //create an infinite loop  
    while (true) {  
        //initialise all the labels to random characters  
        for (int i = 0; i < NUMBER_OF_REPEATS; i++) {  
         int character_initial = random.nextInt(TEXT.length());  
          random_x[i] = random.nextInt(panel.getWidth() / FONT_SIZE) - 1;  
          label[i] = new JLabel("" + TEXT.charAt(character_initial));  
          panel.add(label[i]);  
          label[i].setFont(new Font("monospaced", Font.PLAIN, FONT_SIZE));  
        label[i].setForeground(new Color(0, 255, 0));  
     }  
    // change the text of the labels and their position  
    for (int j = 0; j < (panel.getHeight() / FONT_SIZE) * 2; j++) {  
        int character = random.nextInt(TEXT.length());  
        //move each character  
       for (int i = 0; i < NUMBER_OF_REPEATS; i++) {  
            label[i].setBounds(random_x[i] * FONT_SIZE, j * (FONT_SIZE / 2), FONT_SIZE, FONT_SIZE);  
            label[i].setText("" + TEXT.charAt(character));  
            label[i].setForeground(new Color(0, 255 - (j * 5), 0));       
           for (int k = 0; k < NUMBER_OF_REPEATS; k++) {  
               int character_initial = random.nextInt(TEXT.length());  
               random_x[k] = random.nextInt(panel.getWidth() / FONT_SIZE) - 1;  
                label[k] = new JLabel("" + TEXT.charAt(character_initial));  
                panel.add(label[k]);  
                label[k].setFont(new Font("monospaced", Font.PLAIN, FONT_SIZE));  
               label[k].setForeground(new Color(0, 255, 0));  
               Color colour = label[k].getForeground();  
               if (colour.getGreen() <= 80) {  
                    panel.remove(label[k]);  
                   k = (panel.getHeight() / FONT_SIZE) * 2;  
                }  
            }  
        }  
        // pause between each character  
        try {  
            Thread.sleep(15);  
        } catch (Exception e) {  
        }  
     }  
  }  
        }  
  public static void main(String[] args) {  
      matrixRain frame = new matrixRain();  
      frame.setVisible(true);  
      frame.setSize(600, 400);  
     frame.setResizable(false);  
     frame.setMinimumSize(new Dimension(300, 200));  
      frame.setLocationRelativeTo(null);  
     frame.setTitle("Matrix Code Emulator by Ricco");  
     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);     
      frame.scroll();  
  }  
}  


 *
 * @author  Junior
 */
public class matrixteste extends javax.swing.JFrame { este trecho não está em cinza
/** Creates new form matrixteste */
public matrixteste() { initComponents(); este trecho não está em cinza
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")   [b] este trecho não está em cinza[/b]
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() { este trecho não está em cinza, de public até a última chave
public void run() {
new matrixteste().setVisible(true);
}
});
}
// Variables declaration - do not modify // End of variables declaration

}

5 Respostas

andretech

Bom dia!

Retire o inicio do comentário na linha 13:

Seu código

/**import java.awt.<em>;

import java.util.</em>;

import javax.swing.*;
Correção:

import java.awt.<em>;

import java.util.</em>;

import javax.swing.*;

Retire o autor, nas linhas 90 a 92
*

B

Você ta querendo o código pronto!, não precisa abrir 100 tópicos. To olhando os 100 tópicos que você abriu e seu código num muda nada.

oljr35

por favor me esculpe professor más o Senhor pode repetir más claramente?

oljr35

Professor não se rogue em me ajudar, só não entendí a frase aposente o início, mostre que parte é? obrigado no aguardo.

oljr35

Professor o Senhor desistiu de mim? se for continuar me ajudando mande resposta. faça assim: mande todas as alterações que eu tenho que faze, e qualquer dúvida lhe aviso. Ps: diga até o lugar onde eu insiro o código no projeto depois de criado o projeto.
Muitissimo Obrigado.

Criado 1 de agosto de 2013
Ultima resposta 1 de ago. de 2013
Respostas 5
Participantes 3