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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:13:33+00:00 2026-06-16T04:13:33+00:00

I’ll start with what I want then go from there: +——————————————+ |[] jCheckBox jLabel

  • 0

I’ll start with what I want then go from there:

+------------------------------------------+
|[] jCheckBox                       jLabel |
+------------------------------------------+

Basically I would like to have a JCheckBox with 2 segments of text, 1 left aligned and 1 right aligned. I would like the entire box to be clickable and act exactly like a JCheckBox(As in if I press my mouse down it highlights the box ect.).

Now I have tried:

  • Using HTML inside the text box, with a table along the lines of: <html><table width=100%><tr width=100%><td>Left Text</td><td align=right>Right Text</td></tr></table>. This produces [] Left TextRightText without any visual alignment.

  • Adding both the JCheckBox and the JLabel to a panel, however this would require me to implement all the mouse events and call the correct respective methods on the JCheckBox. I put this aside – however I am willing to reconsider if this is the only option

  • Adding the JLabel to the JCheckBox

    • Firstly this caused the JCheckBox to decide to change the font, so that had to be ‘adjusted’
    • Secondly, the baselines were off by 1 or 2 pixels, This was fixed by implementing a LayoutManager that placed the JLabel on the baseline.
    • Thirdly, the JLabel overlapped with the JCheckBox text so I ad to adjust my layout manager, however the JCheckBox did not give a correct result from getPreferedSize()(of [1,1]).

So, basically my question is: How should I implement this?

  • 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-16T04:13:34+00:00Added an answer on June 16, 2026 at 4:13 am
    • create parent JLabel, JLabel haven’t implemented any LayoutManager, then to set there proper LayoutManager, I think that GridLayout (with 2 segments of text, 1 left aligned and 1 right aligned)

    • add there two JLabels with proper alignment (JLabel.setHorizontalAlignment(javax.swing.SwingConstants.XXX);)

    • put together JCheckBox with parent JLabel (JLabel.setLabelFor(JCheckBox);)

    • the same way for MultiIcon in the JLabel

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a text area in my form which accepts all possible characters from
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I would like to run a str_replace or preg_replace which looks for certain words
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a reasonable size flat file database of text documents mostly saved in
I have a view passing on information from a database: def serve_article(request, id): served_article
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display

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.