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:org.interreg.docexplore.ServerConfigPanel.java

public ServerConfigPanel(final File config, final File serverDir) throws Exception {
    super(new LooseGridLayout(0, 1, 5, 5, true, false, SwingConstants.LEFT, SwingConstants.TOP, true, false));

    this.serverDir = serverDir;
    this.books = new Vector<Book>();
    this.bookList = new JList(new DefaultListModel());

    JPanel listPanel = new JPanel(new BorderLayout());
    listPanel.setBorder(BorderFactory.createTitledBorder(XMLResourceBundle.getBundledString("cfgBooksLabel")));
    bookList.setOpaque(false);/*from   w  w w .  ja v  a  2  s. c  om*/
    bookList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    bookList.setCellRenderer(new ListCellRenderer() {
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {
            Book book = (Book) value;
            JLabel label = new JLabel("<html><b>" + book.name + "</b> - " + book.nPages + " pages</html>");
            label.setOpaque(true);
            if (isSelected) {
                label.setBackground(TextToolbar.styleHighLightedBackground);
                label.setForeground(Color.white);
            }
            if (book.deleted)
                label.setForeground(Color.red);
            else if (!book.used)
                label.setForeground(Color.gray);
            return label;
        }
    });
    bookList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting())
                return;
            setFields((Book) bookList.getSelectedValue());
        }
    });
    JScrollPane scrollPane = new JScrollPane(bookList, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setPreferredSize(new Dimension(500, 300));
    scrollPane.getVerticalScrollBar().setUnitIncrement(10);
    listPanel.add(scrollPane, BorderLayout.CENTER);

    JPanel importPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    importPanel.add(new JButton(new AbstractAction(XMLResourceBundle.getBundledString("cfgImportLabel")) {
        public void actionPerformed(ActionEvent e) {
            final File inFile = DocExploreTool.getFileDialogs().openFile(DocExploreTool.getIBookCategory());
            if (inFile == null)
                return;

            try {
                final File tmpDir = new File(serverDir, "tmp");
                tmpDir.mkdir();

                GuiUtils.blockUntilComplete(new ProgressRunnable() {
                    float[] progress = { 0 };

                    public void run() {
                        try {
                            ZipUtils.unzip(inFile, tmpDir, progress);
                        } catch (Exception ex) {
                            ErrorHandler.defaultHandler.submit(ex);
                        }
                    }

                    public float getProgress() {
                        return (float) progress[0];
                    }
                }, ServerConfigPanel.this);

                File tmpFile = new File(tmpDir, "index.tmp");
                ObjectInputStream input = new ObjectInputStream(new FileInputStream(tmpFile));
                String bookFile = input.readUTF();
                String bookName = input.readUTF();
                String bookDesc = input.readUTF();
                input.close();

                new PresentationImporter().doImport(ServerConfigPanel.this, bookName, bookDesc,
                        new File(tmpDir, bookFile));
                FileUtils.cleanDirectory(tmpDir);
                FileUtils.deleteDirectory(tmpDir);
                updateBooks();
            } catch (Exception ex) {
                ErrorHandler.defaultHandler.submit(ex);
            }
        }
    }));
    listPanel.add(importPanel, BorderLayout.SOUTH);
    add(listPanel);

    JPanel setupPanel = new JPanel(
            new LooseGridLayout(0, 1, 5, 5, true, false, SwingConstants.LEFT, SwingConstants.TOP, true, false));
    setupPanel.setBorder(
            BorderFactory.createTitledBorder(XMLResourceBundle.getBundledString("cfgBookInfoLabel")));
    usedBox = new JCheckBox(XMLResourceBundle.getBundledString("cfgUseLabel"));
    usedBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Book book = (Book) bookList.getSelectedValue();
            if (book != null) {
                book.used = usedBox.isSelected();
                bookList.repaint();
            }
        }
    });
    setupPanel.add(usedBox);

    JPanel fieldPanel = new JPanel(new LooseGridLayout(0, 2, 5, 5, false, false, SwingConstants.LEFT,
            SwingConstants.TOP, true, false));
    fieldPanel.add(new JLabel(XMLResourceBundle.getBundledString("cfgTitleLabel")));
    nameField = new JTextField(50);
    nameField.getDocument().addDocumentListener(new DocumentListener() {
        public void removeUpdate(DocumentEvent e) {
            changedUpdate(e);
        }

        public void insertUpdate(DocumentEvent e) {
            changedUpdate(e);
        }

        public void changedUpdate(DocumentEvent e) {
            Book book = (Book) bookList.getSelectedValue();
            if (book == null)
                return;
            book.name = nameField.getText();
            bookList.repaint();
        }
    });
    fieldPanel.add(nameField);

    fieldPanel.add(new JLabel(XMLResourceBundle.getBundledString("cfgDescriptionLabel")));
    descField = new JTextPane();
    //descField.setWrapStyleWord(true);
    descField.getDocument().addDocumentListener(new DocumentListener() {
        public void removeUpdate(DocumentEvent e) {
            changedUpdate(e);
        }

        public void insertUpdate(DocumentEvent e) {
            changedUpdate(e);
        }

        public void changedUpdate(DocumentEvent e) {
            Book book = (Book) bookList.getSelectedValue();
            if (book == null)
                return;
            book.desc = descField.getText();
        }
    });
    scrollPane = new JScrollPane(descField, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setPreferredSize(new Dimension(420, 50));
    scrollPane.getVerticalScrollBar().setUnitIncrement(10);
    fieldPanel.add(scrollPane);

    setupPanel.add(fieldPanel);

    exportButton = new JButton(new AbstractAction(XMLResourceBundle.getBundledString("cfgExportLabel")) {
        public void actionPerformed(ActionEvent e) {
            File file = DocExploreTool.getFileDialogs().saveFile(DocExploreTool.getIBookCategory());
            if (file == null)
                return;
            final Book book = (Book) bookList.getSelectedValue();
            final File indexFile = new File(serverDir, "index.tmp");
            try {
                final File outFile = file;
                ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(indexFile));
                out.writeUTF(book.bookFile.getName());
                out.writeUTF(book.name);
                out.writeUTF(book.desc);
                out.close();

                GuiUtils.blockUntilComplete(new ProgressRunnable() {
                    float[] progress = { 0 };

                    public void run() {
                        try {
                            ZipUtils.zip(serverDir, new File[] { indexFile, book.bookFile, book.bookDir },
                                    outFile, progress, 0, 1, 9);
                        } catch (Exception ex) {
                            ErrorHandler.defaultHandler.submit(ex);
                        }
                    }

                    public float getProgress() {
                        return (float) progress[0];
                    }
                }, ServerConfigPanel.this);
            } catch (Exception ex) {
                ErrorHandler.defaultHandler.submit(ex);
            }
            if (indexFile.exists())
                indexFile.delete();
        }
    });
    deleteButton = new JButton(new AbstractAction(XMLResourceBundle.getBundledString("cfgDeleteRestoreLabel")) {
        public void actionPerformed(ActionEvent e) {
            Book book = (Book) bookList.getSelectedValue();
            if (book == null)
                return;
            book.deleted = !book.deleted;
            bookList.repaint();
        }
    });

    JPanel actionsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    actionsPanel.add(exportButton);
    actionsPanel.add(deleteButton);
    setupPanel.add(actionsPanel);

    add(setupPanel);

    JPanel optionsPanel = new JPanel(new LooseGridLayout(0, 2, 5, 5, false, false, SwingConstants.LEFT,
            SwingConstants.TOP, true, false));
    optionsPanel
            .setBorder(BorderFactory.createTitledBorder(XMLResourceBundle.getBundledString("cfgOptionsLabel")));
    JPanel timeoutPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    timeoutField = new JTextField(5);
    timeoutPanel.add(timeoutField);
    timeoutPanel.add(new JLabel(XMLResourceBundle.getBundledString("cfgTimeoutLabel")));
    optionsPanel.add(timeoutPanel);
    add(optionsPanel);

    updateBooks();
    setFields(null);

    final String xml = config.exists() ? StringUtils.readFile(config) : "<config></config>";
    String idle = StringUtils.getTagContent(xml, "idle");
    if (idle != null)
        try {
            timeoutField.setText("" + Integer.parseInt(idle));
        } catch (Throwable e) {
        }
}

From source file:cool.pandora.modeller.ui.jpanel.base.BagView.java

/**
 * createTopButtonPanel./*w w  w . j  a v a  2 s. c o  m*/
 *
 * @return buttonPanel
 */
private JPanel createTopButtonPanel() {
    final JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 10, 10));
    startNewBagHandler = new StartNewBagHandler(this);
    openBagHandler = new OpenBagHandler(this);
    createBagInPlaceHandler = new CreateBagInPlaceHandler(this);
    saveBagHandler = new SaveBagHandler(this);
    saveBagAsHandler = new SaveBagAsHandler(this);
    completeBagHandler = new CompleteBagHandler(this);
    validateBagHandler = new ValidateBagHandler(this);
    clearBagHandler = new ClearBagHandler(this);
    createDefaultContainersHandler = new CreateDefaultContainersHandler(this);
    uploadBagHandler = new UploadBagHandler(this);
    patchResourceHandler = new PatchResourceHandler(this);
    createListsHandler = new CreateListsHandler(this);
    createCanvasesHandler = new CreateCanvasesHandler(this);
    createSequencesHandler = new CreateSequencesHandler(this);
    patchSequenceHandler = new PatchSequenceHandler(this);
    patchCanvasHandler = new PatchCanvasHandler(this);
    patchManifestHandler = new PatchManifestHandler(this);
    createXmlFilesHandler = new CreateXmlFilesHandler(this);
    patchListHandler = new PatchListHandler(this);
    createPagesHandler = new CreatePagesHandler(this);
    createAreasHandler = new CreateAreasHandler(this);
    createLinesHandler = new CreateLinesHandler(this);
    createWordsHandler = new CreateWordsHandler(this);
    patchPagesHandler = new PatchPagesHandler(this);
    patchAreasHandler = new PatchAreasHandler(this);
    patchLinesHandler = new PatchLinesHandler(this);
    patchWordsHandler = new PatchWordsHandler(this);
    return buttonPanel;
}

From source file:org.openmicroscopy.shoola.agents.imviewer.util.proj.ProjSavingDialog.java

/**
 * Creates a row.// w w w.  j  av a 2s. c o  m
 * 
 * @return See above.
 */
private JPanel createRow() {
    JPanel row = new JPanel();
    row.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0));
    row.setBorder(null);
    return row;
}

From source file:org.onesun.sdi.swing.app.views.DataServicesView.java

private void addControlsToPanel() {
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setAutoscrolls(true);//from   w  ww. ja  v a 2 s .  c o  m

    JPanel panel = null;

    panel = new JPanel(new SpringLayout());
    panel.add(copyDataButton);
    SpringLayoutUtils.makeCompactGrid(panel, 1, 1, 5, 5, 5, 5);
    this.add(panel);

    panel = new JPanel(new SpringLayout());
    panel.add(containerPanel);
    SpringLayoutUtils.makeCompactGrid(panel, 1, 1, 5, 5, 5, 5);
    this.add(panel);

    panel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    panel.add(executeButton);
    panel.add(computeMetricsButton);
    this.add(panel);

    panel = new JPanel(new SpringLayout());
    JLabel label = new JLabel("Enriched Data", JLabel.LEADING);
    label.setPreferredSize(new Dimension(150, 24));
    scrollPane.setPreferredSize(new Dimension(250, 900));

    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);

    panel.add(label);
    label.setLabelFor(scrollPane);
    panel.add(scrollPane);
    SpringLayoutUtils.makeCompactGrid(panel, 2, 1, 5, 5, 5, 5);
    this.add(panel);

    panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    panel.add(rowCountLabel);
    this.add(panel);
}

From source file:org.jajuk.ui.views.SuggestionView.java

/**
 * Return the result panel for local albums.
 *
 * @param type /*from   w w  w .  ja  v a 2 s.  c  o m*/
 *
 * @return the local suggestions panel
 */
JScrollPane getLocalSuggestionsPanel(SuggestionType type) {
    FlowScrollPanel out = new FlowScrollPanel();
    out.setLayout(new FlowLayout(FlowLayout.LEFT));
    JScrollPane jsp = new JScrollPane(out, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    jsp.setBorder(null);
    out.setScroller(jsp);
    List<Album> albums = null;
    if (type == SuggestionType.BEST_OF) {
        albums = albumsPrefered;
    } else if (type == SuggestionType.NEWEST) {
        albums = albumsNewest;
    } else if (type == SuggestionType.RARE) {
        albums = albumsRare;
    }
    if (albums != null && albums.size() > 0) {
        for (Album album : albums) {
            LocalAlbumThumbnail thumb = new LocalAlbumThumbnail(album, 100, false);
            thumb.populate();
            thumb.getIcon().addMouseListener(new ThumbMouseListener());
            out.add(thumb);
        }
    } else {
        out.add(UtilGUI.getCentredPanel(new JLabel(Messages.getString("WikipediaView.3"))));
    }
    return jsp;
}

From source file:org.openmicroscopy.shoola.agents.metadata.rnd.GraphicsPane.java

/** 
 * Builds and lays out the images as seen by other experimenters.
 *  //from   w  w w.ja v  a 2 s.com
 * @param results The thumbnails to lay out.
 */
void displayViewedBy(List results) {
    if (results == null)
        return;
    JPanel p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    p.setBackground(UIUtilities.BACKGROUND_COLOR);
    Iterator<ViewedByItem> i = results.iterator();
    JPanel row = null;
    int index = 0;
    ViewedByItem item;
    int maxPerRow = 2;
    while (i.hasNext()) {
        item = i.next();
        if (index == 0) {
            row = new JPanel();
            row.setBackground(UIUtilities.BACKGROUND_COLOR);
            row.setLayout(new FlowLayout(FlowLayout.LEFT));
            row.add(item);
            index++;
        } else if (index == maxPerRow) {
            row.add(item);
            p.add(row);
            index = 0;
        } else {
            row.add(item);
            index++;
        }
    }
    if (index > 0)
        p.add(row);
    viewedBy.removeAll();
    JPanel content = UIUtilities.buildComponentPanel(p);
    content.setBackground(UIUtilities.BACKGROUND_COLOR);
    viewedBy.add(content);
    viewedBy.setVisible(true);
    viewedBy.setCollapsed(false);
}

From source file:metdemo.Finance.SHNetworks.java

/**
 * /*from   ww w .jav  a 2s. c o  m*/
 * @param jp
 * @param usersarray
 * @param viphm_hashmap
 */
protected void addBottomControls(final JPanel jp, String[] usersarray) {
    // create the control panel which will hold settings and picked list
    final JPanel control_panel = new JPanel();
    jp.add(control_panel, BorderLayout.SOUTH);
    control_panel.setLayout(new BorderLayout());

    // create the settings panel which will hold all of the settings
    Box settings_box = Box.createVerticalBox();
    settings_box.setBorder(BorderFactory.createTitledBorder("Display Settings"));
    control_panel.add(settings_box, BorderLayout.NORTH);
    JPanel settings_panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 10, 10));

    // add the zoom controls to the settings panel
    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            // call listener in GraphMouse instead of manipulating vv scale
            // directly
            // this is so the crossover from zoom to scale works with the
            // buttons
            // as well as with the mouse wheel
            Dimension d = m_visualizationview.getSize();
            m_graphmouse.mouseWheelMoved(
                    new MouseWheelEvent(m_visualizationview, MouseEvent.MOUSE_WHEEL, System.currentTimeMillis(),
                            0, d.width / 2, d.height / 2, 1, false, MouseWheelEvent.WHEEL_UNIT_SCROLL, 1, 1));
        }
    });
    JButton minus = new JButton(" - ");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            // call listener in GraphMouse instead of manipulating vv scale
            // directly
            // this is so the crossover from zoom to scale works with the
            // buttons
            // as well as with the mouse wheel
            Dimension d = m_visualizationview.getSize();
            m_graphmouse.mouseWheelMoved(
                    new MouseWheelEvent(m_visualizationview, MouseEvent.MOUSE_WHEEL, System.currentTimeMillis(),
                            0, d.width / 2, d.height / 2, 1, false, MouseWheelEvent.WHEEL_UNIT_SCROLL, 1, -1));
        }
    });
    Box zoomPanel = Box.createHorizontalBox();
    zoomPanel.setBorder(BorderFactory.createTitledBorder("Zoom"));
    minus.setAlignmentX(Component.LEFT_ALIGNMENT);
    plus.setAlignmentX(Component.RIGHT_ALIGNMENT);
    zoomPanel.add(minus);
    zoomPanel.add(plus);
    settings_panel.add(zoomPanel);

    // add the mouse mode combo box to the settings panel
    JComboBox modeBox = m_graphmouse.getModeComboBox();
    modeBox.setAlignmentX(Component.CENTER_ALIGNMENT);
    m_graphmouse.setMode(ModalGraphMouse.Mode.PICKING);
    JPanel modePanel = new JPanel(new BorderLayout()) {
        public Dimension getMaximumSize() {
            return getPreferredSize();
        }
    };
    modePanel.setBorder(BorderFactory.createTitledBorder("Mouse Mode"));
    modePanel.add(modeBox);
    settings_panel.add(modePanel);

    // add the display type combo box to the settings panel
    String[] layoutTypeStrings = { "OrgChart Layout", "FR Layout" };
    layoutTypeBox = new JComboBox(layoutTypeStrings);
    layoutTypeBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (layoutTypeBox.getSelectedIndex() == 0)
                moveVertices();//viphm_hashmap);
            else
                m_visualizationview.restart();
        }
    });
    layoutTypeBox.setAlignmentX(Component.CENTER_ALIGNMENT);
    JPanel displayTypePanel = new JPanel(new BorderLayout()) {
        public Dimension getMaximumSize() {
            return getPreferredSize();
        }
    };
    displayTypePanel.setBorder(BorderFactory.createTitledBorder("Display Type"));
    displayTypePanel.add(layoutTypeBox);
    settings_panel.add(displayTypePanel);

    // add user search to the panel - SHLOMO
    JPanel searchPanel = new JPanel(new BorderLayout()) {
        public Dimension getMaximumSize() {
            return getPreferredSize();
        }
    };
    // take the users and organize it sorted
    /*
     * ArrayList<String> ta = new ArrayList<String>(userlist); String []
     * usersarray = (String[]) ta.toArray(new String[ta.size()]);
     */Arrays.sort(usersarray);
    usercombolist = new JComboBox(usersarray);

    usercombolist.insertItemAt("Anyone", 0);
    usercombolist.setSelectedIndex(0);// show only anyone choice
    // lets add all current users to the list

    searchPanel.setBorder(BorderFactory.createTitledBorder("Search User"));
    searchPanel.add(usercombolist);

    //add a check box to show not show labels on all vertices
    m_showLabels = new JCheckBox("Show name?", false);
    settings_panel.add(m_showLabels);

    settings_panel.add(searchPanel);

    usercombolist.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            // will need to react to the choice list
            if (usercombolist.getSelectedIndex() == 0) {
                // might have to reset something in case they move back
                PickedState picked_state = m_visualizationview.getPickedState();
                picked_state.clearPickedVertices();

                return;
            }
            String username = (String) usercombolist.getSelectedItem();

            for (Iterator walker = m_layout.getVertexIterator(); walker.hasNext();) {
                VIPVertex V = (VIPVertex) walker.next();

                // Integer indexNum = (Integer)index.getNumber(V);
                String seeName = V.getAcct();// accounts_arraylist.get(indexNum);
                if (username.equals(seeName)) {
                    PickedState picked_state = m_visualizationview.getPickedState();
                    picked_state.clearPickedVertices();
                    picked_state.pick(V, true);
                    /*
                     * int x= (int)m_layout.getX(V); int y=
                     * (int)m_layout.getY(V); //lets trigger the event
                     * m_graphmouse.mousePressed(new
                     * MouseEvent(m_visualizationview,MouseEvent.MOUSE_CLICKED,System.currentTimeMillis(),0,x,y,2,false));
                     */return;
                }
            }

        }
    });

    // add the settings panel to the settings box
    settings_box.add(settings_panel);

    // add the vip table to the control panel
    SortTableModel model = new SortTableModel();
    model.addColumn("Account");
    model.addColumn("ResponseScore");
    model.addColumn("SocialScore");
    m_timeTable = new JTable(model);
    model.addMouseListenerToHeaderInTable(m_timeTable);
    m_timeTable.setRowSelectionAllowed(true);
    m_timeTable.setColumnSelectionAllowed(false);
    m_timeTable.getTableHeader().setReorderingAllowed(false);
    m_timeTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    m_timeTable.setDefaultRenderer(model.getColumnClass(1), md5Renderer);
    tablePane = new JScrollPane(m_timeTable);
    tablePane.setPreferredSize(new Dimension(300, 150));
    control_panel.add(tablePane, BorderLayout.SOUTH);
}

From source file:nz.ac.waikato.cms.supernova.gui.Supernova.java

/**
 * Creates the panel for batch generation.
 *
 * @return      the panel//from w  ww  .  j a va  2s .co  m
 */
protected BasePanel createBatchPanel() {
    BasePanel result;
    JPanel params;
    JPanel left1;
    JPanel left2;
    JPanel panel;

    result = new BasePanel(new BorderLayout());
    m_BatchLog = new JTextArea(20, 40);
    m_BatchLog.setFont(Font.decode("Monospaced-PLAIN-12"));
    result.add(new BaseScrollPane(m_BatchLog), BorderLayout.CENTER);

    left1 = new JPanel(new BorderLayout());
    result.add(left1, BorderLayout.WEST);

    // params with height 2
    params = new JPanel(new GridLayout(0, 1));
    left1.add(params, BorderLayout.NORTH);

    m_BatchColors = new ColorTable();
    left1.add(new BaseScrollPane(m_BatchColors), BorderLayout.NORTH);

    // params with height 1
    panel = new JPanel(new BorderLayout());
    left1.add(panel, BorderLayout.CENTER);
    left2 = new JPanel(new BorderLayout());
    panel.add(left2, BorderLayout.NORTH);
    params = new JPanel(new GridLayout(0, 1));
    left2.add(params, BorderLayout.NORTH);

    // background
    m_BatchBackground = new ColorButton(Color.BLACK);
    params.add(createParameter("Background", m_BatchBackground));

    // opacity
    m_BatchOpacity = new JSpinner();
    m_BatchOpacity.setValue(10);
    ((SpinnerNumberModel) m_BatchOpacity.getModel()).setMinimum(0);
    ((SpinnerNumberModel) m_BatchOpacity.getModel()).setMaximum(100);
    ((SpinnerNumberModel) m_BatchOpacity.getModel()).setStepSize(10);
    ((JSpinner.DefaultEditor) m_BatchOpacity.getEditor()).getTextField().setColumns(5);
    params.add(createParameter("Opacity %", m_BatchOpacity));

    // margin
    m_BatchMargin = new JSpinner();
    m_BatchMargin.setValue(20);
    ((SpinnerNumberModel) m_BatchMargin.getModel()).setMinimum(0);
    ((SpinnerNumberModel) m_BatchMargin.getModel()).setMaximum(100);
    ((SpinnerNumberModel) m_BatchMargin.getModel()).setStepSize(10);
    ((JSpinner.DefaultEditor) m_BatchMargin.getEditor()).getTextField().setColumns(5);
    params.add(createParameter("Margin %", m_BatchMargin));

    // width
    m_BatchWidth = new JSpinner();
    m_BatchWidth.setValue(400);
    ((SpinnerNumberModel) m_BatchWidth.getModel()).setMinimum(1);
    ((SpinnerNumberModel) m_BatchWidth.getModel()).setStepSize(100);
    ((JSpinner.DefaultEditor) m_BatchWidth.getEditor()).getTextField().setColumns(5);
    params.add(createParameter("Width", m_BatchWidth));

    // height
    m_BatchHeight = new JSpinner();
    m_BatchHeight.setValue(400);
    ((SpinnerNumberModel) m_BatchHeight.getModel()).setMinimum(1);
    ((SpinnerNumberModel) m_BatchHeight.getModel()).setStepSize(100);
    ((JSpinner.DefaultEditor) m_BatchHeight.getEditor()).getTextField().setColumns(5);
    params.add(createParameter("Height", m_BatchHeight));

    // generator
    m_BatchGenerator = new JComboBox<>(Registry.toStringArray(Registry.getGenerators(), true));
    params.add(createParameter("Generator", m_BatchGenerator));

    // center
    m_BatchCenter = new JComboBox<>(Registry.toStringArray(Registry.getCenters(), true));
    params.add(createParameter("Center", m_BatchCenter));

    // csv
    m_BatchCSV = new FileChooserPanel();
    m_BatchCSV.addChoosableFileFilter(new ExtensionFileFilter("CSV files", "csv"));
    m_BatchCSV.setPreferredSize(new Dimension(170, (int) m_BatchCSV.getPreferredSize().getHeight()));
    params.add(createParameter("CSV", m_BatchCSV));

    // output
    m_BatchOutput = new DirectoryChooserPanel();
    m_BatchOutput.setPreferredSize(new Dimension(170, (int) m_BatchOutput.getPreferredSize().getHeight()));
    params.add(createParameter("Output", m_BatchOutput));

    // generate
    panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    m_BatchGenerate = new JButton("Generate");
    m_BatchGenerate.addActionListener((ActionEvent e) -> {
        SwingWorker worker = new SwingWorker() {
            @Override
            protected Object doInBackground() throws Exception {
                generateBatchOutput();
                return null;
            }
        };
        worker.execute();
    });
    panel.add(m_BatchGenerate);
    params.add(panel);

    adjustLabels();

    return result;
}

From source file:org.eobjects.datacleaner.panels.WelcomePanel.java

private DCPanel createNewDatastorePanel() {
    final DCPanel panel = new DCPanel();
    panel.setBorder(WidgetUtils.BORDER_LIST_ITEM);
    panel.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
    panel.add(createNewDatastoreButton("CSV file",
            "Comma-separated values (CSV) file (or file with other separators)", IconUtils.CSV_IMAGEPATH,
            CsvDatastore.class, CsvDatastoreDialog.class));
    panel.add(createNewDatastoreButton("Excel spreadsheet",
            "Microsoft Excel spreadsheet. Either .xls (97-2003) or .xlsx (2007+) format.",
            IconUtils.EXCEL_IMAGEPATH, ExcelDatastore.class, ExcelDatastoreDialog.class));
    panel.add(createNewDatastoreButton("Access database", "Microsoft Access database file (.mdb).",
            IconUtils.ACCESS_IMAGEPATH, AccessDatastore.class, AccessDatastoreDialog.class));
    panel.add(createNewDatastoreButton("SAS library", "A directory of SAS library files (.sas7bdat).",
            IconUtils.SAS_IMAGEPATH, SasDatastore.class, SasDatastoreDialog.class));
    panel.add(createNewDatastoreButton("DBase database", "DBase database file (.dbf)",
            IconUtils.DBASE_IMAGEPATH, DbaseDatastore.class, DbaseDatastoreDialog.class));
    panel.add(createNewDatastoreButton("Fixed width file",
            "Text file with fixed width values. Each value spans a fixed amount of text characters.",
            IconUtils.FIXEDWIDTH_IMAGEPATH, FixedWidthDatastore.class, FixedWidthDatastoreDialog.class));
    panel.add(createNewDatastoreButton("XML file", "Extensible Markup Language file (.xml)",
            IconUtils.XML_IMAGEPATH, XmlDatastore.class, XmlDatastoreDialog.class));
    panel.add(createNewDatastoreButton("JSON file", "JavaScript Object NOtation file (.json).",
            IconUtils.JSON_IMAGEPATH, JsonDatastore.class, JsonDatastoreDialog.class));
    panel.add(/*  w  w  w .j  a  va 2s .c om*/
            createNewDatastoreButton("OpenOffice.org Base database", "OpenOffice.org Base database file (.odb)",
                    IconUtils.ODB_IMAGEPATH, OdbDatastore.class, OdbDatastoreDialog.class));

    panel.add(Box.createHorizontalStrut(10));

    panel.add(createNewDatastoreButton("Salesforce.com", "Connect to a Salesforce.com account",
            IconUtils.SALESFORCE_IMAGEPATH, SalesforceDatastore.class, SalesforceDatastoreDialog.class));
    panel.add(createNewDatastoreButton("SugarCRM", "Connect to a SugarCRM system",
            IconUtils.SUGAR_CRM_IMAGEPATH, SugarCrmDatastore.class, SugarCrmDatastoreDialog.class));

    panel.add(Box.createHorizontalStrut(10));

    panel.add(createNewDatastoreButton("MongoDB database", "Connect to a MongoDB database",
            IconUtils.MONGODB_IMAGEPATH, MongoDbDatastore.class, MongoDbDatastoreDialog.class));

    panel.add(createNewDatastoreButton("CouchDB database", "Connect to an Apache CouchDB database",
            IconUtils.COUCHDB_IMAGEPATH, CouchDbDatastore.class, CouchDbDatastoreDialog.class));

    panel.add(createNewDatastoreButton("HBase database", "Connect to an Apache HBase database",
            IconUtils.HBASE_IMAGEPATH, HBaseDatastore.class, HBaseDatastoreDialog.class));

    // set of databases that are displayed directly on panel
    final Set<String> databaseNames = new HashSet<String>();

    createDefaultDatabaseButtons(panel, databaseNames);

    final JButton moreDatastoreTypesButton = new JButton("More",
            imageManager.getImageIcon(IconUtils.FILE_FOLDER, IconUtils.ICON_SIZE_SMALL));
    moreDatastoreTypesButton.setMargin(new Insets(1, 1, 1, 4));
    moreDatastoreTypesButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            final JPopupMenu popup = new JPopupMenu();

            // installed databases
            final List<DatabaseDriverDescriptor> databaseDrivers = _databaseDriverCatalog
                    .getInstalledWorkingDatabaseDrivers();
            for (DatabaseDriverDescriptor databaseDriver : databaseDrivers) {
                final String databaseName = databaseDriver.getDisplayName();
                if (!databaseNames.contains(databaseName)) {
                    final String imagePath = databaseDriver.getIconImagePath();
                    final ImageIcon icon = imageManager.getImageIcon(imagePath, IconUtils.ICON_SIZE_SMALL);
                    final JMenuItem menuItem = WidgetFactory.createMenuItem(databaseName, icon);
                    menuItem.addActionListener(createJdbcActionListener(databaseName));
                    popup.add(menuItem);
                }
            }

            // custom/other jdbc connection
            {
                final ImageIcon icon = imageManager.getImageIcon(IconUtils.GENERIC_DATASTORE_IMAGEPATH,
                        IconUtils.ICON_SIZE_SMALL);
                final JMenuItem menuItem = WidgetFactory.createMenuItem("Other database", icon);
                menuItem.addActionListener(createJdbcActionListener(null));
                popup.add(menuItem);
            }

            // composite datastore
            final JMenuItem compositeMenuItem = WidgetFactory.createMenuItem("Composite datastore",
                    imageManager.getImageIcon(IconUtils.COMPOSITE_IMAGEPATH, IconUtils.ICON_SIZE_SMALL));
            compositeMenuItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    new CompositeDatastoreDialog(_datastoreCatalog,
                            _analysisJobBuilderWindow.getWindowContext()).setVisible(true);
                }
            });

            final JMenuItem databaseDriversMenuItem = WidgetFactory.createMenuItem("Manage database drivers...",
                    imageManager.getImageIcon(IconUtils.MENU_OPTIONS, IconUtils.ICON_SIZE_SMALL));
            databaseDriversMenuItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    OptionsDialog dialog = _optionsDialogProvider.get();
                    dialog.selectDatabaseDriversTab();
                    dialog.setVisible(true);
                }
            });

            popup.add(databaseDriversMenuItem);
            popup.add(new JSeparator(JSeparator.HORIZONTAL));
            popup.add(compositeMenuItem);
            popup.setBorder(WidgetUtils.BORDER_THIN);

            popup.show(moreDatastoreTypesButton, 0, moreDatastoreTypesButton.getHeight());
        }
    });

    panel.add(Box.createHorizontalStrut(10));
    panel.add(moreDatastoreTypesButton);

    return panel;
}

From source file:cool.pandora.modeller.ui.jpanel.base.BagView.java

/**
 * createBagPanel./*www  . j ava2 s  .c  om*/
 *
 * @return splitPane
 */
private JSplitPane createBagPanel() {

    final LineBorder border = new LineBorder(Color.GRAY, 1);

    bagButtonPanel = createBagButtonPanel();

    final JPanel bagTagButtonPanel = createBagTagButtonPanel();

    bagPayloadTree = new BagTree(this, AbstractBagConstants.DATA_DIRECTORY);
    bagPayloadTree.setEnabled(false);

    bagPayloadTreePanel = new BagTreePanel(bagPayloadTree);
    bagPayloadTreePanel.setEnabled(false);
    bagPayloadTreePanel.setBorder(border);
    bagPayloadTreePanel.setToolTipText(getMessage("bagTree.help"));

    bagTagFileTree = new BagTree(this, getMessage("bag.label.noname"));
    bagTagFileTree.setEnabled(false);
    bagTagFileTreePanel = new BagTreePanel(bagTagFileTree);
    bagTagFileTreePanel.setEnabled(false);
    bagTagFileTreePanel.setBorder(border);
    bagTagFileTreePanel.setToolTipText(getMessage("bagTree.help"));

    tagManifestPane = new TagManifestPane(this);
    tagManifestPane.setToolTipText(getMessage("compositePane.tab.help"));

    final JSplitPane splitPane = new JSplitPane();
    splitPane.setResizeWeight(0.5);
    splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);

    final JPanel payloadPannel = new JPanel();
    splitPane.setLeftComponent(payloadPannel);
    payloadPannel.setLayout(new BorderLayout(0, 0));

    final JPanel payLoadToolBarPanel = new JPanel();
    payloadPannel.add(payLoadToolBarPanel, BorderLayout.NORTH);
    payLoadToolBarPanel.setLayout(new GridLayout(1, 0, 0, 0));

    final JPanel payloadLabelPanel = new JPanel();
    final FlowLayout flowLayout = (FlowLayout) payloadLabelPanel.getLayout();
    flowLayout.setAlignment(FlowLayout.LEFT);
    payLoadToolBarPanel.add(payloadLabelPanel);

    final JLabel lblPayloadTree = new JLabel(getMessage("bagView.payloadTree.name"));
    payloadLabelPanel.add(lblPayloadTree);

    payLoadToolBarPanel.add(bagButtonPanel);

    payloadPannel.add(bagPayloadTreePanel, BorderLayout.CENTER);

    final JPanel tagFilePanel = new JPanel();
    splitPane.setRightComponent(tagFilePanel);
    tagFilePanel.setLayout(new BorderLayout(0, 0));

    final JPanel tagFileToolBarPannel = new JPanel();
    tagFilePanel.add(tagFileToolBarPannel, BorderLayout.NORTH);
    tagFileToolBarPannel.setLayout(new GridLayout(0, 2, 0, 0));

    final JPanel TagFileLabelPanel = new JPanel();
    final FlowLayout tagFileToolbarFlowLayout = (FlowLayout) TagFileLabelPanel.getLayout();
    tagFileToolbarFlowLayout.setAlignment(FlowLayout.LEFT);
    tagFileToolBarPannel.add(TagFileLabelPanel);

    final JLabel tagFileTreeLabel = new JLabel(getMessage("bagView.TagFilesTree.name"));
    TagFileLabelPanel.add(tagFileTreeLabel);

    tagFileToolBarPannel.add(bagTagButtonPanel);

    tagFilePanel.add(bagTagFileTreePanel, BorderLayout.CENTER);

    return splitPane;
}