mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-01 21:52:12 +01:00
Set foreground color on board/library titles in managers
In commit 93581b03d (Set foreground color in library/board manager), the foreground color was set in addition to the background color, to make sure that the library and board manager would remain readable even with a non-standard color scheme (e.g. a dark theme). When that commit was created, this worked properly. However, between creating that commit and merging it as part of #9272, the title rendering was changed from being part of the description (which had its color set up properly) to being part of the title border (which used default colors) in #9262. This commit fixes this again by applying the foreground color also to the TitledBorder component. In ContributedPlatformTableCellJPanel this also moves the creation of the TitledBorder into the constructor, and for ContributedLibraryTableCellJPanel upwards in the constructor (where it is run unconditionally), so the property can be final.
This commit is contained in:
parent
42336ace32
commit
2659875078
@ -34,6 +34,7 @@ public class ContributedLibraryTableCellJPanel extends JPanel {
|
|||||||
final JPanel inactiveButtonsPanel;
|
final JPanel inactiveButtonsPanel;
|
||||||
final JLabel statusLabel;
|
final JLabel statusLabel;
|
||||||
final JTextPane description;
|
final JTextPane description;
|
||||||
|
final TitledBorder titledBorder;
|
||||||
private final String moreInfoLbl = tr("More info");
|
private final String moreInfoLbl = tr("More info");
|
||||||
|
|
||||||
public ContributedLibraryTableCellJPanel(JTable parentTable, Object value,
|
public ContributedLibraryTableCellJPanel(JTable parentTable, Object value,
|
||||||
@ -41,6 +42,11 @@ public class ContributedLibraryTableCellJPanel extends JPanel {
|
|||||||
super();
|
super();
|
||||||
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
|
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
|
||||||
|
|
||||||
|
// Actual title set below
|
||||||
|
titledBorder = BorderFactory.createTitledBorder("");
|
||||||
|
titledBorder.setTitleFont(getFont().deriveFont(Font.BOLD));
|
||||||
|
setBorder(titledBorder);
|
||||||
|
|
||||||
moreInfoButton = new JButton(moreInfoLbl);
|
moreInfoButton = new JButton(moreInfoLbl);
|
||||||
moreInfoButton.setVisible(false);
|
moreInfoButton.setVisible(false);
|
||||||
installButton = new JButton(tr("Install"));
|
installButton = new JButton(tr("Install"));
|
||||||
@ -120,9 +126,7 @@ public class ContributedLibraryTableCellJPanel extends JPanel {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
ContributedLibrary selected = releases.getSelected();
|
ContributedLibrary selected = releases.getSelected();
|
||||||
TitledBorder titledBorder = BorderFactory.createTitledBorder(selected.getName());
|
titledBorder.setTitle(selected.getName());
|
||||||
titledBorder.setTitleFont(getFont().deriveFont(Font.BOLD));
|
|
||||||
setBorder(titledBorder);
|
|
||||||
Optional<ContributedLibrary> mayInstalled = releases.getInstalled();
|
Optional<ContributedLibrary> mayInstalled = releases.getInstalled();
|
||||||
|
|
||||||
boolean installable, upgradable;
|
boolean installable, upgradable;
|
||||||
@ -271,5 +275,7 @@ public class ContributedLibraryTableCellJPanel extends JPanel {
|
|||||||
// The description is not opaque, so copy our foreground color to it.
|
// The description is not opaque, so copy our foreground color to it.
|
||||||
if (description != null)
|
if (description != null)
|
||||||
description.setForeground(c);
|
description.setForeground(c);
|
||||||
|
if (titledBorder != null)
|
||||||
|
titledBorder.setTitleColor(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,6 +67,7 @@ public class ContributedPlatformTableCellJPanel extends JPanel {
|
|||||||
final JPanel inactiveButtonsPanel;
|
final JPanel inactiveButtonsPanel;
|
||||||
final JLabel statusLabel;
|
final JLabel statusLabel;
|
||||||
final JTextPane description;
|
final JTextPane description;
|
||||||
|
final TitledBorder titledBorder;
|
||||||
private final String moreInfoLbl = tr("More Info");
|
private final String moreInfoLbl = tr("More Info");
|
||||||
private final String onlineHelpLbl = tr("Online Help");
|
private final String onlineHelpLbl = tr("Online Help");
|
||||||
|
|
||||||
@ -74,6 +75,11 @@ public class ContributedPlatformTableCellJPanel extends JPanel {
|
|||||||
super();
|
super();
|
||||||
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
|
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
|
||||||
|
|
||||||
|
// Actual title set by update()
|
||||||
|
titledBorder = BorderFactory.createTitledBorder("");
|
||||||
|
titledBorder.setTitleFont(getFont().deriveFont(Font.BOLD));
|
||||||
|
setBorder(titledBorder);
|
||||||
|
|
||||||
{
|
{
|
||||||
installButton = new JButton(tr("Install"));
|
installButton = new JButton(tr("Install"));
|
||||||
moreInfoButton = new JButton(moreInfoLbl);
|
moreInfoButton = new JButton(moreInfoLbl);
|
||||||
@ -186,9 +192,7 @@ public class ContributedPlatformTableCellJPanel extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ContributedPlatform selected = releases.getSelected();
|
ContributedPlatform selected = releases.getSelected();
|
||||||
TitledBorder titledBorder = BorderFactory.createTitledBorder(selected.getName());
|
titledBorder.setTitle(selected.getName());
|
||||||
titledBorder.setTitleFont(getFont().deriveFont(Font.BOLD));
|
|
||||||
setBorder(titledBorder);
|
|
||||||
ContributedPlatform installed = releases.getInstalled();
|
ContributedPlatform installed = releases.getInstalled();
|
||||||
|
|
||||||
boolean removable, installable, upgradable;
|
boolean removable, installable, upgradable;
|
||||||
@ -311,5 +315,7 @@ public class ContributedPlatformTableCellJPanel extends JPanel {
|
|||||||
// The description is not opaque, so copy our foreground color to it.
|
// The description is not opaque, so copy our foreground color to it.
|
||||||
if (description != null)
|
if (description != null)
|
||||||
description.setForeground(c);
|
description.setForeground(c);
|
||||||
|
if (titledBorder != null)
|
||||||
|
titledBorder.setTitleColor(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user