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(int orientation) 

Source Link

Document

Creates a new separator with the specified horizontal or vertical orientation.

Usage

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    frame.add(new JSeparator(JSeparator.VERTICAL));

    frame.setSize(300, 200);//from w w w.  j  a v  a2s . c  o m
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JSeparator sep = new JSeparator(JSeparator.VERTICAL);
    sep.setOrientation(JSeparator.VERTICAL);
    frame.add(sep);/*from  w  ww. j  a  va 2s  . com*/

    frame.setSize(300, 200);
    frame.setVisible(true);
}

From source file:Main.java

public LoginPanel() {
    setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();

    gbc.anchor = GridBagConstraints.CENTER;
    gbc.weightx = 1;/*from   w  w w .j a  v a  2  s .com*/
    gbc.gridx = 2;
    gbc.anchor = GridBagConstraints.EAST;
    JLabel label = new JLabel("Username: ");
    add(label, gbc);

    gbc.anchor = GridBagConstraints.WEST;
    gbc.gridx = 3;
    gbc.gridwidth = 2;
    add(userfield, gbc);

    gbc.gridy = 1;
    add(passfield, gbc);

    gbc.anchor = GridBagConstraints.EAST;
    gbc.gridx = 2;
    label = new JLabel("Password: ");
    add(label, gbc);

    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridy = 2;
    gbc.gridx = 1;
    gbc.gridwidth = 5;
    add(new JSeparator(JSeparator.HORIZONTAL), gbc);
}

From source file:com.mirth.connect.client.ui.attachments.IdentityAttachmentDialog.java

private void initComponents() {
    setBackground(UIConstants.BACKGROUND_COLOR);
    getContentPane().setBackground(getBackground());

    propertiesPanel = new JPanel();
    propertiesPanel.setBackground(getBackground());
    propertiesPanel.setBorder(BorderFactory.createTitledBorder("Properties"));

    mimeTypeLabel = new JLabel("MIME Type:");
    mimeTypeField = new JTextField();

    separator = new JSeparator(SwingConstants.HORIZONTAL);

    closeButton = new JButton("Close");
    closeButton.addActionListener(new ActionListener() {
        @Override/* ww  w . ja v  a 2 s  .co m*/
        public void actionPerformed(ActionEvent evt) {
            close();
        }
    });
}

From source file:net.launchpad.jabref.plugins.ZentralSearch.java

public JPanel getOptionsPanel() {
    JPanel pan = new JPanel();
    pan.setLayout(new java.awt.GridLayout(10, 1));
    pan.add(new JLabel("The above query field has to be filled."));
    pan.add(new JSeparator(SwingConstants.HORIZONTAL));
    pan.add(new JLabel("Below are additional query options."));
    pan.add(new JLabel("Search by author"));
    pan.add(author);/*from  w  w w  .  j  av  a2 s.c  om*/
    pan.add(new JLabel("Search by title"));
    pan.add(title);
    pan.add(new JLabel("Search the abstract"));
    pan.add(theAbstract);
    reset.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent arg0) {
            author.setText("");
            title.setText("");
            theAbstract.setText("");
        }
    });
    pan.add(reset);
    return pan;
}

From source file:Main.java

public Main() {
    super(new BorderLayout());
    listModel.addElement("A");
    listModel.addElement("B");
    listModel.addElement("C");

    list = new JList(listModel);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    list.setSelectedIndex(0);/*from w ww  . j  a  v  a 2 s.c o m*/
    list.addListSelectionListener(this);
    list.setVisibleRowCount(5);
    JScrollPane listScrollPane = new JScrollPane(list);

    JButton hireButton = new JButton(addCommand);
    HireListener hireListener = new HireListener(hireButton);
    hireButton.setActionCommand(addCommand);
    hireButton.addActionListener(hireListener);
    hireButton.setEnabled(false);

    fireButton = new JButton(deleteCommand);
    fireButton.setActionCommand(deleteCommand);
    fireButton.addActionListener(new FireListener());

    employeeName = new JTextField(10);
    employeeName.addActionListener(hireListener);
    employeeName.getDocument().addDocumentListener(hireListener);
    String name = listModel.getElementAt(list.getSelectedIndex()).toString();
    System.out.println(name);

    // Create a panel that uses BoxLayout.
    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
    buttonPane.add(fireButton);
    buttonPane.add(Box.createHorizontalStrut(5));
    buttonPane.add(new JSeparator(SwingConstants.VERTICAL));
    buttonPane.add(Box.createHorizontalStrut(5));
    buttonPane.add(employeeName);
    buttonPane.add(hireButton);
    buttonPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    add(listScrollPane, BorderLayout.CENTER);
    add(buttonPane, BorderLayout.PAGE_END);
}

From source file:Main.java

public Main() {
    super(new BorderLayout());

    listModel = new DefaultListModel();
    listModel.addElement("Debbie Scott");
    listModel.addElement("Scott Hommel");
    listModel.addElement("Sharon Zakhour");

    // Create the list and put it in a scroll pane.
    list = new JList(listModel);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    list.setSelectedIndex(0);/*from w  ww . j a v a 2s  .c om*/
    list.addListSelectionListener(this);
    list.setVisibleRowCount(5);
    JScrollPane listScrollPane = new JScrollPane(list);

    JButton hireButton = new JButton(hireString);
    HireListener hireListener = new HireListener(hireButton);
    hireButton.setActionCommand(hireString);
    hireButton.addActionListener(hireListener);
    hireButton.setEnabled(false);

    fireButton = new JButton(fireString);
    fireButton.setActionCommand(fireString);
    fireButton.addActionListener(new FireListener());

    employeeName = new JTextField(10);
    employeeName.addActionListener(hireListener);
    employeeName.getDocument().addDocumentListener(hireListener);
    String name = listModel.getElementAt(list.getSelectedIndex()).toString();

    // Create a panel that uses BoxLayout.
    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
    buttonPane.add(fireButton);
    buttonPane.add(Box.createHorizontalStrut(5));
    buttonPane.add(new JSeparator(SwingConstants.VERTICAL));
    buttonPane.add(Box.createHorizontalStrut(5));
    buttonPane.add(employeeName);
    buttonPane.add(hireButton);
    buttonPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    add(listScrollPane, BorderLayout.CENTER);
    add(buttonPane, BorderLayout.PAGE_END);
}

From source file:com.adito.upgrade.GUIUpgrader.java

public GUIUpgrader() {
    super(new BorderLayout());
    JPanel info = new JPanel(new BorderLayout(2, 2));

    //        info.setBackground(Color.white);
    //        info.setForeground(Color.black);
    //        info.setOpaque(true);
    info.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    JLabel l = new JLabel("<html><p>This utility upgrades configuration from "
            + "one version 0.1.16 installation to another "
            + "0.2.5+ installation. You may choose which resources you "
            + "wish to be copied. If resources with the same name already " + "exist they will be left as is.");
    l.setIcon(new ImageIcon(GUIUpgrader.class.getResource("upgrader-48x48.png")));
    info.add(l, BorderLayout.CENTER);
    info.add(new JSeparator(JSeparator.HORIZONTAL), BorderLayout.SOUTH);
    mainPanel = new JPanel(new BorderLayout());
    add(info, BorderLayout.NORTH);
    add(mainPanel, BorderLayout.CENTER);

    // Installations panel
    JPanel installations = new JPanel(new GridBagLayout());
    installations.setBorder(BorderFactory.createTitledBorder("Installations"));
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(2, 2, 2, 2);
    gbc.weightx = 2.0;//from   w ww. j av  a2s  . c  o m
    UIUtil.jGridBagAdd(installations, new JLabel("Source"), gbc, GridBagConstraints.REMAINDER);
    gbc.weightx = 1.0;
    source = new JTextField();
    source.getDocument().addDocumentListener(this);
    UIUtil.jGridBagAdd(installations, source, gbc, GridBagConstraints.RELATIVE);
    browseSource = new JButton("Browse");
    browseSource.setMnemonic('b');
    browseSource.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            JFileChooser chooser = new JFileChooser(source.getText());
            chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            chooser.setDialogTitle("Select source installation directory (0.16.1)");
            if (chooser.showOpenDialog(GUIUpgrader.this) == JFileChooser.APPROVE_OPTION) {
                source.setText(chooser.getSelectedFile().getAbsolutePath());
            }
        }
    });
    gbc.weightx = 0.0;
    UIUtil.jGridBagAdd(installations, browseSource, gbc, GridBagConstraints.REMAINDER);
    gbc.weightx = 2.0;
    UIUtil.jGridBagAdd(installations, new JLabel("Target"), gbc, GridBagConstraints.REMAINDER);
    gbc.weightx = 1.0;
    target = new JTextField(System.getProperty("user.dir"));
    target.getDocument().addDocumentListener(this);
    UIUtil.jGridBagAdd(installations, target, gbc, GridBagConstraints.RELATIVE);
    browseTarget = new JButton("Browse");
    browseTarget.setMnemonic('r');
    browseTarget.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JFileChooser chooser = new JFileChooser(target.getText());
            chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            chooser.setDialogTitle("Select target installation directory (0.2.5+)");
            if (chooser.showOpenDialog(GUIUpgrader.this) == JFileChooser.APPROVE_OPTION) {
                target.setText(chooser.getSelectedFile().getAbsolutePath());
            }
        }
    });
    gbc.weightx = 0.0;
    UIUtil.jGridBagAdd(installations, browseTarget, gbc, GridBagConstraints.REMAINDER);
    mainPanel.add(installations, BorderLayout.NORTH);

    // Upgrade selection
    upgradeSelectionPanel = new JPanel();
    upgradeSelectionPanel.setBorder(BorderFactory.createTitledBorder("Upgrades"));
    upgradeSelectionPanel.setLayout(new BoxLayout(upgradeSelectionPanel, BoxLayout.Y_AXIS));
    mainPanel.add(upgradeSelectionPanel, BorderLayout.CENTER);

}

From source file:components.ListDemo.java

public ListDemo() {
    super(new BorderLayout());

    listModel = new DefaultListModel();
    listModel.addElement("Jane Doe");
    listModel.addElement("John Smith");
    listModel.addElement("Kathy Green");

    //Create the list and put it in a scroll pane.
    list = new JList(listModel);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    list.setSelectedIndex(0);//from   w  w w  .  j av  a  2  s  .  com
    list.addListSelectionListener(this);
    list.setVisibleRowCount(5);
    JScrollPane listScrollPane = new JScrollPane(list);

    JButton hireButton = new JButton(hireString);
    HireListener hireListener = new HireListener(hireButton);
    hireButton.setActionCommand(hireString);
    hireButton.addActionListener(hireListener);
    hireButton.setEnabled(false);

    fireButton = new JButton(fireString);
    fireButton.setActionCommand(fireString);
    fireButton.addActionListener(new FireListener());

    employeeName = new JTextField(10);
    employeeName.addActionListener(hireListener);
    employeeName.getDocument().addDocumentListener(hireListener);
    String name = listModel.getElementAt(list.getSelectedIndex()).toString();

    //Create a panel that uses BoxLayout.
    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
    buttonPane.add(fireButton);
    buttonPane.add(Box.createHorizontalStrut(5));
    buttonPane.add(new JSeparator(SwingConstants.VERTICAL));
    buttonPane.add(Box.createHorizontalStrut(5));
    buttonPane.add(employeeName);
    buttonPane.add(hireButton);
    buttonPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    add(listScrollPane, BorderLayout.CENTER);
    add(buttonPane, BorderLayout.PAGE_END);
}

From source file:com.sshtools.sshterm.SshTermCommandTab.java

/**
 * Creates a new SshToolsConnectionCommandTab object.
 *///from   ww  w .  ja v  a 2  s .c o m
public SshTermCommandTab() {
    super();

    JPanel main = new JPanel(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.NORTH;
    gbc.insets = new Insets(0, 2, 2, 2);

    Insets ins2 = new Insets(2, 24, 2, 2);
    gbc.weightx = 1.0;
    requestPseudoTerminal.getModel().setSelected(false);
    disconnectOnSessionClose.getModel().setSelected(true);
    UIUtil.jGridBagAdd(main, requestPseudoTerminal, gbc, GridBagConstraints.REMAINDER);
    UIUtil.jGridBagAdd(main, disconnectOnSessionClose, gbc, GridBagConstraints.REMAINDER);
    UIUtil.jGridBagAdd(main, new JSeparator(JSeparator.HORIZONTAL), gbc, GridBagConstraints.REMAINDER);
    UIUtil.jGridBagAdd(main, onceAuthenticated, gbc, GridBagConstraints.REMAINDER);
    group.add(doNothing);
    group.add(startShell);
    group.add(executeCommands);
    startShell.setSelected(true);
    UIUtil.jGridBagAdd(main, doNothing, gbc, GridBagConstraints.REMAINDER);
    UIUtil.jGridBagAdd(main, startShell, gbc, GridBagConstraints.REMAINDER);
    UIUtil.jGridBagAdd(main, executeCommands, gbc, GridBagConstraints.REMAINDER);
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets = ins2;
    gbc.weighty = 1.0;

    //commands.setLineWrap(true);
    commands.setBorder(BorderFactory.createEtchedBorder());

    JScrollPane scroll = new JScrollPane(commands);
    scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    UIUtil.jGridBagAdd(main, scroll, gbc, GridBagConstraints.REMAINDER);

    IconWrapperPanel iconProxyDetailsPanel = new IconWrapperPanel(new ResourceIcon(COMMANDS_ICON), main);
    commands.setRows(8);

    //  This panel
    setLayout(new BorderLayout());
    setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.NORTH;
    gbc.insets = new Insets(2, 2, 2, 2);
    gbc.weightx = 1.0;
    add(iconProxyDetailsPanel, BorderLayout.NORTH);
}