Paint the client with FlatLaf, in a light and a dark theme
The look-and-feel is FlatLaf now, chosen light or dark on the new Design tab and remembered in the settings. Theme keeps only the colours TeamSpeak gives meaning to (talking, away, muted, channel and server names) and takes its surfaces and fonts from the look-and-feel, so a switch recolours the whole window, chat logs included: the HTML panes share one themed stylesheet and re-parse their content when the theme changes. Also fixes the channel tree not scrolling: the tree listened for the mouse wheel to re-check its hover row, and AWT only forwards a wheel event to the enclosing scroll pane when the component under the pointer has no wheel listener of its own. The hover row now follows the viewport instead, which also covers scrollbar drags and keyboard scrolling. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -151,8 +151,8 @@ public final class ServerTreePanel extends JScrollPane {
|
||||
ui.setRightChildIndent(10);
|
||||
}
|
||||
tree.setRowHeight(20);
|
||||
tree.setBackground(Theme.TREE_BG);
|
||||
tree.setFont(Theme.UI_FONT);
|
||||
tree.setBackground(Theme.treeBg());
|
||||
tree.setFont(Theme.uiFont());
|
||||
ServerTreeCellRenderer renderer = new ServerTreeCellRenderer(id -> id == selfClientId);
|
||||
tree.setCellRenderer(renderer);
|
||||
nicknameEditor = NicknameCellEditor.create(tree, renderer, id -> id == selfClientId);
|
||||
@@ -161,10 +161,13 @@ public final class ServerTreePanel extends JScrollPane {
|
||||
tree.setPathEditable(nicknameEditor::editsPath);
|
||||
tree.setInvokesStopCellEditing(true);
|
||||
setViewportView(tree);
|
||||
getViewport().setBackground(Theme.TREE_BG);
|
||||
getViewport().setBackground(Theme.treeBg());
|
||||
// The icon strip is drawn against the viewport's right edge, so the blitted
|
||||
// pixels a scroll would reuse are stale; repaint the whole viewport instead.
|
||||
getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE);
|
||||
// Scrolling slides the rows past a pointer that has not moved, so the outlined
|
||||
// row has to be worked out again.
|
||||
getViewport().addChangeListener(e -> tree.refreshHoverRow());
|
||||
|
||||
// Within the tree a drag moves the client or channel; dropped elsewhere it
|
||||
// yields the TS3 link BBCode, which the chat input accepts as plain text.
|
||||
|
||||
Reference in New Issue
Block a user