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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:45:31+00:00 2026-06-12T01:45:31+00:00

SOLVED Hi Guys so if I had a program that went like this: import

  • 0

SOLVED

Hi Guys so if I had a program that went like this:

import java.awt.*;
import javax.swing.*;

public class Tab extends JFrame
{
    public Tab()
    {
        super ("Swimming Pool Calculator");

        JTabbedPane tab = new JTabbedPane();

        // constructing the first panel
        JLabel l1 = new JLabel( "Welcome to blah,blah!", SwingConstants.CENTER); 

        JPanel p1 = new JPanel();
        p1.add( l1 );
        tab.addTab( "Tab#1", null, p1, " Panel #1" );

        // constructing the second panel
        JLabel l2 = new JLabel("Welcome to JTabbedPaneDemo",SwingConstants.CENTER);
        JPanel p2 = new JPanel();
        p2.setBackground( Color.blue );
        p2.add( l2 );
        tab.addTab( "Tab#2", null, p2, " Panel #2" );

    }
}

And I wanted the wording in JLabel l1 to say:

                                     "Welcome! 
                              Thank you for using the
                              Swimming Pool Calculator.

How would I do this?

I tried to use the \n for new line but that didn’t work so well for me.

  • 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-12T01:45:33+00:00Added an answer on June 12, 2026 at 1:45 am

    Swing components understand some HTML

    JLabel l1 = new JLabel( "<html><center>Welcome!<br>Thank you for using the<br>Swimming Pool Calculator.</center>");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

-------EDIT------- hi guys, seeing that you solved this problem for me, i thought it
This is similar to an earlier problem I was having which you guys solved
I have a Java program running on two computers that are both on the
I have a class with a static method that looks roughly like: class X
I read this question and thought that would easily be solved (not that it
ok guys, u solved this so fast last time. i've altered my sub lists
@Solved The two subquestions I have created have been solved (yay for splitting this
SOLVED: This is what was wrong: current.addFolder(folder); (in the final else clause of the
Solved: You guys are the best! I took al the content of goyouidiot_Click and
SOLVED! Used this example from php.net post method handling multiple uploads, with the knowledge

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.