Skip to content

Commit

Permalink
wip(ui): beta test title hiding and button rect placement
Browse files Browse the repository at this point in the history
  • Loading branch information
bric3 committed Apr 15, 2022
1 parent 3765c10 commit fe97382
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.extras.FlatAnimatedLafChange;
import com.formdev.flatlaf.util.SystemInfo;
import com.github.weisj.darklaf.platform.DecorationsConstants;
import com.github.weisj.darklaf.platform.decorations.DecorationsColorProvider;
import com.github.weisj.darklaf.platform.decorations.ExternalLafDecorator;
import com.github.weisj.darklaf.platform.preferences.SystemPreferencesManager;
Expand Down Expand Up @@ -53,6 +54,8 @@ static void install(JFrame frame) {
rootPane.putClientProperty("apple.awt.fullWindowContent", true);
// makes the title bar transparent
rootPane.putClientProperty("apple.awt.transparentTitleBar", true);
// hide window title
rootPane.putClientProperty(DecorationsConstants.KEY_HIDE_TITLE, false);
}

ExternalLafDecorator.instance().install();
Expand Down Expand Up @@ -81,6 +84,10 @@ public TitleColor windowTitleColor() {
INSTANCE.start();
}

static Rectangle getWindowButtonsRect(JFrame frame){
return ExternalLafDecorator.instance().decorationsManager().titlePaneLayoutInfo(frame).windowButtonRect();
}

private static void setGlobalProperties(String title) {
if (SystemInfo.isLinux) {
// most linux distros have ugly font rendering, but these here can fix that:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ private static void initUI(JFRBinder jfrBinder, List<Path> cliPaths) {
}

var topPanel = new JPanel(new BorderLayout());
if (SystemInfo.isMacOS) {
openedFileLabel.setBorder(BorderFactory.createEmptyBorder(30, 5, 5, 5));
}
topPanel.add(openedFileLabel, BorderLayout.CENTER);
topPanel.add(AppearanceControl.getComponent(), BorderLayout.EAST);

Expand All @@ -138,8 +135,6 @@ private static void initUI(JFRBinder jfrBinder, List<Path> cliPaths) {
JfrFilesDropHandler.install(jfrBinder::load, appLayers, hudPanel.getDnDTarget());

var frame = new JFrame("FirePlace");


frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(new Dimension(1000, 600));
frame.getContentPane().add(appLayers);
Expand All @@ -161,6 +156,17 @@ public void windowOpened(WindowEvent e) {
AppearanceControl.install(frame);

frame.setVisible(true);


if (SystemInfo.isMacOS) {
var windowButtonsRect = AppearanceControl.getWindowButtonsRect(frame);
openedFileLabel.setBorder(BorderFactory.createEmptyBorder(
5,
windowButtonsRect.x + windowButtonsRect.width + 5,
5,
5
));
}
});
}

Expand Down

0 comments on commit fe97382

Please sign in to comment.