DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report
  1. DZone
  2. Coding
  3. Java
  4. ListMenu JavaFX Control

ListMenu JavaFX Control

How to build a list menu using the JavaFX framework for Kotlin — TornadoFX.

Edvin Syse user avatar by
Edvin Syse
·
Jan. 19, 16 · Tutorial
Like (7)
Save
Tweet
Share
7.08K Views

Join the DZone community and get the full member experience.

Join For Free

While working on an upcoming JavaFX Framework for Kotlin — TornadoFX, I needed a HTML5 like menu for a demo application. I thought it would be easy to reuse existing components like a VBox with ToggleButtons in it, but there were a lot of corner cases involved in making it behave like an actual menu.

Instead I opted to create a reusable component for web-like menus with configurable orientatioImage titlen and icon position. I also wanted to solve another problem I ran into with the ToggleButton approach — not all icons, especially in icon fonts — are the same width. This makes it quite difficult to align the button text in relation to the other buttons. I therefore added a custom css property called -fx-graphic-fixed-size to deal with icons of different width or height, depending on the orientation of the menu.

There is also an active pseudo state to distinguish the active menu item visually. You can listen to the menu's active property to react on changes.

You can find it in my TornadoFX Controls repo on GitHub, and in Maven central:

<dependency>
    <groupId>no.tornado</groupId>
    <artifactId>tornadofx-controls</artifactId>
    <version>1.0</version>
</dependency>

For now there is only this single control in there, but I plan to add more in the future.

JavaFX

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Key Elements of Site Reliability Engineering (SRE)
  • Integrating AWS Secrets Manager With Spring Boot
  • How Agile Architecture Spikes Are Used in Shift-Left BDD
  • A First Look at Neon

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: