question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When we use FlatLaf.setUseNativeWindowDecorations(FlatLaf.supportsNativeWindowDecorations()); , sometimes we got two title bars (one from system and one from FlatLaf). Also when this error occurs, buttons on title bar don`t work as expected - no action after click.

The bug occurs in a non-deterministic way, so a test application has been created to reproduce it - double-title-bar-app.zip Gif included from test app Animation

FlatLaf version: 1.1.2 Java Version: 11 OS: Windows 10 Pro

import com.formdev.flatlaf.FlatIntelliJLaf;
import com.formdev.flatlaf.FlatLaf;

import javax.swing.*;
import java.awt.*;
import java.lang.reflect.InvocationTargetException;

public class FrameCreator {
   private static int size = 200;

   public static void initLAF() throws UnsupportedLookAndFeelException {
      UIManager.setLookAndFeel(new FlatIntelliJLaf());
      FlatLaf.setUseNativeWindowDecorations(FlatLaf.supportsNativeWindowDecorations());

      UIManager.put("TitlePane.unifiedBackground", true);
   }
   public static void main(String[] args) throws InvocationTargetException, InterruptedException {
      SwingUtilities.invokeAndWait(() -> {
         try {
            initLAF();
         } catch (UnsupportedLookAndFeelException e) {
            e.printStackTrace();
         }
      });
      Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
      double width = screenSize.getWidth();
      double height = screenSize.getHeight();
         for (int i = 0; i < width / size; i++) {
            for (int j = 0; j < height / size; j++) {
               showFrame(i,j);
            }
      }
   }

   public static void showFrame(int i, int j) {
      SwingUtilities.invokeLater(() -> {
         JFrame frame = new JFrame();
         frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
         frame.setSize(size - 10, size - 10);
         frame.setLocation(i * size + 10, j * size + 10);
         frame.setVisible(true);
      });
   }
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:6

github_iconTop GitHub Comments

1reaction
irequecommented, Apr 26, 2021

@DevCharly I confirm that fix works. Can you backport it to release version?

0reactions
DevCharlycommented, May 18, 2021

FlatLaf 1.2 is now available. Sorry for the delay…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Double title bars/ Two title bars appear in Ubuntu 20.04
Double title bars / Two title bars appear in Ubuntu 20.04 ... This is another demonstration of why mixing desktop environments is not...
Read more >
Double title bar in macOS · Issue #2968 - GitHub
Describe the bug Very minor issue, but in macOS the title bar is doubled, losing a small bit of vertical screen estate, and...
Read more >
Ubuntu Budgie - Terminal has double title bars
I'm running Ubuntu 19.04 with the Budgie UI installed on it. My Gnome terminal windows have two title bars sometimes.
Read more >
double title bar with floating window | WPF Forums - Syncfusion
I've noticed with the most recent version that if I Float any of my docked windows that there is a double title bar....
Read more >
XFCE 4.16 dialog double title bars with gtk3-classic
I'm using it with gtk3-classic and it works well to restore the classic XFCE window appearance. One more little advantage of using Manjaro!...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found