List of usage examples for com.jgoodies.forms.layout CellConstraints CENTER
Alignment CENTER
To view the source code for com.jgoodies.forms.layout CellConstraints CENTER.
Click Source Link
From source file:presentation.timer.GuiBoxTimerPanel.java
License:Open Source License
private void initialize() { FormLayout layout = new FormLayout("f:320:grow, 10, 100:grow, 160:grow, 7, pref", // columns "pref, t:220:grow, pref, 10, pref, 90:grow, 90:grow, 20"); // rows PanelBuilder builder = new PanelBuilder(this, layout); builder.setDefaultDialogBorder();//from ww w .j a v a 2 s . c om CellConstraints cc = new CellConstraints(); builder.addSeparator(ControlMain.getProperty("label_recordTimer"), cc.xyw(1, 1, 4)); builder.add(this.getJScrollPaneRecordTimerTable(), cc.xyw(1, 2, 4)); builder.add(this.getJPanelDauerTimer(), cc.xyw(1, 3, 4, CellConstraints.CENTER, CellConstraints.TOP)); builder.addSeparator(ControlMain.getProperty("label_systemTimer"), cc.xyw(1, 5, 4)); builder.add(this.getJScrollPaneSystemTimerTable(), cc.xywh(1, 6, 4, 2)); builder.add(this.getJPanelDauerTimer2(), cc.xyw(1, 8, 4, CellConstraints.CENTER, CellConstraints.TOP)); builder.addTitle(ControlMain.getProperty("label_actRecTimer"), cc.xy(6, 1)); builder.add(this.getJPanelButtonsRecordTimer(), cc.xywh(6, 2, 1, 1, CellConstraints.FILL, CellConstraints.TOP)); builder.addTitle(ControlMain.getProperty("label_actSysTimer"), cc.xy(6, 5, CellConstraints.CENTER, CellConstraints.DEFAULT)); builder.add(this.getJPanelButtonsSystemTimer(), cc.xywh(6, 6, 1, 1, CellConstraints.CENTER, CellConstraints.TOP)); builder.add(this.getJPanelButtonsGui(), cc.xywh(6, 7, 1, 2, CellConstraints.CENTER, CellConstraints.BOTTOM)); }
From source file:se.streamsource.streamflow.client.ui.administration.surface.AccessPointView.java
License:Apache License
public AccessPointView(@Service ApplicationContext appContext, @Uses final AccessPointModel model, @Structure Module module) {// ww w . ja v a 2s. c om this.model = model; this.labels = module.objectBuilderFactory().newObjectBuilder(CaseLabelsView.class) .use(model.getLabelsModel()).newInstance(); setLayout(new BorderLayout()); setActionMap(appContext.getActionMap(this)); RefreshComponents refreshComponents = new RefreshComponents(); model.addObserver(refreshComponents); actionBinder = module.objectBuilderFactory().newObjectBuilder(ActionBinder.class).use(getActionMap()) .newInstance(); valueBinder = module.objectBuilderFactory().newObject(ValueBinder.class); actionBinder.setResourceMap(appContext.getResourceMap(getClass())); LinkValueConverter linkValueConverter = new LinkValueConverter(); FormLayout layout = new FormLayout("90dlu, 5dlu, 150:grow", "pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, " + "pref, 12dlu, pref, 2dlu, pref, 12dlu, pref, 2dlu, default:grow"); JPanel panel = new JPanel(layout); DefaultFormBuilder builder = new DefaultFormBuilder(layout, panel); builder.setBorder(Borders.createEmptyBorder(Sizes.DLUY8, Sizes.DLUX4, Sizes.DLUY2, Sizes.DLUX8)); CellConstraints cc = new CellConstraints(); MacOsUIWrapper.convertAccelerators(appContext.getActionMap(AccessPointView.class, this)); selectedProject.setFont(selectedProject.getFont().deriveFont(Font.BOLD)); selectedCaseType.setFont(selectedCaseType.getFont().deriveFont(Font.BOLD)); selectedForm.setFont(selectedForm.getFont().deriveFont(Font.BOLD)); selectedTemplate.getLabel().setFont(selectedTemplate.getLabel().getFont().deriveFont(Font.BOLD)); ActionMap am = getActionMap(); // Select project javax.swing.Action projectAction = am.get("project"); projectButton = new StreamflowButton(projectAction); projectButton.registerKeyboardAction(projectAction, (KeyStroke) projectAction.getValue(javax.swing.Action.ACCELERATOR_KEY), JComponent.WHEN_IN_FOCUSED_WINDOW); projectButton.setHorizontalAlignment(SwingConstants.LEFT); builder.add(projectButton, cc.xy(1, 1)); builder.add(valueBinder.bind("project", selectedProject, linkValueConverter), new CellConstraints(3, 1, 1, 1, CellConstraints.LEFT, CellConstraints.CENTER, new Insets(5, 0, 0, 0))); // Select case type javax.swing.Action caseTypeAction = am.get("casetype"); caseTypeButton = new StreamflowButton(caseTypeAction); caseTypeButton.registerKeyboardAction(caseTypeAction, (KeyStroke) caseTypeAction.getValue(javax.swing.Action.ACCELERATOR_KEY), JComponent.WHEN_IN_FOCUSED_WINDOW); caseTypeButton.setHorizontalAlignment(SwingConstants.LEFT); builder.add(caseTypeButton, cc.xy(1, 3)); builder.add(valueBinder.bind("caseType", selectedCaseType, linkValueConverter), new CellConstraints(3, 3, 1, 1, CellConstraints.LEFT, CellConstraints.CENTER, new Insets(5, 0, 0, 0))); // Select labels javax.swing.Action labelAction = labels.getActionMap().get("addLabel"); labelButton = new StreamflowButton(labelAction); labelButton.registerKeyboardAction(labelAction, (KeyStroke) labelAction.getValue(javax.swing.Action.ACCELERATOR_KEY), JComponent.WHEN_IN_FOCUSED_WINDOW); labelButton.setHorizontalAlignment(SwingConstants.LEFT); builder.add(labelButton, cc.xy(1, 5, CellConstraints.FILL, CellConstraints.TOP)); labels.setPreferredSize(new Dimension(500, 60)); labels.setTextBold(true); labels.setButtonRelation(labelButton); builder.add(labels, new CellConstraints(3, 5, 1, 1, CellConstraints.LEFT, CellConstraints.TOP, new Insets(5, 0, 0, 0))); // Select form javax.swing.Action formAction = am.get("form"); formButton = new StreamflowButton(formAction); formButton.registerKeyboardAction(formAction, (KeyStroke) formAction.getValue(javax.swing.Action.ACCELERATOR_KEY), JComponent.WHEN_IN_FOCUSED_WINDOW); formButton.setHorizontalAlignment(SwingConstants.LEFT); builder.add(formButton, cc.xy(1, 7, CellConstraints.FILL, CellConstraints.TOP)); // Open replace selection field value editor javax.swing.Action replaceSelectionFieldValueAction = am.get("openReplaceSelectionFieldValueEditor"); replaceSelectionFieldValueEditButton = new StreamflowButton(replaceSelectionFieldValueAction); /*replaceSelectionFieldValueEditButton.registerKeyboardAction( replaceSelectionFieldValueAction, (KeyStroke) replaceSelectionFieldValueAction .getValue( javax.swing.Action.ACCELERATOR_KEY ), JComponent.WHEN_IN_FOCUSED_WINDOW ); */ replaceSelectionFieldValueEditButton.setHorizontalAlignment(SwingConstants.RIGHT); PanelBuilder panelBuilder = new PanelBuilder(new FormLayout("150dlu,5dlu,250:grow", "pref")); panelBuilder.add(valueBinder.bind("form", selectedForm, linkValueConverter)); panelBuilder.nextColumn(2); panelBuilder.add(replaceSelectionFieldValueEditButton, new CellConstraints(3, 1, 1, 1, CellConstraints.RIGHT, CellConstraints.CENTER, new Insets(0, 0, 0, 0))); //panelBuilder.setBorder(BorderFactory.createLineBorder(Color.RED)); builder.add(panelBuilder.getPanel()/*valueBinder.bind( "form", selectedForm, linkValueConverter )*/, new CellConstraints(3, 7, 1, 1, CellConstraints.LEFT, CellConstraints.CENTER, new Insets(5, 0, 0, 0))); // Select template javax.swing.Action templateAction = am.get("template"); templateButton = new StreamflowButton(templateAction); templateButton.registerKeyboardAction(templateAction, (KeyStroke) templateAction.getValue(javax.swing.Action.ACCELERATOR_KEY), JComponent.WHEN_IN_FOCUSED_WINDOW); templateButton.setHorizontalAlignment(SwingConstants.LEFT); builder.add(templateButton, cc.xy(1, 9, CellConstraints.FILL, CellConstraints.TOP)); builder.add(valueBinder.bind("template", actionBinder.bind("removeTemplate", selectedTemplate)), new CellConstraints(3, 9, 1, 1, CellConstraints.LEFT, CellConstraints.CENTER, new Insets(3, 0, 0, 0))); builder.add(new JLabel(text(AdministrationResources.cookieExpirationHours)), cc.xy(1, 13, CellConstraints.LEFT, CellConstraints.BOTTOM)); builder.add( valueBinder.bind("cookieExpirationHours", actionBinder.bind("changeCookieExpirationHours", cookieExpiration = new JTextField())), new CellConstraints(3, 13, 1, 1, CellConstraints.FILL, CellConstraints.BOTTOM, new Insets(3, 0, 0, 0))); mailSelectionLabel.setText(text(AdministrationResources.changeMailSelectionMessage)); mailSelectionLabel.setToolTipText(text(AdministrationResources.changeMailSelectionMessageHint)); builder.add(mailSelectionLabel, cc.xy(1, 15, CellConstraints.LEFT, CellConstraints.BOTTOM)); builder.add( valueBinder.bind("mailSelectionMessage", actionBinder.bind("changeMailSelectionMessage", mailSelectionField)), new CellConstraints(3, 15, 1, 1, CellConstraints.FILL, CellConstraints.BOTTOM, new Insets(3, 0, 0, 0))); PanelBuilder signPanel = new PanelBuilder(new FormLayout("180dlu, 15dlu, 180dlu", "default:grow")); CellConstraints signPanelCc = new CellConstraints(); PanelBuilder primarySignPanel = new PanelBuilder(new FormLayout("180dlu", "pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, default:grow")); CellConstraints primaryCc = new CellConstraints(); primarySignPanel.addSeparator(text(AdministrationResources.signature_1), primaryCc.xy(1, 1)); primarySignPanel.add(valueBinder.bind("primarysign", actionBinder.bind("setSignActive1", signActive1 = new JCheckBox(text(AdministrationResources.active))), new ValueBinder.Converter<RequiredSignatureValue, Boolean>() { public Boolean toComponent(RequiredSignatureValue value) { return value != null ? value.active().get() : Boolean.FALSE; } }), primaryCc.xy(1, 3)); primarySignPanel.addLabel(text(AdministrationResources.name_label), primaryCc.xy(1, 5)); primarySignPanel.add( valueBinder.bind("primarysign", actionBinder.bind("setSignName1", signName1 = new JTextField()), new ValueBinder.Converter<RequiredSignatureValue, String>() { public String toComponent(RequiredSignatureValue value) { return value != null ? value.name().get() : ""; } }), primaryCc.xy(1, 7)); refreshComponents.enabledOn("updateprimarysign", signName1); primarySignPanel.add(new JLabel(text(AdministrationResources.description_label)), primaryCc.xy(1, 9)); primarySignPanel.add(valueBinder.bind("primarysign", actionBinder.bind("setSignDescription1", signDescription1 = new JTextField()), new ValueBinder.Converter<RequiredSignatureValue, String>() { public String toComponent(RequiredSignatureValue value) { return value != null ? value.description().get() : ""; } }), primaryCc.xy(1, 11)); refreshComponents.enabledOn("updateprimarysign", signDescription1); signPanel.add(primarySignPanel.getPanel(), signPanelCc.xy(1, 1, CellConstraints.LEFT, CellConstraints.TOP)); PanelBuilder secondarySignPanel = new PanelBuilder(new FormLayout("180dlu", "pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 12dlu, pref, 2dlu, pref, 2dlu, default:grow")); CellConstraints secondaryCc = new CellConstraints(); secondarySignPanel.addSeparator(text(AdministrationResources.signature_2), secondaryCc.xy(1, 1)); PanelBuilder secondaryOptionsPanel = new PanelBuilder(new FormLayout("70dlu,5dlu,70dlu,pref:grow", "pref")); secondaryOptionsPanel.add(valueBinder.bind("secondarysign", actionBinder.bind("setSignActive2", signActive2 = new JCheckBox(text(AdministrationResources.active))), new ValueBinder.Converter<RequiredSignatureValue, Boolean>() { public Boolean toComponent(RequiredSignatureValue value) { return value != null ? value.active().get() : Boolean.FALSE; } }), secondaryCc.xy(1, 1)); refreshComponents.enabledOn("updatesecondarysignactive", signActive2); secondaryOptionsPanel.add(valueBinder.bind("secondarysign", actionBinder.bind("setSecondMandatory", mandatory2 = new JCheckBox(text(AdministrationResources.mandatory))), new ValueBinder.Converter<RequiredSignatureValue, Boolean>() { public Boolean toComponent(RequiredSignatureValue value) { return value != null ? value.mandatory().get() : Boolean.FALSE; } }), secondaryCc.xy(3, 1)); refreshComponents.enabledOn("updatesecondarysign", mandatory2); secondarySignPanel.add(secondaryOptionsPanel.getPanel(), secondaryCc.xy(1, 3)); secondarySignPanel.add(new JLabel(text(AdministrationResources.name_label)), secondaryCc.xy(1, 5)); secondarySignPanel.add( valueBinder.bind("secondarysign", actionBinder.bind("setSignName2", signName2 = new JTextField()), new ValueBinder.Converter<RequiredSignatureValue, String>() { public String toComponent(RequiredSignatureValue value) { return value != null ? value.name().get() : ""; } }), secondaryCc.xy(1, 7)); refreshComponents.enabledOn("updatesecondarysign", signName2); secondarySignPanel.add(new JLabel(text(AdministrationResources.description_label)), secondaryCc.xy(1, 9)); secondarySignPanel.add(valueBinder.bind("secondarysign", actionBinder.bind("setSignDescription2", signDescription2 = new JTextField()), new ValueBinder.Converter<RequiredSignatureValue, String>() { public String toComponent(RequiredSignatureValue value) { return value != null ? value.description().get() : ""; } }), secondaryCc.xy(1, 11)); refreshComponents.enabledOn("updatesecondarysign", signDescription2); // Select form javax.swing.Action form2Action = am.get("setSecondForm"); form2Button = new StreamflowButton(form2Action); form2Button.registerKeyboardAction(form2Action, (KeyStroke) form2Action.getValue(javax.swing.Action.ACCELERATOR_KEY), JComponent.WHEN_IN_FOCUSED_WINDOW); form2Button.setHorizontalAlignment(SwingConstants.LEFT); refreshComponents.enabledOn("updatesecondarysign", form2Button); PanelBuilder form2ButtonPanel = new PanelBuilder(new FormLayout("70dlu, 5dlu, 150dlu:grow", "pref")); CellConstraints form2ButtonPanelCc = new CellConstraints(); form2ButtonPanel.add(form2Button, form2ButtonPanelCc.xy(1, 1, CellConstraints.FILL, CellConstraints.TOP)); form2ButtonPanel.add(valueBinder.bind("secondarysign", selectedForm2 = new JLabel(), new ValueBinder.Converter<RequiredSignatureValue, String>() { public String toComponent(RequiredSignatureValue value) { return value != null ? value.formdescription().get() : ""; } }), form2ButtonPanelCc.xy(3, 1, CellConstraints.LEFT, CellConstraints.CENTER)); secondarySignPanel.add(form2ButtonPanel.getPanel(), secondaryCc.xy(1, 13)); secondarySignPanel.add(new JLabel(text(AdministrationResources.question_label)), secondaryCc.xy(1, 17)); secondarySignPanel.add(valueBinder.bind("secondarysign", actionBinder.bind("setQuestion", formQuestion2 = new JTextField()), new ValueBinder.Converter<RequiredSignatureValue, String>() { public String toComponent(RequiredSignatureValue value) { return value != null ? value.question().get() : ""; } }), secondaryCc.xy(1, 19)); refreshComponents.enabledOn("updatesecondarysign", formQuestion2); signPanel.add(secondarySignPanel.getPanel(), signPanelCc.xy(3, 1, CellConstraints.LEFT, CellConstraints.TOP)); builder.add(signPanel.getPanel(), new CellConstraints(1, 17, 3, 1, CellConstraints.FILL, CellConstraints.FILL, new Insets(0, 0, 0, 0))); JPanel templatePanel = new JPanel(); templatePanel.setVisible(false); FormLayout templateFormLayout = new FormLayout("75dlu, 5dlu, fill:p:grow", "pref, pref, fill:p:grow, pref"); DefaultFormBuilder templateFormBuilder = new DefaultFormBuilder(templateFormLayout, templatePanel); templateFormBuilder.addSeparator(text(AdministrationResources.emailTemplates)); templateFormBuilder.nextLine(); templateFormBuilder.append(text(AdministrationResources.subject), valueBinder.bind("subject", actionBinder.bind("changeSubject", subject = new JTextField()))); templateFormBuilder.nextLine(); templateFormBuilder.append(new JScrollPane(emailTemplateList)); templateFormBuilder.append(new JScrollPane(actionBinder.bind("save", emailTemplateText))); templateFormBuilder.nextLine(); emailTemplateList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { if (emailTemplateList.getSelectedIndex() != -1) { emailTemplateText.setText(model.getAccessPointValue().messages().get() .get(emailTemplateList.getSelectedValue())); } } } }); refreshComponents.visibleOn("updatesecondarysign", templatePanel); builder.add(templatePanel, new CellConstraints(1, 19, 3, 1, CellConstraints.FILL, CellConstraints.FILL, new Insets(0, 0, 0, 0))); add(new JScrollPane(panel), BorderLayout.CENTER); new RefreshWhenShowing(this, this); }
From source file:se.streamsource.streamflow.client.ui.administration.surface.EmailAccessPointView.java
License:Apache License
public void init(@Service ApplicationContext context, @Uses final EmailAccessPointModel model) { setActionMap(context.getActionMap(this)); JPanel panel = new JPanel(); this.setViewportView(panel); this.model = model; this.labels = module.objectBuilderFactory().newObjectBuilder(CaseLabelsView.class) .use(model.createLabelsModel()).newInstance(); FormLayout layout = new FormLayout("75dlu, 5dlu, fill:p:grow", "pref, pref, pref, pref, pref, fill:p:grow, pref"); DefaultFormBuilder formBuilder = new DefaultFormBuilder(layout, panel); formBuilder.append(projectButton = new StreamflowButton(getActionMap().get("project"))); formBuilder.append(project = new JLabel()); formBuilder.nextLine();/*w w w . j a v a2 s . c o m*/ formBuilder.append(casetypeButton = new StreamflowButton(getActionMap().get("casetype"))); formBuilder.add(casetype, new CellConstraints(3, 2, 1, 1, CellConstraints.LEFT, CellConstraints.CENTER, new Insets(3, 0, 0, 0))); formBuilder.nextLine(); formBuilder.append(labelsButton = new StreamflowButton(labels.getActionMap().get("addLabel"))); formBuilder.add(labels, new CellConstraints(3, 3, 1, 1, CellConstraints.LEFT, CellConstraints.CENTER, new Insets(3, -3, 0, 0))); formBuilder.nextLine(); formBuilder.addSeparator(i18n.text(AdministrationResources.emailTemplates)); formBuilder.nextLine(); formBuilder.append(i18n.text(AdministrationResources.subject), subject = new JTextField()); formBuilder.nextLine(); formBuilder.append(new JScrollPane(emailTemplateList)); formBuilder.append(new JScrollPane(emailTemplateText)); formBuilder.nextLine(); emailTemplateList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { if (emailTemplateList.getSelectedIndex() != -1) { emailTemplateText.setText( model.getValue().messages().get().get(emailTemplateList.getSelectedValue())); } } } }); ActionBinder actionBinder = new ActionBinder(getActionMap()); actionBinder.bind("save", emailTemplateText); actionBinder.bind("changeSubject", subject); actionBinder.bind("removecasetype", casetype); new RefreshWhenShowing(this, this); }
From source file:torpedo.LoginForm.java
public LoginForm(MainFrame frame) { userNameLbl = new JLabel("Felhasznlnv:"); userName = new JTextField(20); pwdLbl = new JLabel("Jelsz:"); pwd = new JPasswordField(20); loginBtn = new JButton("Bejelentlezs"); regBtn = new JButton("Regisztrci"); errorMsgLbl = new JLabel(); errorMsgLbl.setForeground(Color.red); this.frame = frame; this.setLayout(new FormLayout("100px, 250px, 200px", "100px, 70px, 70px, 70px, 100px")); CellConstraints c = new CellConstraints(); this.add(errorMsgLbl, c.xy(2, 1, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(userNameLbl, c.xy(2, 2, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(userName, c.xy(2, 2, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(pwdLbl, c.xy(2, 3, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(pwd, c.xy(2, 3, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(loginBtn, c.xy(2, 4, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(regBtn, c.xy(2, 4, CellConstraints.RIGHT, CellConstraints.BOTTOM)); loginBtn.addMouseListener(new LoginEvent(this.frame)); regBtn.addMouseListener(new MouseAdapter() { @Override/*from w w w. j av a2 s . com*/ public void mouseClicked(MouseEvent e) { frame.showCard("regForm"); //SettingsForm s=new SettingsForm(); } }); }
From source file:torpedo.RegForm.java
public RegForm(MainFrame frame) { userNameLbl = new JLabel("Felhasznlnv:"); userName = new JTextField(20); nickNameLbl = new JLabel("Becenv:"); nickName = new JTextField(20); countryLbl = new JLabel("Orszg:"); country = new JComboBox(); pwdLbl = new JLabel("Jelsz:"); pwd = new JPasswordField(20); confPwdLbl = new JLabel("Jelsz megerstse:"); confPwd = new JPasswordField(20); errorMsgLbl = new JLabel(); errorMsgLbl.setForeground(Color.red); regBtn = new JButton("Regisztrls"); backBtn = new JButton("<< Vissza"); for (int i = 0; i < 10; i++) { country.addItem(new ComboItem("Visible String " + i, "Value " + i)); }/*from w w w.ja v a 2s . c o m*/ this.frame = frame; this.setLayout(new FormLayout("100px, 350px, 200px", "70px, 70px, 70px, 70px, 70px, 70px, 70px")); CellConstraints c = new CellConstraints(); this.add(errorMsgLbl, c.xy(2, 1, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(userNameLbl, c.xy(2, 2, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(userName, c.xy(2, 2, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(nickName, c.xy(2, 3, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(nickNameLbl, c.xy(2, 3, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(country, c.xy(2, 4, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(countryLbl, c.xy(2, 4, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(pwdLbl, c.xy(2, 5, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(pwd, c.xy(2, 5, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(confPwdLbl, c.xy(2, 6, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(confPwd, c.xy(2, 6, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(regBtn, c.xy(2, 7, CellConstraints.RIGHT, CellConstraints.BOTTOM)); this.add(backBtn, c.xy(2, 7, CellConstraints.LEFT, CellConstraints.BOTTOM)); regBtn.addMouseListener(new RegEvent(this.frame)); backBtn.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { frame.showCard("loginForm"); } }); }
From source file:torpedo.SettingsForm.java
public SettingsForm(User user) { this.user = user; ArrayList result = new ArrayList(); result = Db.getProfile();/*ww w.j ava 2 s. c o m*/ userNameLbl = new JLabel("Felhasznlnv:"); userName = new JTextField(20); nickNameLbl = new JLabel("Becenv:"); nickName = new JTextField(20); countryLbl = new JLabel("Orszg:"); country = new JComboBox(); pwdLbl = new JLabel("Jelsz:"); pwd = new JPasswordField(20); confPwdLbl = new JLabel("Jelsz megerstse:"); confPwd = new JPasswordField(20); errorMsgLbl = new JLabel(); errorMsgLbl.setForeground(Color.red); regBtn = new JButton("Regisztrls"); backBtn = new JButton("<< Vissza"); for (int i = 0; i < 10; i++) { country.addItem(new ComboItem("Visible String " + i, "Value " + i)); } this.frame = frame; this.setLayout(new FormLayout("100px, 350px, 200px", "70px, 70px, 70px, 70px, 70px, 70px, 70px")); CellConstraints c = new CellConstraints(); this.add(errorMsgLbl, c.xy(2, 1, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(userNameLbl, c.xy(2, 2, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(userName, c.xy(2, 2, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(nickName, c.xy(2, 3, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(nickNameLbl, c.xy(2, 3, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(country, c.xy(2, 4, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(countryLbl, c.xy(2, 4, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(pwdLbl, c.xy(2, 5, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(pwd, c.xy(2, 5, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(confPwdLbl, c.xy(2, 6, CellConstraints.LEFT, CellConstraints.CENTER)); this.add(confPwd, c.xy(2, 6, CellConstraints.LEFT, CellConstraints.BOTTOM)); this.add(regBtn, c.xy(2, 7, CellConstraints.RIGHT, CellConstraints.BOTTOM)); this.add(backBtn, c.xy(2, 7, CellConstraints.LEFT, CellConstraints.BOTTOM)); int result = JOptionPane.showConfirmDialog(null, this, "Test", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if (result == JOptionPane.OK_OPTION) { System.out.println("asd"); } else { System.out.println("Cancelled"); } /*regBtn.addMouseListener(new RegEvent(this.frame)); backBtn.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { frame.showCard("loginForm"); } });*/ }
From source file:trollhammer.HdVPanel.java
License:Open Source License
private void initHdVComponents() { //majChamps(); //nullPointerException quand tu nous tiens..... //Liste des objets listeObjetsPanel = new FreshPanel('x', true); //Informations adjudications prixEnCours = new JLabel(Client.client.getPrixCourant() + ".-"); infoAdjPanel = new CoolPanel("pref:grow, right:pref", "pref, pref"); nbCdMLabel = new JLabel("0"); infoAdjPanel.addLabel("Prix d'adjudication: ", new CellConstraints(1, 1)); infoAdjPanel.addC(prixEnCours, new CellConstraints(2, 1)); infoAdjPanel.addLabel("Nombre de coups de marteau: ", new CellConstraints(1, 2)); infoAdjPanel.addC(nbCdMLabel, new CellConstraints(2, 2)); //Informations sur l'objets slectionn selectPanel = new CoolPanel("pref,left:pref:grow,pref", "pref,center:pref,pref,pref,pref,fill:pref:grow"); selectPanel.setColumnGroups(new int[][] { { 1, 3 } }); imgPanel = new CoolPanel("center:pref:grow", "pref:grow,pref,pref,pref,pref:grow"); imgPanel.setRowGroups(new int[][] { { 1, 4 } }); imgPanel.setPreferredSize(new Dimension(150, 150)); imgPanel.setBorder(BorderFactory.createEtchedBorder()); imgPanel.addC(new JLabel("Image"), new CellConstraints(1, 2)); imgPanel.addC(new JLabel("non disponible"), new CellConstraints(1, 3)); nomObjetTextField = new JTextField(); nomObjetTextField.setEditable(false); descrObjetTextArea = new JTextArea(); descrObjetTextArea.setColumns(17);//from w ww .ja v a 2 s . c om descrObjetTextArea.setEditable(false); descrObjetTextArea.setWrapStyleWord(true); descrObjetTextArea.setLineWrap(true); descrObjetPane = new JScrollPane(descrObjetTextArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); descrObjetPane.setWheelScrollingEnabled(true); //selectPanel.addLabel("Image: ", new CellConstraints(1,1,3,1)); selectPanel.addC(imgPanel, new CellConstraints(2, 2, CellConstraints.CENTER, CellConstraints.CENTER)); selectPanel.addLabel("Nom : ", new CellConstraints(1, 3, 3, 1)); selectPanel.addC(nomObjetTextField, new CellConstraints(1, 4, 3, 1)); selectPanel.addLabel("Description : ", new CellConstraints(1, 5, 3, 1)); selectPanel.addC(descrObjetPane, new CellConstraints(1, 6, 3, 1)); //Salle && objet en cours... grpl = new ButtonGroup(); milieuPanel = new CoolPanel("pref:grow", "pref,pref,fill:pref:grow"); statutVentePanel = new CoolPanel("fill:pref:grow", "fill:pref:grow"); objEnCoursPanel = new CoolPanel("center:pref:grow", "pref"); statutVenteArea = new JTextArea(); statutVenteArea.setEditable(true); statutVenteArea.setWrapStyleWord(true); statutVenteArea.setLineWrap(true); statutVenteArea.setBackground(milieuPanel.getBackground()); // triche : choper la fonte d'un label statutVenteArea.setFont(nbCdMLabel.getFont()); statutVentePane = new JScrollPane(statutVenteArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); Dimension size = statutVentePane.getPreferredSize(); statutVentePane.setPreferredSize(new Dimension(size.width, 3 * size.height)); statutVentePanel.addC(statutVentePane, new CellConstraints(1, 1)); imgObjEnCoursLabel = new JLabel((ImageIcon) null, SwingConstants.CENTER); imgObjEnCoursLabel.setPreferredSize(new Dimension(55, 55)); objEnCoursPanel.addC(imgObjEnCoursLabel, new CellConstraints(1, 1)); sallePanel = new FreshPanel('y', true); milieuPanel.addC(statutVentePanel, new CellConstraints(1, 1)); milieuPanel.addC(objEnCoursPanel, new CellConstraints(1, 2)); milieuPanel.addC(sallePanel, new CellConstraints(1, 3)); //Log logPanel = new CoolPanel("fill:pref:grow", "fill:pref:grow"); logArea = new JTextArea(log); logArea.setEditable(false); logArea.setWrapStyleWord(true); logArea.setLineWrap(true); logPane = new JScrollPane(logArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); logPane.setWheelScrollingEnabled(true); this.afficher_message_encours = true; // ceci vite que la fentre de chat modifie sa taille et fasse foirer // le layout en poussant tout le bas de l'interface hors-fentre. logPane.setPreferredSize(logPane.getSize()); logPanel.addC(logPane, new CellConstraints(1, 1)); //Adjudication en cours if (Client.client.getDernierEncherisseur() == null) adjEnCours = new JLabel("Aucune..."); else if (Client.client.getDernierEncherisseur().equals(Client.session.getLogin())) adjEnCours = new JLabel("EN VOTRE FAVEUR"); else adjEnCours = new JLabel("CONTRE VOUS!"); adjPanel = new CoolPanel("fill:pref:grow", "pref,pref:grow"); adjPanel.addLabel("Adjudication en cours: ", new CellConstraints(1, 1, CellConstraints.CENTER, CellConstraints.CENTER)); adjPanel.add(adjEnCours, new CellConstraints(1, 2, CellConstraints.CENTER, CellConstraints.CENTER)); //enchre prochaineEnchere = new JLabel(Client.client.getNouveauPrix() + ".-"); encherePanel = new CoolPanel("pref:grow,right:pref,", "pref:grow,pref"); enchereButton = new JButton("Enchrir!"); enchereButton.setActionCommand("encherir"); enchereButton.addActionListener(this); encherePanel.addLabel("Prochain prix d'adjudication: ", new CellConstraints(1, 1)); encherePanel.addC(prochaineEnchere, new CellConstraints(2, 1)); encherePanel.addC(enchereButton, new CellConstraints(1, 2, CellConstraints.CENTER, CellConstraints.CENTER)); //Chat chatPanel = new CoolPanel("fill:pref:grow", "pref, pref"); chatField = new JTextField(); chatField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { chatButton.doClick(); } }); chatButton = new JButton("Envoyer"); chatButton.setActionCommand("sendchat"); chatButton.addActionListener(this); chatPanel.addC(chatField, new CellConstraints(1, 1)); chatPanel.addC(chatButton, new CellConstraints(1, 2, CellConstraints.CENTER, CellConstraints.CENTER)); //Panel des commandes cmdPanel = new CoolPanel("pref,pref,pref", "pref"); logOutButton = new JButton("Dconnecter"); logOutButton.setActionCommand("disconnect"); logOutButton.addActionListener(this); cmdPanel.addC(logOutButton, new CellConstraints(1, 1)); if (modo) { cdmButton = new JButton("Coup de Marteau"); cdmButton.setActionCommand("trollhammer"); cdmButton.addActionListener(this); cdmButton.setEnabled(false); kickButton = new JButton("Expulser"); kickButton.setActionCommand("kick"); kickButton.addActionListener(this); kickButton.setEnabled(false); cmdPanel.addC(cdmButton, new CellConstraints(2, 1)); cmdPanel.addC(kickButton, new CellConstraints(3, 1)); } }
From source file:uk.ac.ebi.caf.report.bar.MessageBar.java
License:Open Source License
public MessageBar() { super(new FormLayout("1dlu, min, 1dlu, min, 4dlu, p:grow, 1dlu", "0dlu, center:p, 0dlu")); CellConstraints cc = new CellConstraints(); label.setForeground(Color.BLACK); this.add(ButtonFactory.newCleanButton(ResourceUtility.getIcon(MessageBar.class, "close_16x16.png"), new HideMessage()), cc.xy(2, 2, CellConstraints.CENTER, CellConstraints.CENTER)); this.add(iconLabel, cc.xy(4, 2, CellConstraints.CENTER, CellConstraints.CENTER)); this.add(label, cc.xy(6, 2, CellConstraints.CENTER, CellConstraints.CENTER)); this.addMouseListener(new CopyPopup()); // set the paints ERROR_PAINT = new GradientPaint(0, 0, ERROR_LOW, 0, getPreferredSize().height / 2, ERROR_HIGH, true); WARN_PAINT = new GradientPaint(0, 0, WARN_LOW, 0, getPreferredSize().height / 2, WARN_HIGH, true); this.setVisible(false); }
From source file:uk.ac.ebi.mdk.ui.edit.reaction.ParticipantEditor.java
License:Open Source License
public ParticipantEditor() { setOpaque(false);/*from w ww . j a v a2s.c o m*/ setLayout(new FormLayout("right:p, 1dlu, p", "min, 2dlu, min, 2dlu, min")); compartment = ComboBoxFactory.newComboBox((Object[]) getCompartments()); compartment.setRenderer(new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { String desc = ((Compartment) value).getDescription(); this.setText(desc.substring(0, Math.min(desc.length(), 20))); this.setBackground(isSelected ? list.getSelectionBackground() : list.getBackground()); return this; } }); metabolite = FieldFactory.newField(12); stoichiometry = FieldFactory.newField(3); structure = LabelFactory.newLabel(""); CellConstraints cc = new CellConstraints(); add(compartment, cc.xyw(1, 1, 3)); add(structure, cc.xyw(1, 3, 3, CellConstraints.CENTER, cc.CENTER)); add(stoichiometry, cc.xy(1, 5)); add(metabolite, cc.xy(3, 5)); }
From source file:uk.ac.ebi.mnb.view.entity.metabolite.MetabolitePanel.java
License:Open Source License
/** * Builds entity specific panel/* w w w . j a v a 2 s.c om*/ */ private void buildSynopsis() { specific = PanelFactory.createInfoPanel(); specific.setLayout( new FormLayout("p:grow, 4dlu, p:grow, 4dlu, p:grow, 4dlu, p:grow", "p, 4dlu, p, 4dlu, p")); specific.add(structure, cc.xyw(1, 1, 7, CellConstraints.CENTER, CellConstraints.CENTER)); specific.add(formularViewer, cc.xyw(1, 3, 7, CellConstraints.CENTER, CellConstraints.CENTER)); specific.add(markush, cc.xy(1, 5)); specific.add(markushViewer, cc.xy(3, 5)); specific.add(markushEditor, cc.xy(3, 5)); specific.add(type, cc.xy(5, 5)); specific.add(typeViewer, cc.xy(7, 5)); specific.add(typeEditor, cc.xy(7, 5)); }