Package: openjdk-17-jre Version: 17.0.9~4ea-1 Severity: normal X-Debbugs-Cc: onit...@gmail.com
The OpenJDK version in Debian includes the GTK+ theme, but the SystemLookAndFeelClassName is set to the default Swing Metal theme. Manually loading the GTK+ theme works, but this is very unportable and shouldn't be necessary. Instead, the following code should use the native GTK+ theme: import java.awt.*; import javax.swing.*; public class Test { public static void main(String[] args) { try { System.out.println("System look&feel class: " + UIManager.getSystemLookAndFeelClassName()); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); // This shouldn't be necessary: // UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); } catch (Exception e) { System.err.println("Can't find native look&feel: " + e); } JFrame frame = new JFrame(); frame.getContentPane().setLayout(new FlowLayout()); frame.setSize(new Dimension(200, 200)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(new JButton("Button 1")); frame.getContentPane().add(new JButton("Button 2")); frame.getContentPane().add(new JButton("Button 3")); frame.setVisible(true); } } Is this by design, or would it be possible to change the system theme to the native one? Metal doesn't really fit well with most modern desktops, and the GTK+ theme would at least make Java applications match the system GTK theme. -- System Information: Debian Release: trixie/sid APT prefers testing APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 'testing-debug'), (500, 'stable'), (300, 'unstable'), (1, 'experimental-debug'), (1, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 6.4.0-3-amd64 (SMP w/4 CPU threads; PREEMPT) Kernel taint flags: TAINT_WARN Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages openjdk-17-jre depends on: ii libc6 2.37-7 ii libgif7 5.2.1-2.5 ii libgl1 1.6.0-1 ii libglib2.0-0 2.77.3-1 ii libgtk-3-0 3.24.38-4 ii libgtk2.0-0 2.24.33-2 ii libharfbuzz0b 8.0.1-1 ii libjpeg62-turbo 1:2.1.5-2 ii libpng16-16 1.6.40-1 ii libx11-6 2:1.8.6-1 ii libxext6 2:1.3.4-1+b1 ii libxi6 2:1.8-1+b1 ii libxinerama1 2:1.1.4-3 ii libxrandr2 2:1.5.2-2+b1 ii libxrender1 1:0.9.10-1.1 ii libxtst6 2:1.2.3-1.1 ii openjdk-17-jre-headless 17.0.9~4ea-1 ii zlib1g 1:1.2.13.dfsg-3 Versions of packages openjdk-17-jre recommends: ii fonts-dejavu-extra 2.37-8 ii libatk-wrapper-java-jni 0.40.0-3 openjdk-17-jre suggests no packages. -- no debconf information