phamtranquocviet
20 Oct 2008, 3:41 PM
Hi,
How do you center a dialog box right in the middle of the page, and it automatically adjusts when the monitor size changes?
I tried various styles I got from Google in the place holder (<div id="login" style="tries_from_google"></div>) of my dialog, none works.
Here is my code:
import com.extjs.gxt.ui.client.widget.Dialog;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
public class Login extends Dialog
{
private TextField<String> userName;
private TextField<String> password;
public Login()
{
makeGui();
}
private void makeGui()
{
init();
makeForm();
makeUserName();
makePassword();
}
private void makePassword()
{
password = new TextField<String>();
password.setFieldLabel("Password");
password.setAllowBlank(false);
add(password);
}
private void makeUserName()
{
userName = new TextField<String>();
userName.setFieldLabel("Username");
userName.setAllowBlank(false);
add(userName);
}
private void makeForm()
{
FormLayout layout = new FormLayout();
layout.setLabelWidth(90);
layout.setDefaultWidth(155);
setLayout(layout);
}
private void init()
{
setHeading("Login");
setButtons("");
setResizable(false);
setClosable(false);
setDraggable(false);
}
}
===========================================
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
public class Main implements EntryPoint
{
public void onModuleLoad()
{
Login login = new Login();
login.show();
RootPanel.get("login").add(login);
}
}
I also tried login.center(), but it does not work.
Thanks.
How do you center a dialog box right in the middle of the page, and it automatically adjusts when the monitor size changes?
I tried various styles I got from Google in the place holder (<div id="login" style="tries_from_google"></div>) of my dialog, none works.
Here is my code:
import com.extjs.gxt.ui.client.widget.Dialog;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
public class Login extends Dialog
{
private TextField<String> userName;
private TextField<String> password;
public Login()
{
makeGui();
}
private void makeGui()
{
init();
makeForm();
makeUserName();
makePassword();
}
private void makePassword()
{
password = new TextField<String>();
password.setFieldLabel("Password");
password.setAllowBlank(false);
add(password);
}
private void makeUserName()
{
userName = new TextField<String>();
userName.setFieldLabel("Username");
userName.setAllowBlank(false);
add(userName);
}
private void makeForm()
{
FormLayout layout = new FormLayout();
layout.setLabelWidth(90);
layout.setDefaultWidth(155);
setLayout(layout);
}
private void init()
{
setHeading("Login");
setButtons("");
setResizable(false);
setClosable(false);
setDraggable(false);
}
}
===========================================
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
public class Main implements EntryPoint
{
public void onModuleLoad()
{
Login login = new Login();
login.show();
RootPanel.get("login").add(login);
}
}
I also tried login.center(), but it does not work.
Thanks.