Auto Resize ToggleButtonBar Button

Hi,
     I have using ToggleButtonBar in my application. I want to resize the ToggleButtonBar Button according to the size of label. Now what happens, it truncate the button label with some fixed size.
Anyone have ideas to resolve my problem.
Thanks in Advance.
Regards,
Arun P. Ganesh

The buttons resize in the following code. How does your differ?
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
  <mx:Script>
    <![CDATA[
      import mx.collections.ArrayCollection;
      [Bindable] private var ac1:ArrayCollection = new ArrayCollection(["one", "two", "three"]);
      [Bindable] private var ac2:ArrayCollection = new ArrayCollection(["string one", "string two", "string three"]);
    ]]>
  </mx:Script>
  <mx:ToggleButtonBar id="tbb" dataProvider="{ac1}"/>
  <mx:Button label="Change Data Provider"
    click="tbb.dataProvider==ac1?tbb.dataProvider=ac2:tbb.dataProvider=ac1"/>
</mx:Application>
If this post answers your question or helps, please mark it as such.
Greg Lafrance - Flex 2 and 3 ACE certified
www.ChikaraDev.com
Flex Training, Tutoring, Contracting, and Support Services

Similar Messages

  • JButton with auto resizing icon

    Hi,
    I want to extend the JButon in order to make it auto resize the icon image to the button size itself.
    I tried somethink like the following code and it work but there is some recursive side effect I cannot understand becouse I get a 100% CPU usage and from the print() I see the paint() method is called continuosly.
    import java.awt.Graphics;
    import java.awt.Image;
    import javax.swing.Icon;
    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    public class IconButton extends JButton {
    private static final long serialVersionUID = 4049919355141829686L;
    int cntr;
    public IconButton(ImageIcon icon) {
    super(icon);
    public void paintComponent(Graphics g) {
    System.out.println(cntr++);
    Icon icn = getIcon();
    if (icn instanceof ImageIcon) {
    ImageIcon ii = (ImageIcon)icn;
    Image img = ii.getImage();
    img = img.getScaledInstance(getWidth(), getHeight(), Image.SCALE_AREA_AVERAGING);
    icn = new ImageIcon(img);
    super.setIcon(icn);
    super.paintComponent(g);
    Maybe there's a better way... for example by changing the icon only when the button size change: but how?
    Thank in advance,
    Carlo.

    ok,
    the question is:
    how to have a Button with the icon automatically resized to the button size? Is it right to extends JButton or is better extends AbstractButton?
    thanks.

  • My auto-scroll 3rd button does not work in FireFox 3.6. It worked in previous FF versions.

    I have updated FireFox. My auto-scroll 3rd button now does not work in this version, 3.6 I have updated my mouse and checked the TOOLS "Use auto-scroll"... still it does not work.
    I need my equipment to work. PLEASE FIX

    I hate to sound like a broken record, DONE THAT ALREADY. _ _ _
    I've ALSO learned to reboot after an uninstall then manually delete any residue in said uninstalled program. I've also gone as far as REGISTER searching for program residue and deleting that WITH reboot of coarse to be sure nothing has gone wrong. _ _ _ NEXT suggestion? I suggest FireFox fix there software. _ _ _ BY-THE-WAY,... I have also gone through my mouses buttton choices for my #5 button. Everything works but the "Auto-Scroll". One tab down/up/right/left works, one page down/up/left/right works. _ _ _ I used recently tried and successfully used the Auto-Scroll in Netscape, Opera, My Browser, Ace Browser, Chrome, and 2 others that escape my memory. _ _ _ PLEASE READ and understand this. >>> It's FireFox's software that is stopping this, not my mouse or PC.

  • JTable in JScrollPane auto resize refresh problem

    Hello,
    I have a JTable in a JScrollPane. Number of rows is changing.
    I'm using the following to auto-resize JScrollPane.
    public Dimension getPreferredSize() {
                  Dimension size = super.getPreferredSize();
                  size.height -= getViewport().getPreferredSize().height;
                  Component view = getViewport().getView();
                  if(view != null)
                  size.height += view.getPreferredSize().height;
                  return size;
             }There is a JButton, which adds an empty row to the JTable. It all works fine, except the auto-resize when a new row is added. I want all rows of JTable to be visible, with no scrollbars present. I tried repaint(), revalidate(), addNotify(). What should I do?
    Thanks.

    Sure
    DefaultTableModel dtm = new DefaultTableModel(vec, header);
              jt0 = new JTable(dtm);
              jt0.getTableHeader().setReorderingAllowed(false);
              jt0.setFont(new Font("Tahoma", Font.PLAIN, 12));
              jt0.getTableHeader().setFont(new java.awt.Font("Tahoma", java.awt.Font.BOLD, 12));
              jt0.setRowHeight(18);
            jt0.setPreferredScrollableViewportSize(new Dimension(500, jt0.getRowCount() * jt0.getRowHeight()));
            jt0.setFillsViewportHeight(false);
              jsp0 = new JScrollPane(jt0);
    GridBagConstraints gbc = new GridBagConstraints(); 
            gbc.insets = new Insets(2,1,2,1); 
            gbc.weightx = 1.0; 
            gbc.weighty = 1.0; 
            JPanel p0 = new JPanel(new GridBagLayout()); 
            gbc.fill = gbc.HORIZONTAL;
            p0.add(jsp0, gbc);
              JButton jb1 = new JButton("add row");
              jb1.setSize(40, 18);
    jb1.addActionListener(new java.awt.event.ActionListener() {
                   public void actionPerformed(java.awt.event.ActionEvent e) {
                        dtm.addRow(new Object[]{....});
    //                    jt0.scrollRectToVisible(jt0.getCellRect(jt0.getModel().getRowCount()-1, 1, false));
    //                    jt0.setRowSelectionInterval(jt0.getModel().getRowCount()-1, jt0.getModel().getRowCount()-1);
        public class SizeX extends JScrollPane {
             public Dimension getPreferredSize() {
                  Dimension size = super.getPreferredSize();
                  size.height -= getViewport().getPreferredSize().height;
                  Component view = getViewport().getView();
                  if(view != null)
                  size.height += view.getPreferredSize().height;
                  return size;
        }

  • Auto resize webpage?

    i have just finished my site which can be seen here www.jbpermanentcosmetics.co.uk The site looks fine on my Macbook pro on Mac and windows but it is way too large for 4:3 monitors. The site width is 1200 which in hindsight is too large really but i don't want to have to resize the whole website. Is there any HTML code which i can add which will auto resize the page to avoid horizontal scrolling?

    rossn49 wrote:
    I found the following code which looks like it might do what i want:
    <SCRIPT language="JavaScript">
    <!--
    if ((screen.width>=1024) && (screen.height>=768))
    window.location="highres.html";
    else
    window.location="lowres.html";
    //-->
    </SCRIPT>
    rossn49, you can not use that javascript. It switches between two pages/sites (I bolded the code), which means you have to add another site with narrow width.... you indicated that you wouldn't like to do that.
    However, you can find the sweet spot for your site design; many people started to design their sites for regular computer and also accommodate mobile devices such as iPhone.
    You may like to do just that, iPhone's resolution is 960px wide, so I would conservatively take it down to 900px~920px wide.
    OT, thanks for the good words... I'd not read the forum today. I'd been spending time today to figure out and mount my GPS on my new motorscooter, maybe I will buy motorscootersaurus.com for my new site. LOL!

  • S230u reinstallation and auto-rotate lock button

    Some time ago (after switching to SSD) I reinstalled Windows 8 and upgraded to 8.1. I have made a fresh installation as I could not get the image copying from HDD to SSD to work properly.
    The OS has been working great so far, but the one thing I am really missing is the auto-rotate lock button next to the power button. It does not work at all and never has.
    I do have the System Update 5 software for installing packages from Lenovo and have installed all of the drivers it recommended except for Password Manager and IRST which I do not need.
    I have also manually installed the 'Hotkey Features Integration for Windows 8.1 (32-bit, 64-bit) - ThinkPad' package which I expected to be the thing I was missing.
    Is there any additional software that I should install or something that I should enable to get the functionality?
    I know Windows+O does the same thing, but when you are in tablet mode that key is not that handy.

    Hi Wojciechka,
    Welcome to Lenovo Community!
    As per the query, we understood that you are facing issue with auto rotate lock button on your ThinkPad S230u.
    We have a solution for this issue, please visit the below link and follow the steps provided in that.
    https://forums.lenovo.com/t5/S-Series-ThinkPads-ThinkPad-Yoga/ThinkPad-Twist-s230u-Auto-rotate-is-no...
    Hope this helps.
    Best regards,
    Hemanth Kumar
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"! This will help the rest of the Community with similar issues identify the verified solution and benefit from it.
    Follow @LenovoForums on Twitter!

  • How can I disable the auto resizing in NetBeans?

    Hello,
    how can I disable the auto resizing in NetBeans?
    I cannot resize nor displace components due to this automation.

    first what do u mean by auto resizing ? if u mean the layout that automatically aligns itself then ..... if that's yr question then u need to set the layout to null
    if using netbeans then right click on the the mainPanel and setlayout to null if eclipse the frame.getContent.setlayout(null);
    NetBean doesn't have a forum it has mailing list u can subscribe there
    http://www.netbeans.org/servlets/TLogin
    Edited by: raven_roy on Mar 12, 2008 2:58 AM

  • Auto-resizing all components

    Is there a method that auto resizes all components on a JFrame when it is maximised for example. I have got a JTable (in a scrollpane) and some other components on a panel. I have sized the frame to be approx 80% of the screen size. When the frame is maximised, the table and the other components retain their original size (understandably so!). Is there a method available that can resize the panel and its components to resize accordingly when the frame is maximised?...I know I can add the componentListener and implement a method in the componentResized() method...but I dont want to duplicate stuff that's already available. Thanx for your help.

    I don't know the specific needs.
    BorderLayout: simple Layout; Components are oriented NORTH, EAST, SOUTH, WEST
    FlowLayout: all components are added after the other
    GridLayout: components are oriented in a grid
    GridBagLayout: complex once
    See the Java Tutorial for more information.

  • Auto Resize Text in a Text Box

    How do you make the text inside of a text box auto resize to fit the box I'm typing in?
    I have a text box with a list in it. I change this list everyday and like the text to fit the box. The size of the text doesn't matter. If I have a long list, I don't mind that the font is small. If I have a short list that day, I don't mind that the font size is then big. Hopefully I am making sense. I used to use text boxes like this in MS Publisher and am assuming I just need to find a setting change in Pages.
    I do this often enough that it would save time not having to keep guessing the correct font size until it fits properly.
    Thanks!
    Message was edited by: mnbinth

    mnbinth wrote:
    I used to use text boxes like this in MS Publisher and am assuming I just need to find a setting change in Pages.
    Assuming that application B will behave the same than application A is always a bad idea.
    There is no reason for such a guess.
    Happily, all engineers aren't thinking the same way and remember Apple's statement :
    *_Think different !_*
    Yvan KOENIG (VALLAURIS, France) samedi 25 septembre 2010 10:55:56

  • How to avoid auto resizing the JPanel

    I have JFrame as main window. This JFrame consist of statusbar at the bottom of the JFrame. The statusbar has implemented as a panel that uses BorderLayout. This statusbar has two JPanels as children.
    1) the first child panel(label panel) has 3 labels on it.
    2) the second child panel(image panel) has only one label with a image and this second panel is added to statusbar to the next of the first child.
    3) all panels use BorderLayout.
    If I resize the JFrame by dragging its right border (right to left) both the panels on the statusbar are auto resizing. But I don't want to resize the image panel on the statusbar. I mean even if I resize the frame the size of the image panel should not change. It has to always visible completly.
    Any help is heighly appreciated.
    Regards
    Venkat

    There could be several different ways to achieve this, but it all boils down to using appropriate layouts and/or preferredSizes.
    The Java&#8482; Tutorials: [Laying Out Components Within a Container|http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html]
    db

  • Something is wrong with Firefox's image auto resize

    In forums, when I post an image, it's seems to be doing an incorrect image auto resize, for the image is still large to be fit in the websites' pages, and when I CTRL+Scroll, the browser makes a proper resize though making the letters and numbers smaller.

    Resizing images automatically only works if you open an image in a tab and there is only that image to be shown. In all other cases it is the website that determines how large an image is displayed.<br />
    If you post an image on a forum and the forum doesn't resize the image automatically then use an upload host that automatically generates a thumbnail that you can show and that opens the full sized image if you click the thumbnail.

  • Auto-resizing TextArea in Flex 4

    Does anyone know how I can auto-resize the height of a Spark TextArea please? I tried following the examples in http://forums.adobe.com/thread/748191 but couldn't get it to work in either Flex 4.1 or Flex Hero.
    Here's what I'm doing:
    <?xml version="1.0" encoding="utf-8"?>
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                           xmlns:s="library://ns.adobe.com/flex/spark"
                           xmlns:mx="library://ns.adobe.com/flex/mx">
        <s:TextArea width="100%" heightInLines="{NaN}" minHeight="50"/>
    </s:WindowedApplication>
    When I press enter I need the TextArea's height to auto-resize, rather than scrolling up/down. Any help appreciated.

    @jeffry
    it surprises me too - but try this: http://polygeek.com/2249_flex_display-html-text-in-the-spark-textarea

  • 'Auto resize image' 'Settings' dialog box controls

    I have a signature that contains an avatar image (size 120px by 120px)
    Every time I 'Send' an 'Auto Resize Image' > 'Settings' dialogue box pops up
    How can I bypass this as its becoming annoying.
    Most emails (98%) do not contain any other embedded or attached images.
    This only started to happen after upgrading to latest version of Thunderbird, was never an issue before.

    Doesn't sound like a standard Thunderbird pop up as I've not come across it.
    Do you by any chance have an addon /extension such as Auto Resize Image?
    * https://addons.mozilla.org/en-US/thunderbird/addon/auto-resize-image/
    if yes, disable it and retest to see if message stops.
    Check you are using an up to date version.
    check to see if there is some settings you can use to 'not ask again' or similar. Can't say exactly as I do not use it.
    I use the standard TB settings to adjust for sizing when I originally insert an image.

  • How do I turn off "image auto-resizing"?

    After upgrading to version 3.6.3, the browser is now auto-scaling my images. I turned off "auto-resizing" on the About:Config page (in other words, setting that parameter to "false") but Firefox is still auto-scaling my images. How can I prevent this?
    == This happened ==
    Every time Firefox opened
    == I upgraded to version 3.6.3

    If you have set the pref '''browser.enable_automatic_image_resizing''' to ''false'' on the '''about:config''' page then Firefox shouldn't resize images.
    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]
    Reset the page zoom on pages that cause problems: '''View > Zoom > Reset''' (Ctrl+0 (zero); Cmd+0 on Mac)
    See [[Text Zoom]] and [[Page Zoom]] and http://kb.mozillazine.org/Zoom_text_of_web_pages
    .

  • Auto resize width height in TextFlow controller

    HI,
    We are facing the problem in auto resize width height in TextFlow controller. Content is overlaping withing the controller or sometimes it's seems like not full containt displaying on the control.
    We are writing the below code in the flashx.textLayout.events.CompositionCompleteEvent listiner to orgnize the above step:
         var controller:ContainerController = new ContainerController();
         textFlow.flowComposer.composeToPosition();
         var contentBounds:Rectangle = _controller.getContentBounds();
       _controller.setCompositionSize(_controller.compositionWidth, contentBounds.height);
       textFlow.flowComposer.addController(_controller);
       textFlow.flowComposer.updateAllControllers();
    Please correct if are missing any steps above.
    Regards,
    R.BS

    Hi,
    I have got the solution on my last query. Below is the code to get rid of the content display and auto adjust the width & height of the controller:
    var textHeight:int = Math.ceil(_controller.getContentBounds().height);
       if (textHeight > _controller.compositionHeight) {
         TextDataHeight = textHeight + 12;
                   _controller.setCompositionSize(TextDataWidth ,TextDataHeight);
                   textFlow.flowComposer.updateAllControllers();
    I have also set the TextDataHeight = 50 to display complete paragraph text.
    Due to this I have one problem arise that is indentation of the paragraph content or bulleted text on my content.
    Is any one have the solution on this?
    Looking forward for your response.
    Regards,
    R.BS

Maybe you are looking for

  • I have an old file that was made by macromedia flash,but I can't run this file in my Windows 7 64-bit ,while I can run it in Windows XP 32-bit

    I have an old file that was made by macromedia flash,but I can't run this file in my Windows 7 64-bit ,while I can run it in Windows XP 32-bit

  • Cash Discount taken after overdue

    Hi, I am a supplier to an SAP customer. Our Terms are  2% net 31, from receipt of the product. They 'always' take the 2% discount, though often they write the check in 32-35 days (the weekends are not the reason for the delay, as they receive usually

  • Hide Task Bar , Hide all windows notification , Set screensaver

    Hello,  Can any one please help me in doing any one or all the customization in Windows 7x86 Embedded satndard. How to hide Task bar permanently  ?  How to set specific logo as screensaver ? How to hide all windows notification ? I have to do all the

  • Enter G/L document error-urgent

    Dear expert, When user enter document in FB50 for G/L account xxx, there was a message :"an entry in field order is not permitted for account xxxx.". In which tcode I could check for what kind of orders permitted to that account? And how to correct t

  • Repeated Crashing

    Hello, In the middle of wraping up a comission piece and illustrator has crashed 5 times. It opens fine, I go to make any edit and it immediatly shuts down. I have the following if it is helpful: Thank you very much for your time, I am hairpullingly