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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:55:05+00:00 2026-06-11T10:55:05+00:00

What I am trying to do is make it so the JTextPane takes up

  • 0

What I am trying to do is make it so the JTextPane takes up as much space as possible in the JPanel.
For my UpdateInfoPanel I am using:

public class UpdateInfoPanel extends JPanel {
private static final long serialVersionUID = 257125249175323679L;

private JTextPane textPane;

public UpdateInfoPanel(){
    textPane = new JTextPane();
    textPane.setBackground(Color.DARK_GRAY);
    textPane.setEditable(false);
    textPane.setMargin(null);
    textPane.setContentType("text/html");
    textPane.setText("<html><body style=\"font: Arial; color: white; padding: 5px; padding-top: 0;\"><h1 style=\"padding-top: 0;\">News</h1></body></html>");
    JScrollPane scrollPane = new JScrollPane(textPane);
    add(scrollPane);
    setBackground(Color.DARK_GRAY);
    textPane.setBorder(BorderFactory.createLineBorder(Color.BLACK));
}
}

And for my frame I simply create an instance of this and put it in BorderLayout.CENTER.
Currently this is how it looks. White border is the scroll pane, black is the textpane. What I want to do is have the borders be at the edge of the panel.
![][1]

  • 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-11T10:55:07+00:00Added an answer on June 11, 2026 at 10:55 am

    Are you setting layout of your panel?

        setLayout(new BorderLayout());
        add(scrollPane,BorderLayout.CENTER);
    

    If you dont need the border of textpane do textPane.setBorder(null);
    Dont extend the JPanel. You can create is as you create the JTextPane.

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

Sidebar

Related Questions

I'm trying to make JTextPane with two columns, both aligning to left like that:
I'm trying make a static text which if too long for the sizer, will
Trying to make td elements clickable. Here's my HTML: <td id=A3 class= open-square><a href=/gameplay/A3></a></td>
I'm trying make a <dl> to define the icons I am using on the
Trying to make this function dynamic instead of static. This was the original code
Trying to make a simple client that consumes a web service using RemObjects SDK,
Trying to make a Grid Like this using java and I'm assuming a 2d
I'm trying to make a text editor with a JTextPane, but i'm having trouble
I'm currently trying to make Log4J log into a JTextPane . I want to
I'm trying make some stuff in jQuery using ASP.NET. But the ID from runat=server

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.