1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    1
    Vote Rating
    0
    TheMrCego is on a distinguished road

      0  

    Default get Screen size to center Windows Login

    get Screen size to center Windows Login


    hi!

    i'm developing a chat for Software Engineering homework. we're learning GWT and we're using GXT to develop.

    first part of homework is "develop a chat login". I'm using "Windows form" and I almost finished the login windows. but I want to get screen size to situate this windows on center of any screen size. I know I should get browser screen, but I dont know how, least situate the windows on center.

    here my code source:

    Code:
    package com.mycompany.project.client;
    
    import com.extjs.gxt.ui.client.widget.MessageBox;
    
    
    public class LoginWindows extends Window {
        private LabelField lblfldUsername;
        private LabelField lblfldPassword;
        
        public LoginWindows() {
    
    
            setResizable(false);
            setHeading("Ventana de Login");
            CenterLayout centerLayout = new CenterLayout();
            centerLayout.setExtraStyle("centered.DialogLogin");
            setLayout(centerLayout);
            
            FlexTable flexTable = new FlexTable();
            add(flexTable);
            flexTable.setSize("321px", "110px");
            
            final TextField cajaUse = new TextField();
            cajaUse.setMinLength(4);
            cajaUse.getMessages().setMinLengthText("Debe Ser Mayor de 3 Caracter");
            
            lblfldUsername = new LabelField("Nombre de Usuario:");
            flexTable.setWidget(0, 0, lblfldUsername);
            lblfldUsername.setSize("150", "22");
            cajaUse.setEmptyText("Usuario");
            flexTable.setWidget(0, 2, cajaUse);
            
            final TextField cajaPas = new TextField();
            cajaPas.setMinLength(5);
            cajaPas.getMessages().setMinLengthText("Debe Ser Mayor de 5 Caracteres");
            
            lblfldPassword = new LabelField("Contrase\u00F1a:");
            flexTable.setWidget(1, 0, lblfldPassword);
            cajaPas.setPassword(true);
            flexTable.setWidget(1, 2, cajaPas);
            
            CheckBox checkBox = new CheckBox();
            flexTable.setWidget(2, 1, checkBox);
            checkBox.setSize("17px", "16px");
            checkBox.setBoxLabel("");
            checkBox.setHideLabel(true);
            
            Text txtRecordarEnEste = new Text("Recordar En Este PC");
            flexTable.setWidget(2, 2, txtRecordarEnEste);
            flexTable.getCellFormatter().setHorizontalAlignment(2, 1, HasHorizontalAlignment.ALIGN_CENTER);
            flexTable.getRowFormatter().setVerticalAlign(2, HasVerticalAlignment.ALIGN_MIDDLE);
            flexTable.getCellFormatter().setHorizontalAlignment(0, 2, HasHorizontalAlignment.ALIGN_CENTER);
            flexTable.getCellFormatter().setVerticalAlignment(0, 2, HasVerticalAlignment.ALIGN_MIDDLE);
            flexTable.getCellFormatter().setHorizontalAlignment(3, 2, HasHorizontalAlignment.ALIGN_CENTER);
            flexTable.getCellFormatter().setVerticalAlignment(3, 2, HasVerticalAlignment.ALIGN_MIDDLE);
            flexTable.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER);
            flexTable.getCellFormatter().setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_CENTER);
            flexTable.getCellFormatter().setHorizontalAlignment(3, 1, HasHorizontalAlignment.ALIGN_CENTER);
            flexTable.getCellFormatter().setHorizontalAlignment(3, 0, HasHorizontalAlignment.ALIGN_CENTER);
            flexTable.getCellFormatter().setVerticalAlignment(1, 2, HasVerticalAlignment.ALIGN_MIDDLE);
            flexTable.getCellFormatter().setHorizontalAlignment(1, 2, HasHorizontalAlignment.ALIGN_CENTER);
            flexTable.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE);
            flexTable.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);
            flexTable.getCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_MIDDLE);
            flexTable.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER);
            
            final Button btnReset = new Button("Reset");
            btnReset.addListener(Events.Select, new Listener<ButtonEvent>() {
                public void handleEvent(ButtonEvent e) {
                    cajaUse.clear();
                    cajaPas.clear();
                }
            });
            flexTable.setWidget(3, 0, btnReset);
            btnReset.setSize("93px", "null");
            
            Button btnIngresa = new Button("Ingresa");
            btnIngresa.setWidth("93px");
            btnIngresa.addListener(Events.Select, new Listener<ButtonEvent>() {
                public void handleEvent(ButtonEvent e) {
                    cajaUse.selectAll();
                    cajaPas.selectAll();
                    
                    if((cajaUse.getSelectionLength()==0) && (cajaPas.getSelectionLength()==0)) {
                        MessageBox.alert("Error", "Inserte Username & Password!", null);
                    }
                    else if (cajaUse.getSelectionLength()==0) {
                        MessageBox.alert("Error", "Inserte Username", null);
                    }
                    else if (cajaPas.getSelectionLength()==0){
                        MessageBox.alert("Error", "Inserte Password!", null);
                    }
                    else if (!(cajaUse.getSelectionLength()>=1 && cajaUse.getSelectionLength()<4) 
                            && !(cajaPas.getSelectionLength()>=1 && cajaPas.getSelectionLength()<5)){
                        final MessageBox menAct = MessageBox.progress("Espere...", "Estamos Comprobando Acceso, Espere Un Momento...", "Cargando...");
                        final ProgressBar barraAct = menAct.getProgressBar();
                        barraAct.setStyleName("ProgressBar");
                        Timer t = new Timer() {
                            float i;
                            @Override
                            public void run() {
                                 barraAct.updateProgress(i / 100, (int) i + "% Completado");
                                 i += 5;
                                 if (i > 100) {
                                     cancel();
                                     menAct.close();
                                     MessageBox.info("Bienvenido!", "Ingreso Correcto!", null); 
                                 }
                               
                            }
                        };
                        t.scheduleRepeating(300);
                    }
                    
                }    
            });
            flexTable.setWidget(3, 2, btnIngresa);
            btnIngresa.setWidth("93px");
            btnIngresa.setWidth("93px");
        }
        
    
    
    }
    any help is welcome! regards!

    (sorry for my english )

  2. #2
    Sencha User
    Join Date
    Jun 2011
    Location
    Iasi, Romania
    Posts
    144
    Vote Rating
    0
    catalin.ciobanu is on a distinguished road

      0  

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi