How to charge the screen when changing languages in JavaFX 2?

I am a beginner with javaFX and need to change the language of the screen... but I have no idea how to do to recharge the screen when the language has been changed. The application has a button where to have the language available. I just want to refresh screen when the user changes language.

Here is the start method to show the scene.

@Override

public void start (steps) throws exceptions

{

Stage = this.stage;

Locale locale = Locale.getDefault ();

Rb ResourceBundle = ResourceBundle.getBundle ("resources/Label", local);

loader = new FXMLLoader (getClass () .getResource ("FXMLDocument.fxml"), rb);

root = (Parent) loader.load().

FXMLDocumentController controller = loader.getController ((FXMLDocumentController));

controller.setMain (this);

scene = new Scene (root);

stage.setScene (scene);

internship. Show();

}

Here is the function to change the language (in the same class with start function), the rb is the new ResourceBundle:

public void refresh (ResourceBundle rb)

{

change the language here

}

1. I don't want to use the resourceBundle to get the value in the resource file, and set the label in a scene of one.like following:

this.btnLabel.setText (rb.getString (key.test));

...

2. I don't want to reload the scene as follows:

public void refresh (ResourceBundle rb)

{

VR;

{

loader = new FXMLLoader (getClass () .getResource ("FXMLDocument.fxml"), rb);

root = (Parent) loader.load().

scene.setRoot (root);

FXMLDocumentController controller = loader.getController ((FXMLDocumentController));

controller.setMain (this);

}

catch (exception Err)

{

err.printStackTrace ();

}

}

While we have a solution to just define the resourceBundle and recharge the easier scene?

Thank you and best regards!

773846 wrote:

JAVAFX isn't that kind of solution (more efficient and automatic)?

No and nor Swing or AWT (no idea for SWT): whenever you manually change the value of all labels autour (or build a custom system to do as suggested). The easiest way that most of the app use is simply to save the language in preferences and then ask the user to restart the application. So when the computer reboots, the app is full new regional settings. On the change of the fly is another matter.

Note: there is no FXML binding as far as i18n and text labels are concerned. You can just describe them as being located by using the '%' symbol, and at load time, the FXMLLoader has made an extra effort to replace anything out of all values (see the method resolvedPrefixedValue() in the class FXMLLoader source code simply call resources.getString ())... and that's all. There is more no link between controls text properties and the bundle once finished loading (and that's why you can replace everything that follows when in the controller when you want).

Another option would be to create your own custom FXMLLoader keeps the autour bundle and create links to i18n labels at load time.,.

Tags: Java

Similar Questions

  • How to update the table when change list item in the classic report

    Hello
    I worked with apex 4.2 and I create normal classic report with list (named loved) select a column, now I want to update the table when the user changes the list with the new value, I can't create a dynamic action to do this, I create checkbox with the primary key and the loop for check point to update the table but I can not get the value of the list item. and for more speed, the user want to do it when changing the value from the list.

    My question
    1. how to do it in javascript and get the value of the list item and update the table with the new value
    2. do I have to use the API to create the list item so I can get the value of the report item or what.





    Thank you

    Ahmed

    You can find a lot of information in this forum (and outside in google) when you search for AJAX processes and demand. However, the tutorial in the link below should be useful:
    http://www.Oracle.com/WebFolder/technetwork/tutorials/OBE/DB/hol08/apexweb20/ajax_otn.htm

    BTW, if we answer your question, don't forget to mark the appropriate post as correct. It will help all of us in the forum.

  • PAVILION dv7-1232nr, the sound signal is displayed on the screen when changing volume disappeard.

    hp pavilion dv7-1232nr, the volume signal which appears on the screen at any time the volume is set does not work as before! y at - it a point or the option which is in klicked on or off to turn off this signal!

    Hello

    If you have a MediaSmart software installed on your portable computer, the volume OSD (on-screen display) is provided by HP MediaSmart SmartMenu - you can download and reinstall this app from the following link.

    http://ftp.HP.com/pub/SoftPaq/sp45001-45500/sp45140.exe

    When the installation is complete, restart the computer and let Windows load fully before checking if it works fine now.

    Kind regards

    DP - K

  • How to fill the screen when encoding?

    I was coding a short video segment by using H.264 and trying to output to a custom size of 566 x 424.  Whenever I have coding the sequence at that size I get black bars at the top and bottom of the frame and still when I encode any other report size 3 x 4, I do not have.  Y at - it a screen adjustment 'fill' in the encoder in Premiere Pro that I can use?  Why don't I get bars upstairs and down on other 3 x 4 report parameters, and yet I do on this custom size?

    You can see the sample output here: http://www.Southridge.BC.ca/index.aspx

    In the Source of the export settings window tab, crop a few lines of the left and right of the image. It was probably around 6 to 12 pixels per side. Backwards, you can switch between the tabs Source and output to see the effect of the cream.

    Premiere Pro will scale to fit the dimensions of the output image without distorting; When it reaches a limit, it stops at the scale. These lines on the sides of culture will allow Agency until she correctly fills the wide framework.

  • How to stop Windows 7 to change the size of the screen when accidentally moving the mouse or touchpad?

    Ho can I stop win 7 to change the size of the screen when I move the mouse a let way or touchpad as it is quite annoying

    It is a feature of the touchpad on some Acer laptops, known as the multi touch and Dell.  If you open your mouse control panel (type mouse into the start menu), you can use the touchpad settings to disable these features.

    If it solves your problem, click on the link "Propose as answer" below and vote as useful by clicking on the green triangle for the lelft. Thank you!

  • The volume and brightness display showing is not on the screen when I change the volume or brightness

    Hi all

    My laptop used to display the controls volume and brightness on the screen when I would try to change. A few weeks ago, he stopped, and I'm just trying to understand how to solve this problem?

    Hello

    In this case, uninstall the current version, restart and then reinstall HP Quick Launch Buttons (1e) and SmartMenu again.

    Reboot after that.

    Regads,

    DP - K

  • got black screen when changing the screen background images

    got black screen when changing the screen background images

    can any one help

  • How always show left column on the screen, when I scroll to the right of a large spreadsheet

    How always show left column on the screen, when I scroll to the right of a large spreadsheet

    If the left column is a column header, you can check freeze header columns in the table menu.

    Better not to use TOO many columns.  Numbers works best with relatively little.

    SG

  • My toolbar was at the bottom and is not on the right side of the screen when I turned on the PC. How do come back on the bottom?

    How do you reposisition the toolbar background down

    Wednesday, June 13, 2012 19:45:28 + 0000, BJWoodham wrote:

    My tool bar downstairs was on the right side of the screen when I turned on the PC this morning. How do come back on the bottom?

    You say "toolbar." Do you mean the taskbar?

    Although by default, the taskbar is displayed on the bottom of the screen,
    It can be on any of the sides on what you prefer. To move any
    side to side, simply click an unused portion and drag
    where you want it. Don't forget to click inside it, not on the edge.
    by clicking on the edge and dragging will resize not move.

    If it does not move, it can be locked. In this case, right click on it
    and uncheck "Lock the taskbar", then try again.

    Moreover, with the screen monitors wide today, I prefer the taskbar
    on the left or the right of the screen. I think that allows a better
    use of real estate than have it at the bottom of screen.
    Ken Blake, Microsoft MVP

  • How to avoid the minimizin of the screen when the user down ups slide

    How to avoid the minimizin of the screen when the user ups the down slide.

    Hello

    I guess that not possible because this is a feature of the system. Be able to substitute the blow to the gesture of bottom up would mean for combat when a user can switch to another application. It is not something that an application must be able to do it at all.

  • How to get the cursor to change when rolled on an object?

    does anyone know how to get the cursor to change when rolled onto an object. BTW, I have several objects to apply it.

    Select your object's buttonMode:

    yourobject.buttonMode = true;

  • Volume control does not appear on the screen when I try to activate it. This has never been a problem until now. How can I get this working again?

    The volume control is located at the bottom right of my sidebar it me has not given any problems so far. Now, he just will not appear on the screen when I try to call. This has never been a problem before. I really did something to screw things up (again!) today. This is the first time I had this problem.

    Next time please indicate what opersting system you first use before describe you your problem.

    You can start by doing a system restore. Choose a date on which your Volume icon in the taskbar.
    http://www.howtogeek.com/HOWTO/Windows-Vista/using-Windows-Vista-system-restore/

    If for some reason it does not restore the Volume icon, then...

    For Vista, use this tutorial:

    http://www.Vistax64.com/tutorials/106787-notification-area-system-icons.html

    You can try a method first. If the Volume box is grayed out (is usually), go to method 3.

    2. for the Volume icon

    To activate the Volume - icon Enable_Volume.reg< click="" to="">
    Then, follow the instructions from #5 to #9.
    Make sure that you restart the computer to complete the process.

    For Windows 7, use this tutorial:
    http://www.SevenForums.com/tutorials/19085-system-icons-enable-disable.html

    Go directly to the Option two

    9. to activate the Volume icon

    (A) click on the download button below to download the file below.

    Enable_Volume_Notification_Icon.reg

    then follow the instructions from #11 to #15.

    Make sure that you restart the computer to complete the process.

  • How to get the coordinates of the screen when they are hit.

    Hi all!

    I am a beginner on the development of blackberry, also a beginner in programming in general ^^

    I've done some app using just QML and take some C++ tutorials

    I try to get the coordinate of the screen when the user touches, I wasn't able to do that you use just QML, I found the source TouchEvent and tried to make it work on C++, to get the windowX and windowY coordinates of the touch.

    http://developer.BlackBerry.com/Cascades/reference/bb__cascades__touchevent.html

    I use the image on background to try to get contact with the event.
    So far, we have:

    PPS:

    class LostInSpace : public QObject
    {
        Q_OBJECT
    public:
        LostInSpace(bb::cascades::Application *app);
        virtual  ~LostInSpace() {}
    public slots:
    Q_INVOKABLE float screentouchY(bb::cascades::TouchEvent* event);
    Q_INVOKABLE float screentouchX(bb::cascades::TouchEvent* event);
    
    private:
    QPointer fundo;
    
    };
    

    CPP:

    LostInSpace::LostInSpace(bb::cascades::Application *app)
    
    {
    
        QmlDocument *qml =
    QmlDocument::create("asset:///main.qml").parent(this);
        qml->setContextProperty("app", this);
        AbstractPane *root = qml->createRootObject();
    
        app->setScene(root);
    
        fundo = root->findChild("fundo");
        bool res = QObject::connect(fundo, SIGNAL(touch(bb::cascades::TouchEvent*)),this, SLOT(screentouchY(bb::cascades::TouchEvent*)));
        Q_ASSERT(res);
        res = QObject::connect(fundo, SIGNAL(touch(bb::cascades::TouchEvent*)),
    this, SLOT(screentouchX(bb::cascades::TouchEvent*)));
        Q_ASSERT(res);
    
    }
    
    float LostInSpace::screentouchY(bb::cascades::TouchEvent* event) {
        return event->windowY();
    }
    float LostInSpace::screentouchX(bb::cascades::TouchEvent* event) {
        return event->windowX();
    }
    

    QML: (I'll do later animations, it's just to see if it works. I mean a "unknown simbol app" the Notecard, I thought I just had to put "qml-> setContextProperty ("app", this);  in the constructor)

    ImageView {
                    objectName: "fundo"
                    imageSource: "images/fundo1.png"
                    touchPropagationMode: TouchPropagationMode.Full
                    onTouch: {
                        tiro.translationX = app.screentouchX();
                        tiro.translationY = app.screentouchY();
                    }
                }
    

    Any help will be very appreciated!

    Thank you!

    Hey there,

    You don't need to do... You can access the 'event' TouchEvent object in the notecard: {} area QML...

    ImageView {
                    objectName: "fundo"
                    imageSource: "images/fundo1.png"
                    touchPropagationMode: TouchPropagationMode.Full
                    onTouch: {
                        tiro.translationX = event.windowX
                        tiro.translationY = event.windowY
                    }
                }
    
  • How to lighten the screen on my laptop?

    How to lighten the screen on my laptop? It's waaay to obscurity and the only time where it is bright enough is when I plug in the power cord. I have Windows Vista.

    Hi AdrianeJackson,

    1. What is the make and model of your laptop?

    2. when the problem started?

    3. you remember recent changes to the computer?

    You can try to hold down the function key (FN) on the laptop and press the arrow key UP while you are on the farm, he must try to change the brightness. You can also get in touch with the manufacturer of the system and check.

    Hope this information is helpful

  • How to split the screen with 2 or more apps

    How do I split the screen when I have 2 or more open applications?

    Here are the instructions for use, two Mac apps side by side in split - view Apple Support

Maybe you are looking for

  • Video freeze or crash

    Hi, when I click to watch the podcast, it freezes sometimes. What should I do?

  • BlackBerry App passport and Facebook question

    Since FB can't stand BB, what is the best configuration for notifications by email FB on my passport?  I deleted the FB app and saved FB on my homescreen Passport using the browser... but I don't get notifications by e-mail FB either on my passport o

  • Uninstall/Change programs, all the programs installed on my system are not visible

    Uninstall/Change programs, all the programs installed on my system are not visible. That's why I not able to uninstall some programs. help out me.

  • Windows 8 key cannot activate

    Due to my portable drive hard corrupt and unable to restore my laptop, I had to get the recovery media and had to have a new hard drive put in and used the recovery media to restore. After it was fixed, I came to discover that Windows 8 will not acti

  • Flash vs animate using Animate/encode for the class

    Hello!I take Adobe animate as a class for graduate studies. I use the latest version of Animate, however, the class uses the book of Flash CC 2013 for the lessons. In Lesson 7 I have Media Encoder allows you to convert video files for the project Ani