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

  • Home
  • SEARCH
  • 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 6858001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:06:10+00:00 2026-05-27T02:06:10+00:00

I want to display a list of links in a java component, doesn’t matter

  • 0

I want to display a list of links in a java component, doesn’t matter what component it is.
By links I mean URLs of some sites.
Those links can be clicked and doing so opens chosen URL in the default web browser for example google chrome / firefox ( I don’t want to display web pages in java, only links ).

I already know how to display single link, but I am having problems with display a list of links. I tried to do it like this :

 public void appendTextToJEditorPane(String text) {

    try {
        Document doc = jEditorPane1.getDocument();
        String newLine = "\n";

        String url = "<html><a href=" + text + ">" + text + "<//a><//html>.";

        doc.insertString(doc.getLength(), url, null);
        doc.insertString(doc.getLength(), newLine, null);

    } catch (BadLocationException exc) {
        exc.printStackTrace();
    }


}

    appendTextToJEditorPane("http://google.pl");
    appendTextToJEditorPane("http://wp.pl");
    appendTextToJEditorPane("http://onet.pl");

but it doesn’t work due to problems with “/” in the html closing tag. And I get plain text in JEditorPane. How to append links properly?

  • 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-27T02:06:11+00:00Added an answer on May 27, 2026 at 2:06 am

    You can use html in JLabel component. That means you can use links via a-href also.

    label.setText("<html><a href="your-link">link</a></html>.")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to display some data through primefaces datalist component. To achieve this I
I want to display list of people in the iPhone's address book with atleast
I want to display a list of all the users in my site but
I want to display a list of complex, but fixed-size multiline elements, assuming that
We have a scenario where we want to display a list of items and
I have this situation where I want to display a list of Administration objects
I am creating an application using AppleScript and I want to display a list
I am starting out with Silverlight. I want to display a list of messages
On web page I display list of comments, I want to add an option
I have a list of images which I want to display in a page.

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.