/** * Constructs the title bar. * * @param closeBtn flag indicating the existence of a close button * @param maximizeBtn flag indicating the existence of a maximize button * @param minimizeBtn flag indicating the existence of a minimize button */ protected void buildTitleBar(boolean closeBtn, boolean maximizeBtn, boolean minimizeBtn) { titleBar.setLayoutManager(new RowLayout(true)); title = new Label(); titleBar.addWidget(title); title.setText("Frame"); if (minimizeBtn) { buildMinimizeButton(); } if (maximizeBtn) { buildMaximizeButton(); } if (closeBtn) { buildCloseButton(); } }
/** * Creates a new <code>ConnectionWindow</code>. * * @param closeBtn if this Window has a close button */ public ConnectionWindow(boolean closeBtn) { super(closeBtn, false, false, true); // FIXME: change this soon this.setupTheme(ConnectionWindow.class); setSize(250, 250); setTitle("Connection Window"); ((Container) getContentContainer()).setLayoutManager(new FormLayout()); addressContainer = FengGUI.createContainer(getContentContainer()); addressContainer.getAppearance().add(new TitledBorder("Address")); FormData fd = new FormData(); fd.left = new FormAttachment(0, 0); fd.right = new FormAttachment(100, 0); fd.top = new FormAttachment(100, 0); addressContainer.setLayoutData(fd); addressContainer.setLayoutManager(new GridLayout(2, 2)); Label l1 = FengGUI.createLabel(addressContainer, "Address:"); addressTextField = FengGUI.createTextField(addressContainer); addressTextField.updateMinSize(); FengGUI.createLabel(addressContainer, "Port:"); portTextField = FengGUI.createTextField(addressContainer); portTextField.setRestrict(TextEditor.RESTRICT_NUMBERSONLY); portTextField.setMaxCharacters(8); portTextField.updateMinSize(); portTextField.setText("80"); loginContainer = FengGUI.createContainer(getContentContainer()); loginContainer.getAppearance().add(new TitledBorder("Login")); fd = new FormData(); fd.left = new FormAttachment(0, 0); fd.right = new FormAttachment(100, 0); fd.top = new FormAttachment(addressContainer, 0); loginContainer.setLayoutData(fd); loginContainer.setLayoutManager(new GridLayout(2, 2)); Label l3 = FengGUI.createLabel(loginContainer, "Name:"); loginNameTextField = FengGUI.createTextField(loginContainer); loginNameTextField.updateMinSize(); FengGUI.createLabel(loginContainer, "Password:"******"Connect"); connectButton.getAppearance().setMargin(new Spacing(2, 2)); cancelButton = FengGUI.createButton(getContentContainer(), "Cancel"); cancelButton.getAppearance().setMargin(new Spacing(2, 2)); statusLabel = FengGUI.createLabel(getContentContainer(), "Say something..."); statusLabel.getAppearance().setAlignment(Alignment.MIDDLE); fd = new FormData(); fd.left = new FormAttachment(0, 0); fd.right = new FormAttachment(100, 0); fd.bottom = new FormAttachment(connectButton, 0); fd.top = new FormAttachment(loginContainer, 0); statusLabel.setLayoutData(fd); fd = new FormData(); fd.left = new FormAttachment(0, 0); fd.right = new FormAttachment(50, 0); fd.bottom = new FormAttachment(0, 0); cancelButton.setLayoutData(fd); fd = new FormData(); fd.left = new FormAttachment(50, 0); fd.right = new FormAttachment(100, 0); fd.bottom = new FormAttachment(0, 0); connectButton.setLayoutData(fd); cancelButton.addButtonPressedListener( new IButtonPressedListener() { public void buttonPressed(ButtonPressedEvent e) { close(); } }); layout(); }