Forum Stats

  • 3,838,514 Users
  • 2,262,378 Discussions
  • 7,900,678 Comments

Discussions

how to fit toolbar according to the screen resolution?

3463663
3463663 Member Posts: 7
edited May 17, 2017 6:06PM in JavaFX 2.0 and Later

hello friends,  I am new in the javafx development programming. I am developing the one desktop application for my company. My problem is how I fit the toolbar according to the screen resolution.

I take the following screen picture.

1) in 1366*768

pastedImage_0.png

2)  in 1280*768

pastedImage_1.png

3) in 1280*720

pastedImage_2.png

4) in 1280*600

pastedImage_3.png

5) in 1024*768

pastedImage_4.png

6) in 800*600

pastedImage_5.png

look the 5 and 6 condition the full toolbar not showing. so the question is how to write the code in such way that in any screen resolution my toolbar shows all the text...

bouye-JavaNet

Answers

  • bouye-JavaNet
    bouye-JavaNet Member Posts: 394 Silver Badge
    edited May 16, 2017 7:24PM

    I think you would need to create a new class that extends ToolBarSkin (remember skins will be public in JDK 9 and are currently private but accessible in JDK 8) so it behaves more like the TabPane header in case of overflow (which dispay a control button with a popup menu that list all tabs).

    JDK8 source code for ToolBarSkin

    JDK8 source code for TabPaneSkin (check inner class TabHeaderArea)

    Also check on the JDK bug system has already a RFE for that and if not create it on the java bug page (it's too late for any JDK9 change BTW).

  • 3463663
    3463663 Member Posts: 7
    edited May 17, 2017 2:07AM

    Thanks for the reply. can you give any example for same..

  • jsmith
    jsmith Member Posts: 2,856
    edited May 17, 2017 4:47PM

    > so it behaves more like the TabPane header in case of overflow (which dispay a control button with a popup menu that list all tabs)

    That is the default behavior of a ToolBar

    > If there are too many items to fit in the ToolBar an overflow button will appear. The overflow button allows you to select items that are not currently visible in the toolbar.

    That the default behavior is not occurring in the instance of this question, would mean that there is some idiosyncrasy of the way the layout in the question has been defined that prevents that from occurring.  It is impossible to say what that is without the source for the relevant FXML file or an mcve.

    bouye-JavaNet
  • bouye-JavaNet
    bouye-JavaNet Member Posts: 394 Silver Badge
    edited May 17, 2017 6:06PM

    Yep if it's the default behavior then this is mainly a layout issue.

    Can you create a small test that use the same layout management you use in your real program/product with random buttons so we can see what's wrong?

This discussion has been closed.