List of usage examples for com.jgoodies.forms.layout CellConstraints RIGHT
Alignment RIGHT
To view the source code for com.jgoodies.forms.layout CellConstraints RIGHT.
Click Source Link
From source file:presentation.GuiLogWindow.java
License:Open Source License
/** * This method initializes jPanelOutput/*from w w w.j a va 2s .c om*/ * * @return javax.swing.JPanel */ private JPanel getJPanelOutput() { if (jPanelOutput == null) { jPanelOutput = new JPanel(); FormLayout layout = new FormLayout("f:d:grow", //columna "f:d:grow, pref"); //rows PanelBuilder builder = new PanelBuilder(jPanelOutput, layout); CellConstraints cc = new CellConstraints(); builder.add(this.getJScrollPaneLogArea(), cc.xy(1, 1)); builder.add(this.getJButtonClearLogArea(), cc.xy(1, 2, CellConstraints.RIGHT, CellConstraints.DEFAULT)); } return jPanelOutput; }
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) {//from w w w. j a v a 2s . co m 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.workspace.cases.caselog.CaseLogListCellRenderer.java
License:Apache License
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { CaseLogEntryDTO entry = (CaseLogEntryDTO) value; JPanel renderer = new JPanel(new BorderLayout()); FormLayout rowLayout = new FormLayout("30dlu, pref:grow, pref", "pref, fill:pref:grow"); renderer.setLayout(rowLayout);/*from www . j av a 2 s. c o m*/ DefaultFormBuilder formBuilder = new DefaultFormBuilder(rowLayout, renderer); renderer.setBorder(new EmptyBorder(3, 3, 6, 3)); // Icons JPanel icons = new JPanel(new BorderLayout()); icons.setOpaque(false); if (entry.myPagesVisibility().get()) { icons.add(myPagesPublishedIcon, BorderLayout.WEST); } switch (entry.caseLogType().get()) { case system: icons.add(systemIcon, BorderLayout.EAST); break; case custom: icons.add(customIcon, BorderLayout.EAST); break; case contact: icons.add(contactIcon, BorderLayout.EAST); break; case form: icons.add(formIcon, BorderLayout.EAST); break; case conversation: icons.add(conversationIcon, BorderLayout.EAST); break; case attachment: icons.add(attachmentIcon, BorderLayout.EAST); break; default: break; } formBuilder.add(icons, new CellConstraints(1, 1, 1, 2, CellConstraints.RIGHT, CellConstraints.TOP, new Insets(0, 0, 0, 10))); // User JLabel user = new JLabel(entry.creator().get()); user.setForeground(Color.GRAY); formBuilder.add(user, new CellConstraints(2, 1, 1, 1, CellConstraints.LEFT, CellConstraints.TOP)); // Date JLabel date = new JLabel( DateFormats.getProgressiveDateTimeValue(entry.creationDate().get(), Locale.getDefault())); date.setForeground(Color.GRAY); formBuilder.add(date, new CellConstraints(3, 1, 1, 1, CellConstraints.RIGHT, CellConstraints.TOP)); // Message String entryMessage = entry.message().get(); if (!Strings.empty(entryMessage)) { entryMessage = String.format("<html><div WIDTH=%d>%s</div><html>", 500, entryMessage.trim().replace("\n", "<br>")); } JLabel message = new JLabel(entryMessage); message.setForeground(Color.BLACK); formBuilder.add(message, new CellConstraints(2, 2, 2, 1, CellConstraints.LEFT, CellConstraints.TOP)); return renderer; }
From source file:se.streamsource.streamflow.client.ui.workspace.cases.caselog.CaseLogView.java
License:Apache License
public CaseLogView(@Service final ApplicationContext context, @Uses CaseLogModel logmodel) { this.model = logmodel; setActionMap(context.getActionMap(this)); // Load icons notPublishedIcon = icon(Icons.not_published, ICON_16); publishedIcon = icon(Icons.published, ICON_16); // Layout and form for the left panel FormLayout rightLayout = new FormLayout("30dlu, 300:grow, 50dlu, 20dlu", "pref, fill:pref:grow, 60dlu"); setLayout(rightLayout);//w w w .j av a 2 s . c o m setFocusable(false); DefaultFormBuilder rightBuilder = new DefaultFormBuilder(rightLayout, this); rightBuilder.setBorder(Borders.createEmptyBorder(Sizes.DLUY2, Sizes.DLUX2, Sizes.DLUY2, Sizes.DLUX2)); JLabel caseLogLabel = new JLabel(i18n.text(WorkspaceResources.case_log)); rightBuilder.add(caseLogLabel, new CellConstraints(1, 1, 2, 1, CellConstraints.LEFT, CellConstraints.TOP, new Insets(0, 0, 0, 0))); rightBuilder.nextColumn(); filtersList = new SelectionList( Arrays.asList(system.name(), system_trace.name(), custom.name(), contact.name(), form.name(), conversation.name(), attachment.name()), model.getSelectedFilters(), new ValueToLabelConverter() { public String convert(String value) { return text(valueOf(value.toString())); } }, new ListSelectionListener() { public void valueChanged(ListSelectionEvent event) { if (!event.getValueIsAdjusting()) { String selectedValue = (String) ((JList) event.getSource()).getSelectedValue(); if (selectedValue != null) { if (model.getSelectedFilters().contains(selectedValue)) { model.getSelectedFilters().remove(selectedValue); } else { model.getSelectedFilters().add(selectedValue); } model.refresh(); ((JList) event.getSource()).clearSelection(); } } } }); filterPopupHandler = new StandardPopupHandler(CaseLogView.this, getActionMap().get("filter"), Position.right, false, new RefreshHandler() { public void refresh() { model.refresh(); list.ensureIndexIsVisible(list.getModel().getSize() - 1); } }); rightBuilder.add(filterPopupHandler.getButton(), new CellConstraints(3, 1, 1, 1, CellConstraints.RIGHT, CellConstraints.TOP, new Insets(0, 0, 0, 0))); filtersList.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { if (e.getOppositeComponent() != null && (e.getOppositeComponent().equals(filterPopupHandler.getButton()))) filterPopupHandler.kill(); } }); editButton = new StreamflowToggleButton(getActionMap().get("edit")); editButton.setMargin(new Insets(3, 7, 1, 5)); rightBuilder.add(editButton, new CellConstraints(4, 1, 1, 1, CellConstraints.RIGHT, CellConstraints.TOP, new Insets(0, 0, 0, 0))); // Caselog rightBuilder.nextLine(); ((JXList) list).addHighlighter(HighlighterFactory.createAlternateStriping()); list.setModel(new EventListModel<CaseLogEntryDTO>(model.caselogs())); list.setCellRenderer(new CaseLogListCellRenderer()); list.setFixedCellHeight(-1); list.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); final JList tmpList = list; list.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { if (e.isPopupTrigger()) { int index = tmpList.locationToIndex(new Point(e.getX(), e.getY())); if (tmpList.getSelectedIndex() != index) { tmpList.setSelectedIndex(index); } final JPopupMenu menu = new JPopupMenu(); JMenuItem item = new JMenuItem(); item.setAction(context.getActionMap().get("copy")); item.setIcon(null); menu.add(item); final int x = e.getX(); final int y = e.getY(); final Component c = e.getComponent(); SwingUtilities.invokeLater(new Runnable() { public void run() { menu.show(c, x, y); } }); } } }); scroll = new JScrollPane(list, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scroll.setMinimumSize(new Dimension(250, 100)); scroll.setPreferredSize(new Dimension(400, 300)); rightBuilder.setExtent(3, 1); rightBuilder.add(scroll, new CellConstraints(1, 2, 4, 1, CellConstraints.FILL, CellConstraints.FILL, new Insets(0, 0, 0, 0))); // Add caselog message ImageIcon icon = i18n.icon(Icons.message_add, 24); rightBuilder.add(new JLabel(icon), new CellConstraints(1, 3, 1, 1, CellConstraints.LEFT, CellConstraints.TOP, new Insets(10, 10, 0, 0))); newMessageArea = new JTextArea(10, 30); newMessageArea.setLineWrap(true); newMessageArea.setWrapStyleWord(true); newMessagePane = new JScrollPane(newMessageArea); newMessagePane.setMinimumSize(new Dimension(10, 10)); newMessagePane.setPreferredSize(new Dimension(10, 70)); rightBuilder.add(newMessagePane, new CellConstraints(2, 3, 3, 1, CellConstraints.FILL, CellConstraints.TOP, new Insets(10, 0, 0, 0))); newMessageArea.addKeyListener(new KeyListener() { public void keyTyped(KeyEvent e) { } public void keyReleased(KeyEvent e) { if (e.getKeyCode() == 10) { if (!e.isControlDown()) { newMessageArea.setText(""); } } } public void keyPressed(KeyEvent e) { if (e.getKeyCode() == 10) { if (e.isControlDown()) { newMessageArea.append("\n"); } else { addMessage(); } } } }); listSelectionListener = new ListSelectionListener() { public void valueChanged(ListSelectionEvent event) { if (!event.getValueIsAdjusting()) { final CaseLogEntryDTO selectedValue = (CaseLogEntryDTO) ((JList) event.getSource()) .getSelectedValue(); if (selectedValue != null) { new CommandTask() { @Override protected void command() throws Exception { model.togglepublish(selectedValue); } }.execute(); ((JList) event.getSource()).clearSelection(); } } } }; addHierarchyListener(new HierarchyListener() { public void hierarchyChanged(HierarchyEvent e) { if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0 && !isShowing() && editMode) { editButton.setSelected(false); configureComponentsForEdit(false); } } }); 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 .ja va 2s . c o m*/ 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 ww. j av a2 s .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();/*w w w.j a va 2 s . c om*/ 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:tvpearlplugin.TVPearlProgramPanel.java
License:Open Source License
private void createUI() { Color color = mTextColor;//from w ww . ja va2 s .c o m final Calendar now = Calendar.getInstance(); if ((mProgram != null && mProgram.isExpired()) || mPearlProgram.getStart().before(now)) { color = Color.gray; } setLayout(new FormLayout("pref, pref, fill:min:grow, pref", "pref, pref")); CellConstraints cc = new CellConstraints(); setOpaque(true); JLabel label = new JLabel(TVPearlPlugin.getInstance().getProgramIcon(mProgram != null)); label.setBorder(BorderFactory.createEmptyBorder(2, 4, 2, 4)); add(label, cc.xywh(1, 1, 1, 2)); label = new JLabel(getHeader()); label.setForeground(color); label.setFont(mHeaderFont); add(label, cc.xy(2, 1)); label = new JLabel(getAuthor()); label.setForeground(color); label.setFont(mHeaderFont); label.setAlignmentX(Component.RIGHT_ALIGNMENT); add(label, cc.xyw(3, 1, 2, CellConstraints.RIGHT, CellConstraints.TOP)); label = new JLabel(getBody()); label.setForeground(color); label.setFont(mBodyFont); add(label, cc.xyw(2, 2, 2)); if (mIconList != null) { JPanel iconPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 1, 1)); iconPanel.setOpaque(false); iconPanel.setAlignmentX(Component.RIGHT_ALIGNMENT); add(iconPanel, cc.xy(4, 2)); for (int i = 0; i < mIconList.length; i++) { label = new JLabel(mIconList[i]); label.setOpaque(false); iconPanel.add(label); } } }
From source file:wirschauenplugin.DescriptionInputField.java
License:Open Source License
/** * builds a lengthwise limited text area with a remaining-char-counter beneath it. * * @param maxChars the max length of the text area * @param value the default value of the text area * @param label the remaining characters label. it must include a %s as placeholder for the counter. *///from w ww . j a va2 s .c o m public DescriptionInputField(final int maxChars, final String value, final String label) { this.mMaxChars = maxChars; this.mLabel = label; setLayout(new FormLayout("pref:grow", "fill:50dlu:grow, 3dlu, pref")); CellConstraints cellConstraints = new CellConstraints(); mTextArea = DialogUtil.createTextArea(maxChars); //the text area ensures the length limitation mTextArea.getDocument().addDocumentListener(this); //to update the label add(new JScrollPane(mTextArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER), cellConstraints.xy(1, 1)); mCounterLabel = new JLabel(String.format(label, maxChars - mTextArea.getDocument().getLength())); add(mCounterLabel, cellConstraints.xy(1, 3, CellConstraints.RIGHT, CellConstraints.CENTER)); //this fires a event to the document listeners (i.e. this). so be sure, everything is initialized (e.g. counter label) String initialValue = null; if (value != null) { initialValue = value.trim(); } mTextArea.insert(initialValue, 0); if (WirSchauenPlugin.getInstance().getSettings().getSpellChecking()) { URL dictUrl = getClass().getResource("dictionaries/"); if (dictUrl != null) { SpellChecker.registerDictionaries(dictUrl, "de"); SpellChecker.register(mTextArea); } } }