Possible to have UILabel auto-resize frame?

I'd like to display a block of text, but it's not known at compile time. I know I can set the numberOfLines to 0 for the UILabel and it will automatically use as many lines as it needs, but what about the frame? I want to display content immediately beneath it and I don't know how tall of a rect to provide when I create the UILabel initWithFrame.
Is there something like UILabel.resizeFrameHeightBasedOnTextWrapping?
I've checked the docs and can't find anything like this.
Thanks

Solved this myself. sizeWithFont() message series should do the trick.

Similar Messages

  • Is it possible to have CFTREE auto expand? (with binding)

    Hi there,
    ColdFusion newbie here so please bear with me.
    I'm doing some tutorials on CFTREE right now, so far it works
    well as is, but I have a question:
    Is it possible to have the whole tree expanded automatically
    when the user first open the page? I know there is the "expand"
    attribute for the "cftreeitem" element, but it is not allowed when
    using dynamic data bindings.
    I know I could probably do the manual looping of queries to
    achieve this, but it would be nicer if we could use the binding
    mechnism and still have ColdFusion automatically go through
    different levels.
    The data I intend to use the CFTREE on is of quite managable
    amount, so I don't think performance would be a big problem here.
    Any tips or hints will be appreciated, and many thanks in
    advance!
    Billy

    I've never used it but it seems that there is an attribute
    called expand in the cftree items- I imagine the tag is something
    like
    <cftree>
    <cftreeitem value = "Travel Assistant" display = "Travel
    Assistant" parent = "Emp_ID" queryAsRoot = "No" expand = "yes">
    </cftree>
    good luck

  • Possible to have user auto-download font?

    This is a noob question I know, but I am pretty new to
    Dreamweaver-based web design so hopefully it's excusable. Anyway,
    what I want to know is if it's possible for a font to be
    automatically installed on a user's system upon opening of my
    webpage, and how to do so. Or, if I have control over what font is
    used as a backup in case that's not possible. I imagine, if all
    else fails, I could provide a link to download the font (it's
    freeware).

    No. NO. no. It's not possible (at least it's not practical).
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "marleyforprez" <[email protected]> wrote in
    message
    news:f1foss$d23$[email protected]..
    > This is a noob question I know, but I am pretty new to
    Dreamweaver-based
    > web
    > design so hopefully it's excusable. Anyway, what I want
    to know is if it's
    > possible for a font to be automatically installed on a
    user's system upon
    > opening of my webpage, and how to do so. Or, if I have
    control over what
    > font
    > is used as a backup in case that's not possible. I
    imagine, if all else
    > fails,
    > I could provide a link to download the font (it's
    freeware).
    >

  • Is it possible to have a text field have both auto font resizing and rich text format?

    I am trying to make a field so I can bold or italicize within, but still have the capability to add as much text as I want with the font size getting small so that it all fits in the field.  It seems I can have the auto resize OR the Rich Text, but not both.   Is there a way around this?
    Thank you.

    You can't? Just to give you some context, I work as a graphic designer, I'm creating for the first time an iBook for a client and I have quite a few examples already.
    A couple of vague examples:
    - Imagine a diagonal animation from the bottom left corner to the top right corner of the page. I could do this with keynote or html, for example. Now imagine you want some text floating at the top left and bottom right corner.
    I wont get into details, but the fact the animation is "cutting" through the text is very much relevant to the context.
    - A page with a bold white title, a strong photographic lowkey background and some kind of interaction of top of it.
    - A page with a keynote widget occupying almost the entire area, and a title in text format (that would superpose with they keynote but not with its graphics)
    - etc etc
    These are all impossible scenarios.
    The actual interaction with text/images and interactive elements is nonexistent.
    But I understand now that the interactive bits of the book must be separated from the other content - its context -which is a shame. And I understand it's not a bug, from what you say. The iBA interface shows the book like a PFD export, in a way, as well as the thumbnails at the Table of Contents, were all the text is visible. The actual pages have a different behaviour.
    Thank you very much for the fast feedback. I will use the 'Provide iBooks Author Feedback' menu, as suggested.

  • InDesign auto-size frame feature not working in real time in InCopy why?

    We have just recently migrated from InCopy CS4 to CS6 to take advantage of the new features like the auto resize frame option, however it now seems that this feature is not working in real-time.
    Basically the steps are needed to be complete before it auto-resizes the frame in InCopy, we use both layout and assignment based workflows:
    1. From an ID document ('doc1'), exported a 'layer' to IC, certain frames are set to auto-size in height using the text frame options. So that editorial can review and make changes to text and the frame should resize according to the specifications set. IC stories are saved to a folder located in a content folder inside the top issue working folder.
    2. Editorial opens the IC software, then opens the ID 'doc1'. Check’s out correct .icml file and makes edits to frame with auto resize.
    3. Frame does not resize according to text frame set options and InCopy file does not respond in same fashion as InDesign.
    4. Change only occurs when InCopy file is closed and updated in InDesign, which is frustrating as this feature would save huge amounts of time serving editorial requests.
    Has anybody experienced this type of workflow problem? If anyone can provide mw with some pointers as to what can I do to get this to update in real time perhaps run a script? Update file in InCopy and refresh I will very much appreciate their assistance. I have run out of ideas.
    Thanks!

    We've had all sorts of problems with this feature as it should've worked straight out of the box but after some testing we have found that its something to do with the way you open the actual file in InCopy. Which is far from ideal and should have been UAT by Adobe before release.
    This will not work consistently work if you open the designed .indd or .icma file in InCopy using the file open command within the application.
    If you need this to work, the InCopy user has to open the .indd or .icma file by dragging and droping from OS windows explorer into InCopy, we use Windows 7 acrros all the teams. Check out .icml files add text changes to the set auto resized frames, this process will expand/collapse the frames to fit the content but as you have to use the drag and drop method to open the .indd and .icma file, 2 users cannot access the same time doc at the same time (a serious flaw in the programming architecture!) which stops people working in parallel. Save changes, check in .icml content and close .indd or .icma.
    However the flaw comes in if you then open the .indd and .icma file in InCopy using the file open command within the application, before an InDesign user opens and saves the file (updates the design). The corrections added in the previous stage above, will not show the frames expanded/collapsed to take in the added text and instead show over matter???? The only way around this is to ask an InDesign user to open, update and save the design that way the InCopy user will see the same result no matter what file open method they use.
    Another suggestion is to design the page to have some of the auto resize frames anchored within main body of text and that way the frames will expland/collapse when checking out and editing the content. However, this does cause issues with InDesign crashing etc. so we have tried to stop this method within the working group.
    Have you experienced other more serious issues with InDesign crashing consistently when re-importing .icml files? See other forums here:
    http://forums.adobe.com/thread/671820?start=80&tstart=0
    http://forums.adobe.com/message/5045608#5045608
    As far as we can see this is a major flaw in how the application(s) work, we have an enterprise agreement with Adobe and purchase a large volume of Adobe products globally but so far the technical support team are unable to find a solution to this and I'm not hopeful of any resolution soon even with the new release of Adobe CC.

  • Can you auto resize when tethered shooting?

    Is it possible to have lightoom automatically resize an image when you are tethered capturing?

    I assume you mean crop.
    I don't think it's possible, natively. Why not? because presets don't support saving/applying crop coordinates.
    Moreover, I don't think there are any plugin-assisted solutions either, probably because plugins can't crop photos either, at least not without a lot of "contortion".
    If somebody were ambitious, they could merge the guts of XmpCrop, with OttomanicImporter, to do such contortion, but that somebody would probably be me, and I have no plans to do such a thing at this time.
    Cheers,
    Rob

  • JTabbedPane, switch of auto resizing of the tab header possible?

    Hi,
    Is it possible to prevent the tab header from auto resizing?
    In this code the tab "Page 1" fills the whole row at start up, but I would like to prevent it from taking more space than needed.
    import java.awt.*;
    import javax.swing.*;
    class TabbedPaneExample
            extends     JFrame
        private        JTabbedPane tabbedPane;
        private        JPanel        panel1;
        private        JPanel        panel2;
        private        JPanel        panel3;
        public TabbedPaneExample()
            // NOTE: to reduce the amount of code in this example, it uses
            // panels with a NULL layout.  This is NOT suitable for
            // production code since it may not display correctly for
            // a look-and-feel.
            setTitle( "Tabbed Pane Application" );
            setSize( 140, 200 );
            setBackground( Color.gray );
            JPanel topPanel = new JPanel();
            topPanel.setLayout( new BorderLayout() );
            getContentPane().add( topPanel );
            // Create the tab pages
            createPage1();
            createPage2();
            createPage3();
            // Create a tabbed pane
            tabbedPane = new JTabbedPane();
            tabbedPane.addTab( "Page 1", panel1 );
            tabbedPane.addTab( "Page 2", panel2 );
            tabbedPane.addTab( "Page 3", panel3 );
            topPanel.add( tabbedPane, BorderLayout.CENTER );
        public void createPage1()
            panel1 = new JPanel();
            panel1.setLayout( null );
        public void createPage2()
            panel2 = new JPanel();
            panel2.setLayout( new BorderLayout() );
        public void createPage3()
            panel3 = new JPanel();
            panel3.setLayout( new GridLayout( 3, 2 ) );
        // Main method to get things started
        public static void main( String[] args )
            // Create an instance of the test application
            TabbedPaneExample mainFrame    = new TabbedPaneExample();
            mainFrame.setVisible( true );
    }Edited by: user6102378 on 2010-okt-07 06:51

    Unfortunately, the answer seems to be "no" - looks like the exact behaviour is even different across different LAFs. Nothing short of re-writing the layout code in the xxTabbedPaneUI will help.
    Just curious: how comes that we have so many tabbedPane related questions recently?
    Cheers
    Jeanette

  • Option to auto-resize text frame vertically?

    Hi,
    Sometimes I don't know exactly how tall a text frame is going to be or I just want to get some text on the page quickly without drawing it out exactly.  I was wondering if there was an option to auto-resize the text frame vertically as you type.  Has anyone heard of such an option?  Thanks!

    Vee S wrote:
    I found a plugin called Typefi Autofit that does exactly I'm looking for, but unfortuntely they don't have a CS5 version available.  I did try it on CS4 and it seems to work nicely.
    http://www.typefi.com/index.php/typefi-autofit
    If anyone has a CS5 solution, please share!
    This commercial InDesign plug-in can do it:
    In-Tools » Adobe InDesign Plugins » AutoFlow Pro
    You can download a trial version.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices

  • 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.

  • 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

  • Auto-resizing pop-up window

    What I'm doing is making a calendar and when you click on a
    day a small pop-up window of that day's activities pops up. Well
    not all the days have the same amount of activities, so is it
    possible to have pop-up windows that auto-resize according to how
    much text is in the pop-up window?

    i dont know of any extensions that provide this....
    however you could do something based on # characters. create
    some calculation for the height of the window based on #
    characters.

  • How to disable auto resizing for jComboBox

    Hi,
    I do not know how to prevent jComboBox to be auto resized according to its content. I put a jComboBox on JPanel with IDE.
    After that I use for loop to fill a jComboBox. JComboBox width depends on the content and jComboBox is autoresized. I tried to use set*Size before and after for loop but it did not work as I wish:
            jComboBoxT.setMaximumSize(new java.awt.Dimension(10, 20));
            jComboBoxT.setMinimumSize(new java.awt.Dimension(10, 20));
            jComboBoxT.setPreferredSize(new java.awt.Dimension(10, 20));
            jComboBoxT.setSize(new java.awt.Dimension(10, 20));Could you help me please? The problem is that I have three jComboBox in one row and after autoresizing one disappears...
    Best regards,
    Primoz

    Hi,
    I have created SSCCE. I do not like that jComboBox spread over the whole display. I would like that the jComboBox width is only about 2 inches (5cm). If you run example below you will see that jComboBox width auto resize.
    Regards,
    Primoz
    import java.awt.*;
    import javax.swing.*;
    public class PrimozComboBox extends JPanel {
        JLabel picture;
        public PrimozComboBox() {
            String[] petStrings = { "Bird", "Cat", "Dog", "Rabbit", "Pig" };
            String[] cityStrings = { "New York", "Ljubljana", "Chicago" };
            JComboBox petList = new JComboBox(petStrings);
            petList.addItem("This is very long pet name, which could spread over many lines");
            add(petList);
            JComboBox cityList = new JComboBox(cityStrings);     
            cityList.addItem("This is very long city name, which could spread over many lines");
            add(cityList);
        private static void createAndShowGUI() {
            //Create and set up the window.
            JFrame frame = new JFrame("ComboBoxDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Create and set up the content pane.
            JComponent newContentPane = new PrimozComboBox();
            newContentPane.setOpaque(true); //content panes must be opaque
            frame.setContentPane(newContentPane);
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    }

  • Is it possible to have an Opaque Border

    Is it possible to have a transparent border? I'm asking because I'm putting a component into one of Hans Mullers wizzzy MultiSplitPanes which in turn is opaque because It's used inside a TabbedPane (XP colours these with a white background gradient .i.e. not dialog grey).
    The tree with scrollpane weren't quite centered so a slapped an empty border on it with insets to make it look square, but the border - even empty ones appear opaque when used inside a transparent component?! Anyone seen this before?
    nb.I'd guess it would be possible to nest the scrollpane inside yet another transparent panel with a gridbag insets of (2,2,3,2).. but that seems even more of a pain just to shuffle up one pixel.
    This should illustrate the problem, you shouldnt see any grey around the tree:
    import javax.swing.*;
    import javax.swing.border.EmptyBorder;
    import java.awt.*;
    public class BorderShouldNotBeSeen {
        public static void main(String[] args) {
            JFrame frame = new JFrame();
            JPanel panel = new JPanel();
            frame.getContentPane().add(panel);
            // make it really obvious, should see red right up to the darker scrollpane/tree border
            frame.getContentPane().setBackground(Color.RED);
            panel.setOpaque(false);
            // just BorderFactory.createEmptyBorder() didnt cut it.. so then I used..
            class MyBorder extends EmptyBorder {
                public MyBorder(Insets insets) {
                    super(insets);
                public boolean isBorderOpaque() {
                    // ..guess what it still looks opaque!
                    return false;
            JScrollPane treePane = new JScrollPane(new JTree());
            treePane.setBorder(BorderFactory.createCompoundBorder(
                    new MyBorder(new Insets(10, 10, 11, 10)), treePane.getBorder()));
            panel.add(treePane);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setVisible(true);
    }- Richard

    Wow, yes that fixes it - obvious when you think about it, the borders were just increasing the insets on the component. Just didn't see it.. Thanks.

  • 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;
        }

Maybe you are looking for

  • Iphone 4 is neither recognized by PC not connected to the elec. pluge

    Iphone 4 is not charging, I've tried 3 different cables and 2 adapters. the OS on my computer is win 7 and also I can not connect the Iphone through cable to my portable computer. Sure, Itunes can not be connected as long as the win7 could not recogn

  • AMSN aGent Camera Error 9405

    Hi I have bought an agent webcam and believe I have downloaded the right software, When I click send webcam it does not work, i don't know why. I am on a power pc g4. On my macbook I can use ichat and aol people can view my webcam, however on the pow

  • PL/SQL Introspection - USER_IDENTIFIERS in Oracle 10g

    USER_IDENTIFIERS is a new view as of 11g that will show profile info about stored PL/SQL. For more info, see Tom Kyte's article here: http://www.oracle.com/technology/oramag/oracle/07-nov/o67asktom.html I need to replicate part of that functionality

  • Cd drive not working or responding

    just today I noticed my cd drive isn't working at all. When I put a cd or whatever in nothing happens. also I spilld some V8 fruit juice on the keyboard and the cd drive still worked after that. but now it doesnt work. Anything that I can do?

  • What is that mysterious "X" in the upper right corner of the Viewer?

    I am new to Final Cut Express, and have a couple of questions that I have not yet seen addressed anywhere. First, I am encountering an "X" within a white circle (more or less) in the upper right corner of the Viewer at various points during playback.