在全屏菜單的時候不就是這樣的:爲什麼在做全屏JFrames和按鈕不居中?
然而,當我全屏沒有組織:
有人能幫助我嗎?
我不知道擺動控件是如何集中在窗體上的。
謝謝。
CODE
登錄表單
String sql="select * from logins where username=? and password=?";
try{
pst=(PreparedStatement) conexao.prepareStatement(sql);
pst.setString(1, jTUser.getText());
pst.setString(2, jPass.getText());
rs=pst.executeQuery();
if(rs.next()){
String idTipoLogin = rs.getString("idTipoLogin");
if (idTipoLogin.equals("Administrador")) {
jTMainMenuAdmin ah = new jTMainMenuAdmin();
ah.setExtendedState(JFrame.MAXIMIZED_BOTH);
ah.setVisible(true);
}
MAIN MENU FORM
public class jTMainMenuAdmin extends javax.swing.JFrame {
Connection conexao = null;
PreparedStatement pst= null;
ResultSet rs = null;
public jTMainMenuAdmin() throws SQLException {
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
initComponents();
setTitle();
setIcon();
setDefaultCloseOperation(jTMainMenuAdmin.DO_NOTHING_ON_CLOSE);
conexao=(Connection) CriaConexao.getConexao();
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
try {
new jTMainMenuAdmin().setVisible(true);
} catch (SQLException ex) {
Exceptions.printStackTrace(ex);
}
}
});
}
我們能看到一些代碼嗎?你使用的是什麼佈局管理器?你在調用revalidate()嗎? – Revive
@ I-LOVE-2-REVIVE您不需要在調整大小時手動調用重新驗證...但是,在計算佈局問題時,實際查看一些佈局代碼會很有用 – Ordous
感謝所有人的回覆。我用一些代碼編輯我的問題。我希望能幫助你擺脫我的懷疑。 – rpirez