mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EA-87122
This commit is contained in:
@@ -266,9 +266,9 @@ public class JBUI {
|
||||
}
|
||||
|
||||
/**
|
||||
* JComboBox<String> comboBox = new ComboBox<>();
|
||||
* comboBox.setEditable(true);
|
||||
* comboBox.setEditor(JBUI.ComboBox.compositeComboboxEditor(new JTextField("Text Field")));
|
||||
* JComboBox<String> comboBox = new ComboBox<>(new String[] {"First", "Second", "Third"});
|
||||
* comboBox.setEditable(true);
|
||||
* comboBox.setEditor(JBUI.ComboBox.compositeComboboxEditor(new JTextField(), new JLabel(AllIcons.Icon_CE)));
|
||||
*/
|
||||
public static class ComboBox {
|
||||
public static ComboBoxCompositeEditor compositeComboboxEditor (JComponent ... components) {
|
||||
|
||||
@@ -49,6 +49,7 @@ public class ComboBoxCompositeEditor extends JComponent implements ComboBoxEdito
|
||||
|
||||
for (int i = 0; i < components.length; i ++) {
|
||||
final int index = i;
|
||||
add(components[i]);
|
||||
myComponents[i] = new ComboBoxCompositeEditor.EditorComponent () {
|
||||
public void setItem(String anObject) {
|
||||
if (components[index] instanceof JTextField) {
|
||||
@@ -96,6 +97,8 @@ public class ComboBoxCompositeEditor extends JComponent implements ComboBoxEdito
|
||||
};
|
||||
}
|
||||
|
||||
invalidate();
|
||||
|
||||
focusableComponentIndex = 0;
|
||||
final JComponent component = myComponents[focusableComponentIndex].getDelegate();
|
||||
component.setBorder(null);
|
||||
@@ -105,7 +108,7 @@ public class ComboBoxCompositeEditor extends JComponent implements ComboBoxEdito
|
||||
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
parent = component.getParent();
|
||||
parent = getParent();
|
||||
parent.repaint();
|
||||
}
|
||||
|
||||
@@ -118,7 +121,7 @@ public class ComboBoxCompositeEditor extends JComponent implements ComboBoxEdito
|
||||
|
||||
@Override
|
||||
public Component getEditorComponent() {
|
||||
return myComponents[focusableComponentIndex].getDelegate();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user