Example usage for java.awt FlowLayout LEFT

List of usage examples for java.awt FlowLayout LEFT

Introduction

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

Prototype

int LEFT

To view the source code for java.awt FlowLayout LEFT.

Click Source Link

Document

This value indicates that each row of components should be left-justified.

Usage

From source file:Main.java

private JPanel makeMainInnerPanel() {
    JPanel row1 = makeHorizontalPanel("one", "two", "three", "four", "five");
    JPanel row2 = makeHorizontalPanel("six", "seven", "eight");
    JPanel row3 = makeHorizontalPanel("nine", "ten", "eleven");
    JPanel m = new JPanel(new FlowLayout(FlowLayout.LEFT));
    m.add(row1);//  w  w  w  .  j av a 2s.c om
    m.add(row2);
    m.add(row3);
    return m;
}

From source file:Main.java

private JPanel makeHorizontalPanel(String... labelValues) {
    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    for (String s : labelValues) {
        JLabel label = new JLabel(s);
        panel.add(label);//from w  ww .java  2  s  . c  om
    }
    return panel;
}

From source file:se.trixon.jota.client.ui.TabCloser.java

public TabCloser(final TabHolder pane) {
    super(new FlowLayout(FlowLayout.LEFT, 0, 0));
    setOpaque(false);/*from w ww. ja  v  a  2s .  co  m*/

    JLabel label = new JLabel() {
        @Override
        public String getText() {
            int i = pane.indexOfTabComponent(TabCloser.this);
            if (i != -1) {
                setText(pane.getTitleAt(i));
                return super.getText();
            }
            return null;
        }
    };

    add(label);
    label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
    mButton = new TabButton();
    int buttonPos = SystemUtils.IS_OS_WINDOWS ? 1 : 0;
    add(mButton, buttonPos);
    setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
}

From source file:TextForm.java

public TextForm(String[] labels, char[] mnemonics, int[] widths, String[] tips) {
    super(new BorderLayout());
    JPanel labelPanel = new JPanel(new GridLayout(labels.length, 1));
    JPanel fieldPanel = new JPanel(new GridLayout(labels.length, 1));
    add(labelPanel, BorderLayout.WEST);
    add(fieldPanel, BorderLayout.CENTER);
    fields = new JTextField[labels.length];

    for (int i = 0; i < labels.length; i += 1) {
        fields[i] = new JTextField();
        if (i < tips.length)
            fields[i].setToolTipText(tips[i]);
        if (i < widths.length)
            fields[i].setColumns(widths[i]);

        JLabel lab = new JLabel(labels[i], JLabel.RIGHT);
        lab.setLabelFor(fields[i]);//from   www .j av a2  s.c om
        if (i < mnemonics.length)
            lab.setDisplayedMnemonic(mnemonics[i]);

        labelPanel.add(lab);
        JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT));
        p.add(fields[i]);
        fieldPanel.add(p);
    }
}

From source file:com.haulmont.cuba.desktop.sys.WindowBreadCrumbs.java

public WindowBreadCrumbs() {
    FlowLayout layout = new FlowLayout(FlowLayout.LEFT, 5, 5);
    setLayout(layout);//from   w  w w.j a  v  a  2  s .  c om
    setBorder(BorderFactory.createLineBorder(Color.gray));
    setVisible(false);
}

From source file:org.trzcinka.intellitrac.view.toolwindow.tickets.ticket_editor.AttachmentsListCellRenderer.java

public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
        boolean cellHasFocus) {

    if (!(value instanceof Attachment)) {
        throw new IllegalArgumentException(
                "AttachmentsListCellRenderer may render only Attachments, not " + value.getClass().getName());
    }//from w w  w .  java2 s . c  o  m
    Attachment attachment = (Attachment) value;

    final JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    ListCellRendererUtils.applyDefaultDisplaySettings(list, index, isSelected, cellHasFocus, panel);

    JLabel fileName = new JLabel(attachment.getFileName());
    fileName.setForeground(panel.getForeground());
    panel.add(fileName);

    String additionalTextString = MessageFormat.format(
            BundleLocator.getBundle()
                    .getString("tool_window.tickets.ticket_editor.attachments.attachment_info"),
            FileUtils.byteCountToDisplaySize(attachment.getSize()), attachment.getAuthor());
    JLabel additionalText = new JLabel(additionalTextString);
    additionalText.setForeground(panel.getForeground());
    panel.add(additionalText);

    return panel;
}

From source file:com.game.ui.views.UserDialog.java

public UserDialog(String message, JFrame frame) {
    setLayout(new BorderLayout(5, 5));
    setModalityType(ModalityType.APPLICATION_MODAL);
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setResizable(false);/*from  w  w w .j  av a2 s. com*/
    ImageIcon icon = null;
    try {
        icon = GameUtils.shrinkImage("warning.gif", 30, 30);
    } catch (IOException e) {
        System.out.println("Dialog : showDialogForMap(): Exception occured :" + e);
        e.printStackTrace();
    }
    JPanel panel = new JPanel();
    JLabel label = new JLabel(icon);
    panel.setLayout(new FlowLayout(FlowLayout.LEFT));
    label.setText(message);
    label.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    label.setHorizontalAlignment(0);
    panel.add(label);
    add(panel, BorderLayout.NORTH);
    JPanel contentPanel = new JPanel();
    contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));
    txt = new JTextField();
    txt.setPreferredSize(new Dimension(150, 30));
    txt.setAlignmentX(.5f);
    txt.setMaximumSize(new Dimension(150, 30));
    contentPanel.add(txt);
    contentPanel.add(Box.createVerticalStrut(10));
    JButton btn = new JButton("Submit.");
    btn.setAlignmentX(.5f);
    btn.setPreferredSize(new Dimension(50, 25));
    btn.addActionListener(this);
    validationMess = new JLabel("All fields are mandatory");
    validationMess.setVisible(false);
    validationMess.setForeground(Color.red);
    validationMess.setAlignmentX(.5f);
    contentPanel.add(btn);
    contentPanel.add(Box.createVerticalStrut(10));
    contentPanel.add(validationMess);
    contentPanel.add(Box.createVerticalGlue());
    add(contentPanel, BorderLayout.CENTER);
    pack();
    setSize(new Dimension(300, 200));
    setLocationRelativeTo(frame);
    setVisible(true);
}

From source file:de.weltraumschaf.minesweeper.gui.StatusBar.java

/**
 * Dedicated constructor./*from  w ww. j a  v a  2 s  .c  om*/
 *
 * Initializes {@link #elapsedTime} and {@link #minesLeft} with {@code 0}.
 */
public StatusBar() {
    super(new FlowLayout(FlowLayout.LEFT, 2, 0));
    add(scoreLabel);
    add(new JLabel(SEPARATOR));
    elapsedTime.setValue("0");
    add(elapsedTime);
    add(new JLabel(SEPARATOR));
    minesLeft.setValue("0");
    add(minesLeft);
    setBorder(new BevelBorder(BevelBorder.LOWERED));
}

From source file:com.thoughtworks.go.agent.bootstrapper.osx.MacPreferencesPane.java

public MacPreferencesPane(final AgentMacWindow agentMacWindow) {
    super();/*w ww.ja v a  2s.  c  om*/

    getContentPane().setLayout(new BorderLayout(10, 10));
    JLabel prefsText = new JLabel("Go Server Hostname or IP");

    serverTextField = new JTextField("");
    serverTextField.setColumns(15);
    serverTextField.selectAll();

    JPanel textPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 10, 10));
    textPanel.add(prefsText);
    textPanel.add(serverTextField);

    getContentPane().add(textPanel, BorderLayout.NORTH);

    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 10));

    JButton okButton = new JButton("OK");
    buttonPanel.add(okButton);
    okButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent newEvent) {
            String newHost = serverTextField.getText();
            if (!originalHost.equals(newHost)) {
                LOG.info("Server changed to " + newHost);
                agentMacWindow.setHost(newHost);
            } else {
                LOG.info("Server is still " + originalHost);
            }

            setVisible(false);
        }
    });
    getContentPane().add(buttonPanel, BorderLayout.SOUTH);

    setSize(getPreferredSize());
    setLocation(20, 40);
    setResizable(false);
}

From source file:WebCrawler.java

public void init() {

    // set up the main UI panel
    panelMain = new Panel();
    panelMain.setLayout(new BorderLayout(5, 5));

    // text entry components
    Panel panelEntry = new Panel();
    panelEntry.setLayout(new BorderLayout(5, 5));

    Panel panelURL = new Panel();
    panelURL.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
    Label labelURL = new Label("Starting URL: ", Label.RIGHT);
    panelURL.add(labelURL);//  www  .  ja v  a  2  s .c  o  m
    textURL = new TextField("", 40);
    panelURL.add(textURL);
    panelEntry.add("North", panelURL);

    Panel panelType = new Panel();
    panelType.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
    Label labelType = new Label("Content type: ", Label.RIGHT);
    panelType.add(labelType);
    choiceType = new Choice();
    choiceType.addItem("text/html");
    choiceType.addItem("audio/basic");
    choiceType.addItem("audio/au");
    choiceType.addItem("audio/aiff");
    choiceType.addItem("audio/wav");
    choiceType.addItem("video/mpeg");
    choiceType.addItem("video/x-avi");
    panelType.add(choiceType);
    panelEntry.add("South", panelType);

    panelMain.add("North", panelEntry);

    // list of result URLs
    Panel panelListButtons = new Panel();
    panelListButtons.setLayout(new BorderLayout(5, 5));

    Panel panelList = new Panel();
    panelList.setLayout(new BorderLayout(5, 5));
    Label labelResults = new Label("Search results");
    panelList.add("North", labelResults);
    Panel panelListCurrent = new Panel();
    panelListCurrent.setLayout(new BorderLayout(5, 5));
    listMatches = new List(10);
    panelListCurrent.add("North", listMatches);
    labelStatus = new Label("");
    panelListCurrent.add("South", labelStatus);
    panelList.add("South", panelListCurrent);

    panelListButtons.add("North", panelList);

    // control buttons
    Panel panelButtons = new Panel();
    Button buttonSearch = new Button(SEARCH);
    buttonSearch.addActionListener(this);
    panelButtons.add(buttonSearch);
    Button buttonStop = new Button(STOP);
    buttonStop.addActionListener(this);
    panelButtons.add(buttonStop);

    panelListButtons.add("South", panelButtons);

    panelMain.add("South", panelListButtons);

    add(panelMain);
    setVisible(true);

    repaint();

    // initialize search data structures
    vectorToSearch = new Vector();
    vectorSearched = new Vector();
    vectorMatches = new Vector();

    // set default for URL access
    URLConnection.setDefaultAllowUserInteraction(false);
}