FileDocCategorySizeDatePackage
FlowLayoutDemo.javaAPI DocExample1338Sun Jan 07 16:43:46 GMT 2001None

FlowLayoutDemo

public class FlowLayoutDemo extends JFrame

Fields Summary
Constructors Summary
public FlowLayoutDemo()

    super("FlowLayoutDemo");

    Container contentPane = getContentPane();
    contentPane.setLayout(new FlowLayout());
    contentPane.add(new JButton("OK"));
    contentPane.add(new JButton("Cancel"));

    applyOrientation(this, ComponentOrientation.RIGHT_TO_LEFT);
  
Methods Summary
private voidapplyOrientation(java.awt.Component c, java.awt.ComponentOrientation o)

    c.setComponentOrientation(o);

    if (c instanceof JMenu) {
      JMenu menu = (JMenu)c;
      int ncomponents = menu.getMenuComponentCount();
      for (int i = 0; i < ncomponents; ++i) {
        applyOrientation(menu.getMenuComponent(i), o);
      }
    } else if (c instanceof Container) {
      Container container = (Container)c;
      int ncomponents = container.getComponentCount();
      for (int i = 0; i < ncomponents; ++i) {
        applyOrientation(container.getComponent(i), o);
      }
    }
  
public static voidmain(java.lang.String[] argv)

    JFrame frame = new FlowLayoutDemo();
    frame.addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {System.exit(0);}
    });

    frame.pack();
    frame.setVisible(true);