package ergonosc;
import java.awt.;
import java.awt.event.;
import javax.swing.;
import java.sql.;
public class framebasico extends JDialog {
JPanel contentPane;
BorderLayout borderLayout1 = new BorderLayout();
Connection conn;
// construtor do frame
public framebasico(Connection c) {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
framebasicoInit();
conn = c;
}
catch (Exception e) {
e.printStackTrace();
}
}
//Centraliza frame
public void center(){
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = this.getSize();
if (frameSize.height > screenSize.height)
frameSize.height = screenSize.height;
if (frameSize.width > screenSize.width)
frameSize.width = screenSize.width;
this.setLocation((screenSize.width - frameSize.width) / 2,(screenSize.height - frameSize.height) / 2);
this.setVisible(true);
}
// Inicialização dos componentes
private void framebasicoInit() throws Exception {
contentPane = (JPanel) this.getContentPane();
contentPane.setLayout(borderLayout1);
this.setEnabled(true);
this.setModal(true);
this.setResizable(false);
}
}
package ergonosc;
import java.awt.;
import java.awt.event.;
import javax.swing.;
import java.sql.;
public class teste extends framebasico {
// construtor do frame
Connection conn;
public teste() {
super.framebasico(conn);
}
}