當前位置: 首頁>>代碼示例>>Java>>正文


Java ComboBox.setRenderer方法代碼示例

本文整理匯總了Java中com.intellij.openapi.ui.ComboBox.setRenderer方法的典型用法代碼示例。如果您正苦於以下問題:Java ComboBox.setRenderer方法的具體用法?Java ComboBox.setRenderer怎麽用?Java ComboBox.setRenderer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.ui.ComboBox的用法示例。


在下文中一共展示了ComboBox.setRenderer方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getSelector

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
@NotNull
private ComboBox getSelector() {
    ArrayList<TemplateForSearch> listTemplateForSearch = FileTemplateHelper.getTemplates(
            project,
            cbAddInternal.isSelected(),
            cbAddJ2EE.isSelected(),
            ptWrapper.getPackageTemplate().getFileTemplateSource()
    );

    ComboBox comboBox = new ComboBox(listTemplateForSearch.toArray());
    comboBox.setRenderer(new ListCellRendererWrapper<TemplateForSearch>() {
        @Override
        public void customize(JList list, TemplateForSearch template, int index, boolean selected, boolean hasFocus) {
            if (template != null) {
                setIcon(FileTemplateUtil.getIcon(template.getTemplate()));
                setText(template.getTemplate().getName());
            }
        }
    });

    new ComboboxSpeedSearch(comboBox);
    return comboBox;
}
 
開發者ID:CeH9,項目名稱:PackageTemplates,代碼行數:24,代碼來源:SelectFileTemplateDialog.java

示例2: preShow

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
@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"));
}
 
開發者ID:CeH9,項目名稱:PackageTemplates,代碼行數:20,代碼來源:WriteRulesDialog.java

示例3: DebuggerExpressionComboBox

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
public DebuggerExpressionComboBox(@NotNull Project project, @NotNull Disposable parentDisposable, @Nullable PsiElement context, @Nullable String recentsId, @NotNull CodeFragmentFactory factory) {
  super(project, factory, parentDisposable, context, recentsId);

  setLayout(new BorderLayout(0, 0));

  myComboBox = new ComboBox(new MyComboboxModel(getRecents()), 100);
  myComboBox.setSwingPopup(false);

  // Have to turn this off because when used in DebuggerTreeInplaceEditor, the combobox popup is hidden on every change of selection
  // See comment to SynthComboBoxUI.FocusHandler.focusLost()
  myComboBox.setLightWeightPopupEnabled(false);

  myEditor = new MyEditorComboBoxEditor(getProject(), getCurrentFactory().getFileType());
  //noinspection GtkPreferredJComboBoxRenderer
  myComboBox.setRenderer(new EditorComboBoxRenderer(myEditor));

  myComboBox.setEditable(true);
  myComboBox.setEditor(myEditor);
  add(addChooseFactoryLabel(myComboBox, false));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:DebuggerExpressionComboBox.java

示例4: setupComboBox

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
private void setupComboBox(final ComboBox combobox, FileType fileType) {
  final EditorComboBoxEditor comboEditor = new StringComboboxEditor(myProject, fileType, combobox) {
    @Override
    public void setItem(Object anObject) {
      myNonHumanChange = true;
      super.setItem(anObject);
    }
  };

  combobox.setEditor(comboEditor);
  combobox.setRenderer(new EditorComboBoxRenderer(comboEditor));

  combobox.setEditable(true);
  combobox.setMaximumRowCount(8);

  comboEditor.selectAll();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:NameSuggestionsField.java

示例5: initComponents

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
@Override
protected void initComponents()
{
	myModuleBox = new ComboBox();
	myModuleBox.setRenderer(new ModuleListCellRenderer());

	myVmParametersComponent = LabeledComponent.create(new RawCommandLineEditor(), "VM arguments");
	myVmParametersComponent.setLabelLocation(BorderLayout.WEST);
	copyDialogCaption(myVmParametersComponent);

	myUseAlternativeBundleCheckBox = new JCheckBox("Use alternative bundle: ");
	ProjectSdksModel projectSdksModel = new ProjectSdksModel();
	projectSdksModel.reset();

	myAlternativeBundleComboBox = new SdkComboBox(projectSdksModel, Conditions.<SdkTypeId>is(NodeJSBundleType.getInstance()), true);
	myAlternativeBundleComboBox.setEnabled(false);
	myUseAlternativeBundleCheckBox.addItemListener(new ItemListener()
	{
		@Override
		public void itemStateChanged(ItemEvent e)
		{
			myAlternativeBundleComboBox.setEnabled(myUseAlternativeBundleCheckBox.isSelected());
		}
	});
	super.initComponents();
}
 
開發者ID:consulo,項目名稱:consulo-nodejs,代碼行數:27,代碼來源:NodeJSConfigurationPanelBase.java

示例6: DebuggerExpressionComboBox

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
public DebuggerExpressionComboBox(Project project, PsiElement context, @NonNls String recentsId, final CodeFragmentFactory factory) {
  super(project, context, recentsId, factory);
  setLayout(new BorderLayout(0, 0));

  myComboBox = new ComboBox(new MyComboboxModel(getRecents()), 100);
  myComboBox.setSwingPopup(false);

  // Have to turn this off because when used in DebuggerTreeInplaceEditor, the combobox popup is hidden on every change of selection
  // See comment to SynthComboBoxUI.FocusHandler.focusLost()
  myComboBox.setLightWeightPopupEnabled(false);

  myEditor = new MyEditorComboBoxEditor(getProject(), getCurrentFactory().getFileType());
  //noinspection GtkPreferredJComboBoxRenderer
  myComboBox.setRenderer(new EditorComboBoxRenderer(myEditor));

  myComboBox.setEditable(true);
  myComboBox.setEditor(myEditor);
  add(addChooseFactoryLabel(myComboBox, false));
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:20,代碼來源:DebuggerExpressionComboBox.java

示例7: CreateNewLibraryDialog

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
public CreateNewLibraryDialog(@NotNull JComponent parent, @NotNull StructureConfigurableContext context, @NotNull NewLibraryEditor libraryEditor,
                               @NotNull List<LibraryTable> libraryTables, int selectedTable) {
  super(parent, new LibraryRootsComponent(context.getProject(), libraryEditor));
  myContext = context;
  myLibraryEditor = libraryEditor;
  final DefaultComboBoxModel model = new DefaultComboBoxModel();
  for (LibraryTable table : libraryTables) {
    model.addElement(table);
  }
  myLibraryLevelCombobox = new ComboBox(model);
  myLibraryLevelCombobox.setSelectedIndex(selectedTable);
  myLibraryLevelCombobox.setRenderer(new ListCellRendererWrapper() {
    @Override
    public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
      if (value instanceof LibraryTable) {
        setText(((LibraryTable)value).getPresentation().getDisplayName(false));
      }
    }
  });
  init();
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:22,代碼來源:CreateNewLibraryDialog.java

示例8: createTopRightComponent

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
@Override
protected JComponent createTopRightComponent() {
  final ComboBox artifactTypeBox = new ComboBox();
  for (ArtifactType type : ArtifactType.getAllTypes()) {
    artifactTypeBox.addItem(type);
  }

  artifactTypeBox.setRenderer(new ArtifactTypeCellRenderer(artifactTypeBox.getRenderer()));

  artifactTypeBox.setSelectedItem(getArtifact().getArtifactType());
  artifactTypeBox.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      final ArtifactType selected = (ArtifactType)artifactTypeBox.getSelectedItem();
      if (selected != null && !Comparing.equal(selected, getArtifact().getArtifactType())) {
        getEditor().setArtifactType(selected);
      }
    }
  });

  final JPanel panel = new JPanel(new FlowLayout());
  panel.add(new JLabel("Type: "));
  panel.add(artifactTypeBox);
  return panel;
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:26,代碼來源:ArtifactConfigurable.java

示例9: createKeymapListPanel

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
private JPanel createKeymapListPanel() {
  JPanel panel = new JPanel();
  panel.setLayout(new GridBagLayout());

  myKeymapList = new ComboBox(myKeymapListModel);
  myKeymapList.setEditor(new MyEditor());
  myKeymapList.setRenderer(new MyKeymapRenderer(myKeymapList.getRenderer()));
  JLabel keymapLabel = new JLabel(KeyMapBundle.message("keymaps.border.factory.title"));
  keymapLabel.setLabelFor(myKeymapList);
  panel.add(keymapLabel, new GridBagConstraints(0,0, 1, 1, 0,0,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,0), 0,0));
  panel.add(myKeymapList, new GridBagConstraints(1,0,1,1,0,0,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0,4,0,0),0,0));

  panel.add(createKeymapButtonsPanel(), new GridBagConstraints(2,0,1,1,0,0,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,0),0,0));
  myKeymapList.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      if (myKeymapListModel.getSelectedItem() != mySelectedKeymap) processCurrentKeymapChanged(getCurrentQuickListIds());
    }
  });
  panel.add(createKeymapNamePanel(), new GridBagConstraints(3,0,1,1,1,0,GridBagConstraints.WEST,GridBagConstraints.NONE,new Insets(0,10,0,0),0,0));
  return panel;
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:22,代碼來源:KeymapPanel.java

示例10: createKeymapListPanel

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
private JPanel createKeymapListPanel() {
  JPanel panel = new JPanel();
  panel.setLayout(new GridBagLayout());

  myKeymapList = new ComboBox(myKeymapListModel);
  myKeymapList.setEditor(new MyEditor());
  myKeymapList.setRenderer(new MyKeymapRenderer(myKeymapList.getRenderer()));
  JLabel keymapLabel = new JLabel(KeyMapBundle.message("keymaps.border.factory.title"));
  keymapLabel.setLabelFor(myKeymapList);
  panel.add(keymapLabel, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
  panel.add(myKeymapList, new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 4, 0, 0), 0, 0));

  panel.add(createKeymapButtonsPanel(),
            new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
  myKeymapList.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      if (myKeymapListModel.getSelectedItem() != mySelectedKeymap) processCurrentKeymapChanged(getCurrentQuickListIds());
    }
  });
  panel.add(createKeymapNamePanel(),
            new GridBagConstraints(3, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 10, 0, 0), 0, 0));
  return panel;
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:25,代碼來源:KeymapPanel.java

示例11: CreateNewLibraryDialog

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
public CreateNewLibraryDialog(@Nonnull JComponent parent, @Nonnull StructureConfigurableContext context, @Nonnull NewLibraryEditor libraryEditor,
                              @Nonnull List<LibraryTable> libraryTables, int selectedTable) {
  super(parent, new LibraryRootsComponent(context.getProject(), libraryEditor));
  myContext = context;
  myLibraryEditor = libraryEditor;
  final DefaultComboBoxModel model = new DefaultComboBoxModel();
  for (LibraryTable table : libraryTables) {
    model.addElement(table);
  }
  myLibraryLevelCombobox = new ComboBox(model);
  myLibraryLevelCombobox.setSelectedIndex(selectedTable);
  myLibraryLevelCombobox.setRenderer(new ListCellRendererWrapper() {
    @Override
    public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
      if (value instanceof LibraryTable) {
        setText(((LibraryTable)value).getPresentation().getDisplayName(false));
      }
    }
  });
  init();
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:22,代碼來源:CreateNewLibraryDialog.java

示例12: createTopRightComponent

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
@Override
protected JComponent createTopRightComponent(final JTextField nameField) {
  final ComboBox artifactTypeBox = new ComboBox();
  for (ArtifactType type : ArtifactType.EP_NAME.getExtensions()) {
    artifactTypeBox.addItem(type);
  }

  artifactTypeBox.setRenderer(new ArtifactTypeCellRenderer(artifactTypeBox.getRenderer()));

  artifactTypeBox.setSelectedItem(getArtifact().getArtifactType());
  artifactTypeBox.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      final ArtifactType selected = (ArtifactType)artifactTypeBox.getSelectedItem();
      if (selected != null && !Comparing.equal(selected, getArtifact().getArtifactType())) {
        getEditor().setArtifactType(selected);
      }
    }
  });

  return LabeledComponent.left(artifactTypeBox, "Type");
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:23,代碼來源:ArtifactConfigurable.java

示例13: createUIComponents

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
private void createUIComponents() {
    versionSelectComboBox = new ComboBox(new VersionComboBoxModel());
    versionSelectComboBox.setRenderer(new VersionComboBoxRenderer());

    otherVersionOptionRadioButton = new JRadioButton();

    fromPDEInstallRadioButton = new JRadioButton();
    fromPDEInstallRadioButton.addItemListener(new LocalPdeDependenciesItemListener());
}
 
開發者ID:mistodev,項目名稱:processing-idea,代碼行數:10,代碼來源:ConfigureProcessingProject.java

示例14: createUIComponents

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
private void createUIComponents() {
    // TODO: place custom component creation code here
    groupComboBox = new ComboBox();
    groupComboBox.setRenderer(new CellRenderer());
    groupsPanel = new JPanel();
    groupsPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
}
 
開發者ID:hykes,項目名稱:CodeGen,代碼行數:8,代碼來源:SelectGroupPanel.java

示例15: composePanel

import com.intellij.openapi.ui.ComboBox; //導入方法依賴的package包/類
private void composePanel() {
  myPanel = new JPanel(new GridBagLayout());

  myComboBox = new ComboBox();
  for (QualifyJavadocOptions options : QualifyJavadocOptions.values()) {
    myComboBox.addItem(options);
  }
  myComboBox.setRenderer(new ListCellRendererWrapper() {
    @Override
    public void customize(final JList list, final Object value, final int index, final boolean selected, final boolean hasFocus) {
      if (value instanceof QualifyJavadocOptions) {
        setText(((QualifyJavadocOptions)value).getPresentableText());
      }
    }
  });

  JLabel title = new JLabel(ApplicationBundle.message("radio.use.fully.qualified.class.names.in.javadoc"));
  myPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));

  GridBagConstraints left = new GridBagConstraints();
  left.anchor = GridBagConstraints.WEST;

  GridBagConstraints right = new GridBagConstraints();
  right.anchor = GridBagConstraints.WEST;
  right.weightx = 1.0;
  right.insets = new Insets(0, 5, 0, 0);

  myPanel.add(title, left);
  myPanel.add(myComboBox, right);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:31,代碼來源:FullyQualifiedNamesInJavadocOptionProvider.java


注:本文中的com.intellij.openapi.ui.ComboBox.setRenderer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。