use of com.intellij.ui.DoubleClickListener in project intellij-community by JetBrains.
the class FileTypeChooser method createCenterPanel.
@Override
protected JComponent createCenterPanel() {
myTitleLabel.setText(FileTypesBundle.message("filetype.chooser.prompt", myFileName));
myList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
myList.setCellRenderer(new FileTypeRenderer());
new DoubleClickListener() {
@Override
protected boolean onDoubleClick(MouseEvent e) {
doOKAction();
return true;
}
}.installOn(myList);
myList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
updateButtonsState();
}
});
ScrollingUtil.selectItem(myList, FileTypes.PLAIN_TEXT);
return myPanel;
}
use of com.intellij.ui.DoubleClickListener in project intellij-community by JetBrains.
the class SimpleFieldChooser method createCenterPanel.
@Override
protected JComponent createCenterPanel() {
final DefaultListModel model = new DefaultListModel();
for (PsiField member : myFields) {
model.addElement(member);
}
myList = new JBList(model);
myList.setCellRenderer(new MyListCellRenderer());
new DoubleClickListener() {
@Override
protected boolean onDoubleClick(MouseEvent e) {
if (myList.getSelectedValues().length > 0) {
doOKAction();
return true;
}
return false;
}
}.installOn(myList);
myList.setPreferredSize(JBUI.size(300, 400));
return myList;
}
Aggregations