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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:08:30+00:00 2026-06-11T20:08:30+00:00

I was trying to do some experiments with JavaFX’ HTMLEditor component. I used the

  • 0

I was trying to do some experiments with JavaFX’ HTMLEditor component. I used the following code(excerpt):

    fxPanel=new JFXPanel();
    Platform.runLater(new Runnable() {
        @Override
        public void run() {
            Group group = new Group();
            scene = new Scene(group);               
            fxPanel.setScene(scene);
            view = VBoxBuilder.create().build();

            group.getChildren().add(view);


            edit = HTMLEditorBuilder.create().build();
           // toolPane = TabPaneBuilder.create().minHeight(60d).build();
            //toolPane.getTabs().add(new Tab("Allgemein"));

            view.getChildren().add(edit);

        }
    });

    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            jPanel1.add(fxPanel);
        }
    });

It works fine so far with one important exception – i can’t use the return key for a BR – it seems just to be ignored. There is no reaction on this key at all. As far as i could see, any other key works as expected.

  • 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-11T20:08:31+00:00Added an answer on June 11, 2026 at 8:08 pm

    I noticed that CTRL–M works where Enter doesn’t. So I just worked around this by putting a KeyListener on the JFXPanel, changing the KeyChar from 10 to 13 and reposting the event to the System Event Queue. This may stop working as intended later on if the HTMLEditor starts responding to both ENTER and CTRL–M though.

    fxPanel.addKeyListener(new KeyListener() {
    
        public void keyTyped(KeyEvent e) {
            if (e.getKeyChar() == 10) {
                e.setKeyChar((char) 13);
                Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e);
            }
        }
    
        public void keyPressed(KeyEvent e) {}
    
        public void keyReleased(KeyEvent e) {}
    });
    

    Anyone have a better idea for now?

    Edit: I found another way to get the desired effect is to install a custom KeyEventDispatcher on the current keyboard focus manager like so:

    KeyboardFocusManager kfm = DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager();
    kfm.addKeyEventDispatcher(new KeyEventDispatcher() {
        @Override
        public boolean dispatchKeyEvent(KeyEvent e) {
            if (DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() == jfxPanel) {
                if (e.getID() == KeyEvent.KEY_TYPED && e.getKeyChar() == 10) {
                    e.setKeyChar((char) 13);
                }
            }
            return false;
        }
    });
    

    This has the advantage of changing the original KeyEvent rather than posting a new one afterwards, so that if HTMLEditor were to start responding to Enter events we wouldn’t be doubling up.

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

Sidebar

Related Questions

I am trying to do some experiments using different segments besides the default code
I'm doing some experiments, trying to understand the issues surrounding returning generics. The following
I'm trying some iOS test applications on the new Mac mini, that supports Bluetooth
I am trying some way to optimize following sql statement: exe_sql DELETE FROM tblEvent_type
After following this MVC 4 tutorial series I was trying some of the stuff
I am new in R and am trying to so some graphics using ggplot
One of my personal experiments to understand some of the C++0x features: I'm trying
I've got a peculiar error writing some C++/CLI code. I'm trying to make a
I'm trying to make some keen experiments about android event handler... Let say.., I
I am running some experiments with I/O intensive applications and am trying to understand

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.