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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:52:47+00:00 2026-06-03T22:52:47+00:00

I have a gwt button that has a fixed size. I want to present

  • 0

I have a gwt button that has a fixed size.
I want to present a text on it, and if that text exceeds the button length, I need to cut it short and put “…” in the end. I use the following code now:

if(name.length() > 11){
    //limiting the size of the text presented on the button
    name = name.substring(0,10)+"...";
}

I have a list of such buttons, and this approach causes that not all button’s text have the same size.

The problem is, for example, that 10 chars of “!” are much shorter than 10 chars of “A”.

Can anyone help me with a way to solve this issue?

Thanks!

  • 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-03T22:52:48+00:00Added an answer on June 3, 2026 at 10:52 pm

    Fast answer. Try ussing HTML5/CSS3 property. It does exactly that:

    http://www.w3schools.com/cssref/css3_pr_text-overflow.asp

    If you need to do that for non-CSS3 browsers you’ll need to make some kind of fake. Maybe setting a button div content, with overflow-hidden, and placing a floating “…” to the right. But it’s more difficult…

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

Sidebar

Related Questions

Hi I use GWT and I have a com.smartgwt.client.widgets.Button that has the following eventHandler:
I have a GWT application that I want to release as software-as-a-service (SAAS) on
I have gwt-project that is comunication to database. Application design mvp pattern and view
I have a gwt project that uses gwt-mosaic. Here is the error message I
I have a GWT project in which I need to manually specify currency, number
I have a GWT app that makes an RPC call to a server to
I have a GWT (+GAE) webapp that allows users to edit Customer entities. When
saveButton.setStylePrimaryName(jtyfj); If I do that to a button, it removes the default gwt-button' class
I have created the file upload control in GWT and have one submit button
I have a GWT dialog box that looks like the following: public class FooDialog

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.