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:SliderTest.java

public SliderTestFrame() {
    setTitle("SliderTest");
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    sliderPanel = new JPanel();
    sliderPanel.setLayout(new FlowLayout(FlowLayout.LEFT));

    // common listener for all sliders
    listener = new ChangeListener() {
        public void stateChanged(ChangeEvent event) {
            // update text field when the slider value changes
            JSlider source = (JSlider) event.getSource();
            textField.setText("" + source.getValue());
        }//from  w  w w.j  a  va  2 s .  c o m
    };

    // add a plain slider

    JSlider slider = new JSlider();
    addSlider(slider, "Plain");

    // add a slider with major and minor ticks

    slider = new JSlider();
    slider.setPaintTicks(true);
    slider.setMajorTickSpacing(20);
    slider.setMinorTickSpacing(5);
    addSlider(slider, "Ticks");

    // add a slider that snaps to ticks

    slider = new JSlider();
    slider.setPaintTicks(true);
    slider.setSnapToTicks(true);
    slider.setMajorTickSpacing(20);
    slider.setMinorTickSpacing(5);
    addSlider(slider, "Snap to ticks");

    // add a slider with no track

    slider = new JSlider();
    slider.setPaintTicks(true);
    slider.setMajorTickSpacing(20);
    slider.setMinorTickSpacing(5);
    slider.setPaintTrack(false);
    addSlider(slider, "No track");

    // add an inverted slider

    slider = new JSlider();
    slider.setPaintTicks(true);
    slider.setMajorTickSpacing(20);
    slider.setMinorTickSpacing(5);
    slider.setInverted(true);
    addSlider(slider, "Inverted");

    // add a slider with numeric labels

    slider = new JSlider();
    slider.setPaintTicks(true);
    slider.setPaintLabels(true);
    slider.setMajorTickSpacing(20);
    slider.setMinorTickSpacing(5);
    addSlider(slider, "Labels");

    // add a slider with alphabetic labels

    slider = new JSlider();
    slider.setPaintLabels(true);
    slider.setPaintTicks(true);
    slider.setMajorTickSpacing(20);
    slider.setMinorTickSpacing(5);

    Dictionary<Integer, Component> labelTable = new Hashtable<Integer, Component>();
    labelTable.put(0, new JLabel("A"));
    labelTable.put(20, new JLabel("B"));
    labelTable.put(40, new JLabel("C"));
    labelTable.put(60, new JLabel("D"));
    labelTable.put(80, new JLabel("E"));
    labelTable.put(100, new JLabel("F"));

    slider.setLabelTable(labelTable);
    addSlider(slider, "Custom labels");

    // add a slider with icon labels

    slider = new JSlider();
    slider.setPaintTicks(true);
    slider.setPaintLabels(true);
    slider.setSnapToTicks(true);
    slider.setMajorTickSpacing(20);
    slider.setMinorTickSpacing(20);

    labelTable = new Hashtable<Integer, Component>();

    // add card images

    labelTable.put(0, new JLabel(new ImageIcon("nine.gif")));
    labelTable.put(20, new JLabel(new ImageIcon("ten.gif")));
    labelTable.put(40, new JLabel(new ImageIcon("jack.gif")));
    labelTable.put(60, new JLabel(new ImageIcon("queen.gif")));
    labelTable.put(80, new JLabel(new ImageIcon("king.gif")));
    labelTable.put(100, new JLabel(new ImageIcon("ace.gif")));

    slider.setLabelTable(labelTable);
    addSlider(slider, "Icon labels");

    // add the text field that displays the slider value

    textField = new JTextField();
    add(sliderPanel, BorderLayout.CENTER);
    add(textField, BorderLayout.SOUTH);
}

From source file:components.ButtonTabComponent.java

public ButtonTabComponent(final JTabbedPane pane) {
    //unset default FlowLayout' gaps
    super(new FlowLayout(FlowLayout.LEFT, 0, 0));
    if (pane == null) {
        throw new NullPointerException("TabbedPane is null");
    }//from w  w  w.  jav a2  s .  c  om
    this.pane = pane;
    setOpaque(false);

    //make JLabel read titles from JTabbedPane
    JLabel label = new JLabel() {
        public String getText() {
            int i = pane.indexOfTabComponent(ButtonTabComponent.this);
            if (i != -1) {
                return pane.getTitleAt(i);
            }
            return null;
        }
    };

    add(label);
    //add more space between the label and the button
    label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
    //tab button
    JButton button = new TabButton();
    add(button);
    //add more space to the top of the component
    setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
}

From source file:org.kuali.test.ui.base.SimpleInputDlg.java

private void initComponents(String labelTxt) {
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(new JLabel(labelTxt + ":"), BorderLayout.NORTH);
    JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT));
    p.add(value = new JTextField(30));
    getContentPane().add(p, BorderLayout.CENTER);
    addStandardButtons();//ww w  .j av a  2  s. c om
    setDefaultBehavior();
}

From source file:org.colombbus.tangara.update.SoftwareUpdateDialog.java

private void addCenterPane() {
    JPanel centerPane = new JPanel();
    BoxLayout layout = new BoxLayout(centerPane, BoxLayout.Y_AXIS);
    centerPane.setLayout(layout);/* w  ww  .j av a 2s .c om*/

    JTextArea descPane = new JTextArea(info.getDescription());
    descPane.setFont(font);
    descPane.setEditable(false);
    centerPane.add(descPane);

    JPanel linkPanel = new JPanel();
    linkPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    String linkTitle = bundle.getString("SoftwareUpdateDialog.linkTitle"); //$NON-NLS-1$
    JLabel linkTitleLabel = new JLabel(linkTitle);
    linkTitleLabel.setFont(font);
    linkPanel.add(linkTitleLabel);
    HyperLinkLabel linkLabel = new HyperLinkLabel(info.getLink(), info.getLink());
    linkLabel.setFont(font);
    linkPanel.add(linkLabel);
    linkPanel.setBackground(Color.white);
    linkPanel.setOpaque(true);
    centerPane.add(linkPanel);
    add(centerPane, BorderLayout.CENTER);
}

From source file:ioheater.ui.IOHeaterUI.java

/**
 * Creates new form IOheater/* w ww . j ava2s.  c  om*/
 */
public IOHeaterUI() {
    logger.info("Entering IOheater");
    initComponents();

    jPanel3.removeAll();
    jPanel3.setLayout(new FlowLayout(FlowLayout.LEFT));
    jPanel3.add(chart());
    this.setLocationRelativeTo(null);
    this.sdf = new SimpleDateFormat("dd/MM/yy h:mm:ss");

    setTitle("IO heater");
    addWindowListener(new java.awt.event.WindowAdapter() {
        @Override
        public void windowClosed(java.awt.event.WindowEvent evt) {
            formWindowClosing(evt);
        }

        @Override
        public void windowOpened(java.awt.event.WindowEvent evt) {
            formWindowOpened(evt);
        }
    });

    this.ioHeaterManager = new IOHeaterManager(this, this, this);

    logger.info("Exiting IOheater");
}

From source file:be.fedict.eid.tsl.tool.SignSelectPkcs11FinishablePanel.java

@Override
public Component getComponent() {
    LOG.debug("get component");
    if (null == this.component) {
        /*/* w  w  w.j av a 2 s  . c  om*/
         * We need to return the same component each time, else the
         * validate() logic doesn't work as expected.
         */
        JPanel panel = new JPanel();
        BoxLayout boxLayout = new BoxLayout(panel, BoxLayout.PAGE_AXIS);
        panel.setLayout(boxLayout);
        JPanel infoPanel = new JPanel();
        infoPanel.add(new JLabel("Please select a PKCS#11 library."));
        panel.add(infoPanel);

        JPanel browsePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
        panel.add(browsePanel);
        browsePanel.add(new JLabel("PKCS#11 library:"));
        this.pkcs11TextField = new JTextField(30);
        browsePanel.add(this.pkcs11TextField);
        JButton browseButton = new JButton("Browse...");
        browseButton.addActionListener(this);
        browsePanel.add(browseButton);

        JPanel slotIdxPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
        panel.add(slotIdxPanel);
        slotIdxPanel.add(new JLabel("Slot index:"));
        SpinnerModel spinnerModel = new SpinnerNumberModel(0, 0, 10, 1);
        this.slotIdxSpinner = new JSpinner(spinnerModel);
        slotIdxPanel.add(this.slotIdxSpinner);

        this.component = panel;
    }
    return this.component;
}

From source file:gdt.jgui.tool.JIconSelector.java

/**
 * The default constructor./*from  w ww . j  a  v  a2  s .c  o m*/
 */
public JIconSelector() {
    FlowLayout flowLayout = new FlowLayout(FlowLayout.LEFT, 5, 5);
    flowLayout.setAlignOnBaseline(true);
    WrapLayout wrapLayout = new WrapLayout(FlowLayout.LEFT, 5, 5);
    wrapLayout.setAlignOnBaseline(true);
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    panel = new JPanel();
    panel.setLayout(wrapLayout);
    scrollPane = new JScrollPane(panel);
    add(scrollPane);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
}

From source file:uk.ac.ebi.demo.picr.swing.PICRBLASTDemo.java

public PICRBLASTDemo() {

    //set general layout
    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));

    add(Box.createVerticalStrut(5));

    //create components
    JPanel row1 = new JPanel();
    row1.setLayout(new BoxLayout(row1, BoxLayout.X_AXIS));
    row1.add(Box.createHorizontalStrut(5));
    row1.setBorder(BorderFactory.createTitledBorder(""));
    row1.add(new JLabel("Fragment:"));
    row1.add(Box.createHorizontalStrut(10));
    final JTextArea sequenceArea = new JTextArea(5, 40);
    sequenceArea.setMaximumSize(sequenceArea.getPreferredSize());
    row1.add(Box.createHorizontalStrut(10));

    row1.add(sequenceArea);/*  w  w w .j a va 2s.c om*/
    row1.add(Box.createHorizontalGlue());

    JPanel row2 = new JPanel(new FlowLayout(FlowLayout.LEFT));
    row2.setBorder(BorderFactory.createTitledBorder("Target Databases"));
    final JList databaseList = new JList();
    JScrollPane listScroller = new JScrollPane(databaseList);
    listScroller.setMaximumSize(new Dimension(100, 10));
    JButton loadDBButton = new JButton("Load Databases");
    row2.add(listScroller);
    row2.add(loadDBButton);

    JPanel row3 = new JPanel(new FlowLayout(FlowLayout.LEFT));
    JCheckBox onlyActiveCheckBox = new JCheckBox("Only Active");
    onlyActiveCheckBox.setSelected(true);
    row3.add(new JLabel("Options:  "));
    row3.add(onlyActiveCheckBox);

    add(row1);
    add(row2);
    add(row3);

    final String[] columns = new String[] { "Database", "Accession", "Version", "Taxon ID" };
    final JTable dataTable = new JTable(new Object[0][0], columns);
    dataTable.setShowGrid(true);
    add(new JScrollPane(dataTable));

    JPanel buttonPanel = new JPanel();
    JButton mapAccessionButton = new JButton("Generate Mapping!");
    buttonPanel.add(mapAccessionButton);
    add(buttonPanel);

    //create listeners!

    //update boolean flag in communication class
    onlyActiveCheckBox.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            client.setOnlyActive(((JCheckBox) e.getSource()).isSelected());
        }
    });

    //performs mapping call and updates interface with results
    mapAccessionButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            try {

                if (!"".equals(sequenceArea.getText())) {
                    //TODO filters and database are hardcoded here.  They should be added to the input panel at a later revision.
                    java.util.List<UPEntry> entries = client.performBlastMapping(sequenceArea.getText(),
                            databaseList.getSelectedValues(), "90", "", "IDENTITY", "UniprotKB", "", false,
                            new BlastParameter());

                    //compute size of array
                    if (entries != null) {
                        int size = 0;
                        for (UPEntry entry : entries) {
                            for (CrossReference xref : entry.getIdenticalCrossReferences()) {
                                size++;
                            }
                            for (CrossReference xref : entry.getLogicalCrossReferences()) {
                                size++;
                            }
                        }

                        if (size > 0) {

                            final Object[][] data = new Object[size][4];
                            int i = 0;
                            for (UPEntry entry : entries) {
                                for (CrossReference xref : entry.getIdenticalCrossReferences()) {
                                    data[i][0] = xref.getDatabaseName();
                                    data[i][1] = xref.getAccession();
                                    data[i][2] = xref.getAccessionVersion();
                                    data[i][3] = xref.getTaxonId();
                                    i++;
                                }
                                for (CrossReference xref : entry.getLogicalCrossReferences()) {
                                    data[i][0] = xref.getDatabaseName();
                                    data[i][1] = xref.getAccession();
                                    data[i][2] = xref.getAccessionVersion();
                                    data[i][3] = xref.getTaxonId();
                                    i++;
                                }
                            }

                            //refresh
                            DefaultTableModel dataModel = new DefaultTableModel();
                            dataModel.setDataVector(data, columns);
                            dataTable.setModel(dataModel);

                            System.out.println("update done");

                        } else {
                            JOptionPane.showMessageDialog(null, "No Mappind data found.");
                        }
                    } else {
                        JOptionPane.showMessageDialog(null, "No Mappind data found.");
                    }
                } else {
                    JOptionPane.showMessageDialog(null, "You must enter a valid FASTA sequence to map.");
                }
            } catch (SOAPFaultException soapEx) {
                JOptionPane.showMessageDialog(null, "A SOAP Error occurred.");
                soapEx.printStackTrace();
            }
        }
    });

    //loads list of mapping databases from communication class
    loadDBButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            try {

                java.util.List<String> databases = client.loadDatabases();
                if (databases != null && databases.size() > 0) {

                    databaseList.setListData(databases.toArray());
                    System.out.println("database refresh done");

                } else {
                    JOptionPane.showMessageDialog(null, "No Databases Loaded!.");
                }

            } catch (SOAPFaultException soapEx) {
                JOptionPane.showMessageDialog(null, "A SOAP Error occurred.");
                soapEx.printStackTrace();
            }
        }
    });

}

From source file:ja.lingo.application.gui.main.settings.appearance.AppearanceGui.java

public AppearanceGui(Model model) {
    model.addApplicationModelListener(new ModelAdapter() {
        public void settingsUpdated(Preferences preferences) {
            setSelectedFontSize(preferences.getFontSize());
            setSelectedFontFace(preferences.getFontFace());
            dropZoneCheckBox.setSelected(preferences.isDropZoneVisible());
            memoryBarCheckBox.setSelected(preferences.isMemoryBarVisible());
        }/* ww w. j  a v  a  2 s .c om*/
    });

    dropZoneCheckBox = new JCheckBox(resources.text("showDropZone"));
    fontSizeComboBox = new JComboBox(new Integer[] { 12, 13, DEFAULT_FONT_SIZE, 15, 16, 17 });
    memoryBarCheckBox = new JCheckBox(resources.text("showMemoryBar"));

    JPanel fontSizePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, Gaps.GAP5, 0));
    fontSizePanel.add(resources.label("fontSize"));
    fontSizePanel.add(fontSizeComboBox);
    fontSizePanel.add(resources.label("requiresRestart"));

    gui = new JPanel(new TableLayout(new double[][] { { TableLayout.PREFERRED }, { TableLayout.PREFERRED, // 0: font face
            Gaps.GAP5, TableLayout.PREFERRED, // 2: font size
            Gaps.GAP5, TableLayout.PREFERRED, // 4: drop-zone
            Gaps.GAP5, TableLayout.PREFERRED, // 6: memory bar
            } }));

    JPanel fontFacePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, Gaps.GAP5, 0));
    fontFacePanel.add(resources.label("fontFace"));
    GraphicsEnvironment gEnv = GraphicsEnvironment.getLocalGraphicsEnvironment();
    fontFaceComboBox = new JComboBox(gEnv.getAvailableFontFamilyNames());
    fontFaceComboBox.setMaximumRowCount(10);
    fontFacePanel.add(fontFaceComboBox);
    fontFacePanel.add(resources.label("requiresRestart"));

    gui.add(fontFacePanel, "0, 0");
    gui.add(fontSizePanel, "0, 2");
    gui.add(dropZoneCheckBox, "0, 4");
    gui.add(memoryBarCheckBox, "0, 6");
    Gaps.applyBorder5(gui);

    ActionBinder.bind(this);
}

From source file:org.tinymediamanager.ui.components.ImagePanel.java

public ImagePanel(List<MediaFile> mediaFiles) {
    this.mediaFiles = mediaFiles;
    setLayout(new FormLayout(new ColumnSpec[] { ColumnSpec.decode("100px:grow"), },
            new RowSpec[] { RowSpec.decode("100px:grow"), }));

    scrollPane = new JScrollPane();
    add(scrollPane, "1, 1, fill, fill");

    panelImages = new JPanel();
    panelImages.setLayout(new WrapLayout(FlowLayout.LEFT));
    scrollPane.setViewportView(panelImages);
}