mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-193662: Tabbed Pane: focused state
This commit is contained in:
@@ -84,6 +84,7 @@ TabbedPane.tabSelectionHeight=2
|
||||
TabbedPane.selectedColor=4890cf
|
||||
TabbedPane.selectedDisabledColor=7a7a7a
|
||||
TabbedPane.hoverColor=2e3133
|
||||
TabbedPane.focusColor=3d4b5c
|
||||
TabbedPane.selectedLabelShift=0
|
||||
TabbedPane.contentAreaColor=6b6b6b
|
||||
# tabFillStyle can take "underline" or "fill" values
|
||||
|
||||
+15
-2
@@ -163,7 +163,16 @@ public class DarculaTabbedPaneUI extends BasicTabbedPaneUI {
|
||||
|
||||
case underline:
|
||||
default:
|
||||
g.setColor(tabPane.isEnabled() && tabIndex == hoverTab ? HOVER_COLOR : tabPane.getBackground());
|
||||
Color c = tabPane.getBackground();
|
||||
if (tabPane.isEnabled()) {
|
||||
if (tabPane.hasFocus() && isSelected) {
|
||||
c = FOCUS_COLOR;
|
||||
} else if (tabIndex == hoverTab) {
|
||||
c = HOVER_COLOR;
|
||||
}
|
||||
}
|
||||
|
||||
g.setColor(c);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -330,4 +339,8 @@ public class DarculaTabbedPaneUI extends BasicTabbedPaneUI {
|
||||
|
||||
@Override
|
||||
protected void paintContentBorderBottomEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintFocusIndicator(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect,
|
||||
boolean isSelected) {}
|
||||
}
|
||||
|
||||
@@ -226,6 +226,7 @@ TabbedPane.tabSelectionHeight=2
|
||||
TabbedPane.selectedColor=357ecc
|
||||
TabbedPane.selectedDisabledColor=ababab
|
||||
TabbedPane.hoverColor=d9d9d9
|
||||
TabbedPane.focusColor=dae4ed
|
||||
TabbedPane.selectedLabelShift=0
|
||||
TabbedPane.contentAreaColor=bfbfbf
|
||||
# tabFillStyle can take "underline" or "fill" values
|
||||
|
||||
@@ -68,6 +68,7 @@ TabbedPane.tabSelectionHeight=2
|
||||
TabbedPane.selectedColor=357ecc
|
||||
TabbedPane.selectedDisabledColor=ababab
|
||||
TabbedPane.hoverColor=d9d9d9
|
||||
TabbedPane.focusColor=dae4ed
|
||||
TabbedPane.selectedLabelShift=0
|
||||
TabbedPane.contentAreaColor=bfbfbf
|
||||
# tabFillStyle can take "underline" or "fill" values
|
||||
|
||||
@@ -196,6 +196,7 @@ TabbedPane.tabSelectionHeight=2
|
||||
TabbedPane.selectedColor=357ecc
|
||||
TabbedPane.selectedDisabledColor=ababab
|
||||
TabbedPane.hoverColor=d9d9d9
|
||||
TabbedPane.focusColor=dae4ed
|
||||
TabbedPane.selectedLabelShift=0
|
||||
TabbedPane.contentAreaColor=bfbfbf
|
||||
# tabFillStyle can take "underline" or "fill" values
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.project.DumbAwareAction;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.ComboBox;
|
||||
import com.intellij.openapi.ui.ComponentWithBrowseButton;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.panel.ComponentPanel;
|
||||
@@ -21,6 +22,8 @@ import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.UI;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.util.ui.components.BorderLayoutPanel;
|
||||
import org.intellij.lang.annotations.MagicConstant;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -30,6 +33,31 @@ import java.awt.*;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class ComponentPanelTestAction extends DumbAwareAction {
|
||||
private enum Placement {
|
||||
Top (SwingConstants.TOP, "Top"),
|
||||
Bottom (SwingConstants.BOTTOM, "Bottom"),
|
||||
Left (SwingConstants.LEFT, "Left"),
|
||||
Right (SwingConstants.RIGHT, "Right");
|
||||
|
||||
private final String name;
|
||||
private final int placement;
|
||||
|
||||
Placement(int placement, String name) {
|
||||
this.name = name;
|
||||
this.placement = placement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@MagicConstant(intValues = {SwingConstants.TOP, SwingConstants.BOTTOM, SwingConstants.LEFT, SwingConstants.RIGHT})
|
||||
public int placement() {
|
||||
return placement;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
Project project = e.getProject();
|
||||
@@ -65,9 +93,6 @@ public class ComponentPanelTestAction extends DumbAwareAction {
|
||||
pane.addTab(title, JBUI.Panels.simplePanel(label));
|
||||
}
|
||||
|
||||
//pane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
|
||||
//pane.putClientProperty("JTabbedPane.hasFullBorder", Boolean.TRUE);
|
||||
|
||||
pane.addChangeListener(e -> {
|
||||
if (pane.getSelectedIndex() == 2) {
|
||||
myAlarm.addRequest(progressTimerRequest, 200, ModalityState.any());
|
||||
@@ -76,7 +101,29 @@ public class ComponentPanelTestAction extends DumbAwareAction {
|
||||
}
|
||||
});
|
||||
|
||||
return pane;
|
||||
BorderLayoutPanel panel = JBUI.Panels.simplePanel(pane);
|
||||
|
||||
JPanel southPanel = new JPanel();
|
||||
southPanel.setLayout(new BoxLayout(southPanel, BoxLayout.X_AXIS));
|
||||
|
||||
JCheckBox enabledCB = new JCheckBox("Enable TabPane", true);
|
||||
enabledCB.addActionListener(e -> pane.setEnabled(enabledCB.isSelected()));
|
||||
southPanel.add(enabledCB);
|
||||
|
||||
southPanel.add(Box.createRigidArea(JBUI.size(UIUtil.DEFAULT_HGAP, 0)));
|
||||
|
||||
JComboBox<Placement> placementCombo = new ComboBox<>(Placement.values());
|
||||
placementCombo.setSelectedIndex(0);
|
||||
placementCombo.addActionListener(e -> {
|
||||
Placement p = (Placement)placementCombo.getSelectedItem();
|
||||
if (p != null) pane.setTabPlacement(p.placement());
|
||||
});
|
||||
southPanel.add(placementCombo);
|
||||
southPanel.add(new Box.Filler(JBUI.size(0), JBUI.size(0), JBUI.size(Integer.MAX_VALUE, 0)));
|
||||
|
||||
panel.addToBottom(southPanel);
|
||||
|
||||
return panel;
|
||||
}
|
||||
|
||||
private JComponent createComponentPanel() {
|
||||
|
||||
@@ -1645,6 +1645,7 @@ public class JBUI {
|
||||
public static final Color DISABLED_SELECTED_COLOR = JBColor.namedColor("TabbedPane.selectedDisabledColor", Gray.xAB);
|
||||
public static final Color DISABLED_TEXT_COLOR = JBColor.namedColor("TabbedPane.disabledText", Gray.x99);
|
||||
public static final Color HOVER_COLOR = JBColor.namedColor("TabbedPane.hoverColor", Gray.xD9);
|
||||
public static final Color FOCUS_COLOR = JBColor.namedColor("TabbedPane.focusColor", 0xDAE4ED);
|
||||
public static final JBValue TAB_HEIGHT = new JBValue.UIInteger("TabbedPane.tabHeight", 32);
|
||||
public static final JBValue SELECTION_HEIGHT = new JBValue.UIInteger("TabbedPane.tabSelectionHeight", 2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user