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

configurable title alignment in titlepane #558

Closed
rjahn opened this issue Jun 20, 2022 · 8 comments
Closed

configurable title alignment in titlepane #558

rjahn opened this issue Jun 20, 2022 · 8 comments
Milestone

Comments

@rjahn
Copy link

rjahn commented Jun 20, 2022

I have an application without menubar and want to show 2 buttons in the title. This is possible with #268 - but a menubar is required. So I set a new JMenuBar and buttons are available.

The only "problem" is that the window title is centered after setting a menubar. Without menubar, the title is left aligned.

Is it possible to show the title left aligned in case of an empty menu?

The property:

UIManager.put("TitlePane.centerTitleIfMenuBarEmbedded", false);

is "static".

@DevCharly
Copy link
Collaborator

So you want the title centered if buttons are shown (via menubar),
but the title left aligned if no buttons are shown?

Use frame.setJMenuBar( null ).

@rjahn
Copy link
Author

rjahn commented Jul 8, 2022

The hint setJMenuBar(null) doesn't work, because we require a menubar to add additional items? I tried to describe this in my initial post.

@DevCharly
Copy link
Collaborator

Sorry, but your initial post is a little bit confusing 😕

Can you reexplain? (gerne auch auf Deutsch)

@DevCharly DevCharly reopened this Jul 8, 2022
@rjahn
Copy link
Author

rjahn commented Jul 8, 2022

;-)

Also es braucht unbedingt eine JMenuBar sonst kann man keine zusätzlichen Elemente einfügen, die dann zB am rechten Rand (vor min, max, close) erscheinen.

zB:

JMenuBar jbar = new JMenuBar();

frame.setJMenuBar(jbar);

jbar.add(Box.createHorizontalGlue());
jbar.add(butVideo);
jbar.add(butDocu);

Zumindest ist das lt. Anleitung von #268 so beschrieben.

Und wenn man aber keine Menü Items zur MenuBar hinzufügt, ist der Title centered... schön wäre in diesem Fall aber, wenn er links wäre.

Klar, nur Kosmetik.

@DevCharly
Copy link
Collaborator

Ach so, links kein Menü und Buttons rechts.
Dann sollte der Title natürlich links angezeigt werden 👍

@rjahn
Copy link
Author

rjahn commented Jul 8, 2022

Genau das!

DevCharly added a commit that referenced this issue Jul 10, 2022
…s empty or has no menus at left side, but some components at right side (issue #558)
@DevCharly
Copy link
Collaborator

Fixed in latest 2.4-SNAPSHOT: https://github.com/JFormDesigner/FlatLaf#snapshots

@DevCharly DevCharly added this to the 2.4 milestone Jul 11, 2022
@DevCharly
Copy link
Collaborator

Thx for your feedback 👍

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