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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:39:31+00:00 2026-06-05T19:39:31+00:00

So my issue is, which I’ve had before with Jspinners. Is that I surround

  • 0

So my issue is, which I’ve had before with Jspinners. Is that I surround my jspinner with a titled border. However in the gui it cuts of the title text because the js is smaller. So how can I force the gui to rezise based on the length of the title, or how to I manger to make to the jspinner longer i guess to provide enough room to fit the entire title?

JTextField name= new JTextField(9);
name.setBorder(new TitledBorder("Name"));
//setup spinner date format
SimpleDateFormat datePattern = new SimpleDateFormat("MM/dd/yyyy");
JSpinner dob = new JSpinner(new SpinnerDateModel());
dob.setEditor(new JSpinner.DateEditor(dob, datePattern.toPattern()));
dob.setBorder(new TitledBorder("Date of Birth"));
JPanel childPanel = new JPanel();
childPanel.setLayout(new FlowLayout());
childPanel.add(name);
childPanel.add(dob);
childPanel.setBorder(new TitledBorder("Child Info"));

Then:

JPanel mainPanel = new JPanel(); 
mainPanel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));        
mainPanel.add(childPanel);
childPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
//there are more items in this panel, just omitted them, that's why using BoxLayout
  • 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-05T19:39:33+00:00Added an answer on June 5, 2026 at 7:39 pm

    Just add the JSpinner to a JPanel, and add the border to the panel:

        JPanel dobPanel = new JPanel();
        dobPanel.add(dob);
        dobPanel.setBorder(BorderFactory.createTitledBorder("Date of Birth"));
    

    EDIT: Also note that using a BorderFactory is better than creating Border instances:

    Wherever possible, this factory will hand out references to shared Border instances.

    http://docs.oracle.com/javase/7/docs/api/javax/swing/BorderFactory.html

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

Sidebar

Related Questions

I have an issue which is one of those mysterious occurrences that seems to
I have been working on a json decode issue (which I have already had
I had an issue which I first related to my PHP debugger (xDebug) setup
I already had another question on this issue which was successfully resolved. But now,
I'm running into issue which seems to indicate that ActionController::TestCase.get() method ignores what I
Fairly simple issue which is solved in PHP by using a static variable. private
I have yet another issue which the answer is eluding me. I wish to
i have a small issue which my text field insist to inhert the CSS
I am finding an issue which is specific with IE-7. Working on FF, Chrome,
I am facing some critical issue which might be interesting for whom , those

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.