Example usage for java.awt FlowLayout FlowLayout

List of usage examples for java.awt FlowLayout FlowLayout

Introduction

In this page you can find the example usage for java.awt FlowLayout FlowLayout.

Prototype

public FlowLayout() 

Source Link

Document

Constructs a new FlowLayout with a centered alignment and a default 5-unit horizontal and vertical gap.

Usage

From source file:gui.images.ClassifierResultPanel.java

/**
 * Initialization.
 */
public ClassifierResultPanel() {
    initComponents();
    resultChartPanel.setLayout(new FlowLayout());
}

From source file:Main.java

public Main() {
    Container content = getContentPane();
    content.setLayout(new FlowLayout());
    JLabel jl = new JLabel("          Calculator                ");
    textField = new JTextField(15);
    num1 = new JButton(" 1 ");
    num2 = new JButton(" 2 ");
    num3 = new JButton(" 3 ");
    num4 = new JButton(" 4 ");
    num5 = new JButton(" 5 ");
    num6 = new JButton(" 6 ");
    num7 = new JButton(" 7 ");
    num8 = new JButton(" 8 ");
    num9 = new JButton(" 9 ");
    num0 = new JButton(" 0 ");
    add = new JButton(" + ");
    sub = new JButton("  -  ");
    div = new JButton("  / ");
    mult = new JButton(" *  ");
    equalto = new JButton(" = ");
    exit = new JButton("    Exit     ");
    point = new JButton("  . ");
    reset = new JButton("C");
    reset.setBackground(Color.RED);
    num1.addActionListener(this);
    num2.addActionListener(this);
    num3.addActionListener(this);
    num4.addActionListener(this);
    num5.addActionListener(this);
    num6.addActionListener(this);
    num7.addActionListener(this);
    num8.addActionListener(this);
    num9.addActionListener(this);
    num0.addActionListener(this);
    add.addActionListener(this);
    sub.addActionListener(this);
    mult.addActionListener(this);
    div.addActionListener(this);
    equalto.addActionListener(this);
    exit.addActionListener(this);
    point.addActionListener(this);
    reset.addActionListener(this);
    content.add(jl);/*from   w w  w  .j av  a  2  s . c om*/
    content.add(textField);
    content.add(num1);
    content.add(num2);
    content.add(num3);
    content.add(add);
    content.add(num4);
    content.add(num5);
    content.add(num6);
    content.add(sub);
    content.add(num7);
    content.add(num8);
    content.add(num9);
    content.add(div);
    content.add(num0);
    content.add(point);
    content.add(mult);
    content.add(equalto);
    content.add(reset);
    content.add(exit);
}

From source file:vic.collaborativeClouds.forms.Login.java

/**
 * Creates new form Login//from   w w  w  .  j av a  2 s  .  c o  m
 */
public Login() {
    initComponents();
    //this.setExtendedState(Login.MAXIMIZED_BOTH);
    this.setAlwaysOnTop(true);

    setLayout(new BorderLayout());
    ImageLocator mImage = new ImageLocator();
    //System.err.println(mImage.login_dash);
    JLabel background = new JLabel(new ImageIcon(mImage.login_dash));
    this.add(background);
    background.setLayout(new FlowLayout());

    Toolkit tk = Toolkit.getDefaultToolkit();
    int xSize = ((int) tk.getScreenSize().getWidth());
    int ySize = ((int) tk.getScreenSize().getHeight());
    this.setSize(xSize, ySize);
    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
    this.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2);
    heading.setLocation((xSize / 2) - 100, (ySize / 4) - 100);
    username.setLocation((xSize / 2) - 150, (ySize / 4));
    password.setLocation((xSize / 2) - 150, (ySize / 4) + 50);
    login.setLocation((xSize / 2) - 150, (ySize / 4) + 100);
    cancel.setLocation((xSize / 2) + 120, (ySize / 4) + 100);
    username.setOpaque(false);

}

From source file:ListDrop.java

public ListDrop() {
    JFrame f = new JFrame();
    JList list = new JList(model);
    list.setDropMode(DropMode.INSERT);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    list.setTransferHandler(new ListHandler());

    field.setDragEnabled(true);/*from www.  j  a va  2s .co  m*/
    f.setLayout(new FlowLayout());
    f.add(new JScrollPane(list));
    f.add(field);
    f.pack();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setVisible(true);
}

From source file:MyStatsPanel.java

public MyStatsPanel(AdminGUI adminGUI, Statement statement) {
    this.adminGUI = adminGUI;
    this.statement = statement;

    pieChartPanel = createPieChartPanel();
    pieChartPanel.setBackground(Color.GRAY);
    pieChartPanel.setPreferredSize(new Dimension(550, 260));

    northPanel = new JPanel(new FlowLayout());
    northPanel.setBackground(Color.GRAY);
    clockPanel = new MyClock("Advanced");
    northPanel.add(clockPanel);//from  w ww  . j a  v a  2 s . c  o  m

    statsPanel = setFields();

    add(northPanel, BorderLayout.NORTH);
    add(statsPanel, BorderLayout.CENTER);
    add(pieChartPanel, BorderLayout.SOUTH);

    setUpGUI();
}

From source file:components.GlassPaneDemo.java

/**
 * Create the GUI and show it.  For thread safety,
 * this method should be invoked from the
 * event-dispatching thread./*from  w  w  w .ja  va  2s  . com*/
 */
private static void createAndShowGUI() {
    //Create and set up the window.
    JFrame frame = new JFrame("GlassPaneDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Start creating and adding components.
    JCheckBox changeButton = new JCheckBox("Glass pane \"visible\"");
    changeButton.setSelected(false);

    //Set up the content pane, where the "main GUI" lives.
    Container contentPane = frame.getContentPane();
    contentPane.setLayout(new FlowLayout());
    contentPane.add(changeButton);
    contentPane.add(new JButton("Button 1"));
    contentPane.add(new JButton("Button 2"));

    //Set up the menu bar, which appears above the content pane.
    JMenuBar menuBar = new JMenuBar();
    JMenu menu = new JMenu("Menu");
    menu.add(new JMenuItem("Do nothing"));
    menuBar.add(menu);
    frame.setJMenuBar(menuBar);

    //Set up the glass pane, which appears over both menu bar
    //and content pane and is an item listener on the change
    //button.
    myGlassPane = new MyGlassPane(changeButton, menuBar, frame.getContentPane());
    changeButton.addItemListener(myGlassPane);
    frame.setGlassPane(myGlassPane);

    //Show the window.
    frame.pack();
    frame.setVisible(true);
}

From source file:AddressDialog.java

private void init() {
    this.getContentPane().setLayout(new FlowLayout());
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    final AddressDialog dialog = new AddressDialog(this, false);
    JButton button = new JButton("Show Dialog");
    button.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            dialog.setSize(250, 120);/*  www.  j av a  2  s.co m*/
            dialog.setVisible(true);
        }
    });
    this.getContentPane().add(button);
}

From source file:RedGreenGriffin.java

public void init() {
    setLayout(new FlowLayout());
    GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
    String v = getParameter("url");
    if (v != null) {
        URLString = v;/*w  w  w . j a  v a 2 s.  c  o m*/
    }
    c1.setSize(size, size);
    add(c1);
    scene = createSceneGraph(0);
    u = new SimpleUniverse(c1);
    // This will move the ViewPlatform back a bit so the
    // objects in the scene can be viewed.
    //u.getViewingPlatform().setNominalViewingTransform();
    u.addBranchGraph(scene);

}

From source file:JTextFieldFilter.java

public Main() {
    JTextField tf1b;// w  ww. ja  v  a  2s . c  om
    JLabel l1b;

    setLayout(new FlowLayout());

    l1b = new JLabel("only float");
    tf1b = new JTextField(10);
    getContentPane().add(l1b);
    getContentPane().add(tf1b);
    tf1b.setDocument(new JTextFieldFilter(JTextFieldFilter.FLOAT));
    setSize(300, 300);
    setVisible(true);
}

From source file:JTextFieldFilter.java

public Main() {
    JTextField tf1c;//from w w w  .ja v a2s  . co  m
    JLabel l1c;

    setLayout(new FlowLayout());
    l1c = new JLabel("only float(can be negative)");
    tf1c = new JTextField(10);
    getContentPane().add(l1c);
    getContentPane().add(tf1c);
    JTextFieldFilter jtff = new JTextFieldFilter(JTextFieldFilter.ALPHA_NUMERIC);
    jtff.setNegativeAccepted(true);
    tf1c.setDocument(jtff);

    setSize(300, 300);
    setVisible(true);
}