net.miginfocom.layout.LC Java Examples
The following examples show how to use
net.miginfocom.layout.LC.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PredefinedVariablesDialog.java From PackageTemplates with Apache License 2.0 | 6 votes |
@Override public void preShow() { setTitle(Localizer.get("title.AvailableVariables")); panel.setLayout(new MigLayout(new LC().gridGap("8pt", "4pt"))); JLabel jlName = new JLabel(Localizer.get("label.Name")); JLabel jlExample = new JLabel(Localizer.get("label.Example")); panel.add(jlName, new CC().pushX().growX()); panel.add(jlExample, new CC().pushX().growX().wrap()); panel.add(new SeparatorComponent(10), new CC().pushX().growX().wrap().spanX()); for (Map.Entry<String, String> entry : ptWrapper.getFakeProperties().entrySet()) { JTextField key = new JTextField (entry.getKey()); JTextField value = new JTextField (entry.getValue()); key.setEditable(false); value.setEditable(false); panel.add(key, new CC().pushX().growX()); panel.add(value, new CC().pushX().growX().wrap()); } pack(); }
Example #2
Source File: GlobalVariableWrapper.java From PackageTemplates with Apache License 2.0 | 6 votes |
@NotNull private JPanel createOptionsBlock() { JPanel optionsPanel = new JPanel(new MigLayout(new LC())); // Script jlScript = new IconLabel( Localizer.get("tooltip.ColoredWhenItemHasScript"), PluginIcons.SCRIPT, PluginIcons.SCRIPT_DISABLED ); updateComponentsState(); optionsPanel.add(jlScript, new CC().pad(0, 0, 0, 6)); optionsPanel.add(jlVariable, new CC()); return optionsPanel; }
Example #3
Source File: DesktopFieldGroup.java From cuba with Apache License 2.0 | 6 votes |
public DesktopFieldGroup() { LC lc = new LC(); lc.hideMode(3); // Invisible components will not participate in the layout at all and it will for instance not take up a grid cell. lc.insets("0 0 0 0"); if (LayoutAdapter.isDebug()) { lc.debug(1000); } layout = new MigLayout(lc); impl = new JPanel(layout); assignClassDebugProperty(impl); collapsiblePanel = new CollapsiblePanel(super.getComposition()); assignClassDebugProperty(collapsiblePanel); collapsiblePanel.setBorderVisible(false); setWidth(Component.AUTO_SIZE); fieldFactory = AppBeans.get(FieldGroupFieldFactory.NAME); }
Example #4
Source File: DesktopFilter.java From cuba with Apache License 2.0 | 6 votes |
public DesktopFilter() { delegate = AppBeans.get(FilterDelegate.class); delegate.setFilter(this); LC topLc = new LC(); topLc.hideMode(3); topLc.insetsAll("0"); if (LayoutAdapter.isDebug()) { topLc.debug(1000); } MigLayout topLayout = new MigLayout(topLc); impl = new JPanel(topLayout); ComponentContainer layout = delegate.getLayout(); JComponent unwrap = DesktopComponentsHelper.getComposition(layout); impl.add(unwrap, "width 100%"); setWidth("100%"); delegate.setExpandedStateChangeListener(e -> fireExpandStateChange(e.isExpanded())); delegate.setCaptionChangedListener(this::updateCaption); }
Example #5
Source File: CustomPathDialog.java From PackageTemplates with Apache License 2.0 | 6 votes |
@Override public void preShow() { panel.setLayout(new MigLayout(new LC().gridGap("0", "8pt"))); actionsPanel = new JPanel(new MigLayout(new LC().fillX().insetsAll("0").gridGap("0", "0"))); wrappers = new ArrayList<>(); for (SearchAction searchAction : customPath.getListSearchAction()) { createSearchAction(searchAction); } btnAdd = getAddButton(); btnRegexpHelper = getRegexpButton(); panel.add(actionsPanel, new CC().pushX().grow().spanX().wrap()); panel.add(btnAdd, new CC().spanX().split(2)); panel.add(btnRegexpHelper, new CC().wrap()); }
Example #6
Source File: LibraryDialog.java From PackageTemplates with Apache License 2.0 | 6 votes |
private void initBinaryFilesTab() { pTabBinaryFiles = new JPanel(new MigLayout(new LC())); // List createBinaryFileList(); //Content (right panel) JPanel panelBinaryFilesContent = new JPanel(new MigLayout()); btnBinaryFilePath = new TextFieldWithBrowseButton(); btnBinaryFilePath.setText(""); btnBinaryFilePath.addBrowseFolderListener(Localizer.get("library.ChooseBinaryFile"), "", project, FileReaderUtil.getBinaryFileDescriptor()); tfBinaryFileAlias = new EditorTextField("ExampleAlias"); panelBinaryFilesContent.add(tfBinaryFileAlias, new CC().wrap()); panelBinaryFilesContent.add(btnBinaryFilePath, new CC().wrap().gapY("8pt", "0")); //Splitter JBSplitter splitter = new JBSplitter(0.3f); splitter.setFirstComponent(listBinaryFiles); splitter.setSecondComponent(panelBinaryFilesContent); pTabBinaryFiles.add(splitter, new CC().push().grow()); tabbedPane.addTab("Tab1", pTabBinaryFiles); }
Example #7
Source File: WriteRulesDialog.java From PackageTemplates with Apache License 2.0 | 6 votes |
@Override public void preShow() { panel.setLayout(new MigLayout(new LC().gridGap("0", "8pt"))); //Type ArrayList<WriteRules> actionTypes = new ArrayList<>(); if(hasParent){ actionTypes.add(WriteRules.FROM_PARENT); } actionTypes.add(WriteRules.USE_EXISTING); actionTypes.add(WriteRules.ASK_ME); actionTypes.add(WriteRules.OVERWRITE); comboBoxRules = new ComboBox(actionTypes.toArray()); comboBoxRules.setRenderer(new WriteRulesCellRenderer()); comboBoxRules.setSelectedItem(writeRules); panel.add(comboBoxRules, new CC().pushX().growX().spanX().gapY("10","10")); }
Example #8
Source File: VclTestApp.java From cuba with Apache License 2.0 | 5 votes |
private Component createAlignTab() { JPanel box = new JPanel(); box.setFocusable(false); MigLayout boxLayout = new MigLayout("debug 1000, fill"); box.setLayout(boxLayout); JPanel panel = new JPanel(); MigLayout layout = new MigLayout("debug 1000, fill"); panel.setLayout(layout); JLabel label = new JLabel("Label"); CC cc = new CC(); cc.alignX("right").alignY("50%"); panel.add(label); layout.setComponentConstraints(label, cc); LC lc = new LC(); lc.hideMode(2); // The size of an invisible component will be set to 0, 0 and the gaps will also be set to 0 around it. lc.debug(1000); AC rowConstr = new AC(); AC colConstr = new AC(); lc.fillX(); lc.flowY(); lc.gridGapY("0"); layout.setLayoutConstraints(lc); layout.setRowConstraints(rowConstr); layout.setColumnConstraints(colConstr); box.add(panel, "height 100px, width 100px"); layout.setComponentConstraints(label, cc); return box; }
Example #9
Source File: DesktopRowsCount.java From cuba with Apache License 2.0 | 5 votes |
public RowsCountComponent() { LC lc = new LC(); lc.hideMode(2); lc.insetsAll("2"); layout = new MigLayout(lc); if (LayoutAdapter.isDebug()) { lc.debug(1000); } setLayout(layout); firstButton = new JButton("<<"); add(firstButton); firstButton.setPreferredSize(size); firstButton.setMinimumSize(size); prevButton = new JButton("<"); add(prevButton); prevButton.setPreferredSize(size); prevButton.setMinimumSize(size); label = new JLabel(); label.setMinimumSize(size); add(label); countButton = new JXHyperlink(); countButton.setText("[?]"); add(countButton); nextButton = new JButton(">"); add(nextButton); nextButton.setPreferredSize(size); nextButton.setMinimumSize(size); lastButton = new JButton(">>"); add(lastButton); lastButton.setPreferredSize(size); lastButton.setMinimumSize(size); }
Example #10
Source File: MigBoxLayoutAdapter.java From cuba with Apache License 2.0 | 5 votes |
private void adjustExpanding(LC lc, AC ac) { Component[] components = container.getComponents(); for (int i = 0; i < components.length; i++) { if (expandedComponent == null || expandedComponent == components[i]) { ac.fill(i); } else { ac.size("min!", i); } } lc.fill(); }
Example #11
Source File: MigBoxLayoutAdapter.java From cuba with Apache License 2.0 | 5 votes |
private void updateLayoutConstraints(boolean resetExpanded) { LC lc = new LC(); lc.hideMode(2); // Invisible components will not participate in the layout at all and it will for instance not take up a grid cell lc.fill(); // always give all space to components, otherwise align doesn't work AC rowConstr = new AC(); AC colConstr = new AC(); if (direction.equals(FlowDirection.X)) { rowConstr.align("top"); lc.flowX(); if (expandedComponent != null || resetExpanded) { adjustExpanding(lc, colConstr); } } else { lc.flowY(); if (expandedComponent != null || resetExpanded) { adjustExpanding(lc, rowConstr); } } lc.setInsets(MigLayoutHelper.makeInsets(margins)); if (!spacing) { if (direction.equals(FlowDirection.X)) { lc.gridGapX("0"); } else { lc.gridGapY("0"); } } if (isDebug()) lc.debug(1000); layout.setLayoutConstraints(lc); layout.setRowConstraints(rowConstr); layout.setColumnConstraints(colConstr); }
Example #12
Source File: MigGridLayoutAdapter.java From cuba with Apache License 2.0 | 5 votes |
@Override protected void update() { LC lc = new LC(); lc.setWrapAfter(getColumns()); lc.hideMode(2); // The size of an invisible component will be set to 0, 0 and the gaps will also be set to 0 around it. lc.fill(); lc.setInsets(MigLayoutHelper.makeInsets(margins)); if (!spacing) { lc.gridGap("0", "0"); } if (isDebug()) lc.debug(1000); layout.setLayoutConstraints(lc); AC rowConstr = new AC(); rowConstr.align("top"); // left-top align by default layout.setRowConstraints(rowConstr); AC colConstr = new AC(); for (int i = 0; i < colCount; i++) { float ratio = columnRatio[i]; colConstr.grow(ratio, i); colConstr.shrink(ratio != 0 ? (float) Math.sqrt(1.0f / ratio) : 100.0f, i); } layout.setColumnConstraints(colConstr); }
Example #13
Source File: LibraryDialog.java From PackageTemplates with Apache License 2.0 | 5 votes |
@Override protected MigLayout createLayout() { return new MigLayout(new LC() .insets("0") .fill() .gridGap("0", "0") ); }
Example #14
Source File: RegexpHelperDialog.java From PackageTemplates with Apache License 2.0 | 5 votes |
@Override public void preShow() { setTitle(Localizer.get("title.RegexpHelper")); panel.setLayout(new MigLayout(new LC().gridGap("0", "8pt"))); JLabel jlPattern = new JLabel(Localizer.get("label.RegexpPattern")); tfPattern = new EditorTextField(".*My[\\w]+\\.html.*", project, RegExpFileType.INSTANCE); tfPattern.setOneLineMode(false); JLabel jlText = new JLabel(Localizer.get("label.Text")); tfText = new EditorTextField("Bla bla bla\nMyUniqueTextFragment.html\nBla bla bla"); tfText.setOneLineMode(false); JPanel secondPanel = new JPanel(new MigLayout(new LC().insets("0").gridGap("0", "4pt"))); secondPanel.add(jlText, new CC().wrap()); secondPanel.add(tfText, new CC().wrap().push().grow()); JBSplitter splitter = new JBSplitter(true, 0.35f); splitter.setFirstComponent(tfPattern); splitter.setSecondComponent(secondPanel); splitter.setShowDividerControls(true); splitter.setHonorComponentsMinimumSize(true); btnTry = new JButton(Localizer.get("TryIt")); btnTry.addMouseListener(new ClickListener() { @Override public void mouseClicked(MouseEvent e) { doMatch(); } }); jlResult = new JLabel(Localizer.get("ResultWillBeHere")); panel.add(jlPattern, new CC().wrap().spanX()); panel.add(splitter, new CC().wrap().push().grow().spanX()); panel.add(btnTry, new CC().spanX().split(2)); panel.add(jlResult, new CC().wrap().pushX().growX()); }
Example #15
Source File: SettingsDialog.java From PackageTemplates with Apache License 2.0 | 5 votes |
@Override public void buildView() { panel.setLayout(new MigLayout(new LC().insets("0").fillX().gridGapY("1pt"))); buildLanguageBlock(); buildAutoImportBlock(); presenter.loadAutoImport(); presenter.loadBinaryFileConfig(); }
Example #16
Source File: ReportDialog.java From PackageTemplates with Apache License 2.0 | 5 votes |
@Override public void preShow() { panel.setLayout(new MigLayout(new LC().fillX())); panel.add(new JBLabel( Localizer.get("label.Actions")), new CC().spanX().wrap() ); addSeparator(); createViews(); pack(); }
Example #17
Source File: SelectBinaryFileDialog.java From PackageTemplates with Apache License 2.0 | 5 votes |
@Override protected JComponent createCenterPanel() { presenter = new SelectBinaryFilePresenterImpl(this); panel = new JPanel(); panel.setLayout(new MigLayout(new LC().gridGap("0", "8pt"))); render(); JBScrollPane scrollPane = new JBScrollPane(panel); scrollPane.setMinimumSize(new Dimension(600, 200)); return scrollPane; }
Example #18
Source File: FileWrapper.java From PackageTemplates with Apache License 2.0 | 5 votes |
@NotNull private JPanel getOptionsPanel() { JPanel optionsPanel = new JPanel(new MigLayout(new LC().insets("0").gridGap("2pt","0"))); cbEnabled = new JBCheckBox(); cbEnabled.setSelected(file.isEnabled()); cbEnabled.addItemListener(e -> setEnabled(cbEnabled.isSelected())); cbEnabled.setToolTipText(Localizer.get("tooltip.IfCheckedElementWillBeCreated")); // Script jlScript = new IconLabel( Localizer.get("tooltip.ColoredWhenItemHasScript"), PluginIcons.SCRIPT, PluginIcons.SCRIPT_DISABLED ); // CustomPath jlCustomPath = new IconLabel( Localizer.get("tooltip.ColoredWhenItemHasCustomPath"), PluginIcons.CUSTOM_PATH, PluginIcons.CUSTOM_PATH_DISABLED ); // WriteRules jlWriteRules = new IconLabelCustom<File>(Localizer.get("tooltip.WriteRules"), file) { @Override public void onUpdateIcon(File item) { setIcon(item.getWriteRules().toIcon()); } }; updateOptionIcons(); optionsPanel.add(cbEnabled, new CC()); optionsPanel.add(jlScript, new CC()); optionsPanel.add(jlCustomPath, new CC()); optionsPanel.add(jlWriteRules, new CC()); return optionsPanel; }
Example #19
Source File: DirectoryWrapper.java From PackageTemplates with Apache License 2.0 | 5 votes |
@NotNull private JPanel getOptionsPanel() { // isEnabled cbEnabled = new JBCheckBox(); cbEnabled.setSelected(directory.isEnabled()); cbEnabled.addItemListener(e -> setEnabled(cbEnabled.isSelected())); cbEnabled.setToolTipText(Localizer.get("tooltip.IfCheckedElementWillBeCreated")); // Script jlScript = new IconLabel( Localizer.get("tooltip.ColoredWhenItemHasScript"), PluginIcons.SCRIPT, PluginIcons.SCRIPT_DISABLED ); // CustomPath jlCustomPath = new IconLabel( Localizer.get("tooltip.ColoredWhenItemHasCustomPath"), PluginIcons.CUSTOM_PATH, PluginIcons.CUSTOM_PATH_DISABLED ); // WriteRules jlWriteRules = new IconLabelCustom<Directory>(Localizer.get("tooltip.WriteRules"), directory) { @Override public void onUpdateIcon(Directory item) { setIcon(item.getWriteRules().toIcon()); } }; updateOptionIcons(); JPanel optionsPanel = new JPanel(new MigLayout(new LC().insets("0").gridGap("2pt","0"))); optionsPanel.add(cbEnabled, new CC()); optionsPanel.add(jlScript, new CC()); optionsPanel.add(jlCustomPath, new CC()); optionsPanel.add(jlWriteRules, new CC()); return optionsPanel; }
Example #20
Source File: DirectoryWrapper.java From PackageTemplates with Apache License 2.0 | 5 votes |
@Override public void buildView(Project project, JPanel container) { if (panel == null) { panel = new JPanel(new MigLayout(new LC().insets("0").gridGapY("2pt").fillX())); } else { panel.removeAll(); } jlName = new JLabel(AllIcons.Nodes.Package, SwingConstants.LEFT); jlName.setDisabledIcon(jlName.getIcon()); jlName.setText(Localizer.get("Directory")); etfDescription = UIHelper.getEditorTextField(getDirectory().getName(), project); addMouseListener(); container.add(getOptionsPanel(), new CC().spanX().split(3)); container.add(jlName, new CC().pad(0, 0, 0, UIHelper.PADDING_LABEL)); container.add(etfDescription, new CC().growX().pushX().wrap()); updateComponentsState(); //Children if (!getListElementWrapper().isEmpty()) { for (ElementWrapper elementWrapper : getListElementWrapper()) { elementWrapper.buildView(project, panel); } UIHelper.setLeftPadding(panel, UIHelper.PADDING + UIHelper.DEFAULT_PADDING); container.add(panel, new CC().spanX().growX().pushX().wrap()); } }
Example #21
Source File: BinaryFileWrapper.java From PackageTemplates with Apache License 2.0 | 5 votes |
@NotNull private JPanel getOptionsPanel() { JPanel optionsPanel = new JPanel(new MigLayout(new LC().insets("0").gridGap("2pt", "0"))); cbEnabled = new JBCheckBox(); cbEnabled.setSelected(binaryFile.isEnabled()); cbEnabled.addItemListener(e -> setEnabled(cbEnabled.isSelected())); cbEnabled.setToolTipText(Localizer.get("tooltip.IfCheckedElementWillBeCreated")); // Script jlScript = new IconLabel( Localizer.get("tooltip.ColoredWhenItemHasScript"), PluginIcons.SCRIPT, PluginIcons.SCRIPT_DISABLED ); // CustomPath jlCustomPath = new IconLabel( Localizer.get("tooltip.ColoredWhenItemHasCustomPath"), PluginIcons.CUSTOM_PATH, PluginIcons.CUSTOM_PATH_DISABLED ); // WriteRules jlWriteRules = new IconLabelCustom<BinaryFile>(Localizer.get("tooltip.WriteRules"), binaryFile) { @Override public void onUpdateIcon(BinaryFile item) { setIcon(item.getWriteRules().toIcon()); } }; updateOptionIcons(); optionsPanel.add(cbEnabled, new CC()); optionsPanel.add(jlScript, new CC()); optionsPanel.add(jlCustomPath, new CC()); optionsPanel.add(jlWriteRules, new CC()); return optionsPanel; }
Example #22
Source File: LibraryDialog.java From PackageTemplates with Apache License 2.0 | 4 votes |
private void initSecondTab() { pRight = new JPanel(new MigLayout(new LC())); tabbedPane.addTab("Tab2", pRight); }
Example #23
Source File: ConfigureDialog.java From PackageTemplates with Apache License 2.0 | 4 votes |
@Override public void buildView(PackageTemplateWrapper ptWrapper) { panel.setLayout(new MigLayout(new LC().fillX())); ptWrapper.setUpdateUICallback(updateUICallback); panel.add(ptWrapper.buildView(), new CC().pushX().growX().wrap()); }
Example #24
Source File: PackageTemplateWrapper.java From PackageTemplates with Apache License 2.0 | 4 votes |
public JPanel buildView() { if (panel == null) { panel = new JPanel(new MigLayout(new LC().insets("0").fillX().gridGapY("1pt"))); } // Properties panelProperties = new JPanel(new MigLayout(new LC().insets("0").gridGap("0", "0"))); buildProperties(); panel.add(panelProperties, new CC().spanX().wrap().pushX().growX()); // Globals panel.add(new SeparatorComponent(6), new CC().pushX().growX().wrap().spanX()); JLabel jlGlobals = new JLabel(Localizer.get("GlobalVariables"), JLabel.CENTER); panel.add(jlGlobals, new CC().wrap().growX().pushX().spanX().gapY("0", "4pt")); panelGlobals = new JPanel(new MigLayout(new LC().insets("0").gridGap("0", "0"))); buildGlobals(); panel.add(panelGlobals, new CC().spanX().pushX().growX().wrap()); initAvailableVariablesButton(); // Files and Directories | Elements panel.add(new SeparatorComponent(6), new CC().pushX().growX().wrap().spanX()); JLabel jlFilesAndDirs = new JLabel(Localizer.get("FilesAndDirs"), JLabel.CENTER); panel.add(jlFilesAndDirs, new CC().wrap().growX().pushX().spanX().gapY("0", "4pt")); panelElements = new JPanel(new MigLayout(new LC().insets("0").gridGap("0", "2pt"))); buildElements(); panel.add(panelElements, new CC().spanX().pushX().growX().wrap()); // Text Injection panel.add(new SeparatorComponent(6), new CC().pushX().growX().wrap().spanX()); JLabel jlTextInjection = new JLabel(Localizer.get("TextInjection"), JLabel.CENTER); panel.add(jlTextInjection, new CC().wrap().growX().pushX().spanX()); panelTextInjection = new JPanel(new MigLayout(new LC().insets("0").gridGap("0", "0"))); buildTextInjections(); panel.add(panelTextInjection, new CC().spanX().pushX().growX().wrap()); initTextInjectionAddButton(); return panel; }
Example #25
Source File: ListView.java From PackageTemplates with Apache License 2.0 | 4 votes |
public ListView(List<Item> list) { this(new MigLayout(new LC().insets("0").gridGap("0", "2pt")), list); }