How to detect if text has been clipped in a JRadioButton ?

Hi,
Is there any way to test if the text in a JRadioButton (same holds e.g. for a JCheckBox) has been clipped and contains ellipses ... at the end. For a JLabel, knowing the FontMetrics one can use SwingUtilities.computeStringWidth(). I found the method SwingUtilities.layoutCompoundLabel() but it needs to know also the icon, which is not available by getIcon(), if not explicitly set with setIcon() in the JRadioButton.
So, is there any way to get info about the default icon used by the current UI in a JRadioButton or JCheckBox ?
Or better, is there any convenience method I've overseen which may lead to the goal.
Background info:
The text for the JRadioButtons (or JCheckBoxes) are read from a database and Tooltips should only be generated, when clipping occured, as a popup with the same text as in the base component doesn't provide so much new information.
Thanks for your help
ThomasGrewe

Hi,
your problem could be have a solution when you use a right layout manager. You have to use a layout manager wich use the preferredSize from the objects.
I tryed this code and work, with a BoxLayout. I dont understand yor Problem, maybe you have to write your code here (if it is not too long ;) )
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.Border;
public class Test extends JFrame{
  private String[] text;
  private int index = 0;
  private MyRadioButton rb;
  public Test(){
    text = new String[]{"Loooooooooooooooong", "mittttel", "Small", "1"};
    JButton changeText = new JButton("Change Text");
    rb = new MyRadioButton("Radio Button");
    changeText.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent e){
        if(index >= text.length)
          index = 0;
        rb.setText(text[index++]);
        rb.invalidate();
    getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
    getContentPane().add(changeText);
    getContentPane().add(rb);
  public static void main(String args[]){
    Test f = new Test();
    f.setSize(100,100);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setVisible(true);
class MyRadioButton extends JRadioButton{
  public MyRadioButton(String text) {
    super(text);
  // your business methods...
  // set preferred, min, max size
  public Dimension getPreferredSize(){
    // let the UI compute the preferredSize
    return getUI().getPreferredSize(this);
  public Dimension getMinimumSize(){
    return getPreferredSize();
  public Dimension getMaximumSize(){
    return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
}

Similar Messages

  • HT4059 Being new to iBook publishing I need to know if stats are available to determine how many times my iBook has been downloaded. Can anyone help please? Mr Ignorant

    Being new to iBook publishing I need to know if stats are available to determine how many times my iBook has been downloaded. Can anyone help please? I need to persuade someone that this really is worthwhile. Mr Ignorant.

    The only people who can possibly assist you with this is Apple Customer Relations, call your local Apple contact number and ask for Customer Relations then explain your situation clearly and politely (be firm but don't rant).
    You might want to investiage what the local laws are regarding defective goods and 'fit for use' definitions on warranties etc. Consumer Protection can be a useful tool to use or bargain with if needed ...

  • How can I see what has been purchased on my iTunes account

    How can I see what has been purchased on my iTunes account and when?

    In iTunes, in the lefthand sidebar:

  • My iPad has now been backed up on iCloud. How can I see what has been backed up?

    My iPad has now been backed up on iCloud. How can I see what has been backed up?

    Settings > iCloud > Storage and Backup > Manage Storage

  • Finding query access frequency or how many times a query has been executed?

    Dear Experts
    I need to find the total number of access frequency of individual queries that are requested by the users say at a particular time.
    Say there are 20 distinct queries requested in the time difference of 3 hours. All of the 20 queries or some of the queries may be requested for more than 2/3 times at that time by other users. By the way say query Q1 is requested 5 times at that so its query access frequency or how many times this query is executed is 5.
    From where and how can I can find this counting of query access frequency or how many times a query has been executed at particular time or a session?
    Normally we know the there SQL history dynamic performance views or if it can be possible to query the Shared pool library cache for SQL area it may be possible to find the total number of execution time for a query. But how to find that if anyone knows, please help me about this.
    Regards-
    Engr. A.N.M. Bazlur Rashid
    OCP DBA

    That's one of the stats reported by statspack - assuming that your query does sufficient work to meet the thresholds for the standard report. Executions is of course one of the columns of v$sql so you might just wish to sample that yourself. Finally if you are on 11g and the sql you are interested is relatively low resource intensive and you are licensed for AWR then you can use the slightly madly named "colored sql" feature that ensures that a specific statement will always be sampled for AWR.
    Niall Litchfield
    http://www.orawin.info/

  • How to keep track of how many times a link has been clicked?

    How to keep track of how many times a link has been clicked or accessed? Do I need to use database for this?

    Hi
    Proably something like this can work,
    1> Have a servlet/bean invoked when the link is linked
    2> have a static variable in that servlet/bean wich gets incremented before the control is passed to another desired page..
    The problem with this approach is that care has to be taken that the servlet/bean is not re-instalised, in case of which the static variable will also be instalised and the data would be lost.
    The best thing is to store the count in the database.
    Regards
    Arathi.

  • Can I see how long an "away" buddy has been idle also?

    Hi,
    Is there a way for me to see how long an "away" buddy has been idle? It's long been a feature of regular AIM but I can't figure out if it's even available in iChat. A buddy may be idle for several hours when away, and it would be convenient to be able to see both idle and away status simultaneously. Please let me know. Thanks.

    I can tell that wasn't helpful so here it is... Using iChat if the person simply leaves their computer (doesn't post an away message) you can then see how long they've been idle. Otherwise if they post the default Away or their own custom away message it does not additionally show their time away or idle time. I know!!! it should though (unless their is an add-on application out there, which I haven't seen one that can make this happen)... iChat doesn't show this information in this case. Sorry.

  • Can I see how long the longest entry has been in the sticky table ?

    Hi,
    I have a customer who has a possible issue with the sticky inactivity timeout on the CSS. At the moment we are using no timeout, just relying on the CSS to purge the entries.
    However, is it possible to see how long the longest entry has been in the sticky table. I can see the 'elapsed time' with the 'show sticky' command but this only shows 100 entries per time and not in time order ?
    Thanks in advance for any help

    Michael,
    You can use the command "show sticky-table" with L3 or L4 options, depending on what you have configured, then add ip addressing to the command, to focus down to where the oldest sticky entries are likely to be, but theres no other way. If your problem is having too many entries, configure a sticky timeout, as the default of 0 will keep then forever, or until overwritten due to the table being full. If the problem is sticky entries timing out too early, you can use the timeout parameter to increase their life, but the sticky table is limited to 32k entries.
    Peter

  • How many times a program has been run?

    Is there a transaction or table or something that tracks how many times a program has been run?   The number of times the program has been run plus using the programs' attributes for last changed would help me a lot.  We need this for an archiving study to determine of the client has set up the configuration correctly since they went live and have been executing the correct programs.  Thanks and mucho rewards if someone has an answer.  FYI - I have done a forum search and could find nothing on this topic.  I have looked at the tables TADIR and no help, as well as transaction STAT.

    I know ST03N transaction can be used extensively to determine how the programs were executed or even to know who all are using a particular transaction...
    I tried to find if we can find the number of executions of a program through this transaction, I could not find myself...
    try if you can find it through this tcode.
    Phani

  • How to avoid the event has been repeated many times in the background

    Application, the main screen is divided into two containers:left and  right container,
    The right side of the container is divided into two containers:top and  bottom container,
    There is a button in the left container.
    Click the button, the container at lower right will using ModuleManager  load Module,  The following container load of the right of the screen  has been monitoring the container above the action.
    Problem:
    When you click the button repeatedly to load the container in the lower  right, it will create multiple instances, and can not be freed  immediately. When the above container do an action or event, there are  multiple instances of monitoring exist.
    The background will be repeat the action or event many times.
    How to avoid the event has been repeated many times in the background?
    Thanks

    Flex harUI
    multiple instances of a mxml, maybe ?

  • How to find out what has been restored to a database instance?

    I'm using RMAN to back up and restore/recover. How to find out what has been restored/recovered to a database instance?
    Oracle version is 11gR2 but compatibility is set to 10.
    Edited by: 881656 on Aug 28, 2012 1:54 AM

    select output
    from V$rman_output
    order by stamp;
    select *
    from V$rman_status
    order by start_time desc;
    Regards
    Asif Kabir
    Handle:      881656
    Status Level:      Newbie
    Registered:      Aug 25, 2011
    Total Posts:      52
    Total Questions:      *30 (30 unresolved)*
    -- please close all the answered threads and mark your helpful post as correct/helpful

  • How to see whether GR has been done on PO or Inbound Delivery

    Hi Gurus
    How to know whether GR has been done on PO or inbound delivery. Is there any report or tables through that we can see this.
    Regards
    Irfan

    Hi
    If you check the material document posted for GR it should specify
    If the GR is done with respect to Inbound delivery then the inbound delivery number will be in material document if I remember it correctly.
    Please check and advice
    Deepak

  • How to find out how many hours an iMac has been running!

    Is there a way to find out how many hours an iMac has been running? I am thinking of buying a second hand iMac 20' or 21.5' as for space reasons, the actual 27' versions are too big. And of course, all adverts state "hardly never used"!!

    Hi, I think in later OSes I've seen total Machine hours in System Report or such, but on 10.4.11 right know.
    Hard Drive ON hours might be helpfull using Smart Utility...
    http://www.volitans-software.com/smart_utility.php

  • How to find out how many times an album has been burned to cd

    how to find out how many times an album has been burned to cd

    You can't.
    and the restriction (lwhich limits burning a specific playlist to audio CD) applies only to a specific playlist with DRM songs.

  • How do you find out how many times an app has been downloade

    Wondering where I can find out how many times an app from the app store has been downloaded?

    Are you asking if you can find out how many times an app has been downloaded from the app store? Or you asking if you can find how many times you have downloaded the app? If the former, you could try asking the developer. If the latter, none that I know of.

Maybe you are looking for

  • How can I modify this to process 80,000 records at a time until finish.

    Hello it's me again - Without using a rownum limit in my cursor declare my record-set is around 10 million records. This causes problems within our environment. Is there a way I can loop the following code and only do 80,000 at a time. 1 process 80,0

  • How do we get Front row to get photos from Aperture

    I just got Leopard and with it came Front Row. I thought this would be great to show my photos form Aperture however Front Row does not display any photos. How do i create a path for Front Row to use.

  • Installing Acrobat Reader freeware as printer?

    Maybe this is a weird question, but I'll try giving as much info as possible. I still have 2 old computers in use, not too often, they're both from 2000 and just used for working with  `Office 2000 Professional` programs. On both computers (the deskt

  • Recovery partition disappeared

    Hello everybody, I'm using "HP G62x-400 CTO Notebook PC". Yesterday I installed "Powerquest Partition Magic 8.0". As it was incompatitable, uninstalled it. After that, I found my Recovery partition disappeared. I found the partition in Disk Managemen

  • "Block EDIT option*" for all WEBI Reports with Administrator Account

    Hi, I had opening CMC with Administrator Account.Due to some reasons i want to "Block EDIT option" for all WEBI Reports.Just Viewing is sufficient.In the same way for Universe"Blocking EDIT object option".Instead of Administrator guide reference (cha