Olá a todos,
sou novo no java e estou tentando criar a minha primeira aplicação grafica com swing, preciso criar um menu superior mas não estou conseguindo, o codigo compila mas na hora de executar simplismente meu JFrame está vazio, aceito qualquer dica, “conselho” inclusive sobre outras alternativas e melhores convenções de codigo do que as que eu utilizo. se alguem poder me ajudar agradeço desde já.
[code]
import java.awt.Color;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
public class Home {
private JFrame window = new JFrame();
private JMenuBar menuSuperior = new JMenuBar();
private JMenu cadastrar = new JMenu(“cadastrar”);
private JPanel panel = new JPanel();
private JMenuItem cadastrarCliente = new JMenuItem(“Cadastrar Cliente”);
// Constructor
public Home() {
this.build();
}
// Getters Setters
public JFrame getWindow() {
return this.window;
}
public JMenu getCadastrar() {
return this.cadastrar;
}
public void build() {
this.getWindow().setTitle("C.O.T.A");
this.getWindow().setSize(800, 700);
this.getWindow().setVisible(true);
this.getWindow().setResizable(false);
this.getWindow().getContentPane().setLayout(null);
this.getWindow().setLocation(50,10);
this.getWindow().setBackground(Color.WHITE);
this.getWindow().setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.getWindow().setJMenuBar(menuSuperior);
this.getWindow().add(panel);
this.getWindow().add(cadastrar);
this.getCadastrar().add(cadastrarCliente);
}
}[/code]