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:
2026-10-01 16:31:43 +00:00
parent bda114d2c0
commit 0ff0919db2

View File

@@ -9,6 +9,7 @@ import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
@@ -60,6 +61,16 @@ final class ServerTabPane extends JPanel {
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. */
private void moveTab(int from, int to) {
if (from < 0 || to < 0 || from >= tabs.size() || to >= tabs.size() || from == to) return;