本文整理汇总了Java中com.intellij.util.ui.FormBuilder.addLabeledComponent方法的典型用法代码示例。如果您正苦于以下问题:Java FormBuilder.addLabeledComponent方法的具体用法?Java FormBuilder.addLabeledComponent怎么用?Java FormBuilder.addLabeledComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.ui.FormBuilder
的用法示例。
在下文中一共展示了FormBuilder.addLabeledComponent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createNorthPanel
import com.intellij.util.ui.FormBuilder; //导入方法依赖的package包/类
protected JComponent createNorthPanel() {
final JPanel checkboxPanel = new JPanel(new BorderLayout());
checkboxPanel.add(createInner, BorderLayout.WEST);
checkboxPanel.add(extractAsEnum, BorderLayout.EAST);
FormBuilder builder = FormBuilder.createFormBuilder()
.addComponent(
JBLabelDecorator.createJBLabelDecorator(RefactorJBundle.message("extract.class.from.label", sourceClass.getQualifiedName()))
.setBold(true))
.addLabeledComponent(RefactorJBundle.message("name.for.new.class.label"), classNameField, UIUtil.LARGE_VGAP)
.addLabeledComponent(new JLabel(), checkboxPanel)
.addLabeledComponent(RefactorJBundle.message("package.for.new.class.label"), packageTextField);
if (JavaProjectRootsUtil.getSuitableDestinationSourceRoots(myProject).size() > 1) {
builder.addLabeledComponent(RefactoringBundle.message("target.destination.folder"), myDestinationFolderComboBox);
}
return builder.addVerticalGap(5).getPanel();
}
示例2: CertificateInfoPanel
import com.intellij.util.ui.FormBuilder; //导入方法依赖的package包/类
public CertificateInfoPanel(@NotNull X509Certificate certificate) {
myCertificateWrapper = new CertificateWrapper(certificate);
setLayout(new BorderLayout());
FormBuilder builder = FormBuilder.createFormBuilder();
// I'm not using separate panels and form builders to preserve alignment of labels
updateBuilderWithTitle(builder, "Issued To");
updateBuilderWithPrincipalData(builder, myCertificateWrapper.getSubjectFields());
updateBuilderWithTitle(builder, "Issued By");
updateBuilderWithPrincipalData(builder, myCertificateWrapper.getIssuerFields());
updateBuilderWithTitle(builder, "Validity Period");
String notBefore = DATE_FORMAT.format(myCertificateWrapper.getNotBefore());
String notAfter = DATE_FORMAT.format(myCertificateWrapper.getNotAfter());
builder = builder
.setIndent(IdeBorderFactory.TITLED_BORDER_INDENT)
.addLabeledComponent("Valid from:", createColoredComponent(notBefore, "not yet valid", myCertificateWrapper.isNotYetValid()))
.addLabeledComponent("Valid until:", createColoredComponent(notAfter, "expired", myCertificateWrapper.isExpired()));
builder.setIndent(0);
updateBuilderWithTitle(builder, "Fingerprints");
builder.setIndent(IdeBorderFactory.TITLED_BORDER_INDENT);
builder.addLabeledComponent("SHA-256:", getTextPane(formatHex(myCertificateWrapper.getSha256Fingerprint())));
builder.addLabeledComponent("SHA-1:", getTextPane(formatHex(myCertificateWrapper.getSha1Fingerprint())));
add(builder.getPanel(), BorderLayout.NORTH);
}
示例3: CreateGradleLibraryFromFilesDialog
import com.intellij.util.ui.FormBuilder; //导入方法依赖的package包/类
public CreateGradleLibraryFromFilesDialog(@NotNull Project project, @NotNull List<OrderRoot> roots) {
super(project, true);
setTitle(COMMAND_TITLE);
myProject = project;
myRoots = roots;
mySettingsFile = GradleSettingsFile.get(myProject);
final FormBuilder builder = LibraryNameAndLevelPanel.createFormBuilder();
myModulesComboBox = new ModulesComboBox();
myModulesComboBox.fillModules(myProject);
myModulesComboBox.setSelectedModule(findModule(roots));
for (Iterator iter = ((SortedListModel)myModulesComboBox.getModel()).iterator(); iter.hasNext(); ) {
Module module = (Module)iter.next();
String path = GradleSettingsFile.getModuleGradlePath(module);
if (path == null || !mySettingsFile.hasBuildFile(path)) {
iter.remove();
}
}
builder.addLabeledComponent("&Add to module:", myModulesComboBox);
myPanel = builder.getPanel();
init();
}
示例4: createCustomPanel
import com.intellij.util.ui.FormBuilder; //导入方法依赖的package包/类
@Nullable
@Override
protected JComponent createCustomPanel() {
myField2Variable = new IdentityHashMap<JTextField, TemplateVariable>();
FormBuilder builder = FormBuilder.createFormBuilder();
for (final TemplateVariable variable : myRepository.getTemplateVariables()) {
if (variable.isShownOnFirstTab()) {
JTextField field = variable.isHidden() ? new JPasswordField(variable.getValue()) : new JTextField(variable.getValue());
myField2Variable.put(field, variable);
installListener(field);
JBLabel label = new JBLabel(prettifyVariableName(variable.getName()) + ":", SwingConstants.RIGHT);
label.setAnchor(getAnchor());
builder.addLabeledComponent(label, field);
}
}
return builder.getPanel();
}
示例5: createOptionsPanel
import com.intellij.util.ui.FormBuilder; //导入方法依赖的package包/类
@Override
public JComponent createOptionsPanel() {
final JFormattedTextField valueField = prepareNumberEditor("m_limit");
final JComboBox comboBox = new ComboBox(new Object[] {Scope.NONE, Scope.PRIVATE, Scope.PACKAGE_LOCAL, Scope.PROTECTED});
comboBox.setRenderer(new ListCellRendererWrapper() {
@Override
public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
if (value instanceof Scope) setText(((Scope)value).getText());
}
});
comboBox.setSelectedItem(ignoreScope);
comboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ignoreScope = (Scope)comboBox.getSelectedItem();
}
});
comboBox.setPrototypeDisplayValue(Scope.PROTECTED);
final FormBuilder formBuilder = FormBuilder.createFormBuilder();
formBuilder.addLabeledComponent(getConfigurationLabel(), valueField);
formBuilder.addLabeledComponent(InspectionGadgetsBundle.message("constructor.visibility.option"), comboBox);
final JPanel panel = new JPanel(new BorderLayout());
panel.add(formBuilder.getPanel(), BorderLayout.NORTH);
return panel;
}
示例6: updateBuilderWithPrincipalData
import com.intellij.util.ui.FormBuilder; //导入方法依赖的package包/类
@SuppressWarnings("MethodMayBeStatic")
private FormBuilder updateBuilderWithPrincipalData(FormBuilder builder, X500Principal principal) {
builder = builder.setIndent(IdeBorderFactory.TITLED_BORDER_INDENT);
for (String field : principal.getName().split(",")) {
field = field.trim();
String[] parts = field.split("=", 2);
if (parts.length != 2) {
continue;
}
String name = parts[0];
String value = parts[1];
String longName = FIELD_ABBREVIATIONS.get(name.toUpperCase());
if (longName == null) {
continue;
}
builder = builder.addLabeledComponent(String.format("<html>%s (<b>%s</b>)</html>", longName, name), new JBLabel(value));
}
return builder.setIndent(0);
}
示例7: CertificateInfoPanel
import com.intellij.util.ui.FormBuilder; //导入方法依赖的package包/类
public CertificateInfoPanel(@Nonnull X509Certificate certificate) {
myCertificateWrapper = new CertificateWrapper(certificate);
setLayout(new BorderLayout());
FormBuilder builder = FormBuilder.createFormBuilder();
// I'm not using separate panels and form builders to preserve alignment of labels
updateBuilderWithTitle(builder, "Issued To");
updateBuilderWithPrincipalData(builder, myCertificateWrapper.getSubjectFields());
updateBuilderWithTitle(builder, "Issued By");
updateBuilderWithPrincipalData(builder, myCertificateWrapper.getIssuerFields());
updateBuilderWithTitle(builder, "Validity Period");
String notBefore = DATE_FORMAT.format(myCertificateWrapper.getNotBefore());
String notAfter = DATE_FORMAT.format(myCertificateWrapper.getNotAfter());
builder = builder
.setIndent(IdeBorderFactory.TITLED_BORDER_INDENT)
.addLabeledComponent("Valid from:", createColoredComponent(notBefore, "not yet valid", myCertificateWrapper.isNotYetValid()))
.addLabeledComponent("Valid until:", createColoredComponent(notAfter, "expired", myCertificateWrapper.isExpired()));
builder.setIndent(0);
updateBuilderWithTitle(builder, "Fingerprints");
builder.setIndent(IdeBorderFactory.TITLED_BORDER_INDENT);
builder.addLabeledComponent("SHA-256:", getTextPane(formatHex(myCertificateWrapper.getSha256Fingerprint())));
builder.addLabeledComponent("SHA-1:", getTextPane(formatHex(myCertificateWrapper.getSha1Fingerprint())));
add(builder.getPanel(), BorderLayout.NORTH);
}
示例8: createCenterPanel
import com.intellij.util.ui.FormBuilder; //导入方法依赖的package包/类
@Nullable
protected JComponent createCenterPanel() {
FormBuilder builder = FormBuilder.createFormBuilder().setVertical(true);
builder.addLabeledComponent("&Name:", myNameField);
builder.addLabeledComponent(getSplitDialogChooseFilesPrompt(), myChooser);
myChooser.setPreferredSize(JBUI.size(450, 300));
return builder.getPanel();
}
示例9: updateBuilderWithPrincipalData
import com.intellij.util.ui.FormBuilder; //导入方法依赖的package包/类
private static void updateBuilderWithPrincipalData(FormBuilder builder, Map<String, String> fields) {
builder = builder.setIndent(IdeBorderFactory.TITLED_BORDER_INDENT);
for (CommonField field : CommonField.values()) {
String value = fields.get(field.getShortName());
if (value == null) {
continue;
}
String label = String.format("<html>%s (<b>%s</b>)</html>", field.getShortName(), field.getLongName());
builder = builder.addLabeledComponent(label, new JBLabel(value));
}
builder.setIndent(0);
}
示例10: createNorthPanel
import com.intellij.util.ui.FormBuilder; //导入方法依赖的package包/类
protected JComponent createNorthPanel() {
FormBuilder builder = FormBuilder.createFormBuilder()
.addComponent(
JBLabelDecorator.createJBLabelDecorator(RefactorJBundle.message("extract.class.from.label", sourceClass.getQualifiedName()))
.setBold(true))
.addLabeledComponent(RefactorJBundle.message("name.for.new.class.label"), classNameField, UIUtil.LARGE_VGAP)
.addLabeledComponent(new JLabel(), extractAsEnum)
.addLabeledComponent(RefactorJBundle.message("package.for.new.class.label"), packageTextField);
if (ProjectRootManager.getInstance(myProject).getContentSourceRoots().length > 1) {
builder.addLabeledComponent(RefactoringBundle.message("target.destination.folder"), myDestinationFolderComboBox);
}
return builder.addVerticalGap(5).getPanel();
}
示例11: createCenterPanel
import com.intellij.util.ui.FormBuilder; //导入方法依赖的package包/类
@Nullable
protected JComponent createCenterPanel() {
FormBuilder builder = FormBuilder.createFormBuilder().setVertical(true);
builder.addLabeledComponent("&Name:", myNameField);
builder.addLabeledComponent(getSplitDialogChooseFilesPrompt(), myChooser);
myChooser.setPreferredSize(new Dimension(450, 300));
return builder.getPanel();
}
示例12: createEditor
import com.intellij.util.ui.FormBuilder; //导入方法依赖的package包/类
@NotNull
@Override
protected JComponent createEditor()
{
myProgramParametersPanel = new CommonProgramParametersPanel();
myModuleComboBox = new JComboBox();
myModuleComboBox.setRenderer(new ModuleListCellRenderer());
for(Module module : ModuleManager.getInstance(myProject).getModules())
{
if(ModuleUtilCore.getExtension(module, DotNetModuleExtension.class) != null)
{
myModuleComboBox.addItem(module);
}
}
myModuleComboBox.addItemListener(new ItemListener()
{
@Override
public void itemStateChanged(ItemEvent e)
{
if(e.getStateChange() == ItemEvent.SELECTED)
{
myProgramParametersPanel.setModuleContext((Module) myModuleComboBox.getSelectedItem());
}
}
});
FormBuilder formBuilder = FormBuilder.createFormBuilder();
formBuilder.addLabeledComponent("Module", myModuleComboBox);
myProgramParametersPanel.add(formBuilder.getPanel());
return myProgramParametersPanel;
}
示例13: addNorthComponents
import com.intellij.util.ui.FormBuilder; //导入方法依赖的package包/类
@Override
protected void addNorthComponents(FormBuilder formBuilder) {
formBuilder.addLabeledComponent("&Level:", myLibraryLevelCombobox);
}
示例14: createNorthPanel
import com.intellij.util.ui.FormBuilder; //导入方法依赖的package包/类
@Override
protected JComponent createNorthPanel() {
myInformationLabel = JBLabelDecorator.createJBLabelDecorator().setBold(true);
final FormBuilder formBuilder = FormBuilder.createFormBuilder().addComponent(myInformationLabel).addVerticalGap(
UIUtil.LARGE_VGAP - UIUtil.DEFAULT_VGAP);
DocumentListener documentListener = new DocumentAdapter() {
@Override
public void textChanged(DocumentEvent event) {
validateOKButton();
}
};
if (myShowNewNameField) {
myNewNameField = new JBTextField();
myNewNameField.getDocument().addDocumentListener(documentListener);
formBuilder.addLabeledComponent(RefactoringBundle.message("copy.files.new.name.label"), myNewNameField);
}
if (myShowDirectoryField) {
myTargetDirectoryField = new TextFieldWithHistoryWithBrowseButton();
myTargetDirectoryField.setTextFieldPreferredWidth(MAX_PATH_LENGTH);
final List<String> recentEntries = RecentsManager.getInstance(myProject).getRecentEntries(RECENT_KEYS);
if (recentEntries != null) {
myTargetDirectoryField.getChildComponent().setHistory(recentEntries);
}
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
myTargetDirectoryField.addBrowseFolderListener(RefactoringBundle.message("select.target.directory"),
RefactoringBundle.message("the.file.will.be.copied.to.this.directory"),
myProject, descriptor,
TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);
myTargetDirectoryField.getChildComponent().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
validateOKButton();
}
});
formBuilder.addLabeledComponent(RefactoringBundle.message("copy.files.to.directory.label"), myTargetDirectoryField);
String shortcutText =
KeymapUtil.getFirstKeyboardShortcutText(ActionManager.getInstance().getAction(IdeActions.ACTION_CODE_COMPLETION));
formBuilder.addTooltip(RefactoringBundle.message("path.completion.shortcut", shortcutText));
}
final JPanel wrapper = new JPanel(new BorderLayout());
wrapper.add(myOpenFilesInEditor, BorderLayout.EAST);
formBuilder.addComponent(wrapper);
return formBuilder.getPanel();
}
示例15: createNorthPanel
import com.intellij.util.ui.FormBuilder; //导入方法依赖的package包/类
@Override
protected JComponent createNorthPanel() {
myInformationLabel = JBLabelDecorator.createJBLabelDecorator().setBold(true);
final FormBuilder formBuilder = FormBuilder.createFormBuilder().addComponent(myInformationLabel).addVerticalGap(
UIUtil.LARGE_VGAP - UIUtil.DEFAULT_VGAP);
DocumentListener documentListener = new DocumentAdapter() {
@Override
public void textChanged(DocumentEvent event) {
validateOKButton();
}
};
if (myShowNewNameField) {
myNewNameField = new JTextField();
myNewNameField.getDocument().addDocumentListener(documentListener);
formBuilder.addLabeledComponent(RefactoringBundle.message("copy.files.new.name.label"), myNewNameField);
}
if (myShowDirectoryField) {
myTargetDirectoryField = new TextFieldWithHistoryWithBrowseButton();
myTargetDirectoryField.setTextFieldPreferredWidth(MAX_PATH_LENGTH);
final List<String> recentEntries = RecentsManager.getInstance(myProject).getRecentEntries(RECENT_KEYS);
if (recentEntries != null) {
myTargetDirectoryField.getChildComponent().setHistory(recentEntries);
}
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
myTargetDirectoryField.addBrowseFolderListener(RefactoringBundle.message("select.target.directory"),
RefactoringBundle.message("the.file.will.be.copied.to.this.directory"),
myProject, descriptor,
TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);
myTargetDirectoryField.getChildComponent().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
validateOKButton();
}
});
formBuilder.addLabeledComponent(RefactoringBundle.message("copy.files.to.directory.label"), myTargetDirectoryField);
String shortcutText =
KeymapUtil.getFirstKeyboardShortcutText(ActionManager.getInstance().getAction(IdeActions.ACTION_CODE_COMPLETION));
formBuilder.addTooltip(RefactoringBundle.message("path.completion.shortcut", shortcutText));
}
final JPanel wrapper = new JPanel(new BorderLayout());
wrapper.add(myOpenFilesInEditor, BorderLayout.EAST);
formBuilder.addComponent(wrapper);
return formBuilder.getPanel();
}