Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8372031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:18:47+00:00 2026-06-09T14:18:47+00:00

I placed a ChoiceBox inside an fxml with JavaFX Scene Builder. The FXML has

  • 0

I placed a ChoiceBox inside an fxml with JavaFX Scene Builder.

The FXML has a controller assigned to it.

My question is: Which event do I need to register if I want to know about changed values?

onInputMethodTextChanged="#languageSelectionModified"

this does not work with the following code

public void languageSelectionModified(Event event) {
    ChoiceBox<String> box = (ChoiceBox<String>) event.getSource();
    System.out.println(box.getValue());
}

and this only works for the initial click (i.e. opening the list, not when selecting an item):

onMouseClicked="#languageSelectionModified"

Although the Mouse-Events would never be a good choise because of situations where the touch or keyboard is the input-method, it still proves that the System.out can be reached.

I have absolutly no idea where those things are documentated (in the default Java-API they are not)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T14:18:49+00:00Added an answer on June 9, 2026 at 2:18 pm

    Add a listener to your @FXML injected choicebox in your controller:

    choicebox.getSelectionModel().selectedItemProperty().addListener(choiceboxSelectionChangeListener);
    

    You can also bind to the selected item:

    label.textProperty().bind(choicebox.getSelectionModel().selectedItemProperty());
    

    Here is an example of hooking up a listener in a controller for a ComboBox defined in FXML. Logic for a ChoiceBox is pretty much identical.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a panel placed inside a webpart which holds a chart . The
i placed one button in a page .when click on that need to show
I've placed a table inside a div and set the table width to 100%.
I have an absolutely placed div with an embedded YouTube video inside of it.
I have placed a execute sql task inside the foreach loop container , where
I placed this question in Google groups for gae java ( http://groups.google.com/group/google-appengine-java/browse_thread/thread/85dc9f10d7e12a3 ), but
I placed a breakpoint inside my handler invoked by: def handle_user_save(sender, instance, created, **kwargs):
I've placed in my MainWindow a StackPanel, which gets dynamically on runtime new UserControls
I've placed a ClickOnce deployment inside of a virtual directory on a server running
I've placed some images in my interface with Interface Builder and set them to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.