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:com.db2eshop.gui.menu.RightClickPopupMenu.java

/**
 * <p>Constructor for RightClickPopupMenu.</p>
 *///from ww w.  j  a  va 2  s.  co  m
public RightClickPopupMenu() {
    show = new JMenuItem("Show Entity");
    add = new JMenuItem("Add Entity");
    edit = new JMenuItem("Edit Entity");
    remove = new JMenuItem("Remove Entity");

    this.add(show);
    this.add(new JSeparator());
    this.add(add);
    this.add(edit);
    this.add(remove);

    this.pack();
}

From source file:dbseer.gui.panel.DBSeerExplainChartPanel.java

public DBSeerExplainChartPanel(JFreeChart chart, JTextArea log, DBSeerExplainControlPanel controlPanel) {
    super(chart);
    normalRegion = new ArrayList<Double>();
    anomalyRegion = new ArrayList<Double>();
    this.setLayout(new MigLayout("fill"));
    this.setMouseWheelEnabled(true);
    this.explainConsole = log;
    this.controlPanel = controlPanel;
    this.popupMenu = this.getPopupMenu();

    JMenuItem popupItem;//  www. jav a2 s  . co  m
    //      popupItem = new JMenuItem(new ExplainChartAction("Select as Anomaly (Marked as Black)", DBSeerConstants.EXPLAIN_SELECT_ANOMALY_REGION,
    //            this));
    //      popupMenu.add(popupItem);
    //      popupItem = new JMenuItem(new ExplainChartAction("Select as Normal (Marked as White, Optional)", DBSeerConstants.EXPLAIN_SELECT_NORMAL_REGION,
    //            this));
    //      popupMenu.add(popupItem);
    popupMenu.insert(new JSeparator(), 0);
    popupItem = new JMenuItem(new ExplainChartAction("Clear All", DBSeerConstants.EXPLAIN_CLEAR_REGION, this));
    popupMenu.insert(popupItem, 0);
    popupItem = new JMenuItem(new ExplainChartAction("Select as Normal (Optional)",
            DBSeerConstants.EXPLAIN_APPEND_NORMAL_REGION, this));
    popupMenu.insert(popupItem, 0);
    popupItem = new JMenuItem(
            new ExplainChartAction("Select as Anomaly", DBSeerConstants.EXPLAIN_APPEND_ANOMALY_REGION, this));
    popupMenu.insert(popupItem, 0);
    //      popupMenu.add(popupItem);
    //      popupMenu.add(popupItem);
    //
    //      popupMenu.add(popupItem);
    //      popupMenu.addSeparator();
    //      popupItem = new JMenuItem(new ExplainChartAction("Explain", DBSeerConstants.EXPLAIN_EXPLAIN, this));
    //      popupMenu.add(popupItem);
    //      popupMenu.addSeparator();
    //      showPredicatesMenuItem = new JMenuItem(new ExplainChartAction("Show Predicates", DBSeerConstants.EXPLAIN_SHOW_PREDICATES, this));
    //      showPredicatesMenuItem.setEnabled(false);
    //      popupMenu.add(showPredicatesMenuItem);
    //      savePredicatesMenuItem = new JMenuItem(new ExplainChartAction("Save Predicates as Causal Model", DBSeerConstants.EXPLAIN_SAVE_PREDICATES, this));
    //      savePredicatesMenuItem.setEnabled(false);
    //      popupMenu.add(savePredicatesMenuItem);

    super.setPopupMenu(this.popupMenu);
}

From source file:net.sf.firemox.AbstractMainForm.java

/**
 * Initialize the components of this form.
 *///  w w  w .j a  v  a 2 s.c o  m
protected void initAbstractMenu() {
    // "TBS" menu
    tbsMenu = UIHelper.buildMenu("menu_options_tbs");
    ButtonGroup group4 = new ButtonGroup();
    final MdbListener mdbListener = new MdbListener(this);
    final File[] mdbs = MToolKit.getFile(IdConst.TBS_DIR)
            .listFiles((FileFilter) FileFilterUtils.suffixFileFilter("xml"));
    String defaultTbs = MToolKit.tbsName;
    for (File mdb : mdbs) {
        String mdbName = FilenameUtils.getBaseName(mdb.getName());
        JRadioButtonMenuItem itemChck = new JRadioButtonMenuItem();
        MToolKit.tbsName = mdbName;
        updateMdbMenu(mdbName, itemChck);
        itemChck.setActionCommand(mdbName);
        itemChck.setFont(MToolKit.defaultFont);
        itemChck.addActionListener(mdbListener);
        group4.add(itemChck);
        tbsMenu.add(itemChck);
        if (mdbName.equals(defaultTbs)) {
            itemChck.setSelected(true);
        }
    }
    MToolKit.tbsName = defaultTbs;
    tbsMenu.add(new JSeparator());

    // "More TBS" menu item
    tbsMenu.add(UIHelper.buildMenu("menu_options_tbs_more", mdbListener));
    tbsMenu.add(new JSeparator());
    final JMenuItem updateMdbMenu = UIHelper.buildMenu("menu_options_tbs_update", mdbListener);
    updateMdbMenu.setEnabled(false);
    tbsMenu.add(updateMdbMenu);
    tbsMenu.add(UIHelper.buildMenu("menu_options_tbs_rebuild", mdbListener));
    optionMenu.add(new JSeparator());
    optionMenu.add(tbsMenu);
}

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

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

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

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

@Override
protected JComponent createFormControl() {
    // add field panel
    final JPanel contentPanel = new JPanel(new GridBagLayout());
    int row = 0;/*ww w. java 2  s . co m*/
    final int col = 0;
    GridBagConstraints gbc = LayoutUtil.buildGridBagConstraints(col, row++, 1, 1, 0, 0,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
    addFieldPannel = new AddFieldPanel();
    contentPanel.add(addFieldPannel, gbc);

    gbc = LayoutUtil.buildGridBagConstraints(col, row++, 1, 1, 0, 0, GridBagConstraints.HORIZONTAL,
            GridBagConstraints.CENTER);
    contentPanel.add(new JSeparator(), gbc);

    // bag-info input form
    form = createFormFields();
    gbc = LayoutUtil.buildGridBagConstraints(col, row++, 1, 1, 1, 1, GridBagConstraints.BOTH,
            GridBagConstraints.WEST);
    contentPanel.add(form, gbc);
    return contentPanel;
}

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

private JPanel createComponents() {
    TitlePane titlePane = new TitlePane();
    initStandardCommands();/*from  w ww.  j  av a2s .c  o m*/
    JPanel pageControl = new JPanel(new BorderLayout());
    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);

    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);
    JComponent buttonBar = createButtonBar();
    pageControl.add(buttonBar, BorderLayout.SOUTH);

    this.pack();
    return pageControl;
}

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

public void init() {
    getContentPane().setLayout(new MigLayout("", "[][grow]", "[][][]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    JLabel lblName = new JLabel(Messages.getString("VirtualPrinterConfigDialog.4")); //$NON-NLS-1$
    getContentPane().add(lblName, "cell 0 0,alignx trailing"); //$NON-NLS-1$

    tfName = new FixedLengthTextField(60);
    getContentPane().add(tfName, "cell 1 0,growx"); //$NON-NLS-1$

    //      JPanel orderTypePanel = new JPanel();
    //      orderTypePanel.setBorder(new TitledBorder("ORDER TYPE"));
    //      orderTypePanel.add(cbDineIn);
    //      orderTypePanel.add(cbTakeOut);
    //      orderTypePanel.add(cbPickup);
    //      orderTypePanel.add(cbHomeDeli);
    //      orderTypePanel.add(cbDriveThru);
    //      orderTypePanel.add(cbBarTab);
    //      add(orderTypePanel, "newline, grow, span 2");

    JSeparator separator = new JSeparator();
    getContentPane().add(separator, "cell 0 1 2 1,growx, gap top 50px"); //$NON-NLS-1$

    JPanel panel = new JPanel();
    getContentPane().add(panel, "cell 0 4 2 1,grow"); //$NON-NLS-1$

    JButton btnOk = new JButton(Messages.getString("VirtualPrinterConfigDialog.9")); //$NON-NLS-1$
    btnOk.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            doAddPrinter();//from www .  j a  v  a  2s. c om
        }
    });
    panel.add(btnOk);

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

From source file:hspc.submissionsprogram.AppDisplay.java

AppDisplay() {
    this.setTitle("Dominion High School Programming Contest");
    this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    this.setResizable(false);

    WindowListener exitListener = new WindowAdapter() {
        @Override//www . j a va  2 s .  co  m
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    };
    this.addWindowListener(exitListener);

    JTabbedPane pane = new JTabbedPane();
    this.add(pane);

    JPanel submitPanel = new JPanel(null);
    submitPanel.setPreferredSize(new Dimension(500, 500));

    UIManager.put("FileChooser.readOnly", true);
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.setBounds(0, 0, 500, 350);
    fileChooser.setVisible(true);
    FileNameExtensionFilter javaFilter = new FileNameExtensionFilter("Java files (*.java)", "java");
    fileChooser.setFileFilter(javaFilter);
    fileChooser.setAcceptAllFileFilterUsed(false);
    fileChooser.setControlButtonsAreShown(false);
    submitPanel.add(fileChooser);

    JSeparator separator1 = new JSeparator();
    separator1.setBounds(12, 350, 476, 2);
    separator1.setForeground(new Color(122, 138, 152));
    submitPanel.add(separator1);

    JLabel problemChooserLabel = new JLabel("Problem:");
    problemChooserLabel.setBounds(12, 360, 74, 25);
    submitPanel.add(problemChooserLabel);

    String[] listOfProblems = Main.Configuration.get("problem_names")
            .split(Main.Configuration.get("name_delimiter"));
    JComboBox problems = new JComboBox<>(listOfProblems);
    problems.setBounds(96, 360, 393, 25);
    submitPanel.add(problems);

    JButton submit = new JButton("Submit");
    submit.setBounds(170, 458, 160, 30);
    submit.addActionListener(e -> {
        try {
            File file = fileChooser.getSelectedFile();
            try {
                CloseableHttpClient httpClient = HttpClients.createDefault();
                HttpPost uploadFile = new HttpPost(Main.Configuration.get("submit_url"));

                MultipartEntityBuilder builder = MultipartEntityBuilder.create();
                builder.addTextBody("accountID", Main.accountID, ContentType.TEXT_PLAIN);
                builder.addTextBody("problem", String.valueOf(problems.getSelectedItem()),
                        ContentType.TEXT_PLAIN);
                builder.addBinaryBody("submission", file, ContentType.APPLICATION_OCTET_STREAM, file.getName());
                HttpEntity multipart = builder.build();

                uploadFile.setEntity(multipart);

                CloseableHttpResponse response = httpClient.execute(uploadFile);
                HttpEntity responseEntity = response.getEntity();
                String inputLine;
                BufferedReader br = new BufferedReader(new InputStreamReader(responseEntity.getContent()));
                try {
                    if ((inputLine = br.readLine()) != null) {
                        int rowIndex = Integer.parseInt(inputLine);
                        new ResultWatcher(rowIndex);
                    }
                    br.close();
                } catch (IOException ex) {
                    ex.printStackTrace();
                }
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        } catch (NullPointerException ex) {
            JOptionPane.showMessageDialog(this, "No file selected.\nPlease select a java file.", "Error",
                    JOptionPane.WARNING_MESSAGE);
        }
    });
    submitPanel.add(submit);

    JPanel clarificationsPanel = new JPanel(null);
    clarificationsPanel.setPreferredSize(new Dimension(500, 500));

    cList = new JList<>();
    cList.setBounds(12, 12, 476, 200);
    cList.setBorder(new CompoundBorder(BorderFactory.createLineBorder(new Color(122, 138, 152)),
            BorderFactory.createEmptyBorder(8, 8, 8, 8)));
    cList.setBackground(new Color(254, 254, 255));
    clarificationsPanel.add(cList);

    JButton viewC = new JButton("View");
    viewC.setBounds(12, 224, 232, 25);
    viewC.addActionListener(e -> {
        if (cList.getSelectedIndex() != -1) {
            int id = Integer.parseInt(cList.getSelectedValue().split("\\.")[0]);
            clarificationDatas.stream().filter(data -> data.getId() == id).forEach(
                    data -> new ClarificationDisplay(data.getProblem(), data.getText(), data.getResponse()));
        }
    });
    clarificationsPanel.add(viewC);

    JButton refreshC = new JButton("Refresh");
    refreshC.setBounds(256, 224, 232, 25);
    refreshC.addActionListener(e -> updateCList(true));
    clarificationsPanel.add(refreshC);

    JSeparator separator2 = new JSeparator();
    separator2.setBounds(12, 261, 476, 2);
    separator2.setForeground(new Color(122, 138, 152));
    clarificationsPanel.add(separator2);

    JLabel problemChooserLabelC = new JLabel("Problem:");
    problemChooserLabelC.setBounds(12, 273, 74, 25);
    clarificationsPanel.add(problemChooserLabelC);

    JComboBox problemsC = new JComboBox<>(listOfProblems);
    problemsC.setBounds(96, 273, 393, 25);
    clarificationsPanel.add(problemsC);

    JTextArea textAreaC = new JTextArea();
    textAreaC.setLineWrap(true);
    textAreaC.setWrapStyleWord(true);
    textAreaC.setBorder(new CompoundBorder(BorderFactory.createLineBorder(new Color(122, 138, 152)),
            BorderFactory.createEmptyBorder(8, 8, 8, 8)));
    textAreaC.setBackground(new Color(254, 254, 255));

    JScrollPane areaScrollPane = new JScrollPane(textAreaC);
    areaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    areaScrollPane.setBounds(12, 312, 477, 134);
    clarificationsPanel.add(areaScrollPane);

    JButton submitC = new JButton("Submit Clarification");
    submitC.setBounds(170, 458, 160, 30);
    submitC.addActionListener(e -> {
        if (textAreaC.getText().length() > 2048) {
            JOptionPane.showMessageDialog(this,
                    "Clarification body is too long.\nMaximum of 2048 characters allowed.", "Error",
                    JOptionPane.WARNING_MESSAGE);
        } else if (textAreaC.getText().length() < 20) {
            JOptionPane.showMessageDialog(this,
                    "Clarification body is too short.\nClarifications must be at least 20 characters, but no more than 2048.",
                    "Error", JOptionPane.WARNING_MESSAGE);
        } else {
            Connection conn = null;
            PreparedStatement stmt = null;
            try {
                Class.forName(JDBC_DRIVER);

                conn = DriverManager.getConnection(Main.Configuration.get("jdbc_mysql_address"),
                        Main.Configuration.get("mysql_user"), Main.Configuration.get("mysql_pass"));

                String sql = "INSERT INTO clarifications (team, problem, text) VALUES (?, ?, ?)";
                stmt = conn.prepareStatement(sql);

                stmt.setInt(1, Integer.parseInt(String.valueOf(Main.accountID)));
                stmt.setString(2, String.valueOf(problemsC.getSelectedItem()));
                stmt.setString(3, String.valueOf(textAreaC.getText()));

                textAreaC.setText("");

                stmt.executeUpdate();

                stmt.close();
                conn.close();

                updateCList(false);
            } catch (Exception ex) {
                ex.printStackTrace();
            } finally {
                try {
                    if (stmt != null) {
                        stmt.close();
                    }
                } catch (Exception ex2) {
                    ex2.printStackTrace();
                }
                try {
                    if (conn != null) {
                        conn.close();
                    }
                } catch (Exception ex2) {
                    ex2.printStackTrace();
                }
            }
        }
    });
    clarificationsPanel.add(submitC);

    pane.addTab("Submit", submitPanel);
    pane.addTab("Clarifications", clarificationsPanel);

    Timer timer = new Timer();
    TimerTask updateTask = new TimerTask() {
        @Override
        public void run() {
            updateCList(false);
        }
    };
    timer.schedule(updateTask, 10000, 10000);

    updateCList(false);

    this.pack();
    this.setLocationRelativeTo(null);
    this.setVisible(true);
}

From source file:cz.lidinsky.editor.Menu.java

/**
 *  Adds a separator at the end of the menu.
 *//*from w  w w.  j ava  2  s.  co m*/
Menu addSeparator() {
    JMenu lastMenu = getMenu(getMenuCount() - 1);
    lastMenu.add(new JSeparator());
    return this;
}

From source file:net.sf.firemox.ui.wizard.Wizard.java

/**
 * Create a new instance of this class.//from   w  ww. j a v a2s  .c om
 * 
 * @param ability
 *          ability to associate to this ability. If this ability has an
 *          associated picture, it will be used instead of given picture.
 *          Ability's name is also used to fill the title. This ability will
 *          be used to restart this wizard in case of Background button is
 *          used.
 * @param title
 *          the title of this wizard.
 * @param description
 *          the description appended to the title of this wizard. This content
 *          will be displayed as Html.
 * @param iconName
 *          the icon's name to display on the top right place.
 * @param width
 *          the preferred width.
 * @param height
 *          the preferred height.
 */
public Wizard(Ability ability, String title, String description, String iconName, int width, int height) {
    super(MagicUIComponents.magicForm, StringUtils.capitalize(title), true);
    getRootPane().setPreferredSize(new Dimension(width, 300));
    getRootPane().setMinimumSize(new Dimension(width, height));
    setSize(new Dimension(width, height));

    // center
    gameParamPanel = new JPanel(null);
    gameParamPanel.setLayout(new BoxLayout(gameParamPanel, BoxLayout.Y_AXIS));
    if (ability == null)
        getContentPane().add(new WizardTitle(new WizardImageIcon((Image) null, iconName), description),
                BorderLayout.NORTH);
    else
        getContentPane().add(new WizardTitle(new WizardImageIcon(ability.getCard(), iconName), description),
                BorderLayout.NORTH);
    getContentPane().add(gameParamPanel, BorderLayout.CENTER);
    getContentPane().add(new JPanel(), BorderLayout.EAST);

    // bottom
    final JPanel abstractButtonPanel = new JPanel(new BorderLayout());
    this.buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    this.ability = ability;
    abstractButtonPanel.setBorder(null);
    abstractButtonPanel.add(new JSeparator(), BorderLayout.NORTH);
    abstractButtonPanel.add(buttonPanel, BorderLayout.CENTER);
    abstractButtonPanel.add(wizardInfo, BorderLayout.SOUTH);
    getContentPane().add(abstractButtonPanel, BorderLayout.SOUTH);
    setLocationRelativeTo(null);
}