本文整理汇总了Java中com.intellij.openapi.ui.ComboBox.setSelectedIndex方法的典型用法代码示例。如果您正苦于以下问题:Java ComboBox.setSelectedIndex方法的具体用法?Java ComboBox.setSelectedIndex怎么用?Java ComboBox.setSelectedIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.ui.ComboBox
的用法示例。
在下文中一共展示了ComboBox.setSelectedIndex方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: createOptionsPanel
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
@Nullable
@Override
public JComponent createOptionsPanel() {
final ComboBox comboBox = new ComboBox(new Object[]{
InspectionGadgetsBundle.message("all.levels.option"),
InspectionGadgetsBundle.message("warn.level.and.lower.option"),
InspectionGadgetsBundle.message("info.level.and.lower.option"),
InspectionGadgetsBundle.message("debug.level.and.lower.option"),
InspectionGadgetsBundle.message("trace.level.option")
});
comboBox.setSelectedIndex(warnLevel);
comboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
warnLevel = comboBox.getSelectedIndex();
}
});
final JPanel panel = new JPanel(new BorderLayout());
panel.add(FormBuilder.createFormBuilder().addLabeledComponent(InspectionGadgetsBundle.message("warn.on.label"), comboBox).getPanel(),
BorderLayout.NORTH);
return panel;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:StringConcatenationArgumentToLogCallInspection.java
示例3: doCreateCenterPanel
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
protected JComponent doCreateCenterPanel() {
JPanel panel = new JPanel(new BorderLayout(5, 0));
FilterRule.FilterRuleType[] types = FilterRule.FilterRuleType.values();
ruleType = new ComboBox(types);
ruleType.setEnabled(true);
ruleType.setSelectedIndex(0);
panel.add(ruleType, BorderLayout.WEST);
filterName = new JTextField(20);
PromptSupport.setPrompt("Set the string name here", filterName);
panel.add(filterName, BorderLayout.CENTER);
return panel;
}
示例4: SelectOwner
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
protected SelectOwner(List<String> title, RunLater<String> runLater) {
super(true);
jPanel = new JPanel();
this.runLater = runLater;
init();
this.setTitle("Select Workspace Owner");
Object[] organizations = title.toArray();
orgList = new ComboBox(organizations, 200);
if (organizations.length > 0) {
orgList.setSelectedIndex(0);
}
JLabel jLabel = new JLabel();
jLabel.setText("Select the owner for the workspace:");
jPanel.add(jLabel);
jPanel.add(orgList);
}
示例5: 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();
}
示例6: NameSuggestionsField
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
public NameSuggestionsField(String[] nameSuggestions, Project project, FileType fileType) {
super(new BorderLayout());
myProject = project;
if (nameSuggestions == null || nameSuggestions.length <= 1) {
myComponent = createTextFieldForName(nameSuggestions, fileType);
}
else {
final ComboBox combobox = new ComboBox(nameSuggestions);
combobox.setSelectedIndex(0);
setupComboBox(combobox, fileType);
myComponent = combobox;
}
add(myComponent, BorderLayout.CENTER);
myComboBoxModel = null;
}
示例7: addComboBox
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
public JComboBox addComboBox(@NotNull final ObservableList<String> backingList) {
final CollectionComboBoxModel<String> model = new CollectionComboBoxModel<String>(backingList) {
@NotNull
@Override
public List<String> getItems() {
return backingList;
}
};
final ComboBox comboBox = new ComboBox(model);
InvalidationListener onListModified = new InvalidationListener() {
@Override
protected void onInvalidated(@NotNull Observable sender) {
model.update();
if (backingList.size() > 0 && comboBox.getSelectedIndex() < 0) {
comboBox.setSelectedIndex(0);
}
}
};
addComponent(comboBox);
backingList.addWeakListener(onListModified);
// Keep weak listener alive as long as the combobox is alive
comboBox.putClientProperty("onListModified", onListModified);
return comboBox;
}
示例8: initComboBox
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
private void initComboBox(ComboBox comboBox) {
comboBox.removeAllItems();
comboBox.setModel(createModel());
if (comboBox.getModel().getSize() > 0) {
comboBox.setSelectedIndex(0);
}
}
示例9: initTargetResolutions
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
private void initTargetResolutions() {ComboBox targetResolutionComboBox = new ComboBox();
targetResolutionComboBox.addItem(Resolution.LDPI.getName());
targetResolutionComboBox.addItem(Resolution.MDPI.getName());
targetResolutionComboBox.addItem(Resolution.HDPI.getName());
targetResolutionComboBox.addItem(Resolution.XHDPI.getName());
targetResolutionComboBox.addItem(Resolution.XXHDPI.getName());
targetResolutionComboBox.addItem(Resolution.XXXHDPI.getName());
targetResolutionComboBox.setSelectedIndex(3);
table.getColumnModel().getColumn(2).setCellEditor(new DefaultCellEditor(targetResolutionComboBox));
}
示例10: initAssetResolutions
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
private void initAssetResolutions() {ComboBox assetResolutionComboBox = new ComboBox();
assetResolutionComboBox.addItem(Resolution.LDPI.getName());
assetResolutionComboBox.addItem(Resolution.MDPI.getName());
assetResolutionComboBox.addItem(Resolution.HDPI.getName());
assetResolutionComboBox.addItem(Resolution.XHDPI.getName());
assetResolutionComboBox.addItem(Resolution.XXHDPI.getName());
assetResolutionComboBox.addItem(Resolution.XXXHDPI.getName());
assetResolutionComboBox.addItem(Resolution.OTHER.getName());
assetResolutionComboBox.setSelectedIndex(3);
table.getColumnModel().getColumn(1).setCellEditor(new DefaultCellEditor(assetResolutionComboBox));
}
示例11: createComponent
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
@Nullable
@Override
public JComponent createComponent() {
JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
panel.add(new JLabel("Module type:"));
comboModuleType = new ComboBox(new String[] { "Application", "Console application", "Library" });
comboModuleType.setSelectedIndex(moduleTypeToComboIndex(component.getModuleType()));
panel.add(comboModuleType);
return panel;
}
示例12: createComboBox
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
/**
* Creates a Combo Box of String items.
*/
public static ComboBox createComboBox(JComponent parent,
ItemListener listener, String[] items, int defaultSelection) {
ComboBox comboBox = new ComboBox(items);
comboBox.setSelectedIndex(defaultSelection);
comboBox.addItemListener(listener);
parent.add(comboBox);
return comboBox;
}
示例13: NameSuggestionsField
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
public NameSuggestionsField(String[] nameSuggestions, Project project, FileType fileType) {
super(new BorderLayout());
myProject = project;
if (nameSuggestions == null || nameSuggestions.length <= 1) {
myComponent = createTextFieldForName(nameSuggestions, fileType);
}
else {
final ComboBox combobox = new ComboBox(nameSuggestions,-1);
combobox.setSelectedIndex(0);
setupComboBox(combobox, fileType);
myComponent = combobox;
}
add(myComponent, BorderLayout.CENTER);
myComboBoxModel = null;
}
示例14: SelectAccount
import com.intellij.openapi.ui.ComboBox; //导入方法依赖的package包/类
public SelectAccount(@Nullable Project project, String[] accounts) {
super(project);
setTitle("Select a Floobits Account");
contentPanel = new JPanel();
cccccomboBox = new ComboBox(new DefaultComboBoxModel(accounts));
if (accounts.length > 0) {
cccccomboBox.setSelectedIndex(0);
}
contentPanel.add(cccccomboBox);
JLabel label = new JLabel("Select Account");
contentPanel.add(label);
init();
}