Varying size of JScrollPane

Hi.
I hope you can help me figure out what's going on. I have a component that I've written that should display buttons vertically (it's a basis for an OutlookBar styled component).
The component is based on a JPanel that is put in a JScrollPane and the buttons are added to the JPanel. The JPanel has a VerticalFlowLayout (a custom layout class).
Now for the problem: Every time I adjust the size of the component so that a scroll bar should appear, the getPreferredSize() method of the JScrollPane returns a width that is lesser than it returns when the scroll bar is not visible! The weird thing is that the difference in the width is exactly the width of the scroll bar... but it doesn't make much sense since the width that is returned when the scroll bar is visible is less than the width that is returned when the scroll bar is not visible (it would make sense to have it the other way around!).
Since my component needs to keep a consistent width this behavior is extremely annoying! Below you can find the code for the panel (and the needed layout) if you'd like to try this out, any help will be greatly appreciated:
import javax.swing.*;
import javax.swing.plaf.ComponentUI;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
* A panel that contains a set of operations that are displayed under a common
* category name on a <code>OutlookBar</code>.
* @version Revision:$ Date:$
public class OutlookBarCategoryPanel extends JPanel
    protected JPanel m_contentPanel = new JPanel( new VerticalFlowLayout( 5 ) );
    private JScrollPane m_contentScrollPane = new JScrollPane( m_contentPanel,
                                                    JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                    JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
     * Constructs a new <tt>OutlookBarCategoryPanel</tt> that is initially empty.
    public OutlookBarCategoryPanel()
        super( new BorderLayout() );
        m_contentPanel.setBackground( SystemColor.control );
        super.add( m_contentScrollPane, BorderLayout.CENTER );
     * If the <code>preferredSize</code> has been set to a
     * non-<code>null</code> value just returns it.
     * If the UI delegate's <code>getPreferredSize</code>
     * method returns a non <code>null</code> value then return that;
     * otherwise defer to the component's layout manager.
     * @return the value of the <code>preferredSize</code> property
     * @see #setPreferredSize
     * @see ComponentUI
    public Dimension getPreferredSize()
        Dimension size = super.getPreferredSize();
        if( size.width < m_contentScrollPane.getPreferredSize().width )
            size.width = m_contentScrollPane.getPreferredSize().width;
        return size;
     * Appends the specified component to the end of this container.
     * This is a convenience method for {@link #addImpl}.
     * <p>
     * Note: If a component has been added to a container that
     * has been displayed, <code>validate</code> must be
     * called on that container to display the new component.
     * If multiple components are being added, you can improve
     * efficiency by calling <code>validate</code> only once,
     * after all the components have been added.
     * @param     comp   the component to be added
     * @see #addImpl
     * @see #validate
     * @see #revalidate
     * @return    the component argument
    public Component add( Component comp )
        return m_contentPanel.add( comp );
     * Adds the specified component to the end of this container.
     * Also notifies the layout manager to add the component to
     * this container's layout using the specified constraints object.
     * This is a convenience method for {@link #addImpl}.
     * <p>
     * Note: If a component has been added to a container that
     * has been displayed, <code>validate</code> must be
     * called on that container to display the new component.
     * If multiple components are being added, you can improve
     * efficiency by calling <code>validate</code> only once,
     * after all the components have been added.
     * @param     comp the component to be added
     * @param     constraints an object expressing
     *                  layout contraints for this component
     * @see #addImpl
     * @see #validate
     * @see #revalidate
     * @see       LayoutManager
     * @since     JDK1.1
    public void add( Component comp, Object constraints )
        m_contentPanel.add( comp );
     * Adds the specified component to this container with the specified
     * constraints at the specified index.  Also notifies the layout
     * manager to add the component to the this container's layout using
     * the specified constraints object.
     * This is a convenience method for {@link #addImpl}.
     * <p>
     * Note: If a component has been added to a container that
     * has been displayed, <code>validate</code> must be
     * called on that container to display the new component.
     * If multiple components are being added, you can improve
     * efficiency by calling <code>validate</code> only once,
     * after all the components have been added.
     * @param comp the component to be added
     * @param constraints an object expressing layout contraints for this
     * @param index the position in the container's list at which to insert
     * the component; <code>-1</code> means insert at the end
     * component
     * @see #addImpl
     * @see #validate
     * @see #revalidate
     * @see #remove
     * @see LayoutManager
    public void add( Component comp, Object constraints, int index )
        m_contentPanel.add( comp, index );
     * Adds the specified component to this container at the given
     * position.
     * This is a convenience method for {@link #addImpl}.
     * <p>
     * Note: If a component has been added to a container that
     * has been displayed, <code>validate</code> must be
     * called on that container to display the new component.
     * If multiple components are being added, you can improve
     * efficiency by calling <code>validate</code> only once,
     * after all the components have been added.
     * @param     comp   the component to be added
     * @param     index    the position at which to insert the component,
     *                   or <code>-1</code> to append the component to the end
     * @return    the component <code>comp</code>
     * @see #addImpl
     * @see #remove
     * @see #validate
     * @see #revalidate
    public Component add( Component comp, int index )
        return m_contentPanel.add( comp, index );
     * Adds the specified component to this container.
     * This is a convenience method for {@link #addImpl}.
     * <p>
     * This method is obsolete as of 1.1.  Please use the
     * method <code>add(Component, Object)</code> instead.
     * @see add(Component, Object)
    public Component add( String name, Component comp )
        return m_contentPanel.add( name, comp );
     * Removes the specified button from the panel.  The reference that is sent as
     * a parameter needs to point to the same instance as the button that should actually
     * be removed (in other words, this method will not perform an equal() comparison).
     * @param button    a reference to the button that should be removed.
    public void remove( OutlookBarOperationButton button )
        m_contentPanel.remove( button );
     * Removes all operations that have the specified caption.
     * @param caption   the caption of the operation(s) that should be removed.
    public void removeOperation( String caption )
        Component[] components = m_contentPanel.getComponents();
        for( int i=0; i<components.length; i++ )
            Component component = components;
if( component != null && component instanceof AbstractButton )
if( ((AbstractButton)component).getText().equals( caption ) )
m_contentPanel.remove( i );
public static void main( String[] args )
JFrame frame = new JFrame( "OutlookBarCategorButton" );
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.getContentPane().setLayout( new BorderLayout() );
OutlookBarCategoryPanel obcp = new OutlookBarCategoryPanel();
obcp.add( new OutlookBarOperationButton( "foo", new ImageIcon( "images/History24.gif" ) ) );
obcp.add( new OutlookBarOperationButton( "bar", new ImageIcon( "images/Help24.gif" ) ) );
obcp.add( new OutlookBarOperationButton( "foobar", new ImageIcon( "images/Cut24.gif" ) ) );
obcp.add( new OutlookBarOperationButton( "index 2", new ImageIcon( "images/isl_faninn.png" ) ), 2 );
frame.getContentPane().add( obcp, BorderLayout.WEST );
frame.pack();
frame.show();
And here is the code for the VerticalFlowLayout class:
import java.awt.*;
* A layout manager that works like the default layout manager in swing
* (FlowLayout) except that it arranges its components vertically instead
* of horizontally.
* @version $Revision: 1.1 $ $Date: 2003/03/11 13:37:38 $
public class VerticalFlowLayout implements LayoutManager
    private int m_vgap;
     * Creates a new instance of the class with an initial vertical gap of 0
     * pixels.
    public VerticalFlowLayout()
        this( 0 );
     * Creates a new instance of the class with an initial vertical gap of
     * the specified number of pixels.
     * @param vgap  the number of pixels to use as a gap between
     *              components
    public VerticalFlowLayout( int vgap )
        m_vgap = vgap;
     * Lays out the container in the specified panel.
     * @param theParent the component which needs to be laid out
    public void layoutContainer( Container theParent )
        Insets insets = theParent.getInsets();
        int w = theParent.getSize().width - insets.left - insets.right;
        int numComponents = theParent.getComponentCount();
        if( numComponents == 0 )
            return;
        int y = insets.top;
        int x = insets.left;
        for( int i = 0; i < numComponents; ++i )
            Component c = theParent.getComponent(i);
            if( c.isVisible() )
                Dimension d = c.getPreferredSize();
                c.setBounds( x, y, w, d.height );
                y += d.height + m_vgap;
     * Calculates the minimum size dimensions for the specified
     * panel given the components in the specified parent container.
     * @param theParent the component to be laid out
     * @see #preferredLayoutSize
    public Dimension minimumLayoutSize( Container theParent )
        Insets insets = theParent.getInsets();
        int maxWidth = 0;
        int totalHeight = 0;
        int numComponents = theParent.getComponentCount();
        for( int i = 0; i < numComponents; ++i )
            Component c = theParent.getComponent( i );
            if( c.isVisible() )
                Dimension cd = c.getMinimumSize();
                maxWidth = Math.max( maxWidth, cd.width );
                totalHeight += cd.height;
        Dimension td = new Dimension( maxWidth + insets.left + insets.right,
                totalHeight + insets.top + insets.bottom + m_vgap * numComponents );
        return td;
     * If the layout manager uses a per-component string,
     * adds the component <code>comp</code> to the layout,
     * associating it
     * with the string specified by <code>name</code>.
     * @param name the string to be associated with the component
     * @param comp the component to be added
    public void addLayoutComponent( String name, Component comp )
     * Removes the specified component from the layout.
     * @param comp the component to be removed
    public void removeLayoutComponent( Component comp )
     * Calculates the preferred size dimensions for the specified
     * panel given the components in the specified parent container.
     * @param theParent the component to be laid out
     * @see #minimumLayoutSize
    public Dimension preferredLayoutSize( Container theParent )
        Insets insets = theParent.getInsets();
        int maxWidth = 0;
        int totalHeight = 0;
        int numComponents = theParent.getComponentCount();
        for( int i = 0; i < numComponents; ++i )
            Component c = theParent.getComponent( i );
            if( c.isVisible() )
                Dimension cd = c.getPreferredSize();
                maxWidth = Math.max( maxWidth, cd.width );
                totalHeight += cd.height;
        Dimension td = new Dimension( maxWidth + insets.left + insets.right,
                totalHeight + insets.top + insets.bottom + m_vgap * numComponents );
        return td;

You can use calligraphy/ art brush strokes, can you not? Some of them come with AI and you can find quite a few on ze interweb. You could even create your own, if need be.
Mylenium

Similar Messages

  • Loading COBOL file - blocked variable records and varying size arrays

    We would like to use ODI 11g to regularly to parse and load into Oracle DB 11g complex files that originate on the MVS mainframe.
    Key file characteristics are:
    1. EBCDIC encoding
    2. file contains blocked records - each block starts with a 4-byte Block Descriptor Word (BDW). BDW bytes 1-2 specify the block length stored as a 16-bit unsigned integer, i.e. PIC (5) COMP in COBOL.
    3. each file block contains multiple variable size records - BDW is followed by 1 or more variable length records. Each record starts with a 4-bytes Record Descriptor Word (RDW). RDW bytes 1-2 specify the record length stored as 16 bit unsigned integer, i.e. PIC (5) COMP in COBOL.
    4. each file record contains number of scalar fields and several varying-size arrays - COBOL OCCURS DEPENDING ON. For example:
    03 SAMPLE-ARRAY-CNT PIC S9(1) COMP-3.
    03 SAMPLE-ARRAY OCCURS 0 TO 5 TIMES DEPENDING ON SAMPLE-ARRAY-CNT.
    05 ARRAY-CD1 PIC X(5).
    05 ARRAY-CD2 PIC X(7).
    05 ARRAY-AMOUNT PIC S9(3)V9999 COMP-3.
    5, file contains fields stored as COBOL COMPUTATIONAL and COMPUTATIONAL-3.
    6. average record lengh is 1,000 bytes and each file is about 4GB
    SQL*Loader/external table functionality can handle most of these requirements on one-off basis, but collectively they present a significant challenge. The file layout can't be reversed engineered as COBOL copybook into ODI.
    Does ODI have complex file parsing capabilities that could be used to (pre-)process the file, in as few passes as possible?
    Thanks
    Petr

    Hi,
    there's a couple of options here, and I've included what I think is the simplest below (using TestStand 2.0.1).
    It's not exactly elegant though. What I've done is to put in a step that finds out the number of steps to load (based on an earlier decision - in this case a message popup step). I read a number from the limits file, and use this in the looping options of the property loader step that's loading the values into the array. I've done it with a fixed size array target here, big enough to take any incoming data. (Otherwise, knowing how many items you're going to load from the limits file, you could start with an empty array and re-size it prior to loading).
    I've cheated slightly by using the pre-expression on the property loader step to specify where th
    e data is coming from and where it's going to in the sequence on each iteration of the loop based on the Runstate.Loopindex.
    Another option is to go straight into the property loader step, and keep loading properties until the Step.Result.NumPropertiesRead = 0 (remember we're only doing this one at a time)
    Another idea would be to load in a value, and check it isn't a "flag" value (i.e. you'd never use say 999 in your array, so set the last element in your limits file to this, and drop out of the loop when this happens.
    Further still, you've got the source code for the property loader step, so you could re-write it to make a custom step that loads an array until it fails all on its own (no looping in TestStand).
    Hope this gets you going
    S.
    // it takes almost no time to rate an answer
    Attachments:
    DynamicPropertyLoader.seq ‏32 KB

  • How to adjust corner rounding with varying sizes of shapes to be consistent?

    How do you describe the relationship of a rounded corner to the dimensions of a shape? I want to create a rule of how much to round corners on our boxes, but want it to be applicable to varying sizes of boxes--but I am not sure how the math works. I would like all our boxes to look consistent no matter what the size. Thanks.

    Here the case for changing shape vs. scaling:
    Uwe

  • Allow user to insert varying size text in middle of paragraph, flow

    In the middle of a paragraph I would like to allow a user to add lines of text to fill in a blank. The text amount would vary in size. I have read about the subforms but I cannot get them to do what I want. The text has to follow the asterick and then the rest of the paragraph "compel the removal..." should follow, for a complete paragraph. Example of what I would like to do (see the * parts):
    The Company hereby insures the owner of the indebtedness secured by the mortgage referred to in paragraph _____ of Schedule _____ against loss which the insured shall sustain in the event that the owner of the easement referred to in paragraph _____ of Schedule B shall, for the purpose of *__________________ compell the removal of any portion of the improvements on the land which encroach upon said easement.
    * insert use against which insurance is to be given, e.g.,
    (1)Insurance limited to loss by reason of maintenance and repair of specific existing structure: maintaining and repairing the existing storm drain structure within said easement.
    (2)Insurance same as (1) plus enlarging or replacing existing structure: maintaining, repairing, enlarging or replacing the existing storm drain within said easement.
    (3)Insurance unlimited: exercising the right of use or maintenance of said easement.

    Hi, Can anyone please help me with me question above? I am completely lost and getting very frustrated with this program. I could really use some support. Are their other avenues of support? I bought a book but it didn't go into enough detail and it didn't teach me anything I didn't already figure out on my own. My main source of contention is subforms at the moment.

  • Must reduce size of JScrollPane to see Scrollbar

    when I put a JScrollPane in a JPanel
    I must reduce the size of the JScrollPane to see the JScrollBar
    any Help is welcomed
    Thank U

    setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS );

  • Set size for JScrollPane

    I have a JLabel that I am using to display images thri ImageIcon. i want to wrap the jlabel in a JScrollpane so that i can view the entire image by scrolling. i did this part but the scroll pane is extremely small to begin with. how can set the size of the Jlabel initially ??

    You don't set the size of the Label, you set the size of the
    ScrollPanel. Also you don't add/place the Label on the Frame/Panel,
    you add the ScrollPanel to the Frame/Panel.
    The Label will take on the size of the Image you load into it.

  • Packaging material of varying size

    UOM of my material say x is each. And they are manufactured in lots depending on order. During shippment they are packed some times in cartoons and some times in guinea bags.Also depending on the available cartoon size no of material packed can vary. Please help me in mapping all this.

    Hi friend,
                 you can use the UOM conversion by using the Additional data tab in Material master
    there you can define the Alternate UOM.
    Thanks Satya

  • How to create pages of varied size automatically

    Suppose you are creating signs, street signs to be more specific. The width of each sign will be determined by the length of the text it contains. So you have a spreadsheet containing these [examples] and many more.
    Street Names
    Tumbleweed Ave
    Saloon St
    Barnyard Ln
    The goal would be to create a document (or, if it's easier, multiple) that contains spreads/pages whose widths are adjusted to fit the content. I would prefer to automate this process, like a data merge, rather than create each of the varied pages manually. I assume that creating each sign as a page will enable me to adjust bleeds and trim marks for the sign manufacturer more easily, but perhaps a sign maker might think that this is unnecessary. I've experimented a bit already by creating a large page (sized similar to a big sheet of aluminum) and using data merge to layout multiple textboxes (widths adjusting automatically) to a single page.

    I am assuming your pages are html, if so, change this
    <p><a href="http://www.omniearths.com/dakini/">
    to this
    <p><a href="http://www.omniearths.com/dakini.html">
    Again I am assuming that dakini.html is in the root directory and has been uploaded to the server.
    Gary

  • "Get variant" - Size of Popup

    Hello,
    in a system transaction sa38 was used for executing reports. With new authorization concept authorization for sa38 is not allowed. Reports are executed through (generated) transaction codes provided by the roles.
    A lot of these reports have got a hundred variants. With old authorizations concept users could show these variants through sa38 u2013 reportname u2013 menu program u2013 variant overview.
    With the new concept this way is no longer possible. User can now call transaction and show variants for this report through menu Goto u2013 Variants u2013 Display or button u201CGet variantsu201D.
    The displayed popup is too small, they canu2019t see same overview like in sa38.
    I found a note 313558, but this is not the same problem. There is no info about how to resize this popup.
    Do you know any possibilities how to enlarge this popup?
    Regards,
    Julia

    Hello,
    in a system transaction sa38 was used for executing reports. With new authorization concept authorization for sa38 is not allowed. Reports are executed through (generated) transaction codes provided by the roles.
    A lot of these reports have got a hundred variants. With old authorizations concept users could show these variants through sa38 u2013 reportname u2013 menu program u2013 variant overview.
    With the new concept this way is no longer possible. User can now call transaction and show variants for this report through menu Goto u2013 Variants u2013 Display or button u201CGet variantsu201D.
    The displayed popup is too small, they canu2019t see same overview like in sa38.
    I found a note 313558, but this is not the same problem. There is no info about how to resize this popup.
    Do you know any possibilities how to enlarge this popup?
    Regards,
    Julia

  • HT2639 Is there any way in i Photo '11 to crop a photo in an irregular manner? (e.g., scanned newspaper columns of varying sizes and lengths)

    I want to edit some scanned newspaper prints to include only the columns in which I am interested. Is there any way to crop the scanned photo in an irregular manner so as to include only the relevant section?

    You can do it in iPhoto, if the crop you want is rectangular and not a standard format.
    Do it in iPhoto, by choosing Edit > Crop > and unchecking the Constrain box.
    You can also do it in Preview, by cropping to the desired size with the cross-hair that appears when you mouseover the image, and then selecting Crop from the Tools menu.
    If you want to select several areas of a newspaper page - hiding areas you don't want - you can do it in Keynote.
    Import your scanned image to Keynote, and create shapes to cover what you don't want.  You can blank out unwanted areas completely, or have them semi-opaque, so they remain visible without pulling the focus away from the areas you want to highlight.

  • Varying sizes for text fields

    I have multiple text fields on my form.  However, when I adjust the size for one, they all adjust also.  How do I stop this since I want teh text boxes to be different sizes?

    Are you asking about the FormsCentral designer or are you working with fields in Acrobat?

  • How do you can change the page size of a pdf in MAC?  I have multiple pdf documents of different sizes that I want to combine.

    Help.  How do I change the page size of a pdf in MAC?  I have multiple pdf documents in varying sizes I would like to combine and print.

    There's no real need to do that. A PDF can have pages of different sizes.
    On Fri, Jun 6, 2014 at 4:11 AM, christine rambo <[email protected]>

  • Adjusting multiple images to be the same size?

    Hi,
    I'm trying to create a photo collage in Photoshop that consist of multiple photos imported as Smart Objects into layers, that are all the same size. Ideally, I'd like to be able size/crop/scale each image as a group, or individually, on the fly. So lets say that I have 6 images as Smart Objects on layers, and that they are all of varying sizes, and I'd like to adjust each image to be the same precise size, 2" x 3". Maybe later I decide that they should all be 2.5" x 3."5, can I easily change all 6 images at once? I've tried going into Free Transform and changing the size of each individual image here, but I can't get the precise size that I want. Is there a way that I can open a dialog box, and specify the exact size? Can I then repeat this for all images/layers that I've selected?
    I hope this makes sense, and that someone has a brilliant idea on how to do this?
    Thanks!
    Jeff

    Image Processor doesn't get me what I'm after.
    Photoshop has the option to create a contact sheet. So imagine that I want to create a contact sheet of images, but keep them on separate layers, and be able to change the size of the images as I feel, to fit my collage.

  • Saving the domain file in iWeb fails. I have tried deleting the cache. I see that the file uploads to iWeb but the message is that the domain.sites2 file can't be saved. I note that duplicating the domain gives me different size files. Ideas?

    I have read other discussions and my problem persists.
    I note that duplicating the domain file user/library/applications support/iweb/domain.sites2 gives me files of varying sizes (I'm at around 200Mb).
    I tried rebuilding the cache ../library/caches/com.apple.iweb - no change
    I found a note to delete also a preference file ../library/prefernces/com.apple.iweb   bt found more than one (.../plist and .../plist.lockfile) so ducked that.
    The website seems to update out of sync - as if I have a domain file elsewhere (in the cloud?) that is saving on my drive later - that doesn't make sense of the comments I have read. My domain.sites2 file is stadily growing - so one interpretation is that files are being saved and the error message is the error.
    This has been a problem for about a year as I have tried many alternative solutions. I;m looking fro somethign substantially different.
    One repeated situation is that I write a new page and upload it. I get the usual error message. I visit the site and there is the new page. My domain (on my machine) shows no new work, so I copy the stuff on the web back to my domain and steadily the file increases in size. Bewildering.
    Everything is as up to date as it can be. I don't reboot very often as my machine is rarley off.
    I'm looking for different ideas and approaches.....

    Although some of the following will be a repeat but try the following:
    delete the iWeb preference files, com.apple.iWeb.plist and com.apple.iWeb.plist.lockfile, that resides in your Home() /Library/Preferences folder.
    go to your Home()/Library/Caches/com.apple.iWeb folder and delete its contents.
    Click to view full size
    launch iWeb and try again.
    If that doesn't help continue with:
    move the domain file from your Home/Library/Application Support/iWeb folder to the Desktop.
    launch iWeb, create a new test site, save the new domain file and close iWeb.
    go to the your Home/Library/Application Support/iWeb folder and delete the new domain file.
    move your original domain file from the Desktop to the iWeb folder.
    launch iWeb and try again.
    OT

  • Maximum size of a data packet

    The maximum size of data packet set in configuration is 25MB.
    I want to change the size of data packet as 50 MB. I don't want to change it globally(in SPRO). I want to change it only for specific info-package.
    But in info-package system does not allow to change the packet size more than 25MB.
    Please suggest the way.
    Regards,
    Dheeraj

    Hi..
    MAXSIZE = Maximum size of an individual data packet in KB.
    The individual records are sent in packages of varying sizes in the data transfer to the Business In-formation Warehouse. Using these parameters you determine the maximum size of such a package and therefore how much of the main memory may be used for the creation of the data package. SAP recommends a data package size between 10 and 50 MB.
    https://www.sdn.sap.com/irj/sdn/directforumsearch?threadid=&q=cube+size&objid=c4&daterange=all&numresults=15
    MAXLINES = Upper-limit for the number of records per data packet
    The default setting is 'Max. lines' = 100000
    The maximum main memory space requirement per data packet is around
    memory requirement = 2 * 'Max. lines' * 1000 Byte,
    meaning 200 MByte with the default setting
    3     THE FORMULA FOR CALCULATING NUMBER OF RECORDS
    The formula for calculating the number of records in a Data Packet is:
    packet size = MAXSIZE * 1000 / transfer structure size (ABAP Length)
                        but not more than MAXLINES.
    eg. if MAXLINES < than the result of the formula, then MAXLINES size is transferred into BW.
    The size of the Data Packet is the lowest of MAXSIZE * 1000 / transfer structure size (ABAP Length) or MAXLINES.
    Message was edited by:
            search

Maybe you are looking for