本文整理匯總了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();
}