mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
make big and small checked icons with respect to selection
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 135 B After Width: | Height: | Size: 235 B |
Binary file not shown.
|
After Width: | Height: | Size: 234 B |
Binary file not shown.
|
After Width: | Height: | Size: 135 B |
Binary file not shown.
|
After Width: | Height: | Size: 138 B |
+1
@@ -621,6 +621,7 @@ public abstract class OptionTableWithPreviewPanel extends MultilanguageCodeStyle
|
||||
}
|
||||
});
|
||||
myBooleanEditor.putClientProperty("JComponent.sizeVariant", "small");
|
||||
myOptionsEditor.putClientProperty("JComponent.sizeVariant", "small");
|
||||
}
|
||||
|
||||
public Object getCellEditorValue() {
|
||||
|
||||
+18
-4
@@ -42,18 +42,32 @@ public class JBComboBoxTableCellEditorComponent extends JBLabel {
|
||||
private Object myValue;
|
||||
|
||||
private ListCellRenderer myRenderer = new DefaultListCellRenderer() {
|
||||
private Icon myCheckIcon = Icons.CHECK_ICON;
|
||||
private Icon myEmptyIcon = EmptyIcon.create(Icons.CHECK_ICON.getIconWidth());
|
||||
public Icon myEmptyIcon;
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
final JLabel label = (JLabel)super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (value == myValue) {
|
||||
label.setIcon(myCheckIcon);
|
||||
label.setIcon(getIcon(isSelected));
|
||||
} else {
|
||||
label.setIcon(myEmptyIcon);
|
||||
label.setIcon(getEmptyIcon());
|
||||
}
|
||||
return label;
|
||||
}
|
||||
|
||||
private Icon getEmptyIcon() {
|
||||
if (myEmptyIcon == null) {
|
||||
myEmptyIcon = EmptyIcon.create(getIcon(true).getIconWidth());
|
||||
}
|
||||
return myEmptyIcon;
|
||||
}
|
||||
|
||||
private Icon getIcon(boolean selected) {
|
||||
final boolean small = "small".equals(JBComboBoxTableCellEditorComponent.this.getClientProperty("JComponent.sizeVariant"));
|
||||
return small
|
||||
? selected ? Icons.CHECK_ICON_SMALL_SELECTED : Icons.CHECK_ICON_SMALL
|
||||
: selected ? Icons.CHECK_ICON_SELECTED : Icons.CHECK_ICON;
|
||||
}
|
||||
};
|
||||
|
||||
public JBComboBoxTableCellEditorComponent() {
|
||||
|
||||
@@ -110,6 +110,9 @@ public abstract class Icons {
|
||||
public static final Icon SYNCHRONIZE_ICON = IconLoader.getIcon("/actions/sync.png");
|
||||
|
||||
public static final Icon CHECK_ICON = IconLoader.getIcon("/actions/checked.png");
|
||||
public static final Icon CHECK_ICON_SELECTED = IconLoader.getIcon("/actions/checked_selected.png");
|
||||
public static final Icon CHECK_ICON_SMALL = IconLoader.getIcon("/actions/checked_small.png");
|
||||
public static final Icon CHECK_ICON_SMALL_SELECTED = IconLoader.getIcon("/actions/checked_small_selected.png");
|
||||
|
||||
public static final Icon OPEN_EDIT_DIALOG_ICON = IconLoader.getIcon("/actions/showViewer.png");
|
||||
public static final Icon FLATTEN_PACKAGES_ICON = IconLoader.getIcon("/objectBrowser/flattenPackages.png");
|
||||
|
||||
Reference in New Issue
Block a user