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 7946509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:10:19+00:00 2026-06-04T01:10:19+00:00

JavaFX2’s TableView features Column reordering by the user at runtime. I’d like to disable

  • 0

JavaFX2’s TableView features
“Column reordering by the user at runtime”.
I’d like to disable this feature for one specific table in my Application.

Looking at the API doc, there is no obvious API hook for this.
There is, however, the columns-property. According to the doc, it represents

The TableColumns that are part of this TableView. As the user reorders the TableView columns, this list will be updated to reflect the current visual ordering.

Hoping that I’d at least be able to reset a change after it occurred, I tried adding a listener to reset changes after the fact.

import javafx.application.Application;
import javafx.collections.ListChangeListener;
import javafx.scene.Scene;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.stage.Stage;

public class TableTest extends Application {

  public static void main(String[] args) {
    launch(args);
  }


  @Override
  public void start(Stage stage) {
    TableView tableView = new TableView();
    tableView.getColumns().setAll(new TableColumn(), new TableColumn());
    tableView.getColumns().addListener(new ListChangeListener() {
        @Override
        public void onChanged(Change change) {
            if (change.wasPermutated()){
               change.reset();
            }
        }
    });
    stage.setScene(new Scene(tableView));
    stage.show();
  }
}

However, the listener aborts with an IllegalStateException when I ask for wasPermutated.
Is there a way to prevent reordering, or at least revert it programatically?

  • 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-04T01:10:21+00:00Added an answer on June 4, 2026 at 1:10 am

    See below a SSCCE that shows that the listener gets called – but the flag is set to added when moving columns. Note that you need to call next() before using the change or you will get an IllegalStateException. See the javadoc of ListChangeListener.Change for a simple canonical example.

    import javafx.application.Application;
    import javafx.collections.ListChangeListener;
    import javafx.scene.Scene;
    import javafx.scene.control.TableColumn;
    import javafx.scene.control.TableView;
    import javafx.stage.Stage;
    
    public class TableTest extends Application {
    
      public static void main(String[] args) {
          launch(args);
      }
    
      @Override
      public void start(Stage stage) {
        final TableView tableView = new TableView();
        final TableColumn[] columns = {new TableColumn("1"), new TableColumn("2")};
        tableView.getColumns().setAll(columns);
        tableView.getColumns().addListener(new ListChangeListener() {
            public boolean suspended;
    
            @Override
            public void onChanged(Change change) {
                change.next();
                if (change.wasReplaced() && !suspended) {
                    this.suspended = true;
                    tableView.getColumns().setAll(columns);
                    this.suspended = false;
                }
            }
        });
        stage.setScene(new Scene(tableView));
        stage.show();
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JavaFX app with a some code like this... public class MainListener
I'm new to JavaFX, trying to use bind like this: public function newCircle() :
When I create a JavaFX 2.0 ChoiceBox instance like this: final ChoiceBox<String> fontChBox =
i have a stupid question. Its possible to export JavaFX2 to Android. I have
JavaFX is a new technology introduced by Sun. I would like to know what
I'm learning JavaFX and this is just a small programming question. I have 3
JavaFX 2.0 GUI builder is removed for Linux? Like in old JavaFX we had
JavaFX 2 is not support Linux yet. Does this mean a client Linux machine
I am new to JavaFx technology, I would like to know whether I can
i recently bumps into this code below when exploring javafx, i see that ObservableList

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.