Erro no código matrix

ola Programadores do GUJ!!!
venho até voces para obter ajuda estou com um código que faz o efeito matrix, aquele das letrinhas caindo… bom o código está quase todo bem a não ser por uma linha que esta em vermelho. é esta linha que está abaixo.

public class ExemploMatrix extends JFrame {

abaixo segue o código inteiro, gradeço a ajuda Obrigado e fiquem com DEUS.

/*

  • matrix.java
  • Created on 28 de Julho de 2013, 17:56
    */

package guj;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Random;

import javax.swing.JFrame;
import javax.swing.JTextArea;
import javax.swing.SwingUtilities;
import javax.swing.Timer;

public class ExemploMatrix extends JFrame {
private JTextArea textArea;
private Timer timer;

/**//**
 * Launch the application.
 */
public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                ExemploMatrix frame = new ExemploMatrix();
                frame.setVisible(true);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

/**
 * Create the frame.
 */
public ExemploMatrix() {

    initComponents();
}

char[] matrix = "?????? ????????? ???? ???????????? ? ??????????????".toCharArray();

int step;
Random r = new Random();

public void showMatrixEffect() {
    FontMetrics fm = getTextArea().getFontMetrics(getTextArea().getFont());
    int starWidth = SwingUtilities.computeStringWidth(fm, "*");
    int nColumns = getWidth() / starWidth;
    int nRows = getHeight() / fm.getHeight();
    StringBuilder sbText = new StringBuilder();
    for (int r = 0; r < nRows; ++r) {
        for (int c = 0; c < nColumns; ++c) {
            sbText.append(matrix[(step + r + c * nRows) % matrix.length]);
        }
        sbText.append("\n");
    }
    getTextArea().setText(sbText.toString());
    step = r.nextInt(100);
}

private void initComponents() {
    setBounds(100, 100, 450, 300);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    getContentPane().add(getTextArea(), BorderLayout.CENTER);
    getTimer().start();
}

private JTextArea getTextArea() {
    if (textArea == null) {
        textArea = new JTextArea();
        textArea.setForeground(Color.GREEN);
        textArea.setBackground(Color.BLACK);
        textArea.setEditable(false);
        textArea.setFont(new Font("Monospaced", Font.BOLD, 12));
    }
    return textArea;
}

private Timer getTimer() {
    if (timer == null) {
        timer = new Timer(100, new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                showMatrixEffect();
            }
        });
    }
    return timer;
}

}

/**
*

  • @author Junior
    */
    public class matrix extends javax.swing.JFrame {

    /** Creates new form matrix */
    public matrix() {
    initComponents();
    }

    /** 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”)
      //
      private void initComponents() {

      setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

      javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
      getContentPane().setLayout(layout);
      layout.setHorizontalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGap(0, 400, Short.MAX_VALUE)
      );
      layout.setVerticalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGap(0, 300, Short.MAX_VALUE)
      );

      pack();
      }//

    /**

    • @param args the command line arguments
      */
      public static void main(String args[]) {
      java.awt.EventQueue.invokeLater(new Runnable() {
      public void run() {
      new matrix().setVisible(true);
      }
      });
      }

    // Variables declaration - do not modify
    // End of variables declaration

Beleza, até que enfim você se cadastrou aqui no GUJ “clássico”. Aqui é melhor para poder ensinar as coisas passo-a-passo (no GUJ Respostas é melhor para quando você tem uma pergunta ‘fechada’ com uma resposta ‘fechada’, o que obviamente não é seu caso).

Pois bem:

a) A primeira coisa a fazer é aprender a usar o botãozinho “code” para postar eu código (do jeito que ficou não dá para entender).
b) Poderia pelo menos dizer qual é o erro que está dando? Não adianta só dizer “dá uma linha vermelha”. É a mesma coisa que você ir ao médico e dizer “doutor, está doendo tudo”. Se você não disser pelo menos que tipo de dor está tendo, ele não pode fazer muita coisa.

Só para não ser muito rude com você, vou dizer qual é o seu problema: você copiou o código sem pensar, e não viu que há duas linhas:

package guj;

e

public class ExemploMatrix

A primeira linha indica que o fonte onde ela precisa ficar está em um pacote, e a segunda linha indica que o fonte precisa ficar em um arquivo com o mesmo nome da classe.

Ou você muda o nome do arquivo para ExemploMatrix.java, ou então você muda o nome da classe (e dos seus respectivos construtores) para o nome que você quer dar para a classe.

Professor eu encontrei alinha que diz exemplo matrix, só não entendí o que modifica será que o senhor pode me dar outroe xemplo como se eu tivece 15 anos. e não se rogue não o senhor não é rude tem postura.[code]public class ExemploMatrix extends JFrame {] linha vermelha abaixo do trecho.

[/code]/*

  • matrix.java
  • Created on 28 de Julho de 2013, 17:56
    */

package ExemploMatrix;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Random;

import javax.swing.JFrame;
import javax.swing.JTextArea;
import javax.swing.SwingUtilities;
import javax.swing.Timer;

public class ExemploMatrix extends JFrame {
private JTextArea textArea;
private Timer timer;

/**//**
 * Launch the application.
 */
public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                ExemploMatrix frame = new ExemploMatrix();
                frame.setVisible(true);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

/**
 * Create the frame.
 */
public ExemploMatrix() {

    initComponents();
}

char[] matrix = "?????? ????????? ???? ???????????? ? ??????????????".toCharArray();

int step;
Random r = new Random();

public void showMatrixEffect() {
    FontMetrics fm = getTextArea().getFontMetrics(getTextArea().getFont());
    int starWidth = SwingUtilities.computeStringWidth(fm, "*");
    int nColumns = getWidth() / starWidth;
    int nRows = getHeight() / fm.getHeight();
    StringBuilder sbText = new StringBuilder();
    for (int r = 0; r < nRows; ++r) {
        for (int c = 0; c < nColumns; ++c) {
            sbText.append(matrix[(step + r + c * nRows) % matrix.length]);
        }
        sbText.append("\n");
    }
    getTextArea().setText(sbText.toString());
    step = r.nextInt(100);
}

private void initComponents() {
    setBounds(100, 100, 450, 300);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    getContentPane().add(getTextArea(), BorderLayout.CENTER);
    getTimer().start();
}

private JTextArea getTextArea() {
    if (textArea == null) {
        textArea = new JTextArea();
        textArea.setForeground(Color.GREEN);
        textArea.setBackground(Color.BLACK);
        textArea.setEditable(false);
        textArea.setFont(new Font("Monospaced", Font.BOLD, 12));
    }
    return textArea;
}

private Timer getTimer() {
    if (timer == null) {
        timer = new Timer(100, new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                showMatrixEffect();
            }
        });
    }
    return timer;
}

}

/**
*

  • @author Junior
    */
    public class matrix extends javax.swing.JFrame {

    /** Creates new form matrix */
    public matrix() {
    initComponents();
    }

    /** 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”)
      //
      private void initComponents() {

      setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

      javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
      getContentPane().setLayout(layout);
      layout.setHorizontalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGap(0, 400, Short.MAX_VALUE)
      );
      layout.setVerticalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGap(0, 300, Short.MAX_VALUE)
      );

      pack();
      }//

    /**

    • @param args the command line arguments
      */
      public static void main(String args[]) {
      java.awt.EventQueue.invokeLater(new Runnable() {
      public void run() {
      new matrix().setVisible(true);
      }
      });
      }

    // Variables declaration - do not modify
    // End of variables declaration

Diga pelo menos que mensagem o compilador mostrou para a tal linha vermelha.
É algo em inglês, certo?

Pelo menos tente copiar a mensagem (não ponha um print de tela, porque não posso visualizar imagens aqui, já que estou em uma empresa que não deixa visualizar imagens de vários sites).

O código eu conheço e não precisa postá-lo, porque fui eu que o escrevi.

E quanto à idade, não sei se você tem 15 anos, 20 anos, 30 anos ou 50 anos. Não sei nem se você é homem ou mulher, porque as imagens e fotos não aparecem aqui no meu browser porque são bloqueadas aqui na empresa.

Vou tratar você como alguém que tem 5 meses de Java e deveria já ter alguma experiência na hora de entender as mensagens de erro.

[code]SEGUE ABAIXO A MENSAGEM

init:
deps-jar:
Compiling 1 source file to C:\Documents and Settings\Junior\Desktop\PROJETO SECRETO MACACOS\PROJETO DE ESCRITORIO CONTABIL\Projetos\Siscontábil\build\classes
warning: [options] bootstrap class path not set in conjunction with -source 1.5
C:\Documents and Settings\Junior\Desktop\PROJETO SECRETO MACACOS\PROJETO DE ESCRITORIO CONTABIL\Projetos\Siscontábil\src\siscontabil\matrix.java:23: error: class ExemploMatrix is public, should be declared in a file named ExemploMatrix.java
public class ExemploMatrix extends JFrame {
1 error
1 warning
FALHA NA CONSTRUÇÃO (tempo total: 2 segundos)

Ps:no inicio neste trecho está em cinza é normal? favor verificar.

/*

  • matrix.java
  • Created on 28 de Julho de 2013, 17:56
    */

me desculpe sou homeme e tenho 35 anos por gentileza o Senhor pode me ajudar com mais exemplos?

Professor o Senhor vai poder me ajudar com minha dúvida?

Lendo a parte relevante da mensagem de erro (com cinco meses de Java você deveria ter um pouco mais de prática de localizar a parte que interessa em uma mensagem de erro, não?)

Tradução:

“A classe ExemploMatrix é pública e deve ser declarada em um arquivo com o nome ExemploMatrix.java”

Siga a recomendação da mensagem de erro. Ela diz que é para você mudar o nome do arquivo (se não me engano, era Matrix.java, certo? ) para “ExemploMatrix.java”.