mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 02:09:44 +02:00
GP-4316 - Updated how empty border buttons paint their focused state
This commit is contained in:
parent
190f1eaa1e
commit
208b8238ca
4 changed files with 25 additions and 5 deletions
|
@ -31,6 +31,7 @@ color.fg.filterfield = color.palette.black
|
|||
color.border.bevel.highlight = color.palette.lightgray
|
||||
color.border.bevel.shadow = color.palette.gray
|
||||
color.border.provider.disconnected = color.palette.orange
|
||||
color.border.button.focused = [color]system.color.bg.selected.view
|
||||
color.fg.button = color.palette.black
|
||||
|
||||
color.bg.filechooser = color.bg
|
||||
|
@ -178,3 +179,9 @@ color.bg.highlight = #703401 // orangish
|
|||
color.bg.filechooser.shortcut = [color]system.color.bg.view
|
||||
|
||||
|
||||
[CDE/Motif]
|
||||
|
||||
// the tab pane focus color represents the standard motif focus color
|
||||
color.border.button.focused = [color]laf.color.TabbedPane.focus
|
||||
|
||||
|
||||
|
|
|
@ -224,14 +224,14 @@ public class ThemeColorTableModel extends GDynamicColumnTableModel<ColorValue, O
|
|||
|
||||
private class ThemeColorRenderer extends AbstractGColumnRenderer<ResolvedColor> {
|
||||
|
||||
public ThemeColorRenderer() {
|
||||
setFont(Gui.getFont("font.monospaced"));
|
||||
@Override
|
||||
protected Font getDefaultFont() {
|
||||
return fixedWidthFont;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(GTableCellRenderingData data) {
|
||||
JLabel label = (JLabel) super.getTableCellRendererComponent(data);
|
||||
setFont(Gui.getFont("font.monospaced"));
|
||||
ResolvedColor resolved = (ResolvedColor) data.getValue();
|
||||
|
||||
String text = getValueText(resolved);
|
||||
|
|
|
@ -39,7 +39,7 @@ import utilities.util.reflection.ReflectionUtilities;
|
|||
* colors, and highlights the drop target in a drag-n-drop operation.
|
||||
* <p>
|
||||
* The preferred method to change the font used by this renderer is {@link #setBaseFontId(String)}.
|
||||
* If you would like this renderer to use a monospaced font, then, as an alternative to creating a
|
||||
* If you would like this renderer to use a monospaced font, then, as an alternative to creating a
|
||||
* font ID, you can instead override {@link #getDefaultFont()} to return this
|
||||
* class's {@link #fixedWidthFont}. Also, the fixed width font of this class is based on the
|
||||
* default font set when calling {@link #setBaseFontId(String)}, so it stays up-to-date with theme
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
package docking.widgets;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.event.*;
|
||||
|
||||
import javax.swing.*;
|
||||
|
@ -23,6 +24,7 @@ import javax.swing.border.EmptyBorder;
|
|||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import generic.theme.GColor;
|
||||
import ghidra.docking.util.LookAndFeelUtils;
|
||||
import resources.ResourceManager;
|
||||
|
||||
|
@ -55,6 +57,13 @@ public class EmptyBorderButton extends JButton {
|
|||
public static final Border LOWERED_BUTTON_BORDER = BorderFactory.createCompoundBorder(
|
||||
BorderFactory.createLoweredBevelBorder(), BorderFactory.createEmptyBorder(1, 1, 1, 1));
|
||||
|
||||
/**
|
||||
* A border to signal when the button has focus.
|
||||
*/
|
||||
private static final Color FOCUS_COLOR = new GColor("color.border.button.focused");
|
||||
public static final Border FOCUSED_BUTTON_BORDER = BorderFactory.createCompoundBorder(
|
||||
BorderFactory.createEmptyBorder(2, 2, 2, 2), BorderFactory.createLineBorder(FOCUS_COLOR));
|
||||
|
||||
/**
|
||||
* Construct a new EmptyBorderButton.
|
||||
*
|
||||
|
@ -169,13 +178,17 @@ public class EmptyBorderButton extends JButton {
|
|||
setBorder(getRaisedBorder());
|
||||
}
|
||||
else if (isFocusOwner()) {
|
||||
setBorder(getRaisedBorder());
|
||||
setBorder(getFocusedBorder());
|
||||
}
|
||||
else {
|
||||
setBorder(NO_BUTTON_BORDER);
|
||||
}
|
||||
}
|
||||
|
||||
protected Border getFocusedBorder() {
|
||||
return FOCUSED_BUTTON_BORDER;
|
||||
}
|
||||
|
||||
protected Border getRaisedBorder() {
|
||||
return RAISED_BUTTON_BORDER;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue