Java e Swing

1 resposta
T

eu tenho o seguinte código:

import java.awt.;
import javax.swing.
;

public class MosaicExample extends JFrame {

private JPanel botoes;
private JPanel barraStatus;
private JScrollPane painelTexto;
private JButton novo, limpar, salvar, sair;
private JLabel mensagem, relogio;
private JTextArea areaTexto;

public MosaicExample() {

  super("Mosaic Example");
  novo = new JButton("Novo");
  limpar = new JButton("Limpar");
  mensagem = new JLabel("Mensagem: ");
  
  relogio = new JLabel("Data/Hora: "+ new java.util.Date().toString());
  barraStatus = new JPanel(new FlowLayout());
  areaTexto = new JTextArea("Digite seu texto aqui: ", 20, 40);

  painelTexto = new JScrollPane (areaTexto, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
	JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

}

public void ini() {

  setForeground(Color.black);
  setBackground(new Color(192, 192, 192));
  setLocation(200,130);
  setSize(640,480);

  getContentPane().setLayout(new BorderLayout());

  //Definição da área de botões

  botoes.add(novo);
  botoes.add(limpar);

  barraStatus.add(mensagem);
  barraStatus.add(relogio);

  getContentPane().add(botoes, BorderLayout.NORTH);

  getContentPane().add(painelTexto, BorderLayout.CENTER);
  getContentPane().add(barraStatus, BorderLayout.SOUTH);

  setVisible(true);  

}

  public static void main(String args[]){


  new MosaicExample().init();

  }

}

mas ele acusa o seguinte erro:



1 Resposta

C
public void ini() {

setForeground(Color.black);
setBackground(new Color(192, 192, 192));
setLocation(200,130);
setSize(640,480);

getContentPane().setLayout(new BorderLayout());

//Definição da área de botões

botoes.add(novo);
botoes.add(limpar);

barraStatus.add(mensagem);
barraStatus.add(relogio);

getContentPane().add(botoes, BorderLayout.NORTH);

getContentPane().add(painelTexto, BorderLayout.CENTER);
getContentPane().add(barraStatus, BorderLayout.SOUTH);

setVisible(true);

}

O seu método é ini e não init

Criado 19 de maio de 2005
Ultima resposta 19 de mai. de 2005
Respostas 1
Participantes 2