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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:58:33+00:00 2026-05-27T09:58:33+00:00

I am doing a chat application and I put a JEditor pane to type

  • 0

I am doing a chat application and I put a JEditor pane to type the message.

I put a key listener on this JEditor so that when I type the Enter key, it sends the message.

My problem is that it sends the message but it also does a line break in my JEditor and it doesn’t look good even if right after after I also do a setText(“”).

How to avoid the display of the line break ?

Thank you very much

Regards.

  • 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-05-27T09:58:34+00:00Added an answer on May 27, 2026 at 9:58 am

    Don’t use a KeyListener.

    Swing was designed to be used with Key Bindings. The default Action is to add a new line string to the Document. You need to replace the default Enter Action with a custom Action of your own. You would start by extending TextAction.

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

Sidebar

Related Questions

I'm doing a simple chat. When user sends message to server I want to
I'm doing a Facebook-Like chat. The problem is that the text is making a
When doing TDD , how to tell that's enough tests for this class /
we are doing an android chat application in 2.3.3 as a project in final
I want to build a simple web-interface application that can send/receive chat messages to/from
I am doing a simple chat application and I want to show balloons similar
as I am doing a small chat application in vb.net (windows form), I'm having
I am working on a mini-project which consists of doing a client-server chat application.
I'm writing a Node.JS application that will store chat logs to a datastore (i.e.
I'm doing a chat application accessible via native apps on the iPhone and Android.

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.