Example usage for javax.swing JSeparator JSeparator

List of usage examples for javax.swing JSeparator JSeparator

Introduction

In this page you can find the example usage for javax.swing JSeparator JSeparator.

Prototype

public JSeparator() 

Source Link

Document

Creates a new horizontal separator.

Usage

From source file:org.fhcrc.cpl.toolbox.gui.chart.PanelWithChart.java

public void addSeparatorToPopupMenu() {
    _chartPanel.getPopupMenu().add(new JSeparator());
}

From source file:gov.loc.repository.bagger.ui.NewBagInPlaceFrame.java

private JPanel createComponents() {

    TitlePane titlePane = new TitlePane();
    initStandardCommands();/*  w w  w. ja  va2s . c om*/
    JPanel pageControl = new JPanel(new BorderLayout());
    JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("NewBagInPlace.title"));
    titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("NewBagInPlace.description")));
    titlePaneContainer.add(titlePane.getControl());
    titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH);
    pageControl.add(titlePaneContainer, BorderLayout.NORTH);

    JPanel contentPanel = new JPanel(new GridBagLayout());
    contentPanel.setBorder(new EmptyBorder(10, 10, 10, 10));

    int row = 0;
    layoutSelectDataContent(contentPanel, row++);
    layoutBagVersionContent(contentPanel, row++);
    layoutProfileSelectionContent(contentPanel, row++);
    layoutAddKeepFilesToEmptyCheckBox(contentPanel, row++);
    layoutSpacer(contentPanel, row++);

    GuiStandardUtils.attachDialogBorder(contentPanel);
    pageControl.add(contentPanel);
    JComponent buttonBar = createButtonBar();
    pageControl.add(buttonBar, BorderLayout.SOUTH);

    this.pack();
    return pageControl;

}

From source file:layout.GridLayoutDemo.java

public void addComponentsToPane(final Container pane) {
    initGaps();//  w w w.ja va2 s  .  co m
    final JPanel compsToExperiment = new JPanel();
    compsToExperiment.setLayout(experimentLayout);
    JPanel controls = new JPanel();
    controls.setLayout(new GridLayout(2, 3));

    //Set up components preferred size
    JButton b = new JButton("Just fake button");
    Dimension buttonSize = b.getPreferredSize();
    compsToExperiment.setPreferredSize(new Dimension((int) (buttonSize.getWidth() * 2.5) + maxGap,
            (int) (buttonSize.getHeight() * 3.5) + maxGap * 2));

    //Add buttons to experiment with Grid Layout
    compsToExperiment.add(new JButton("Button 1"));
    compsToExperiment.add(new JButton("Button 2"));
    compsToExperiment.add(new JButton("Button 3"));
    compsToExperiment.add(new JButton("Long-Named Button 4"));
    compsToExperiment.add(new JButton("5"));

    //Add controls to set up horizontal and vertical gaps
    controls.add(new Label("Horizontal gap:"));
    controls.add(new Label("Vertical gap:"));
    controls.add(new Label(" "));
    controls.add(horGapComboBox);
    controls.add(verGapComboBox);
    controls.add(applyButton);

    //Process the Apply gaps button press
    applyButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            //Get the horizontal gap value
            String horGap = (String) horGapComboBox.getSelectedItem();
            //Get the vertical gap value
            String verGap = (String) verGapComboBox.getSelectedItem();
            //Set up the horizontal gap value
            experimentLayout.setHgap(Integer.parseInt(horGap));
            //Set up the vertical gap value
            experimentLayout.setVgap(Integer.parseInt(verGap));
            //Set up the layout of the buttons
            experimentLayout.layoutContainer(compsToExperiment);
        }
    });
    pane.add(compsToExperiment, BorderLayout.NORTH);
    pane.add(new JSeparator(), BorderLayout.CENTER);
    pane.add(controls, BorderLayout.SOUTH);
}

From source file:es.uvigo.ei.sing.adops.views.TextFileViewer.java

public TextFileViewer(final File file) {
    super(new BorderLayout());

    this.file = file;

    // TEXT AREA/*w  w w  . j a  va2  s.  c o m*/
    this.textArea = new JTextArea(TextFileViewer.loadFile(file));
    this.textArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, this.textArea.getFont().getSize()));
    this.textArea.setLineWrap(true);
    this.textArea.setWrapStyleWord(true);
    this.textArea.setEditable(false);

    this.highlightPatiner = new DefaultHighlighter.DefaultHighlightPainter(Color.YELLOW);

    // OPTIONS PANEL
    final JPanel panelOptions = new JPanel(new BorderLayout());
    final JPanel panelOptionsEast = new JPanel(new FlowLayout());
    final JPanel panelOptionsWest = new JPanel(new FlowLayout());
    final JCheckBox chkLineWrap = new JCheckBox("Line wrap", true);
    final JButton btnChangeFont = new JButton("Change Font");

    final JLabel lblSearch = new JLabel("Search");
    this.txtSearch = new JTextField();
    this.chkRegularExpression = new JCheckBox("Reg. exp.", true);
    final JButton btnSearch = new JButton("Search");
    final JButton btnClear = new JButton("Clear");
    this.txtSearch.setColumns(12);
    // this.txtSearch.setOpaque(true);

    panelOptionsEast.add(btnChangeFont);
    panelOptionsEast.add(chkLineWrap);
    panelOptionsWest.add(lblSearch);
    panelOptionsWest.add(this.txtSearch);
    panelOptionsWest.add(this.chkRegularExpression);
    panelOptionsWest.add(btnSearch);
    panelOptionsWest.add(btnClear);

    if (FastaUtils.isFasta(file)) {
        panelOptionsWest.add(new JSeparator());

        final JButton btnExport = new JButton("Export...");

        panelOptionsWest.add(btnExport);

        btnExport.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    new ExportDialog(file).setVisible(true);
                } catch (Exception e1) {
                    JOptionPane.showMessageDialog(Workbench.getInstance().getMainFrame(),
                            "Error reading fasta file: " + e1.getMessage(), "Export Error",
                            JOptionPane.ERROR_MESSAGE);
                }
            }
        });
    }

    panelOptions.add(panelOptionsWest, BorderLayout.WEST);
    panelOptions.add(panelOptionsEast, BorderLayout.EAST);

    this.fontChooser = new JFontChooser();

    this.add(new JScrollPane(this.textArea), BorderLayout.CENTER);
    this.add(panelOptions, BorderLayout.NORTH);

    chkLineWrap.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            textArea.setLineWrap(chkLineWrap.isSelected());
        }
    });

    btnChangeFont.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            changeFont();
        }
    });

    this.textArea.getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void removeUpdate(DocumentEvent e) {
            TextFileViewer.this.wasModified = true;
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            TextFileViewer.this.wasModified = true;
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            TextFileViewer.this.wasModified = true;
        }
    });

    this.textArea.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            if (TextFileViewer.this.wasModified) {
                try {
                    FileUtils.write(TextFileViewer.this.file, TextFileViewer.this.textArea.getText());
                    TextFileViewer.this.wasModified = false;
                } catch (IOException e1) {
                    e1.printStackTrace();
                }
            }
        }
    });

    final ActionListener alSearch = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            updateSearch();
        }
    };
    txtSearch.addActionListener(alSearch);
    btnSearch.addActionListener(alSearch);

    btnClear.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            clearSearch();
        }
    });
}

From source file:com.mirth.connect.client.ui.AttachmentExportDialog.java

private void initLayout() {
    setLayout(new MigLayout("insets 12, fill", "[right][left]"));

    add(new JLabel("File Type:"));
    add(binaryButton, "split 2");
    add(textButton, "wrap");

    add(new JLabel("Export To:"));
    add(serverButton, "split 3");
    add(localButton);/*from   ww  w .j  a  va2  s  .c  o m*/
    add(browseButton, "wrap");

    add(new JLabel("File:"));
    add(fileField, "push, growx, span");

    add(new JSeparator(), "grow, span");
    add(exportButton, "width 60, right, split 2, spanx, gaptop 4");
    add(cancelButton, "width 60, gaptop 4");
}

From source file:net.sf.mzmine.modules.peaklistmethods.peakpicking.adap3decompositionV2.ADAP3DecompositionV2SetupDialog.java

/** Creates the interface elements */
@Override/*from ww w. jav  a  2 s . c om*/
protected void addDialogComponents() {
    super.addDialogComponents();

    comboClustersModel = new DefaultComboBoxModel<>();

    PeakList[] peakLists = MZmineCore.getDesktop().getSelectedPeakLists();

    // -----------------------------
    // Panel with preview UI elements
    // -----------------------------

    // Preview CheckBox
    chkPreview = new JCheckBox("Show preview");
    chkPreview.addActionListener(this);
    chkPreview.setHorizontalAlignment(SwingConstants.CENTER);
    chkPreview.setEnabled(peakLists != null && peakLists.length > 0);

    // Preview panel that will contain ComboBoxes
    final JPanel panel = new JPanel(new BorderLayout());
    panel.add(new JSeparator(), BorderLayout.NORTH);
    panel.add(chkPreview, BorderLayout.CENTER);
    panel.add(Box.createVerticalStrut(10), BorderLayout.SOUTH);
    pnlUIElements = new JPanel(new BorderLayout());
    pnlUIElements.add(panel, BorderLayout.NORTH);

    // ComboBox with Clusters
    cboClusters = new JComboBox<>(comboClustersModel);
    cboClusters.setFont(COMBO_FONT);
    cboClusters.addActionListener(this);

    pnlComboBoxes = GUIUtils.makeTablePanel(1, 2, new JComponent[] { new JLabel("Clusters"), cboClusters });

    // --------------------------------------------------------------------
    // ----- Panel with plots --------------------------------------
    // --------------------------------------------------------------------

    pnlPlots = new JPanel();
    pnlPlots.setLayout(new BoxLayout(pnlPlots, BoxLayout.Y_AXIS));

    // Plot with retention-time clusters
    retTimeMZPlot = new SimpleScatterPlot("Retention time", "m/z");
    retTimeMZPlot.setMinimumSize(MIN_DIMENSIONS);

    final JPanel pnlPlotRetTimeClusters = new JPanel(new BorderLayout());
    pnlPlotRetTimeClusters.setBackground(Color.white);
    pnlPlotRetTimeClusters.add(retTimeMZPlot, BorderLayout.CENTER);
    GUIUtils.addMarginAndBorder(pnlPlotRetTimeClusters, 10);

    // Plot with chromatograms
    retTimeIntensityPlot = new EICPlot();
    retTimeIntensityPlot.setMinimumSize(MIN_DIMENSIONS);

    JPanel pnlPlotShapeClusters = new JPanel(new BorderLayout());
    pnlPlotShapeClusters.setBackground(Color.white);
    pnlPlotShapeClusters.add(retTimeIntensityPlot, BorderLayout.CENTER);
    GUIUtils.addMarginAndBorder(pnlPlotShapeClusters, 10);

    pnlPlots.add(pnlPlotRetTimeClusters);
    pnlPlots.add(pnlPlotShapeClusters);

    super.mainPanel.add(pnlUIElements, 0, super.getNumberOfParameters() + 3, 2, 1, 0, 0,
            GridBagConstraints.HORIZONTAL);
}

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

/**
 * createComponents.//w  ww.  j  a va2  s .  c  o  m
 *
 * @return pageControl
 */
private JPanel createComponents() {
    final TitlePane titlePane = new TitlePane();
    initStandardCommands();
    final JPanel pageControl = new JPanel(new BorderLayout());
    final JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("NewBagFrame.title"));
    titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("NewBagFrame" + ".description")));
    titlePaneContainer.add(titlePane.getControl());
    titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH);
    pageControl.add(titlePaneContainer, BorderLayout.NORTH);

    final JPanel contentPane = new JPanel();
    contentPane.setLayout(new GridBagLayout());

    int row = 0;
    layoutBagVersionSelection(contentPane, row++);
    layoutProfileSelection(contentPane, row++);

    if (getPreferredSize() != null) {
        contentPane.setPreferredSize(getPreferredSize());
    }

    GuiStandardUtils.attachDialogBorder(contentPane);
    pageControl.add(contentPane);
    final JComponent buttonBar = createButtonBar();
    pageControl.add(buttonBar, BorderLayout.SOUTH);

    this.pack();
    return pageControl;
}

From source file:com.mucommander.ui.viewer.image.ImageViewer.java

public ImageViewer() {
    imageViewerImpl = new ImageViewerImpl();

    setComponentToPresent(imageViewerImpl);

    // create Go menu
    MnemonicHelper menuMnemonicHelper = new MnemonicHelper();
    controlsMenu = MenuToolkit.addMenu(Translator.get("image_viewer.controls_menu"), menuMnemonicHelper, null);

    nextImageItem = MenuToolkit.addMenuItem(controlsMenu, Translator.get("image_viewer.next_image"),
            menuMnemonicHelper, KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), this);
    prevImageItem = MenuToolkit.addMenuItem(controlsMenu, Translator.get("image_viewer.previous_image"),
            menuMnemonicHelper, KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), this);
    controlsMenu.add(new JSeparator());
    if (OsFamily.getCurrent() != OsFamily.MAC_OS_X) {
        zoomInItem = MenuToolkit.addMenuItem(controlsMenu, Translator.get("image_viewer.zoom_in"),
                menuMnemonicHelper, KeyStroke.getKeyStroke(KeyEvent.VK_ADD, 0), this);
        zoomOutItem = MenuToolkit.addMenuItem(controlsMenu, Translator.get("image_viewer.zoom_out"),
                menuMnemonicHelper, KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, 0), this);
    } else {/* w w  w  . ja  v a 2  s  .  c  o  m*/
        zoomInItem = MenuToolkit.addMenuItem(controlsMenu, Translator.get("image_viewer.zoom_in"),
                menuMnemonicHelper, KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), this);
        zoomOutItem = MenuToolkit.addMenuItem(controlsMenu, Translator.get("image_viewer.zoom_out"),
                menuMnemonicHelper, KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), this);
    }
}

From source file:com.floreantpos.config.ui.DatabaseConfigurationView.java

protected void initUI() {
    setLayout(new BorderLayout());

    JPanel contentPanel = new JPanel();
    contentPanel.setLayout(new MigLayout("fill", "[][grow,fill]", "[][][][][][][][grow,fill]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    tfServerAddress = new POSTextField();
    tfServerPort = new POSTextField();
    tfDatabaseName = new POSTextField();
    tfUserName = new POSTextField();
    tfPassword = new POSPasswordField();
    databaseCombo = new JComboBox(Database.values());

    String databaseProviderName = AppConfig.getDatabaseProviderName();
    if (StringUtils.isNotEmpty(databaseProviderName)) {
        databaseCombo.setSelectedItem(Database.getByProviderName(databaseProviderName));
    }/*from   www . j  a v  a 2  s .  c  o  m*/

    contentPanel.add(new JLabel(Messages.getString("DatabaseConfigurationDialog.8"))); //$NON-NLS-1$
    contentPanel.add(databaseCombo, "grow, wrap"); //$NON-NLS-1$
    lblServerAddress = new JLabel(Messages.getString("DatabaseConfigurationDialog.10") + ":"); //$NON-NLS-1$ //$NON-NLS-2$
    contentPanel.add(lblServerAddress);
    contentPanel.add(tfServerAddress, "grow, wrap"); //$NON-NLS-1$
    lblServerPort = new JLabel(Messages.getString("DatabaseConfigurationDialog.13") + ":"); //$NON-NLS-1$ //$NON-NLS-2$
    contentPanel.add(lblServerPort);
    contentPanel.add(tfServerPort, "grow, wrap"); //$NON-NLS-1$
    lblDbName = new JLabel(Messages.getString("DatabaseConfigurationDialog.16") + ":"); //$NON-NLS-1$ //$NON-NLS-2$
    contentPanel.add(lblDbName);
    contentPanel.add(tfDatabaseName, "grow, wrap"); //$NON-NLS-1$
    lblUserName = new JLabel(Messages.getString("DatabaseConfigurationDialog.19") + ":"); //$NON-NLS-1$ //$NON-NLS-2$
    contentPanel.add(lblUserName);
    contentPanel.add(tfUserName, "grow, wrap"); //$NON-NLS-1$
    lblDbPassword = new JLabel(Messages.getString("DatabaseConfigurationDialog.22") + ":"); //$NON-NLS-1$ //$NON-NLS-2$
    contentPanel.add(lblDbPassword);
    contentPanel.add(tfPassword, "grow, wrap"); //$NON-NLS-1$
    contentPanel.add(new JSeparator(), "span, grow, gaptop 10"); //$NON-NLS-1$

    btnTestConnection = new JButton(Messages.getString("DatabaseConfigurationDialog.26")); //$NON-NLS-1$
    btnTestConnection.setActionCommand(TEST);
    btnSave = new JButton(Messages.getString("DatabaseConfigurationDialog.27")); //$NON-NLS-1$
    btnSave.setActionCommand(SAVE);

    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    btnCreateDb = new JButton(Messages.getString("DatabaseConfigurationDialog.29")); //$NON-NLS-1$
    btnCreateDb.setActionCommand(CONFIGURE_DB);
    buttonPanel.add(btnCreateDb);
    buttonPanel.add(btnTestConnection);
    buttonPanel.add(btnSave);

    contentPanel.add(buttonPanel, "span, grow"); //$NON-NLS-1$

    JScrollPane scrollPane = new JScrollPane(contentPanel);
    scrollPane.setBorder(null);
    add(scrollPane);
}

From source file:com.floreantpos.config.ui.AddPrinterDialog.java

@Override
public void initUI() {
    setLayout(new BorderLayout(5, 5));
    JPanel centerPanel = new JPanel();
    centerPanel.setLayout(new MigLayout("", "[][grow][]", "[][][][][grow]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    titlePanel = new TitlePanel();
    titlePanel.setTitle("Printer Type:");//$NON-NLS-1$
    add(titlePanel, BorderLayout.NORTH);

    JLabel lblName = new JLabel("Virtual Printer Name : "); //$NON-NLS-1$
    centerPanel.add(lblName, "cell 0 0,alignx trailing"); //$NON-NLS-1$

    tfName = new FixedLengthTextField(20);

    cbVirtualPrinter = new JComboBox();
    List<VirtualPrinter> virtualPrinters = VirtualPrinterDAO.getInstance().findAll();
    cbVirtualPrinter/*from   ww w.  j  a  v a  2 s . com*/
            .setModel(new DefaultComboBoxModel<VirtualPrinter>(virtualPrinters.toArray(new VirtualPrinter[0])));
    //centerPanel.add(cbVirtualPrinter, "cell 1 0,growx"); //$NON-NLS-1$

    centerPanel.add(tfName, "cell 1 0,growx"); //$NON-NLS-1$

    JButton btnNew = new JButton(Messages.getString("AddPrinterDialog.7")); //$NON-NLS-1$
    btnNew.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            doAddNewVirtualPrinter();
        }
    });
    //centerPanel.add(btnNew, "cell 2 0"); //$NON-NLS-1$

    JLabel lblDevice = new JLabel(Messages.getString("AddPrinterDialog.9")); //$NON-NLS-1$
    centerPanel.add(lblDevice, "cell 0 1,alignx trailing"); //$NON-NLS-1$

    cbDevice = new JComboBox();
    List printerServices = new ArrayList<>();
    printerServices.add(DO_NOT_PRINT);
    PrintService[] lookupPrintServices = PrintServiceLookup.lookupPrintServices(null, null);
    //cbDevice.setModel(new DefaultComboBoxModel(PrintServiceLookup.lookupPrintServices(null, null)));
    cbDevice.addItem(null);
    for (int i = 0; i < lookupPrintServices.length; i++) {
        printerServices.add(lookupPrintServices[i]);
    }
    cbDevice.setModel(new ComboBoxModel(printerServices));

    cbDevice.setRenderer(new PrintServiceComboRenderer());
    centerPanel.add(cbDevice, "cell 1 1,growx"); //$NON-NLS-1$

    chckbxDefault = new JCheckBox(Messages.getString("AddPrinterDialog.12")); //$NON-NLS-1$
    centerPanel.add(chckbxDefault, "cell 1 2"); //$NON-NLS-1$

    JSeparator separator = new JSeparator();
    centerPanel.add(separator, "cell 0 3 3 1,growx,gapy 50px"); //$NON-NLS-1$

    add(centerPanel, BorderLayout.CENTER);

    JPanel panel = new JPanel();

    JButton btnOk = new JButton(Messages.getString("AddPrinterDialog.16")); //$NON-NLS-1$
    btnOk.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            doAddPrinter();
        }
    });
    panel.add(btnOk);

    JButton btnCancel = new JButton(Messages.getString("AddPrinterDialog.17")); //$NON-NLS-1$
    btnCancel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setCanceled(true);
            dispose();
        }
    });
    panel.add(btnCancel);
    add(panel, BorderLayout.SOUTH); //$NON-NLS-1$
}