JDK-8149818 : TableView localization could not be changed after first usage
  • Type: Bug
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: 8u72
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-02-15
  • Updated: 2016-03-03
  • Resolved: 2016-02-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Fixed
Related Reports
Relates :  
Description
In TableViewSkinBase the texts are static and can therefore not be changed anymore:

127     private static final String EMPTY_TABLE_TEXT = ControlResources.getString("TableView.noContent");
128    private static final String NO_COLUMNS_TEXT = ControlResources.getString("TableView.noColumns");

======================================================

import java.util.Locale;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.TableView;
import javafx.stage.Stage;

public class RunTest extends Application {

	@Override
	public void start(Stage primaryStage) throws Exception {
		Locale.setDefault(Locale.GERMANY);
		TableView<String> tableView1 = new TableView<>();
		tableView1.setId("tableView1");
		Scene scene = new Scene(tableView1);
		primaryStage.setScene(scene);
		primaryStage.show();

		Locale.setDefault(Locale.US);
		TableView<String> tableView2 = new TableView<>();
		tableView2.setId("tableView2");
		scene.setRoot(tableView2);
	}

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

}
Comments
Also applied the same fix to ListViewSkin, ProgressIndicatorSkin, and TableHeaderRow. Changeset: http://hg.openjdk.java.net/openjfx/9-dev/rt/rev/f4c4d2980d68
24-02-2016

The strings should not be static, but initialized by constructor. Note that JavaFX does not support changing locale after instances are created, so apps need to recreate the GUI after changing the default locale.
15-02-2016