Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make AtlantaFX smaller / more compact / dense globally? #120

Open
hjohn opened this issue Jan 25, 2025 · 4 comments
Open

How to make AtlantaFX smaller / more compact / dense globally? #120

hjohn opened this issue Jan 25, 2025 · 4 comments

Comments

@hjohn
Copy link

hjohn commented Jan 25, 2025

I'm testing AtlantaFX as it offers a nice flat alternative to the standard FX theme.

After setting:

Application.setUserAgentStylesheet(new PrimerDark().getUserAgentStylesheet());

I immediately noticed that with AtlantaFX my Window is about 50% larger than with the standard theme. After adjusting the font size in the .root node to 12, this has improved somewhat, but it still far larger and roomier than the standard theme. For productivity apps, I like to see a more dense and compact layout, but it doesn't seem to be easily possible to set this globally. I've tried:

mainWindow.getStyleClass().addAll(Styles.DENSE, Styles.SMALL);

...but this seems to have no effect anywhere on any controls.

I also couldn't find anything in the sampler application that changes this. There's also a discussion topic that asks a similar question, without an answer: #116

@PavelTurk
Copy link

@hjohn I also had the same problem.

mainWindow.getStyleClass().addAll(Styles.DENSE, Styles.SMALL);

won't help you. You should add Styles.DENSE to every node you want to make dense. For example, tables. Remember that not all nodes support it. So, you should check it, for example see

, so tableView supports it.

@hjohn
Copy link
Author

hjohn commented Feb 1, 2025

Thanks, but putting these styles on all controls is not acceptable for me. The whole idea of cascading stylesheets is that you can put styles at any level.

@PavelTurk
Copy link

@hjohn As I know there is no other way to do it. Because it is not javafx feature, it is atlantafx feature, so, by default it is disabled.

@hjohn
Copy link
Author

hjohn commented Feb 1, 2025

I think the tableview styles should have been defined like:

.tableview.dense,
.dense .tableview {
  /* Style rules for dense */
}

In SCSS that's probably:

 &.dense, .dense & {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants