Very thans to all.
that's is another sample:
//File FrmTaoLogin.java
package tao;
import javax.swing.*;
import java.awt.*;
import tao.icons.*;
public class FrmTaoLogin extends JFrame {
private Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
private JPanel
pnlMain = new JPanel(),
pnlLeft = new JPanel(),
pnlRight = new JPanel();
private JLabel
lbIco = new JLabel(),
lbLogin = new JLabel("Login"),
lbPassword = new JLabel("Password");
public FrmTaoLogin(String caption, int width, int height) {
super(caption);
int x = (dim.width - width) >> 1;
int y = (dim.height - height) >> 1;
lbIco.setIcon(Nuvola.actions.lll_kgpg_identity);
pnlLeft.setPreferredSize(new Dimension(60,height));
pnlLeft.setMinimumSize(new Dimension(60,height));
pnlLeft.add(lbIco, BorderLayout.CENTER);
pnlLeft.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 8));
pnlRight.setPreferredSize(new Dimension(60,height));
pnlRight.setMinimumSize(new Dimension(60,height));
pnlRight.setLayout(new GridLayout(2,1));
pnlRight.add(lbPassword);
pnlRight.setBorder(BorderFactory.createEtchedBorder());
pnlMain.setLayout(new BorderLayout());
pnlMain.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
pnlMain.add(pnlLeft,BorderLayout.WEST);
pnlMain.add(pnlRight,BorderLayout.CENTER);
pnlMain.invalidate();
this.setContentPane(pnlMain);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setResizable(false);
this.setLocation(x, y);
this.setSize(width, height);
}
}
//File vector.java
import tao.FrmTaoLogin;
import javax.swing.*;
public class VectorApp {
public FrmTaoLogin FrmLogin;
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
FrmTaoLogin FrmLogin = new FrmTaoLogin("Login", 300,150);
FrmLogin.setVisible(true);
}
});
}
}
Result of this code:
When I am adding pack to end of constructor result is:
When I am remark //this.setResizable(false); result not change, but when i am resizing window manually result is:
When I remark:
//pnlRight.add(lbPassword); result is:
Any idea?
Thaks a lot.