List of usage examples for com.jgoodies.forms.layout FormLayout FormLayout
public FormLayout(ColumnSpec[] colSpecs, RowSpec[] rowSpecs)
From source file:com.gui.account.AccountEditorDialog.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents ResourceBundle bundle = ResourceBundle.getBundle("com.resource.locale"); DefaultComponentFactory compFactory = DefaultComponentFactory.getInstance(); editorPane = new JPanel(); editorContent = new JPanel(); separator1 = compFactory.createSeparator(bundle.getString("AccountEditorDialog.separator1.text")); label1 = new JLabel(); textField1 = BasicComponentFactory/*w w w. jav a 2 s. com*/ .createTextField(this.accountPresentationModel.getBufferedModel("pseudo")); label2 = new JLabel(); textField2 = BasicComponentFactory .createTextField(this.accountPresentationModel.getBufferedModel("password")); separator2 = compFactory.createSeparator(bundle.getString("AccountEditorDialog.separator2.text")); label3 = new JLabel(); textField3 = BasicComponentFactory .createTextField(this.accountPresentationModel.getBufferedModel("description")); label4 = new JLabel(); textField4 = BasicComponentFactory .createTextField(this.accountPresentationModel.getBufferedModel("initDate")); label5 = new JLabel(); textField5 = new JTextField(); editorButtons = new JPanel(); editorOk = new JButton(); editorCancel = new JButton(); actionOk = new EditorOk(); actionCancel = new EditorCancel(); CellConstraints cc = new CellConstraints(); //======== this ======== setTitle(bundle.getString("AccountEditorDialog.this.title")); Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); //======== editorPane ======== { editorPane.setBorder(Borders.DIALOG_BORDER); editorPane.setLayout(new BorderLayout()); //======== editorContent ======== { editorContent.setBorder(Borders.DLU4_BORDER); editorContent.setLayout(new FormLayout("right:[50dlu,default], $lcgap, [100dlu,default]", "6*(default, $lgap), default")); editorContent.add(separator1, cc.xywh(1, 1, 3, 1)); //---- label1 ---- label1.setText(bundle.getString("AccountEditorDialog.label1.text")); editorContent.add(label1, cc.xy(1, 3)); editorContent.add(textField1, cc.xy(3, 3)); //---- label2 ---- label2.setText(bundle.getString("AccountEditorDialog.label2.text")); editorContent.add(label2, cc.xy(1, 5)); editorContent.add(textField2, cc.xy(3, 5)); editorContent.add(separator2, cc.xywh(1, 7, 3, 1)); //---- label3 ---- label3.setText(bundle.getString("AccountEditorDialog.label3.text")); editorContent.add(label3, cc.xy(1, 9)); editorContent.add(textField3, cc.xy(3, 9)); //---- label4 ---- label4.setText(bundle.getString("AccountEditorDialog.label4.text")); editorContent.add(label4, cc.xy(1, 11)); //---- textField4 ---- textField4.setEditable(false); editorContent.add(textField4, cc.xy(3, 11)); //---- label5 ---- label5.setText(bundle.getString("AccountEditorDialog.label5.text")); editorContent.add(label5, cc.xy(1, 13)); //---- textField5 ---- textField5.setEditable(false); editorContent.add(textField5, cc.xy(3, 13)); } editorPane.add(editorContent, BorderLayout.CENTER); //======== editorButtons ======== { editorButtons.setBorder(Borders.BUTTON_BAR_GAP_BORDER); editorButtons.setLayout(new FormLayout("$glue, $button, $rgap, $button", "pref")); //---- editorOk ---- editorOk.setMnemonic(bundle.getString("AccountEditorDialog.editorOk.mnemonic").charAt(0)); editorOk.setAction(actionOk); editorButtons.add(editorOk, cc.xy(2, 1)); //---- editorCancel ---- editorCancel.setMnemonic(bundle.getString("AccountEditorDialog.editorCancel.mnemonic").charAt(0)); editorCancel.setAction(actionCancel); editorButtons.add(editorCancel, cc.xy(4, 1)); } editorPane.add(editorButtons, BorderLayout.SOUTH); } contentPane.add(editorPane, BorderLayout.CENTER); pack(); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:com.gui.IHM.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - Van Fanel ResourceBundle bundle = ResourceBundle.getBundle("com.resource.locale"); menuTop = new JMenuBar(); menu1 = new JMenu(); menuItem1 = new JMenuItem(); menuItem2 = new JMenuItem(); menu2 = new JMenu(); menuItem6 = new JMenuItem(); menu3 = new JMenu(); menuItem5 = new JMenuItem(); menu4 = new JMenu(); menu5 = new JMenu(); menuItem4 = new JMenuItem(); menu6 = new JMenu(); menuItem3 = new JMenuItem(); uIFSplitPane1 = new UIFSplitPane(); frameLeft = new SimpleInternalFrame(); tabsLeft = new JTabbedPane(); uIFSplitPane2 = new UIFSplitPane(); uIFSplitPane3 = new UIFSplitPane(); frameCenter = new SimpleInternalFrame(); tabsCenter = new JTabbedPane(); panelGoban = new JPanel(); frameRight = new SimpleInternalFrame(); tabsRight = new JTabbedPane(); frameBottom = new SimpleInternalFrame(); tabsBottom = new JTabbedPane(); CellConstraints cc = new CellConstraints(); //======== this ======== setTitle(bundle.getString("IHM.this.title")); Container contentPane = getContentPane(); contentPane.setLayout(new FormLayout("[1010px,default]", "[710px,default]")); //======== menuTop ======== {/*from ww w . j av a2 s . co m*/ //======== menu1 ======== { menu1.setText(bundle.getString("IHM.menu1.text")); //---- menuItem1 ---- menuItem1.setText(bundle.getString("IHM.menuItem1.text")); menu1.add(menuItem1); //---- menuItem2 ---- menuItem2.setText(bundle.getString("IHM.menuItem2.text")); menu1.add(menuItem2); } menuTop.add(menu1); //======== menu2 ======== { menu2.setText(bundle.getString("IHM.menu2.text")); //---- menuItem6 ---- menuItem6.setText(bundle.getString("IHM.menuItem6.text")); menu2.add(menuItem6); } menuTop.add(menu2); //======== menu3 ======== { menu3.setText(bundle.getString("IHM.menu3.text")); //---- menuItem5 ---- menuItem5.setText(bundle.getString("IHM.menuItem5.text")); menu3.add(menuItem5); } menuTop.add(menu3); //======== menu4 ======== { menu4.setText(bundle.getString("IHM.menu4.text")); } menuTop.add(menu4); //======== menu5 ======== { menu5.setText(bundle.getString("IHM.menu5.text")); //---- menuItem4 ---- menuItem4.setText(bundle.getString("IHM.menuItem4.text")); menu5.add(menuItem4); } menuTop.add(menu5); //======== menu6 ======== { menu6.setText(bundle.getString("IHM.menu6.text")); //---- menuItem3 ---- menuItem3.setText(bundle.getString("IHM.menuItem3.text")); menu6.add(menuItem3); } menuTop.add(menu6); } setJMenuBar(menuTop); //======== uIFSplitPane1 ======== { //======== frameLeft ======== { frameLeft.setTitle(bundle.getString("IHM.frameLeft.title")); // JFormDesigner evaluation mark frameLeft.setBorder(new javax.swing.border.CompoundBorder( new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0), "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.red), frameLeft.getBorder())); frameLeft.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent e) { if ("border".equals(e.getPropertyName())) throw new RuntimeException(); } }); Container frameLeftContentPane = frameLeft.getContentPane(); frameLeftContentPane.setLayout(new FormLayout("default", "default")); frameLeftContentPane.add(tabsLeft, cc.xy(1, 1)); } uIFSplitPane1.setLeftComponent(frameLeft); //======== uIFSplitPane2 ======== { uIFSplitPane2.setOrientation(JSplitPane.VERTICAL_SPLIT); //======== uIFSplitPane3 ======== { //======== frameCenter ======== { frameCenter.setTitle(bundle.getString("IHM.frameCenter.title")); Container frameCenterContentPane = frameCenter.getContentPane(); frameCenterContentPane.setLayout(new FormLayout("default", "default")); //======== tabsCenter ======== { //======== panelGoban ======== { panelGoban.setLayout(new GridBagLayout()); ((GridBagLayout) panelGoban.getLayout()).columnWidths = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; ((GridBagLayout) panelGoban.getLayout()).rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; ((GridBagLayout) panelGoban.getLayout()).columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4 }; ((GridBagLayout) panelGoban.getLayout()).rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4 }; } tabsCenter.addTab(bundle.getString("IHM.panelGoban.tab.title"), panelGoban); } frameCenterContentPane.add(tabsCenter, cc.xy(1, 1)); } uIFSplitPane3.setLeftComponent(frameCenter); //======== frameRight ======== { frameRight.setTitle(bundle.getString("IHM.frameRight.title")); Container frameRightContentPane = frameRight.getContentPane(); frameRightContentPane.setLayout(new FormLayout("default", "default")); frameRightContentPane.add(tabsRight, cc.xy(1, 1)); } uIFSplitPane3.setRightComponent(frameRight); } uIFSplitPane2.setTopComponent(uIFSplitPane3); //======== frameBottom ======== { frameBottom.setTitle(bundle.getString("IHM.frameBottom.title")); Container frameBottomContentPane = frameBottom.getContentPane(); frameBottomContentPane.setLayout(new FormLayout("default", "default")); frameBottomContentPane.add(tabsBottom, cc.xy(1, 1)); } uIFSplitPane2.setBottomComponent(frameBottom); } uIFSplitPane1.setRightComponent(uIFSplitPane2); } contentPane.add(uIFSplitPane1, cc.xy(1, 1)); pack(); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:com.imaginea.betterdocs.BetterDocsSettings.java
License:Apache License
@Nullable @Override/*from w w w. j av a 2 s .c o m*/ public JComponent createComponent() { FormLayout layout = new FormLayout(COLUMN_SPECS, ROW_SPECS); PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(); CellConstraints cc = new CellConstraints(); JLabel esURL = new JLabel(ELASTIC_SEARCH_URL); esURL.setVisible(true); JLabel size = new JLabel(RESULTS_SIZE); size.setVisible(true); JLabel distance = new JLabel(DISTANCE_FROM_CURSOR); distance.setVisible(true); esURLText = new JTextField(); esURLText.setEditable(true); esURLText.setVisible(true); if (propertiesComponent.isValueSet(BetterDocsAction.ES_URL)) { esURLText.setText(propertiesComponent.getValue(BetterDocsAction.ES_URL)); } else { esURLText.setText(BetterDocsAction.ES_URL_DEFAULT); } sizeText = new JTextField(); sizeText.setEditable(true); sizeText.setVisible(true); sizeText.setText(propertiesComponent.getValue(BetterDocsAction.SIZE, String.valueOf(BetterDocsAction.SIZE_DEFAULT_VALUE))); distanceText = new JTextField(); distanceText.setEditable(true); distanceText.setVisible(true); distanceText.setText(propertiesComponent.getValue(BetterDocsAction.DISTANCE, String.valueOf(BetterDocsAction.DISTANCE_DEFAULT_VALUE))); JPanel jPanel = new JPanel(layout); jPanel.add(esURL, cc.xy(1, 3)); jPanel.add(esURLText, cc.xy(2, 3)); jPanel.add(size, cc.xy(1, 2)); jPanel.add(sizeText, cc.xy(2, 2)); jPanel.add(distance, cc.xy(1, 1)); jPanel.add(distanceText, cc.xy(2, 1)); return jPanel; }
From source file:com.imaginea.betterdocs.BetterDocsWindow.java
License:Apache License
@Override public void createToolWindowContent(Project project, ToolWindow toolWindow) { toolWindow.setIcon(Messages.getInformationIcon()); DefaultMutableTreeNode root = new DefaultMutableTreeNode(PROJECTS); JTree jTree = new JTree(root); jTree.setVisible(false);/*from w ww. j ava 2 s . c o m*/ jTree.setAutoscrolls(true); jTree.setForeground(new JBColor(new Color(100, 155, 155), new Color(100, 155, 155))); Document document = EditorFactory.getInstance().createDocument(""); Editor windowEditor = EditorFactory.getInstance().createEditor(document, project, FileTypeManager.getInstance().getFileTypeByExtension("java"), false); BetterDocsAction action = new BetterDocsAction(); action.setTree(jTree); action.setWindowEditor(windowEditor); DefaultActionGroup group = new DefaultActionGroup(); group.add(action); JComponent toolBar = ActionManager.getInstance().createActionToolbar("BetterDocs", group, true) .getComponent(); EditorToggleAction toggleAction = new EditorToggleAction(); DefaultActionGroup moveGroup = new DefaultActionGroup(); moveGroup.add(toggleAction); FormLayout layout = new FormLayout(PREF_PREF_GROW, PREF_PREF); CellConstraints cc = new CellConstraints(); JBScrollPane jTreeScrollPane = new JBScrollPane(); jTreeScrollPane.setViewportView(jTree); jTreeScrollPane.setAutoscrolls(true); jTreeScrollPane.setBackground(new Color(255, 0, 0)); jTreeScrollPane.setPreferredSize(new Dimension(200, 300)); JPanel jPanel = new JPanel(layout); jPanel.setVisible(true); jPanel.add(toolBar, cc.xy(1, 1)); jPanel.add(jTreeScrollPane, cc.xy(2, 1)); JBScrollPane jbScrollPane = new JBScrollPane(); jbScrollPane.setViewportView(windowEditor.getComponent()); final JSplitPane jSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, jbScrollPane, jPanel); jSplitPane.setDividerLocation(0.5); toggleAction.setjSplitPane(jSplitPane); toolWindow.getComponent().getParent().add(jSplitPane); }
From source file:com.imaginea.kodebeagle.ui.SettingsPanel.java
License:Apache License
@Nullable @Override//ww w . j ava 2s . c om public final JComponent createComponent() { FormLayout formLayout = new FormLayout(COLUMN_SPECS, ROW_SPECS); JLabel esURL = new JLabel(ELASTIC_SEARCH_URL); esURL.setVisible(true); JLabel size = new JLabel(RESULTS_SIZE); size.setVisible(true); JLabel distance = new JLabel(DISTANCE_FROM_CURSOR); distance.setVisible(true); JLabel excludeImports = new JLabel(EXCLUDE_IMPORT_LIST); excludeImports.setVisible(true); JLabel helpText = new JLabel(HELP_TEXT); helpText.setVisible(true); helpText.setFont(new Font("Plain", Font.PLAIN, HELPTEXT_FONTSIZE)); JLabel maxTinyEditors = new JLabel(MAX_TINY_EDITORS); maxTinyEditors.setVisible(true); JLabel beagleId = new JLabel(BEAGLE_ID); beagleId.setVisible(true); createValidationLabels(); createTextFields(); JLabel beagleIdValue = new JLabel(); beagleIdValue.setVisible(true); if (!propertiesComponent.isValueSet(BEAGLE_ID)) { windowObjects.setBeagleId(UUID.randomUUID().toString()); beagleIdValue.setText(windowObjects.getBeagleId()); } else { beagleIdValue.setText(propertiesComponent.getValue(BEAGLE_ID)); } JPanel jPanel = new JPanel(formLayout); jPanel.add(beagleId, TOP_LEFT); jPanel.add(beagleIdValue, TOP_RIGHT); jPanel.add(distance, FIRST_LEFT); jPanel.add(distanceText, FIRST_RIGHT); jPanel.add(validationLabels.get(INDEX_DISTANCE), SECOND_RIGHT); jPanel.add(size, THIRD_LEFT); jPanel.add(sizeText, THIRD_RIGHT); jPanel.add(validationLabels.get(INDEX_SIZE), FOURTH_RIGHT); jPanel.add(esURL, FIFTH_LEFT); jPanel.add(esURLText, FIFTH_RIGHT); jPanel.add(validationLabels.get(INDEX_ES_URL), SIXTH_RIGHT); jPanel.add(maxTinyEditors, SEVENTH_LEFT); jPanel.add(maxTinyEditorsText, SEVENTH_RIGHT); jPanel.add(validationLabels.get(INDEX_FEATURED_COUNT), EIGHTH_RIGHT); jPanel.add(excludeImports, NINTH_LEFT); jPanel.add(excludeImportsText, NINTH_RIGHT); jPanel.add(helpText, TENTH_RIGHT); return jPanel; }
From source file:com.intellij.uiDesigner.radComponents.RadFormLayoutManager.java
License:Apache License
@Override @Nullable public LayoutManager createLayout() { return new FormLayout(ENCODED_FORMSPEC_GROW, ENCODED_FORMSPEC_GROW); }
From source file:com.intellij.uiDesigner.radComponents.RadFormLayoutManager.java
License:Apache License
@Override protected void changeLayoutFromGrid(final RadContainer container, final List<RadComponent> contents, final List<Boolean> canRowsGrow, final List<Boolean> canColumnsGrow) { int rowCount = canRowsGrow.size(); int columnCount = canColumnsGrow.size(); int rowCountWithGaps = (rowCount == 0) ? 0 : rowCount * 2 - 1; int columnCountWithGaps = (columnCount == 0) ? 0 : columnCount * 2 - 1; RowSpec[] rowSpecs = new RowSpec[rowCountWithGaps]; ColumnSpec[] colSpecs = new ColumnSpec[columnCountWithGaps]; for (int i = 0; i < rowCount; i++) { rowSpecs[i * 2] = canRowsGrow.get(i).booleanValue() ? RowSpec.decode(ENCODED_FORMSPEC_GROW) : new RowSpec(DEFAULT_NOGROW_SIZE); if (i * 2 + 1 < rowSpecs.length) { rowSpecs[i * 2 + 1] = FormSpecs.RELATED_GAP_ROWSPEC; }/* www . ja v a 2s . com*/ } for (int i = 0; i < columnCount; i++) { colSpecs[i * 2] = canColumnsGrow.get(i).booleanValue() ? ColumnSpec.decode(ENCODED_FORMSPEC_GROW) : new ColumnSpec(DEFAULT_NOGROW_SIZE); if (i * 2 + 1 < colSpecs.length) { colSpecs[i * 2 + 1] = FormSpecs.RELATED_GAP_COLSPEC; } } container.setLayoutManager(this, new FormLayout(colSpecs, rowSpecs)); }
From source file:com.intellij.uiDesigner.radComponents.RadFormLayoutManager.java
License:Apache License
@Override protected void changeLayoutFromIndexed(final RadContainer container, final List<RadComponent> components) { int maxSizePolicy = 0; for (RadComponent c : components) { maxSizePolicy = Math.max(maxSizePolicy, c.getConstraints().getHSizePolicy()); }//from w ww.j a va 2s . c o m ColumnSpec[] colSpecs = new ColumnSpec[components.size() * 2 - 1]; for (int i = 0; i < components.size(); i++) { colSpecs[i * 2] = components.get(i).getConstraints().getHSizePolicy() == maxSizePolicy ? ColumnSpec.decode(ENCODED_FORMSPEC_GROW) : FormSpecs.DEFAULT_COLSPEC; if (i * 2 + 1 < colSpecs.length) { colSpecs[i * 2 + 1] = FormSpecs.RELATED_GAP_COLSPEC; } } container.setLayoutManager(this, new FormLayout(colSpecs, new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC })); }
From source file:com.intellij.uiDesigner.radComponents.RadFormLayoutManager.java
License:Apache License
@Override public void createSnapshotLayout(final SnapshotContext context, final JComponent parent, final RadContainer container, final LayoutManager layout) { ColumnSpec[] colSpecs;/*w w w .j av a 2 s . co m*/ RowSpec[] rowSpecs; int[][] rowGroups; int[][] columnGroups; try { Method method = layout.getClass().getMethod("getRowCount", ArrayUtil.EMPTY_CLASS_ARRAY); int rowCount = ((Integer) method.invoke(layout, ArrayUtil.EMPTY_OBJECT_ARRAY)).intValue(); method = layout.getClass().getMethod("getColumnCount", ArrayUtil.EMPTY_CLASS_ARRAY); int columnCount = ((Integer) method.invoke(layout, ArrayUtil.EMPTY_OBJECT_ARRAY)).intValue(); rowSpecs = new RowSpec[rowCount]; colSpecs = new ColumnSpec[columnCount]; method = layout.getClass().getMethod("getRowSpec", int.class); for (int i = 0; i < rowCount; i++) { rowSpecs[i] = (RowSpec) createSerializedCopy(method.invoke(layout, i + 1)); } method = layout.getClass().getMethod("getColumnSpec", int.class); for (int i = 0; i < columnCount; i++) { colSpecs[i] = (ColumnSpec) createSerializedCopy(method.invoke(layout, i + 1)); } method = layout.getClass().getMethod("getRowGroups", ArrayUtil.EMPTY_CLASS_ARRAY); rowGroups = (int[][]) method.invoke(layout); method = layout.getClass().getMethod("getColumnGroups", ArrayUtil.EMPTY_CLASS_ARRAY); columnGroups = (int[][]) method.invoke(layout); } catch (Exception ex) { throw new RuntimeException(ex); } final FormLayout formLayout = new FormLayout(colSpecs, rowSpecs); formLayout.setRowGroups(rowGroups); formLayout.setColumnGroups(columnGroups); container.setLayout(formLayout); }
From source file:com.isencia.passerelle.hmi.form.CheckableComponent.java
License:Open Source License
public CheckableComponent(Component c, Object subject, boolean isChecked) { super(new FormLayout("pref,10px,pref", "pref")); this.checkedComponent = c; this.checkBox = new JCheckBox(); this.subject = subject; checkBox.setSelected(isChecked);//from w ww . j av a 2 s . c om checkBox.addActionListener(new ComponentVisualizer()); // for some reason, if we put it as not visible here // the component can not be set visible later on // when we're checking the checkbox... checkedComponent.setEnabled(isChecked); CellConstraints cc = new CellConstraints(); add(this.checkBox, cc.xy(1, 1)); add(this.checkedComponent, cc.xy(3, 1)); }