-4
Follows code of the Telaprincipal class
package telas;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.Window.Type;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class TelaPrincipal extends JFrame {
private JPanel contentPane;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
TelaPrincipal frame = new TelaPrincipal();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public TelaPrincipal() {
setTitle("Cadastro Geral v 1.0");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
setExtendedState(MAXIMIZED_BOTH);
setDefaultCloseOperation(EXIT_ON_CLOSE);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JButton btnCadastrar = new JButton("CADASTRAR");
btnCadastrar.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new TelaCadastro().setVisible(true);
}
});
btnCadastrar.setBounds(91, 135, 89, 23);
contentPane.add(btnCadastrar);
}
}
Telacadastro class
package telas;
import java.awt.EventQueue;
public class TelaCadastro extends JInternalFrame {
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
TelaCadastro frame = new TelaCadastro();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public TelaCadastro() {
setBounds(100, 100, 450, 300);
}
}
Even so is not calling the registration screen.
– David_Ferreira
An error occurs?
– Giovani
No, just the other screen doesn’t appear
– David_Ferreira