Results 1 to 5 of 5

Thread: How to use FlowLayout in Java?

  1. #1
    Join Date
    Jul 2006
    Posts
    218

    How to use FlowLayout in Java?

    I know that when i not mention any other type of the layout manager, by default, the flow layout appears. But since I don't know much about the Java, I am interested in knowing more about the flow layout. So thought that some guys over there would be interested in helping me. So please tell me how to use FlowLayout in Java.?? Any coding related to the topic would be grateful.!!
    ~*~Silent~Kid~*~
    "To The World You May Be Just One Person, But To One Person You May Be The World"

  2. #2
    Join Date
    Jul 2006
    Posts
    289

    Re: How to use FlowLayout in Java?

    A components are arranged in a directional flow in a flow layout which is much like lines of text in a paragraph. The following are the two types of componentOrientation property which describes the flow direction and may be one of two values :
    • ComponentOrientation.LEFT_TO_RIGHT
    • ComponentOrientation.RIGHT_TO_LEFT

    Flow layouts are typically used to arrange buttons in a panel.
    Signatures reduce available bandwidth

  3. #3
    Join Date
    Mar 2008
    Posts
    349

    Re: How to use FlowLayout in Java?

    The code that I have provided would be very helpful for you in applets.
    Code:
    import java.awt.*;
     import java.applet.Applet;
    
     public class ButtonsDemo extends Applet {
         Button button1, button2, button3;
         public void init() {
             button1 = new Button("Next");
             button2 = new Button("Previous");
             button3 = new Button("Close");
             add(button1);
             add(button2);
             add(button3);
         }
     }

  4. #4
    Join Date
    Jul 2006
    Posts
    442

    Re: How to use FlowLayout in Java?

    Once if you know about the Constructor of the FlowLayout, then you will find easy to use it. So I have provided some constructor which are as below :
    Code:
    public FlowLayout()
    By using the above constructor you can construct a new FlowLayout with a centered alignment and a default 5-unit horizontal and vertical gap. If you want to creates a new flow layout manager with the indicated alignment and the indicated horizontal and vertical gaps, check the following code :
    Code:
    public FlowLayout(int align,
                      int hgap,
                      int vgap)
    "When they give you ruled paper, write the other way..." J.R.J.

  5. #5
    Join Date
    Jul 2006
    Posts
    286

    Re: How to use FlowLayout in Java?

    The code snippet below creates a FlowLayout object and the components it manages.
    Code:
    FlowLayout TrialLayout = new FlowLayout();
    
    ...
    
    	compsToTrial.setLayout(TrialLayout);
    
    	compsToTrial.add(new JButton("Button 1"));
    	compsToTrial.add(new JButton("Button 2"));
    	compsToTrial.add(new JButton("Button 3"));
    	compsToTrial.add(new JButton("Long-Named Button 4"));
    	compsToTrial.add(new JButton("5"));
    IF you hate me, please don't mention it. I know who hates me and who doesn't. You really do not have to make fun of people....

Similar Threads

  1. Replies: 4
    Last Post: 04-09-2013, 11:04 PM
  2. Setting Of Java to The Point At Manual Java
    By winni in forum Software Development
    Replies: 4
    Last Post: 10-01-2011, 10:05 PM
  3. Java Programming using Adventnet SNMP Java API
    By ROCKING_Suhas in forum Software Development
    Replies: 5
    Last Post: 17-07-2010, 06:52 AM
  4. Link List Example in Java Sample program in Java
    By trickson in forum Software Development
    Replies: 2
    Last Post: 04-08-2009, 08:23 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,727,418,672.60213 seconds with 17 queries