Keep the server tab strip in step with theme switches
The strip is out of the component tree while one server is open, so a look-and-feel switch missed it and it came back in the old theme's colours. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,7 @@ import javax.swing.JComponent;
|
|||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JTabbedPane;
|
import javax.swing.JTabbedPane;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
@@ -60,6 +61,16 @@ final class ServerTabPane extends JPanel {
|
|||||||
dragReorder.attach(tabbed);
|
dragReorder.attach(tabbed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The tab strip is out of the component tree while a single server is open, so a
|
||||||
|
* look-and-feel switch would miss it and leave it in the old theme's colours.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void updateUI() {
|
||||||
|
super.updateUI();
|
||||||
|
if (tabbed != null && tabbed.getParent() == null) SwingUtilities.updateComponentTreeUI(tabbed);
|
||||||
|
}
|
||||||
|
|
||||||
/** Drags a tab from one position to another, keeping the current selection on screen. */
|
/** Drags a tab from one position to another, keeping the current selection on screen. */
|
||||||
private void moveTab(int from, int to) {
|
private void moveTab(int from, int to) {
|
||||||
if (from < 0 || to < 0 || from >= tabs.size() || to >= tabs.size() || from == to) return;
|
if (from < 0 || to < 0 || from >= tabs.size() || to >= tabs.size() || from == to) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user