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:
@@ -66,7 +66,7 @@ public final class FileBrowserDialog extends JDialog {
|
||||
this.channelPassword = "";
|
||||
|
||||
JPanel content = new JPanel(new BorderLayout(0, 8));
|
||||
content.setBackground(Theme.WINDOW_BG);
|
||||
content.setBackground(Theme.windowBg());
|
||||
content.setBorder(BorderFactory.createEmptyBorder(10, 12, 10, 12));
|
||||
content.add(buildToolbar(), BorderLayout.NORTH);
|
||||
content.add(buildTable(), BorderLayout.CENTER);
|
||||
@@ -85,7 +85,7 @@ public final class FileBrowserDialog extends JDialog {
|
||||
private JPanel buildToolbar() {
|
||||
JPanel bar = new JPanel();
|
||||
bar.setLayout(new BoxLayout(bar, BoxLayout.X_AXIS));
|
||||
bar.setBackground(Theme.WINDOW_BG);
|
||||
bar.setBackground(Theme.windowBg());
|
||||
|
||||
upButton.addActionListener(e -> navigateUp());
|
||||
JButton refresh = new JButton("Refresh", Icons.of("FILE_REFRESH"));
|
||||
@@ -111,13 +111,13 @@ public final class FileBrowserDialog extends JDialog {
|
||||
bar.add(Box.createHorizontalStrut(6));
|
||||
bar.add(deleteButton);
|
||||
|
||||
pathLabel.setFont(Theme.UI_FONT);
|
||||
pathLabel.setForeground(Theme.TREE_TEXT);
|
||||
pathLabel.setFont(Theme.uiFont());
|
||||
pathLabel.setForeground(Theme.treeText());
|
||||
return bar;
|
||||
}
|
||||
|
||||
private JScrollPane buildTable() {
|
||||
table.setFont(Theme.UI_FONT);
|
||||
table.setFont(Theme.uiFont());
|
||||
table.setRowHeight(20);
|
||||
table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
|
||||
table.setFillsViewportHeight(true);
|
||||
@@ -137,17 +137,17 @@ public final class FileBrowserDialog extends JDialog {
|
||||
}
|
||||
});
|
||||
JScrollPane scroll = new JScrollPane(table);
|
||||
scroll.getViewport().setBackground(Theme.TREE_BG);
|
||||
scroll.getViewport().setBackground(Theme.treeBg());
|
||||
return scroll;
|
||||
}
|
||||
|
||||
private JScrollPane buildTransfers() {
|
||||
transfersPanel.setLayout(new BoxLayout(transfersPanel, BoxLayout.Y_AXIS));
|
||||
transfersPanel.setBackground(Theme.WINDOW_BG);
|
||||
transfersPanel.setBackground(Theme.windowBg());
|
||||
JScrollPane scroll = new JScrollPane(transfersPanel);
|
||||
scroll.setBorder(BorderFactory.createTitledBorder("Transfers"));
|
||||
scroll.setPreferredSize(new Dimension(10, 120));
|
||||
scroll.getViewport().setBackground(Theme.WINDOW_BG);
|
||||
scroll.getViewport().setBackground(Theme.windowBg());
|
||||
return scroll;
|
||||
}
|
||||
|
||||
@@ -326,10 +326,10 @@ public final class FileBrowserDialog extends JDialog {
|
||||
|
||||
TransferRow() {
|
||||
setLayout(new BorderLayout(8, 0));
|
||||
setBackground(Theme.WINDOW_BG);
|
||||
setBackground(Theme.windowBg());
|
||||
setBorder(BorderFactory.createEmptyBorder(3, 2, 3, 2));
|
||||
setMaximumSize(new Dimension(Integer.MAX_VALUE, 44));
|
||||
label.setFont(Theme.UI_FONT);
|
||||
label.setFont(Theme.uiFont());
|
||||
bar.setStringPainted(true);
|
||||
add(label, BorderLayout.NORTH);
|
||||
add(bar, BorderLayout.CENTER);
|
||||
|
||||
Reference in New Issue
Block a user