List of usage examples for com.jgoodies.forms.layout CellConstraints xywh
public CellConstraints xywh(int col, int row, int colSpan, int rowSpan)
Examples:
cc.xywh(1, 3, 2, 1); cc.xywh(1, 3, 7, 3);
From source file:edu.ku.brc.specify.utilapps.DataModelClassGenerator.java
License:Open Source License
/** * @param dataClass/* w ww . j av a 2s . c o m*/ * @param tableId */ public DataModelClassGenerator(final Class<?> dataClass) { this.dataClass = dataClass; Class<?>[] baseClasses = { Boolean.class, Integer.class, Double.class, String.class, Float.class, Character.class, Short.class, Byte.class, BigDecimal.class, Date.class, Calendar.class }; for (Class<?> cls : baseClasses) { baseClassHash.put(cls.getSimpleName(), true); } int cnt = 0; for (Field field : dataClass.getDeclaredFields()) { if (field.getType() == String.class || Collection.class.isAssignableFrom(field.getType())) { cnt++; } } Font font = new Font("Courier", Font.PLAIN, 10); logArea = new JTextArea(); logArea.setFont(font); tableIdTxt = new JTextField(10); devTxt = new JTextField(10); PanelBuilder outer = new PanelBuilder(new FormLayout("p,2px,p,2px,f:p:g", "200px:g,4px,f:300px:g,4px,p")); PanelBuilder pb = new PanelBuilder(new FormLayout("p,2px,p,2px,l:p:g,2px,l:p", UIHelper.createDuplicateJGoodiesDef("p", "2px", cnt + 2))); CellConstraints cc = new CellConstraints(); pb.add(new JLabel("Table Id"), cc.xy(1, 1)); pb.add(tableIdTxt, cc.xywh(3, 1, 3, 1)); pb.add(new JLabel("Dev"), cc.xy(1, 3)); pb.add(devTxt, cc.xywh(3, 3, 3, 1)); int y = 5; for (Field field : dataClass.getDeclaredFields()) { if (field.getType() == String.class) { UIRow row = new UIRow(DataType.String, field); pb.add(new JLabel(field.getName()), cc.xy(1, y)); pb.add(row.getSizetxt(), cc.xywh(3, y, 1, 1)); y += 2; rows.add(row); fieldRowhash.put(field, row); } if (Collection.class.isAssignableFrom(field.getType())) { UIRow row = new UIRow(DataType.Set, field); pb.add(new JLabel(field.getName()), cc.xy(1, y)); pb.add(row.getSizetxt(), cc.xywh(3, y, 3, 1)); pb.add(new JLabel("(Set)", SwingConstants.LEFT), cc.xy(7, y)); y += 2; rows.add(row); fieldRowhash.put(field, row); } } JButton processBtn = UIHelper.createButton("Process"); JButton cancelBtn = UIHelper.createButton("Cancel"); processBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { process(); } }); cancelBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); } }); pb.getPanel().setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); JPanel panel = ButtonBarFactory.buildGrowingBar(new JButton[] { processBtn, cancelBtn }); outer.add(new JScrollPane(pb.getPanel(), ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), cc.xywh(1, 1, 5, 1)); outer.add(new JScrollPane(logArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), cc.xywh(1, 3, 5, 1)); outer.add(panel, cc.xy(5, 5)); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); JPanel p = new JPanel(new BorderLayout()); p.add(outer.getPanel(), BorderLayout.CENTER); setContentPane(p); //setSize(500,500); pack(); setSize(500, getSize().height); }
From source file:edu.ku.brc.specify.utilapps.SetUpBuildDlg.java
License:Open Source License
public void createUI() { super.createUI(); Specify.setUpSystemProperties();//from w w w.j a v a2s . c o m UIFieldFormatterMgr.setDoingLocal(true); driverList = DatabaseDriverInfo.getDriversList(); int inx = Collections.binarySearch(driverList, new DatabaseDriverInfo(dbDriverName, null, null, false, null)); drivers = createComboBox(driverList); drivers.setSelectedIndex(inx); catNumFmtList = (Vector<UIFieldFormatterIFace>) UIFieldFormatterMgr.getInstance() .getFormatterList(CollectionObject.class, "catalogNumber"); Collections.sort(catNumFmtList, new Comparator<UIFieldFormatterIFace>() { @Override public int compare(UIFieldFormatterIFace o1, UIFieldFormatterIFace o2) { return o1.getTitle().compareTo(o2.getTitle()); } }); for (UIFieldFormatterIFace fmt : catNumFmtList) { catNumFmtHash.put(fmt.getName(), fmt); } accNumFmtList = (Vector<UIFieldFormatterIFace>) UIFieldFormatterMgr.getInstance() .getFormatterList(Accession.class, "accessionNumber"); Collections.sort(accNumFmtList, new Comparator<UIFieldFormatterIFace>() { @Override public int compare(UIFieldFormatterIFace o1, UIFieldFormatterIFace o2) { return o1.getTitle().compareTo(o2.getTitle()); } }); for (UIFieldFormatterIFace fmt : accNumFmtList) { accNumFmtHash.put(fmt.getName(), fmt); } catNumGrpList = new Vector<String>(); catNumGrpList.add("None"); catNumGrpList.add("Cat Global"); catNumGrpList.add("Cat Test Group #1"); catNumGrpList.add("Cat Test Group #2"); for (DisciplineType d : DisciplineType.getDisciplineList()) { catNumGrpList.add("Cat " + d.getTitle() + " Group"); } accNumGrpList = new Vector<String>(); accNumGrpList.add("None"); accNumGrpList.add("Acc Global"); accNumGrpList.add("Acc Test Group #1"); accNumGrpList.add("Acc Test Group #2"); for (DisciplineType d : DisciplineType.getDisciplineList()) { accNumGrpList.add("Acc " + d.getTitle() + " Group"); } databaseNameTxt = addAutoSelect(createTextField(databaseName, 15)); dbUsernameTxtFld = addAutoSelect(createTextField(dbUser.first, 15)); dbPasswdTxtFld = addAutoSelect(createPasswordField(dbUser.second, 15)); saUsernameTxtFld = addAutoSelect(createTextField(saUser.first, 15)); saPasswdTxtFld = addAutoSelect(createPasswordField(saUser.second, 15)); usrUsernameTxtFld = addAutoSelect(createTextField(cmUser.first, 15)); usrPasswdTxtFld = addAutoSelect(createPasswordField(cmUser.second, 15)); extraCollectionsChk = createCheckBox("Create Extra Collections"); extraCollectionsChk.setSelected(true); PanelBuilder builder = new PanelBuilder(new FormLayout("p,2px,p,10px,p,2px,p,10px,p,2px,p,p:g", UIHelper.createDuplicateJGoodiesDef("P", "2px", 9) + ",f:p:g,4px,p")); CellConstraints cc = new CellConstraints(); int y = 1; builder.addSeparator("Username and Passwords", cc.xyw(1, y, 12)); y += 2; builder.add(createLabel("IT Username:", SwingConstants.RIGHT), cc.xy(1, y)); builder.add(dbUsernameTxtFld, cc.xy(3, y)); builder.add(createLabel("Master Username:", SwingConstants.RIGHT), cc.xy(5, y)); builder.add(saUsernameTxtFld, cc.xy(7, y)); builder.add(createLabel("User Username:", SwingConstants.RIGHT), cc.xy(9, y)); builder.add(usrUsernameTxtFld, cc.xy(11, y)); y += 2; builder.add(createLabel("IT Password:", SwingConstants.RIGHT), cc.xy(1, y)); builder.add(dbPasswdTxtFld, cc.xy(3, y)); builder.add(createLabel("Master Password:", SwingConstants.RIGHT), cc.xy(5, y)); builder.add(saPasswdTxtFld, cc.xy(7, y)); builder.add(createLabel("User Password:", SwingConstants.RIGHT), cc.xy(9, y)); builder.add(usrPasswdTxtFld, cc.xy(11, y)); y += 2; builder.addSeparator("Database Info", cc.xyw(1, y, 12)); y += 2; builder.add(createLabel("Database Name:", SwingConstants.RIGHT), cc.xy(1, y)); builder.add(databaseNameTxt, cc.xy(3, y)); y += 2; builder.add(createLabel("Driver:", SwingConstants.RIGHT), cc.xy(1, y)); builder.add(drivers, cc.xy(3, y)); y += 2; builder.addSeparator("Collection Options", cc.xyw(1, y, 12)); y += 2; collChoiceList = loadPersistedChoices(); fillChoicesWithDefaults(); choiceTable = new JTable(new DisciplineSetupModel()); choiceTable.setRowHeight((new JComboBox()).getPreferredSize().height); TableColumn col = choiceTable.getColumnModel().getColumn(2); col.setCellEditor(new MyComboBoxEditor(catNumFmtList, catNumFmtHash)); col.setCellRenderer(new MyLabelRenderer(catNumFmtHash)); col = choiceTable.getColumnModel().getColumn(3); col.setCellEditor(new MyComboBoxStringEditor(catNumGrpList)); col = choiceTable.getColumnModel().getColumn(4); col.setCellEditor(new MyComboBoxEditor(accNumFmtList, accNumFmtHash)); col = choiceTable.getColumnModel().getColumn(5); col.setCellEditor(new MyComboBoxStringEditor(accNumGrpList)); //col.setCellRenderer(new MyComboBoxRenderer(catNumFmtList)); UIHelper.makeTableHeadersCentered(choiceTable, false); calcColumnWidths(choiceTable); builder.add(UIHelper.createScrollPane(choiceTable), cc.xywh(1, y, 12, 1)); y += 2; final JButton catGblBtn = createButton("Global Cat Nums"); final JButton accGblBtn = createButton("Global Acc Nums"); final JButton selectAllBtn = createButton("Select All"); final JButton deSelectAll = createButton("Deselect All"); final JButton defBtn = createButton("Revert"); PanelBuilder btnBar = new PanelBuilder( new FormLayout("f:p:g," + UIHelper.createDuplicateJGoodiesDef("p", "4px", 5), "p")); btnBar.add(catGblBtn, cc.xy(2, 1)); btnBar.add(accGblBtn, cc.xy(4, 1)); btnBar.add(selectAllBtn, cc.xy(6, 1)); btnBar.add(deSelectAll, cc.xy(8, 1)); btnBar.add(defBtn, cc.xy(10, 1)); builder.add(btnBar.getPanel(), cc.xywh(1, y, 12, 1)); y += 2; catGblBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { setCatNumGroup("Cat Group"); } }); accGblBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { setAccNumGroup("Acc Group"); } }); selectAllBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { selectAll(true); } }); deSelectAll.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { selectAll(false); } }); cancelBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { closeDlg(true); } }); okBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { saveChoices(collChoiceList); closeDlg(false); } }); defBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { resetDefaults(collChoiceList); } }); // make sure closing the window does the same thing as clicking cancel this.addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { cancelBtn.doClick(); } }); builder.setDefaultDialogBorder(); contentPanel = builder.getPanel(); mainPanel.add(contentPanel, BorderLayout.CENTER); pack(); Dimension size = getSize(); size.width = Math.max(size.width, 900); setSize(size); }
From source file:edu.ku.brc.ui.ListSlider.java
License:Open Source License
/** * @param sourceListModel/* w w w .j ava 2s .co m*/ * @param destListModel */ private void setupListComponents(DefaultListModel sourceListModel, DefaultListModel destListModel) { sourceList = new JList(sourceListModel); //if(cellRenderer!=null) sourceList.setCellRenderer(cellRenderer); sourceList.setSelectedIndex(0); sourceList.addListSelectionListener(new SourceListSelectionHandler()); sourceList.setVisibleRowCount(5); JPanel sourcePanel = getListPanel(sourceList, sourceListTitle); destinationList = new JList(destListModel); //if(cellRenderer!=null)destinationList.setCellRenderer(cellRenderer); destinationList.setSelectedIndex(0); destinationList.addListSelectionListener(new DestinationListSelectionHandler()); destinationList.setVisibleRowCount(5); JPanel destinationPanel = getListPanel(destinationList, destinationListTitle); addButton = UIHelper.createButton(addString); addAllButton = UIHelper.createButton(addAllString); removeButton = UIHelper.createButton(removeString); removeAllButton = UIHelper.createButton(removeAllString); AddListener addListener = new AddListener(); addButton.addActionListener(addListener); addButton.setEnabled(true); addButton.setAlignmentX(Component.CENTER_ALIGNMENT); addButton.setMaximumSize(addButton.getPreferredSize()); AddAllListener addAllListener = new AddAllListener(); addAllButton.addActionListener(addAllListener); addAllButton.setEnabled(true); addAllButton.setAlignmentX(Component.CENTER_ALIGNMENT); addAllButton.setMaximumSize(addAllButton.getPreferredSize()); RemoveListener removeListener = new RemoveListener(); removeButton.addActionListener(removeListener); removeButton.setEnabled(false); removeButton.setAlignmentX(Component.CENTER_ALIGNMENT); removeButton.setMaximumSize(removeButton.getPreferredSize()); RemoveAllListener removeAllListener = new RemoveAllListener(); removeAllButton.addActionListener(removeAllListener); removeAllButton.setEnabled(true); removeAllButton.setAlignmentX(Component.CENTER_ALIGNMENT); removeAllButton.setMaximumSize(removeAllButton.getPreferredSize()); ButtonStackBuilder builder = new ButtonStackBuilder(); builder.addGridded(addAllButton); builder.addRelatedGap(); builder.addGridded(addButton); builder.addRelatedGap(); builder.addGridded(removeButton); builder.addRelatedGap(); builder.addGridded(removeAllButton); JPanel buttonPanel = builder.getPanel(); PanelBuilder panelBuilder; if (isGrowableList) { panelBuilder = new PanelBuilder(new FormLayout("f:d:g(0.5), 7dlu, c:p, 7dlu, f:d:g(0.5)", "f:pref:g(0.5), pref, f:pref:g(0.5)"), this); } else { panelBuilder = new PanelBuilder(new FormLayout("f:d, 7dlu, c:p, 7dlu, f:d", "t:d, c:pref, t:d"), this); } CellConstraints cc = new CellConstraints(); panelBuilder.add(sourcePanel, cc.xywh(1, 1, 1, 3)); panelBuilder.add(buttonPanel, cc.xy(3, 2)); panelBuilder.add(destinationPanel, cc.xywh(5, 1, 1, 3)); //cc.xy }
From source file:edu.ku.brc.ui.ProgressDialog.java
License:Open Source License
/** * @param title/*from w w w .j a v a 2 s.co m*/ * @param includeBothBars * @param includeClose */ public ProgressDialog(final String title, final boolean includeBothBars, final boolean includeClose) { String rowDef = "p,5px" + (includeBothBars ? ",p,5px" : "") + (includeClose ? ",p,10px" : "") + ",p"; PanelBuilder builder = new PanelBuilder(new FormLayout("p,2px,f:p:g", rowDef)); CellConstraints cc = new CellConstraints(); int y = 1; overallProgress = createProgressBar(); desc = createLabel(""); desc.setHorizontalAlignment(SwingConstants.CENTER); builder.add(desc, cc.xywh(1, y, 3, 1)); y += 2; processProgress = createProgressBar(); //new JProgressBar(); processProgress.setStringPainted(true); builder.add(createLabel("Process:"), cc.xy(1, y)); // I18N builder.add(processProgress, cc.xy(3, y)); y += 2; if (includeBothBars) { builder.add(createLabel("Overall:"), cc.xy(1, y)); // I18N builder.add(overallProgress, cc.xy(3, y)); y += 2; overallProgress.setIndeterminate(true); } createLabel(""); if (includeClose) { closeBtn = createButton(UIRegistry.getResourceString("CANCEL")); builder.add(closeBtn, cc.xy(1, y)); y += 2; } builder.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); setContentPane(builder.getPanel()); pack(); Dimension size = getPreferredSize(); int heightNudge = closeBtn != null ? 40 : 20; setSize(new Dimension(500, size.height + heightNudge)); setTitle(title); ImageIcon appIcon = IconManager.getIcon("AppIcon"); //$NON-NLS-1$ if (appIcon != null) { setIconImage(appIcon.getImage()); } if (closeBtn != null) { closeBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ProgressDialog.this.setVisible(false); } }); } //setDefaultCloseOperation(DISPOSE_ON_CLOSE); }
From source file:edu.ku.brc.ui.ProgressFrame.java
License:Open Source License
/** * @param title//from ww w . j ava 2 s . c o m * @param iconName */ protected void createUI(final String title, final String iconName) { PanelBuilder builder = new PanelBuilder(new FormLayout("p,2px,f:p:g", "p,5px,p,5px,p,10px,p")); CellConstraints cc = new CellConstraints(); overallProgress = new JProgressBar(); processProgress = new JProgressBar(); desc = createLabel(""); closeBtn = createButton("Cancel"); processProgress.setStringPainted(true); overallProgress.setStringPainted(true); desc.setHorizontalAlignment(SwingConstants.CENTER); builder.add(desc, cc.xywh(1, 1, 3, 1)); builder.add(createLabel("Process:"), cc.xy(1, 3)); // I18N builder.add(processProgress, cc.xy(3, 3)); builder.add(overallLbl = createLabel("Overall:"), cc.xy(1, 5)); // I18N builder.add(overallProgress, cc.xy(3, 5)); builder.add(closeBtn, cc.xy(1, 7)); builder.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JPanel mainPanel = new JPanel(new BorderLayout()); if (StringUtils.isNotEmpty(iconName)) { PanelBuilder iconBldr = new PanelBuilder( new FormLayout("8px, f:p:g,130px,f:p:g", "8px,f:p:g,130px,f:p:g, 8px")); iconBldr.add(new JLabel(IconManager.getIcon(iconName)), cc.xy(3, 3)); mainPanel.add(iconBldr.getPanel(), BorderLayout.WEST); mainPanel.add(builder.getPanel(), BorderLayout.CENTER); } else { mainPanel = builder.getPanel(); } setContentPane(mainPanel); setSize(new Dimension(500, 125)); setTitle(title); overallProgress.setIndeterminate(true); instance = this; closeBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { instance.setVisible(false); System.exit(0); } }); setDefaultCloseOperation(DISPOSE_ON_CLOSE); ImageIcon appIcon = IconManager.getIcon("AppIcon"); //$NON-NLS-1$ if (appIcon != null) { setIconImage(appIcon.getImage()); } pack(); }
From source file:edu.udo.scaffoldhunter.gui.dialogs.DatabaseErrorDialog.java
License:Open Source License
/** * @param parent//from w w w .j a v a2 s. c om * @param message * @param allowIgnore */ public DatabaseErrorDialog(Frame parent, String message, boolean allowIgnore) { super(parent, _("DatabaseErrorDialog.Title"), ModalityType.APPLICATION_MODAL); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); FormLayout layout = new FormLayout("pref, 8dlu, pref:grow, 8dlu, 72dlu, 8dlu, 72dlu", "pref, 8dlu, top:pref:grow, 8dlu, pref"); CellConstraints cc = new CellConstraints(); PanelBuilder pb = new PanelBuilder(layout); pb.setDefaultDialogBorder(); JButton retryButton = new JButton(_("DatabaseErrorDialog.Retry")); retryButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { result = Result.RETRY; dispose(); } }); JButton ignoreButton = new JButton(_("DatabaseErrorDialog.Ignore")); ignoreButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { result = Result.IGNORE; dispose(); } }); JButton quitButton = new JButton(Resources.getImageIcon("icons/misc/button.png")); quitButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { result = Result.QUIT; dispose(); } }); pb.add(new JLabel(_("DatabaseErrorDialog.Text")), cc.xyw(3, 1, 5)); pb.add(new JLabel("<html>" + StringEscapeUtils.escapeHTML(message) + "</html>"), cc.xyw(3, 3, 5)); if (allowIgnore) { pb.add(ignoreButton, cc.xy(5, 5)); } pb.add(retryButton, cc.xy(7, 5)); pb.add(quitButton, cc.xywh(1, 1, 1, 5)); getRootPane().setDefaultButton(retryButton); setContentPane(pb.getPanel()); pack(); setResizable(false); setLocationRelativeTo(parent); }
From source file:edu.udo.scaffoldhunter.gui.dialogs.SessionDialog.java
License:Open Source License
private JPanel getSessionsPanel() { FormLayout layout = new FormLayout("l:d, 5dlu, f:d:grow, 5dlu, f:d", // 5 // columns "f:d, 5dlu, f:d, 5dlu, f:d:grow, 5dlu, f:d"); // 7 rows CellConstraints cc = new CellConstraints(); PanelBuilder pb = new PanelBuilder(layout); pb.setDefaultDialogBorder();/*from w w w . j ava 2s . c o m*/ sessionsList = new JList(sessionsModel); sessionsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sessionsList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent arg0) { updateAllowSessionActions(); } }); sessionsList.addMouseListener(new MouseListener() { @Override public void mouseReleased(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mousePressed(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseExited(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseEntered(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2 && openAction.isEnabled()) openAction.actionPerformed(null); } }); Session session = profile.getCurrentSession(); sessionsList.setCellRenderer(new SessionCellRenderer()); JScrollPane sessionsScroll = new JScrollPane(sessionsList); sessionsScroll.setPreferredSize(new Dimension(200, 200)); pb.add(sessionsScroll, cc.xywh(1, 1, 3, 5)); if (session != null) sessionsList.setSelectedValue(findSessionInformation(session.getTitle()), true); JButton renameButton = new JButton(renameAction); pb.add(renameButton, cc.xy(5, 1)); JButton removeButton = new JButton(removeAction); pb.add(removeButton, cc.xy(5, 3)); JButton openButton = new JButton(openAction); getRootPane().setDefaultButton(openButton); JButton cancelButton = new JButton(cancelAction); pb.add(ButtonBarFactory.buildOKCancelBar(openButton, cancelButton), cc.xyw(1, 7, 5)); JPanel panel = pb.getPanel(); panel.setBorder(BorderFactory.createTitledBorder(_("Sessions.Title"))); return panel; }
From source file:edu.uj.zbit.bpath.editor.propertyPanel.LinkEditor.java
License:Academic Free License
private void initComponents() { dialogPane = new JPanel(); contentPanel = new JPanel(); label1 = new JLabel(); hrefField = new JTextField(); label2 = new JLabel(); scrollPane1 = new JScrollPane(); dscrArea = new JTextArea(); buttonBar = new JPanel(); okButton = new JButton(); cancelButton = new JButton(); CellConstraints cc = new CellConstraints(); //======== this ======== setTitle(BpathMainFrame.messages.getString("DIALOG.LINK.TITLE")); Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); //======== dialogPane ======== {//from w ww. j a v a2s.c om dialogPane.setBorder(Borders.DIALOG_BORDER); dialogPane.setLayout(new BorderLayout()); //======== contentPanel ======== { contentPanel.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.dluX(19), FormSpec.DEFAULT_GROW) }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, new RowSpec(RowSpec.CENTER, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) })); //---- label1 ---- label1.setText(BpathMainFrame.messages.getString("DIALOG.LINK.LINK") + ":"); contentPanel.add(label1, cc.xy(1, 1)); contentPanel.add(hrefField, cc.xywh(3, 1, 3, 1)); //---- label2 ---- label2.setText(BpathMainFrame.messages.getString("DIALOG.LINK.DSCR") + ":"); contentPanel.add(label2, cc.xy(1, 3)); //======== scrollPane1 ======== { scrollPane1.setViewportView(dscrArea); } contentPanel.add(scrollPane1, cc.xywh(3, 3, 3, 3)); } dialogPane.add(contentPanel, BorderLayout.CENTER); //======== buttonBar ======== { buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER); buttonBar.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.GLUE_COLSPEC, FormFactory.BUTTON_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, FormFactory.BUTTON_COLSPEC }, RowSpec.decodeSpecs("pref"))); //---- okButton ---- okButton.setText("OK"); buttonBar.add(okButton, cc.xy(2, 1)); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { completed = true; setVisible(false); } }); //---- cancelButton ---- cancelButton.setText(BpathMainFrame.messages.getString("COMMON.CANCEL")); buttonBar.add(cancelButton, cc.xy(4, 1)); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { completed = false; setVisible(false); } }); } dialogPane.add(buttonBar, BorderLayout.SOUTH); } contentPane.add(dialogPane, BorderLayout.CENTER); pack(); setLocationRelativeTo(getOwner()); }
From source file:edu.yale.plugins.tasks.YaleAnalogInstancesFields.java
License:Open Source License
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner non-commercial license panel2 = new JDialog(); fields = new JPanel(); label_subjectSource4 = new JLabel(); containerLabel3 = new JTextField(); separator3 = new JSeparator(); label_subjectTermType3 = new JLabel(); container3Type = new JComboBox(); label_subjectSource7 = new JLabel(); container3Type2 = new JComboBox(); separator2 = new JSeparator(); panel1 = new JPanel(); rights3 = new JCheckBox(); rights2 = new JCheckBox(); panel3 = new JPanel(); cancel = new JButton(); CellConstraints cc = new CellConstraints(); //======== panel2 ======== {/*from w w w .jav a 2s . com*/ Container panel2ContentPane = panel2.getContentPane(); panel2ContentPane.setLayout(new BorderLayout()); //======== fields ======== { fields.setBorder(Borders.DLU4_BORDER); fields.setBackground(new Color(234, 201, 250)); fields.setOpaque(false); fields.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); fields.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec("max(default;400px):grow") }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC })); //---- label_subjectSource4 ---- label_subjectSource4.setText("Barcode"); label_subjectSource4.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_subjectSource4, ArchDescriptionAnalogInstances.class, ArchDescriptionAnalogInstances.PROPERTYNAME_BARCODE); fields.add(label_subjectSource4, cc.xy(1, 1)); //---- containerLabel3 ---- containerLabel3.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); fields.add(containerLabel3, cc.xy(3, 1)); //---- separator3 ---- separator3.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); separator3.setForeground(new Color(147, 131, 86)); fields.add(separator3, cc.xywh(1, 3, 3, 1)); //---- label_subjectTermType3 ---- label_subjectTermType3.setText("Container 3 Type"); label_subjectTermType3.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_subjectTermType3, ArchDescriptionAnalogInstances.class, ArchDescriptionAnalogInstances.PROPERTYNAME_CONTAINER3_TYPE); fields.add(label_subjectTermType3, cc.xy(1, 5)); //---- container3Type ---- container3Type.setOpaque(false); container3Type.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); fields.add(container3Type, cc.xywh(3, 5, 1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT)); //---- label_subjectSource7 ---- label_subjectSource7.setText("User Defined String 2"); label_subjectSource7.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_subjectSource7, ArchDescriptionAnalogInstances.class, ArchDescriptionAnalogInstances.PROPERTYNAME_USER_DEFINED_STRING2); fields.add(label_subjectSource7, cc.xy(1, 7)); //---- container3Type2 ---- container3Type2.setOpaque(false); container3Type2.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); fields.add(container3Type2, cc.xywh(3, 7, 1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT)); //---- separator2 ---- separator2.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); separator2.setForeground(new Color(147, 131, 86)); fields.add(separator2, cc.xywh(1, 9, 3, 1)); //======== panel1 ======== { panel1.setLayout(new FormLayout( new ColumnSpec[] { new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) }, RowSpec.decodeSpecs("default"))); //---- rights3 ---- rights3.setText("User Defined Boolean 1"); rights3.setOpaque(false); rights3.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); rights3.setText(ATFieldInfo.getLabel(ArchDescriptionAnalogInstances.class, ArchDescriptionAnalogInstances.PROPERTYNAME_USER_DEFINED_BOOLEAN1)); panel1.add(rights3, cc.xywh(1, 1, 2, 1, CellConstraints.LEFT, CellConstraints.DEFAULT)); //---- rights2 ---- rights2.setText("User Defined Boolean 2"); rights2.setOpaque(false); rights2.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); rights2.setText(ATFieldInfo.getLabel(ArchDescriptionAnalogInstances.class, ArchDescriptionAnalogInstances.PROPERTYNAME_USER_DEFINED_BOOLEAN2)); panel1.add(rights2, cc.xywh(3, 1, 1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT)); } fields.add(panel1, cc.xywh(1, 11, 3, 1, CellConstraints.FILL, CellConstraints.DEFAULT)); //======== panel3 ======== { panel3.setLayout( new FormLayout( new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC }, RowSpec.decodeSpecs("default"))); //---- cancel ---- cancel.setText("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { cancelActionPerformed(e); } }); panel3.add(cancel, cc.xy(3, 1)); } fields.add(panel3, cc.xywh(1, 13, 3, 1, CellConstraints.CENTER, CellConstraints.DEFAULT)); } panel2ContentPane.add(fields, BorderLayout.CENTER); panel2.pack(); panel2.setLocationRelativeTo(panel2.getOwner()); } // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:eu.europa.ec.markt.dss.applet.view.validationpolicy.SaveView.java
License:Open Source License
@Override protected Container doLayout() { final FormLayout layout = new FormLayout( "5dlu, pref, 5dlu, pref, 5dlu ,pref:grow ,5dlu, fill:default:grow, 5dlu", "5dlu, pref, 5dlu, pref, 5dlu, fill:default:grow, 5dlu"); final PanelBuilder builder = ComponentFactory.createBuilder(layout); final CellConstraints cc = new CellConstraints(); builder.addSeparator(I18N_SAVE_TO_FILE, cc.xyw(2, 2, 5)); builder.add(selectFileTarget, cc.xy(2, 4)); builder.add(fileTargetLabel, cc.xyw(4, 4, 3)); builder.add(scrollPane, cc.xywh(2, 5, 8, 3)); return ComponentFactory.createPanel(builder); }