Example usage for javax.swing.border TitledBorder TitledBorder

List of usage examples for javax.swing.border TitledBorder TitledBorder

Introduction

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

Prototype

public TitledBorder(Border border) 

Source Link

Document

Creates a TitledBorder instance with the specified border and an empty title.

Usage

From source file:userinterface.properties.GUIGraphHandler.java

public void defineConstantsAndPlot(Expression expr, JPanel graph, String seriesName, Boolean isNewGraph,
        boolean is2D) {

    JDialog dialog;//from   w  w w  .  j a  va2 s .  c o  m
    JButton ok, cancel;
    JScrollPane scrollPane;
    ConstantPickerList constantList;
    JComboBox<String> xAxis, yAxis;

    //init everything
    dialog = new JDialog(GUIPrism.getGUI());
    dialog.setTitle("Define constants and select axes");
    dialog.setSize(500, 400);
    dialog.setLocationRelativeTo(GUIPrism.getGUI());
    dialog.setLayout(new BoxLayout(dialog.getContentPane(), BoxLayout.Y_AXIS));
    dialog.setModal(true);

    constantList = new ConstantPickerList();
    scrollPane = new JScrollPane(constantList);

    xAxis = new JComboBox<String>();
    yAxis = new JComboBox<String>();

    ok = new JButton("Ok");
    ok.setMnemonic('O');
    cancel = new JButton("Cancel");
    cancel.setMnemonic('C');

    //add all components to their dedicated panels
    JPanel exprPanel = new JPanel(new FlowLayout());
    exprPanel.setBorder(new TitledBorder("Function"));
    exprPanel.add(new JLabel(expr.toString()));

    JPanel axisPanel = new JPanel();
    axisPanel.setBorder(new TitledBorder("Select axis constants"));
    axisPanel.setLayout(new BoxLayout(axisPanel, BoxLayout.Y_AXIS));
    JPanel xAxisPanel = new JPanel(new FlowLayout());
    xAxisPanel.add(new JLabel("X axis:"));
    xAxisPanel.add(xAxis);
    JPanel yAxisPanel = new JPanel(new FlowLayout());
    yAxisPanel.add(new JLabel("Y axis:"));
    yAxisPanel.add(yAxis);
    axisPanel.add(xAxisPanel);
    axisPanel.add(yAxisPanel);

    JPanel constantPanel = new JPanel(new BorderLayout());
    constantPanel.setBorder(new TitledBorder("Please define the following constants"));
    constantPanel.add(scrollPane, BorderLayout.CENTER);
    constantPanel.add(new ConstantHeader(), BorderLayout.NORTH);

    JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    bottomPanel.add(ok);
    bottomPanel.add(cancel);

    //fill the axes components

    for (int i = 0; i < expr.getAllConstants().size(); i++) {

        xAxis.addItem(expr.getAllConstants().get(i));

        if (!is2D)
            yAxis.addItem(expr.getAllConstants().get(i));
    }

    if (!is2D) {
        yAxis.setSelectedIndex(1);
    }

    //fill the constants table

    for (int i = 0; i < expr.getAllConstants().size(); i++) {

        ConstantLine line = new ConstantLine(expr.getAllConstants().get(i), TypeDouble.getInstance());
        constantList.addConstant(line);

        if (!is2D) {
            if (line.getName().equals(xAxis.getSelectedItem().toString())
                    || line.getName().equals(yAxis.getSelectedItem().toString())) {

                line.doFuncEnables(false);
            } else {
                line.doFuncEnables(true);
            }
        }

    }

    //do enables

    if (is2D) {
        yAxis.setEnabled(false);
    }

    ok.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "ok");
    ok.getActionMap().put("ok", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            ok.doClick();
        }
    });

    cancel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
            "cancel");
    cancel.getActionMap().put("cancel", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            cancel.doClick();
        }
    });

    //add action listeners

    xAxis.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {

            if (is2D) {
                return;
            }

            String item = xAxis.getSelectedItem().toString();

            if (item.equals(yAxis.getSelectedItem().toString())) {

                int index = yAxis.getSelectedIndex();

                if (index != yAxis.getItemCount() - 1) {
                    yAxis.setSelectedIndex(++index);
                } else {
                    yAxis.setSelectedIndex(--index);
                }

            }

            for (int i = 0; i < constantList.getNumConstants(); i++) {

                ConstantLine line = constantList.getConstantLine(i);

                if (line.getName().equals(xAxis.getSelectedItem().toString())
                        || line.getName().equals(yAxis.getSelectedItem().toString())) {

                    line.doFuncEnables(false);
                } else {

                    line.doFuncEnables(true);
                }

            }
        }
    });

    yAxis.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {

            String item = yAxis.getSelectedItem().toString();

            if (item.equals(xAxis.getSelectedItem().toString())) {

                int index = xAxis.getSelectedIndex();

                if (index != xAxis.getItemCount() - 1) {
                    xAxis.setSelectedIndex(++index);
                } else {
                    xAxis.setSelectedIndex(--index);
                }
            }

            for (int i = 0; i < constantList.getNumConstants(); i++) {

                ConstantLine line = constantList.getConstantLine(i);

                if (line.getName().equals(xAxis.getSelectedItem().toString())
                        || line.getName().equals(yAxis.getSelectedItem().toString())) {

                    line.doFuncEnables(false);
                } else {

                    line.doFuncEnables(true);
                }

            }
        }
    });

    ok.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {

            try {

                constantList.checkValid();

            } catch (PrismException e2) {
                JOptionPane.showMessageDialog(dialog,
                        "<html> One or more of the defined constants are invalid. <br><br> <font color=red>Error: </font>"
                                + e2.getMessage() + "</html>",
                        "Parse Error", JOptionPane.ERROR_MESSAGE);
                return;
            }

            if (is2D) {

                // it will always be a parametric graph in 2d case
                ParametricGraph pGraph = (ParametricGraph) graph;

                ConstantLine xAxisConstant = constantList.getConstantLine(xAxis.getSelectedItem().toString());

                if (xAxisConstant == null) {
                    //should never happen
                    JOptionPane.showMessageDialog(dialog, "The selected axis is invalid.", "Error",
                            JOptionPane.ERROR_MESSAGE);
                    return;
                }

                double xStartValue = Double.parseDouble(xAxisConstant.getStartValue());
                double xEndValue = Double.parseDouble(xAxisConstant.getEndValue());
                double xStepValue = Double.parseDouble(xAxisConstant.getStepValue());

                int seriesCount = 0;

                for (int i = 0; i < constantList.getNumConstants(); i++) {

                    ConstantLine line = constantList.getConstantLine(i);

                    if (line.getName().equals(xAxis.getSelectedItem().toString())) {
                        seriesCount++;
                    } else {

                        seriesCount += line.getTotalNumOfValues();

                    }
                }

                // if there will be too many series to be plotted, ask the user if they are sure they know what they are doing
                if (seriesCount > 10) {

                    int res = JOptionPane.showConfirmDialog(dialog,
                            "This configuration will create " + seriesCount + " series. Continue?", "Confirm",
                            JOptionPane.YES_NO_OPTION);

                    if (res == JOptionPane.NO_OPTION) {
                        return;
                    }

                }

                Values singleValuesGlobal = new Values();

                //add the single values to a global values list

                for (int i = 0; i < constantList.getNumConstants(); i++) {

                    ConstantLine line = constantList.getConstantLine(i);

                    if (line.getTotalNumOfValues() == 1) {

                        double singleValue = Double.parseDouble(line.getSingleValue());
                        singleValuesGlobal.addValue(line.getName(), singleValue);
                    }
                }

                // we just have one variable so we can plot directly
                if (constantList.getNumConstants() == 1
                        || singleValuesGlobal.getNumValues() == constantList.getNumConstants() - 1) {

                    SeriesKey key = pGraph.addSeries(seriesName);

                    pGraph.hideShape(key);
                    pGraph.getXAxisSettings().setHeading(xAxis.getSelectedItem().toString());
                    pGraph.getYAxisSettings().setHeading("function");

                    for (double x = xStartValue; x <= xEndValue; x += xStepValue) {

                        double ans = -1;

                        Values vals = new Values();
                        vals.addValue(xAxis.getSelectedItem().toString(), x);

                        for (int ii = 0; ii < singleValuesGlobal.getNumValues(); ii++) {

                            try {
                                vals.addValue(singleValuesGlobal.getName(ii),
                                        singleValuesGlobal.getDoubleValue(ii));
                            } catch (PrismLangException e1) {
                                e1.printStackTrace();
                            }

                        }

                        try {
                            ans = expr.evaluateDouble(vals);
                        } catch (PrismLangException e1) {
                            e1.printStackTrace();
                        }

                        pGraph.addPointToSeries(key, new PrismXYDataItem(x, ans));

                    }

                    if (isNewGraph) {
                        addGraph(pGraph);
                    }

                    dialog.dispose();
                    return;
                }

                for (int i = 0; i < constantList.getNumConstants(); i++) {

                    ConstantLine line = constantList.getConstantLine(i);

                    if (line == xAxisConstant || singleValuesGlobal.contains(line.getName())) {
                        continue;
                    }

                    double lineStart = Double.parseDouble(line.getStartValue());
                    double lineEnd = Double.parseDouble(line.getEndValue());
                    double lineStep = Double.parseDouble(line.getStepValue());

                    for (double j = lineStart; j < lineEnd; j += lineStep) {

                        SeriesKey key = pGraph.addSeries(seriesName);
                        pGraph.hideShape(key);

                        for (double x = xStartValue; x <= xEndValue; x += xStepValue) {

                            double ans = -1;

                            Values vals = new Values();
                            vals.addValue(xAxis.getSelectedItem().toString(), x);
                            vals.addValue(line.getName(), j);

                            for (int ii = 0; ii < singleValuesGlobal.getNumValues(); ii++) {

                                try {
                                    vals.addValue(singleValuesGlobal.getName(ii),
                                            singleValuesGlobal.getDoubleValue(ii));
                                } catch (PrismLangException e1) {
                                    // TODO Auto-generated catch block
                                    e1.printStackTrace();
                                }

                            }

                            for (int ii = 0; ii < constantList.getNumConstants(); ii++) {

                                if (constantList.getConstantLine(ii) == xAxisConstant
                                        || singleValuesGlobal
                                                .contains(constantList.getConstantLine(ii).getName())
                                        || constantList.getConstantLine(ii) == line) {

                                    continue;
                                }

                                ConstantLine temp = constantList.getConstantLine(ii);
                                double val = Double.parseDouble(temp.getStartValue());

                                vals.addValue(temp.getName(), val);
                            }

                            try {
                                ans = expr.evaluateDouble(vals);
                            } catch (PrismLangException e1) {
                                e1.printStackTrace();
                            }

                            pGraph.addPointToSeries(key, new PrismXYDataItem(x, ans));
                        }
                    }

                }

                if (isNewGraph) {
                    addGraph(graph);
                }
            } else {

                // this will always be a parametric graph for the 3d case
                ParametricGraph3D pGraph = (ParametricGraph3D) graph;

                //add the graph to the gui
                addGraph(pGraph);

                //Get the constants we want to put on the x and y axis
                ConstantLine xAxisConstant = constantList.getConstantLine(xAxis.getSelectedItem().toString());
                ConstantLine yAxisConstant = constantList.getConstantLine(yAxis.getSelectedItem().toString());

                //add the single values to a global values list

                Values singleValuesGlobal = new Values();

                for (int i = 0; i < constantList.getNumConstants(); i++) {

                    ConstantLine line = constantList.getConstantLine(i);

                    if (line.getTotalNumOfValues() == 1) {

                        double singleValue = Double.parseDouble(line.getSingleValue());
                        singleValuesGlobal.addValue(line.getName(), singleValue);
                    }
                }

                pGraph.setGlobalValues(singleValuesGlobal);
                pGraph.setAxisConstants(xAxis.getSelectedItem().toString(), yAxis.getSelectedItem().toString());
                pGraph.setBounds(xAxisConstant.getStartValue(), xAxisConstant.getEndValue(),
                        yAxisConstant.getStartValue(), yAxisConstant.getEndValue());

                SwingUtilities.invokeLater(new Runnable() {

                    @Override
                    public void run() {
                        //plot the graph
                        pGraph.plot(expr.toString(), xAxis.getSelectedItem().toString(), "Function",
                                yAxis.getSelectedItem().toString());

                        //calculate the sampling rates from the step sizes as given by the user

                        int xSamples = (int) ((Double.parseDouble(xAxisConstant.getEndValue())
                                - Double.parseDouble(xAxisConstant.getStartValue()))
                                / Double.parseDouble(xAxisConstant.getStepValue()));
                        int ySamples = (int) ((Double.parseDouble(xAxisConstant.getEndValue())
                                - Double.parseDouble(xAxisConstant.getStartValue()))
                                / Double.parseDouble(xAxisConstant.getStepValue()));

                        pGraph.setSamplingRates(xSamples, ySamples);
                    }
                });

            }

            dialog.dispose();
        }
    });

    cancel.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            dialog.dispose();
        }
    });

    //add everything to the dialog show the dialog

    dialog.add(exprPanel);
    dialog.add(axisPanel);
    dialog.add(constantPanel);
    dialog.add(bottomPanel);
    dialog.setVisible(true);

}

From source file:op.care.nursingprocess.PnlEval.java

private void initPanel() {
    pnlReason.setBorder(/*  w w  w .j  av  a  2  s.co  m*/
            new TitledBorder(SYSTools.xx(internalClassID + (disableDate ? ".title4close" : ".title4change"))));

    if (disableDate) {
        lblNextEval.setVisible(false);
        jdcNextEval.setVisible(false);
    } else {
        lblNextEval.setText(SYSTools.xx(internalClassID + ".nextevaldate") + ": ");
        jdcNextEval.setDate(new DateTime().plusWeeks(4).toDate());
        jdcNextEval.setMinSelectableDate(new DateTime().plusDays(1).toDate());
        jdcNextEval.setMaxSelectableDate(new DateTime().plusYears(1).toDate());
    }
    setPreferredSize(new Dimension(525, 250));
}

From source file:op.care.nursingprocess.PnlSchedule.java

private void initPanel() {

    pnlBemerkung.setBorder(new TitledBorder(SYSTools.xx(internalClassID + ".bordertitle4textfield")));

    ArrayList<Date> timelist = SYSCalendar.getTimeList();
    cmbUhrzeit.setModel(new DefaultComboBoxModel(timelist.toArray()));
    cmbUhrzeit.setRenderer(SYSCalendar.getTimeRenderer());

    spinTaeglich.setModel(new SpinnerNumberModel(1, 1, 365, 1));
    spinWoche.setModel(new SpinnerNumberModel(1, 1, 52, 1));
    spinMonat.setModel(new SpinnerNumberModel(1, 1, 12, 1));
    spinMonatTag.setModel(new SpinnerNumberModel(1, 1, 31, 1));

    spinTaeglich.setValue(Math.max(is.getTaeglich(), 1));
    spinWoche.setValue(Math.max(is.getWoechentlich(), 1));
    spinMonat.setValue(Math.max(is.getMonatlich(), 1));
    spinMonatTag.setValue(Math.max(is.getTagNum(), 1));

    tabWdh.setSelectedIndex(TAB_DAILY);/* ww  w .  ja v a  2s  . c om*/

    if (is.getWoechentlich() > 0) {
        cbMon.setSelected(is.getMon() > 0);
        cbDie.setSelected(is.getDie() > 0);
        cbMit.setSelected(is.getMit() > 0);
        cbDon.setSelected(is.getDon() > 0);
        cbFre.setSelected(is.getFre() > 0);
        cbSam.setSelected(is.getSam() > 0);
        cbSon.setSelected(is.getSon() > 0);
        tabWdh.setSelectedIndex(TAB_WEEKLY);
    }

    if (is.getMonatlich() > 0) {
        if (is.getTagNum() > 0) {

            spinMonatTag.setValue(is.getTagNum());
            cmbTag.setSelectedIndex(0);
        } else {

            if (is.getMon() > 0) {
                cmbTag.setSelectedIndex(1);
                spinMonatTag.setValue(is.getMon());
            } else if (is.getDie() > 0) {
                cmbTag.setSelectedIndex(2);
                spinMonatTag.setValue(is.getDie());
            } else if (is.getMit() > 0) {
                cmbTag.setSelectedIndex(3);
                spinMonatTag.setValue(is.getMit());
            } else if (is.getDon() > 0) {
                cmbTag.setSelectedIndex(4);
                spinMonatTag.setValue(is.getDon());
            } else if (is.getFre() > 0) {
                cmbTag.setSelectedIndex(5);
                spinMonatTag.setValue(is.getFre());
            } else if (is.getSam() > 0) {
                cmbTag.setSelectedIndex(6);
                spinMonatTag.setValue(is.getSam());
            } else if (is.getSon() > 0) {
                cmbTag.setSelectedIndex(7);
                spinMonatTag.setValue(is.getSon());
            }
        }
        tabWdh.setSelectedIndex(TAB_MONTHLY);
    }

    txtLDate.setText(DateFormat.getDateInstance()
            .format(new Date(Math.max(is.getLDatum().getTime(), new DateMidnight().getMillis()))));

    txtNachtMo.setText(is.getNachtMo().toString());
    txtMorgens.setText(is.getMorgens().toString());
    txtMittags.setText(is.getMittags().toString());
    txtNachmittags.setText(is.getNachmittags().toString());
    txtAbends.setText(is.getAbends().toString());
    txtNachtAb.setText(is.getNachtAb().toString());
    txtUhrzeit.setText(is.getUhrzeitAnzahl().toString());

    txtMorgens.setBackground(SYSConst.lightblue);
    txtMittags.setBackground(SYSConst.gold7);
    txtNachmittags.setBackground(SYSConst.melonrindgreen);
    txtAbends.setBackground(SYSConst.bermuda_sand);
    txtNachtAb.setBackground(SYSConst.bluegrey);

    Date now = null;
    if (is.getUhrzeitAnzahl() > 0) {
        now = is.getUhrzeit();
    } else {
        now = new Date();
    }

    for (Date zeit : timelist) {
        if (SYSCalendar.compareTime(zeit, now) >= 0) {
            now = zeit;
            break;
        }
    }
    cmbUhrzeit.setSelectedItem(now);
    lblUhrzeit.setText(SYSTools.xx("misc.msg.Number"));

    txtBemerkung.setText(is.getBemerkung());

    lblMinutes.setText(SYSTools.xx("misc.msg.Minute(s)"));
    txtMinutes.setText(is.getDauer().toPlainString());

    tbFloating = GUITools.getNiceToggleButton(SYSTools.xx(internalClassID + ".floatinginterventions"));
    tbFloating.setSelected(is.isFloating());
    panelMain.add(tbFloating, CC.xy(3, 5));

    splitRegularPos = SYSTools.showSide(splitRegular,
            is.getUhrzeit() != null ? SYSTools.RIGHT_LOWER_SIDE : SYSTools.LEFT_UPPER_SIDE);
}

From source file:op.care.prescription.DlgOnDemand.java

/**
 * This method is called from within the constructor to
 * initialize the form./*ww  w .  j  a v  a2s.c o m*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the PrinterForm Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    jPanel1 = new JPanel();
    txtMed = new JXSearchField();
    cmbMed = new JComboBox<>();
    panel4 = new JPanel();
    btnMedWizard = new JButton();
    cmbIntervention = new JComboBox<>();
    txtSit = new JXSearchField();
    cmbSit = new JComboBox<>();
    panel3 = new JPanel();
    btnAddSit = new JButton();
    txtIntervention = new JXSearchField();
    jPanel2 = new JPanel();
    lblNumber = new JLabel();
    lblDose = new JLabel();
    lblMaxPerDay = new JLabel();
    txtMaxTimes = new JTextField();
    lblX = new JLabel();
    txtEDosis = new JTextField();
    lblCheckResultAfter = new JLabel();
    cmbCheckAfter = new JComboBox<>();
    jPanel3 = new JPanel();
    pnlOFF = new JPanel();
    rbActive = new JRadioButton();
    rbDate = new JRadioButton();
    txtOFF = new JTextField();
    jScrollPane3 = new JScrollPane();
    txtBemerkung = new JTextPane();
    lblText = new JLabel();
    pnlON = new JPanel();
    cmbDocON = new JComboBox<>();
    cmbHospitalON = new JComboBox<>();
    panel1 = new JPanel();
    btnClose = new JButton();
    btnSave = new JButton();

    //======== this ========
    setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
    setResizable(false);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    Container contentPane = getContentPane();
    contentPane.setLayout(new FormLayout("14dlu, $lcgap, default, 6dlu, 355dlu, $lcgap, 14dlu",
            "14dlu, $lgap, fill:default:grow, $lgap, fill:default, $lgap, 14dlu"));

    //======== jPanel1 ========
    {
        jPanel1.setBorder(null);
        jPanel1.setLayout(new FormLayout("68dlu, $lcgap, pref:grow, $lcgap, pref",
                "3*(16dlu, $lgap), default, $lgap, fill:113dlu:grow, $lgap, 60dlu"));

        //---- txtMed ----
        txtMed.setFont(new Font("Arial", Font.PLAIN, 14));
        txtMed.setPrompt("Medikamente");
        txtMed.setFocusBehavior(PromptSupport.FocusBehavior.HIGHLIGHT_PROMPT);
        txtMed.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                txtMedActionPerformed(e);
            }
        });
        txtMed.addFocusListener(new FocusAdapter() {
            @Override
            public void focusGained(FocusEvent e) {
                txtMedFocusGained(e);
            }
        });
        jPanel1.add(txtMed, CC.xy(1, 1));

        //---- cmbMed ----
        cmbMed.setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cmbMed.setFont(new Font("Arial", Font.PLAIN, 14));
        cmbMed.addItemListener(new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
                cmbMedItemStateChanged(e);
            }
        });
        jPanel1.add(cmbMed, CC.xy(3, 1));

        //======== panel4 ========
        {
            panel4.setLayout(new BoxLayout(panel4, BoxLayout.LINE_AXIS));

            //---- btnMedWizard ----
            btnMedWizard.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png")));
            btnMedWizard.setBorderPainted(false);
            btnMedWizard.setBorder(null);
            btnMedWizard.setContentAreaFilled(false);
            btnMedWizard.setToolTipText("Neues Medikament eintragen");
            btnMedWizard.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnMedWizard.setSelectedIcon(
                    new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png")));
            btnMedWizard.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnMedActionPerformed(e);
                }
            });
            panel4.add(btnMedWizard);
        }
        jPanel1.add(panel4, CC.xy(5, 1));

        //---- cmbIntervention ----
        cmbIntervention
                .setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cmbIntervention.setFont(new Font("Arial", Font.PLAIN, 14));
        jPanel1.add(cmbIntervention, CC.xywh(3, 5, 3, 1));

        //---- txtSit ----
        txtSit.setPrompt("Situationen");
        txtSit.setFont(new Font("Arial", Font.PLAIN, 14));
        txtSit.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                txtSitActionPerformed(e);
            }
        });
        jPanel1.add(txtSit, CC.xy(1, 3));

        //---- cmbSit ----
        cmbSit.setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cmbSit.setFont(new Font("Arial", Font.PLAIN, 14));
        cmbSit.addItemListener(new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
                cmbSitItemStateChanged(e);
            }
        });
        cmbSit.addPropertyChangeListener("model", new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent e) {
                cmbSitPropertyChange(e);
            }
        });
        jPanel1.add(cmbSit, CC.xy(3, 3));

        //======== panel3 ========
        {
            panel3.setLayout(new BoxLayout(panel3, BoxLayout.LINE_AXIS));

            //---- btnAddSit ----
            btnAddSit.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png")));
            btnAddSit.setBorderPainted(false);
            btnAddSit.setBorder(null);
            btnAddSit.setContentAreaFilled(false);
            btnAddSit.setToolTipText("Neue  Situation eintragen");
            btnAddSit.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnAddSit.setSelectedIcon(
                    new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png")));
            btnAddSit.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnSituationActionPerformed(e);
                }
            });
            panel3.add(btnAddSit);
        }
        jPanel1.add(panel3, CC.xy(5, 3, CC.RIGHT, CC.DEFAULT));

        //---- txtIntervention ----
        txtIntervention.setFont(new Font("Arial", Font.PLAIN, 14));
        txtIntervention.setPrompt("Massnahmen");
        txtIntervention.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                txtMassActionPerformed(e);
            }
        });
        jPanel1.add(txtIntervention, CC.xy(1, 5));

        //======== jPanel2 ========
        {
            jPanel2.setLayout(new FormLayout("default, $lcgap, pref, $lcgap, default, $lcgap, 37dlu:grow",
                    "23dlu, fill:22dlu, $ugap, default"));

            //---- lblNumber ----
            lblNumber.setText("Anzahl");
            jPanel2.add(lblNumber, CC.xy(3, 1));

            //---- lblDose ----
            lblDose.setText("Dosis");
            jPanel2.add(lblDose, CC.xy(7, 1, CC.CENTER, CC.DEFAULT));

            //---- lblMaxPerDay ----
            lblMaxPerDay.setText("Max. Tagesdosis:");
            jPanel2.add(lblMaxPerDay, CC.xy(1, 2));

            //---- txtMaxTimes ----
            txtMaxTimes.setHorizontalAlignment(SwingConstants.CENTER);
            txtMaxTimes.setText("1");
            txtMaxTimes.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    txtMaxTimesActionPerformed(e);
                }
            });
            txtMaxTimes.addFocusListener(new FocusAdapter() {
                @Override
                public void focusGained(FocusEvent e) {
                    txtMaxTimesFocusGained(e);
                }

                @Override
                public void focusLost(FocusEvent e) {
                    txtMaxTimesFocusLost(e);
                }
            });
            jPanel2.add(txtMaxTimes, CC.xy(3, 2));

            //---- lblX ----
            lblX.setText("x");
            jPanel2.add(lblX, CC.xy(5, 2));

            //---- txtEDosis ----
            txtEDosis.setHorizontalAlignment(SwingConstants.CENTER);
            txtEDosis.setText("1.0");
            txtEDosis.addFocusListener(new FocusAdapter() {
                @Override
                public void focusGained(FocusEvent e) {
                    txtEDosisFocusGained(e);
                }

                @Override
                public void focusLost(FocusEvent e) {
                    txtEDosisFocusLost(e);
                }
            });
            txtEDosis.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    txtEDosisActionPerformed(e);
                }
            });
            jPanel2.add(txtEDosis, CC.xy(7, 2));

            //---- lblCheckResultAfter ----
            lblCheckResultAfter.setText("Nachkontrolle:");
            jPanel2.add(lblCheckResultAfter, CC.xy(1, 4));

            //---- cmbCheckAfter ----
            cmbCheckAfter.setModel(new DefaultComboBoxModel<>(new String[] { "keine Nachkontrolle",
                    "nach 1 Stunde", "nach 2 Stunden", "nach 3 Stunden" }));
            jPanel2.add(cmbCheckAfter, CC.xywh(3, 4, 5, 1));
        }
        jPanel1.add(jPanel2, CC.xywh(1, 9, 5, 1, CC.CENTER, CC.TOP));
    }
    contentPane.add(jPanel1, CC.xy(5, 3));

    //======== jPanel3 ========
    {
        jPanel3.setBorder(null);
        jPanel3.setLayout(new FormLayout("149dlu", "3*(fill:default, $lgap), fill:100dlu:grow"));

        //======== pnlOFF ========
        {
            pnlOFF.setBorder(new TitledBorder("Absetzung"));
            pnlOFF.setLayout(new FormLayout("pref, 86dlu:grow", "fill:17dlu, $lgap, fill:17dlu"));

            //---- rbActive ----
            rbActive.setText("text");
            rbActive.setSelected(true);
            rbActive.addItemListener(new ItemListener() {
                @Override
                public void itemStateChanged(ItemEvent e) {
                    rbActiveItemStateChanged(e);
                }
            });
            pnlOFF.add(rbActive, CC.xywh(1, 1, 2, 1));

            //---- rbDate ----
            rbDate.setText(null);
            rbDate.addItemListener(new ItemListener() {
                @Override
                public void itemStateChanged(ItemEvent e) {
                    rbDateItemStateChanged(e);
                }
            });
            pnlOFF.add(rbDate, CC.xy(1, 3));

            //---- txtOFF ----
            txtOFF.setEnabled(false);
            txtOFF.setFont(new Font("Arial", Font.PLAIN, 14));
            txtOFF.addFocusListener(new FocusAdapter() {
                @Override
                public void focusLost(FocusEvent e) {
                    txtOFFFocusLost(e);
                }
            });
            pnlOFF.add(txtOFF, CC.xy(2, 3));
        }
        jPanel3.add(pnlOFF, CC.xy(1, 3));

        //======== jScrollPane3 ========
        {

            //---- txtBemerkung ----
            txtBemerkung.addCaretListener(new CaretListener() {
                @Override
                public void caretUpdate(CaretEvent e) {
                    txtBemerkungCaretUpdate(e);
                }
            });
            jScrollPane3.setViewportView(txtBemerkung);
        }
        jPanel3.add(jScrollPane3, CC.xy(1, 7));

        //---- lblText ----
        lblText.setText("Bemerkung:");
        jPanel3.add(lblText, CC.xy(1, 5));

        //======== pnlON ========
        {
            pnlON.setBorder(new TitledBorder("Ansetzung"));
            pnlON.setLayout(new FormLayout("119dlu:grow", "17dlu, $lgap, fill:17dlu"));

            //---- cmbDocON ----
            cmbDocON.setModel(
                    new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
            cmbDocON.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    cmbDocONKeyPressed(e);
                }
            });
            pnlON.add(cmbDocON, CC.xy(1, 1));

            //---- cmbHospitalON ----
            cmbHospitalON.setModel(
                    new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
            pnlON.add(cmbHospitalON, CC.xy(1, 3));
        }
        jPanel3.add(pnlON, CC.xy(1, 1));
    }
    contentPane.add(jPanel3, CC.xy(3, 3));

    //======== panel1 ========
    {
        panel1.setLayout(new BoxLayout(panel1, BoxLayout.LINE_AXIS));

        //---- btnClose ----
        btnClose.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/cancel.png")));
        btnClose.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        btnClose.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                btnCloseActionPerformed(e);
            }
        });
        panel1.add(btnClose);

        //---- btnSave ----
        btnSave.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png")));
        btnSave.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        btnSave.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                btnSaveActionPerformed(e);
            }
        });
        panel1.add(btnSave);
    }
    contentPane.add(panel1, CC.xy(5, 5, CC.RIGHT, CC.DEFAULT));
    setSize(1035, 515);
    setLocationRelativeTo(getOwner());

    //---- bgMedikament ----
    ButtonGroup bgMedikament = new ButtonGroup();
    bgMedikament.add(rbActive);
    bgMedikament.add(rbDate);
}

From source file:org.jab.docsearch.DocSearch.java

/**
 * Constructor/*from   ww  w.ja v  a 2  s.  c om*/
 */
public DocSearch() {
    super(I18n.getString("ds.windowtitle"));

    // get logger
    logger = Logger.getLogger(getClass().getName());

    //
    File testCDFi = new File(cdRomDefaultHome);
    Properties sys = new Properties(System.getProperties());
    if (testCDFi.exists()) {
        sys.setProperty("disableLuceneLocks", "true");
        logger.info("DocSearch() Disabling Lucene Locks for CDROM indexes");
    } else {
        sys.setProperty("disableLuceneLocks", "false");
    }

    //
    checkCDROMDir();
    defaultHndlr = getBrowserFile();
    loadSettings();

    //
    pPanel = new ProgressPanel("", 100L);
    pPanel.init();

    phrase = new JRadioButton(I18n.getString("label.phrase"));
    searchField = new JComboBox();
    searchIn = new JComboBox(searchOptsLabels);
    JLabel searchTypeLabel = new JLabel(I18n.getString("label.search_type"));
    JLabel searchInLabel = new JLabel(I18n.getString("label.search_in"));
    keywords = new JRadioButton(I18n.getString("label.keyword"));
    //
    searchLabel = new JLabel(I18n.getString("label.search_for"));
    searchButton = new JButton(I18n.getString("button.search"));
    searchButton.setActionCommand("ac_search");
    searchButton.setMnemonic(KeyEvent.VK_A);
    // TODO alt text to resource
    htmlTag = "<img src=\"" + fEnv.getIconURL(FileType.HTML.getIcon())
            + "\" border=\"0\" alt=\"Web Page Document\">";
    wordTag = "<img src=\"" + fEnv.getIconURL(FileType.MS_WORD.getIcon())
            + "\" border=\"0\" alt=\"MS Word Document\">";
    excelTag = "<img src=\"" + fEnv.getIconURL(FileType.MS_EXCEL.getIcon())
            + "\" border=\"0\" alt=\"MS Excel Document\">";
    pdfTag = "<img src=\"" + fEnv.getIconURL(FileType.PDF.getIcon()) + "\" border=\"0\" alt=\"PDF Document\">";
    textTag = "<img src=\"" + fEnv.getIconURL(FileType.TEXT.getIcon())
            + "\" border=\"0\" alt=\"Text Document\">";
    rtfTag = "<img src=\"" + fEnv.getIconURL(FileType.RTF.getIcon()) + "\" border=\"0\" alt=\"RTF Document\">";
    ooImpressTag = "<img src=\"" + fEnv.getIconURL(FileType.OO_IMPRESS.getIcon())
            + "\" border=\"0\" alt=\"OpenOffice Impress Document\">";
    ooWriterTag = "<img src=\"" + fEnv.getIconURL(FileType.OO_WRITER.getIcon())
            + "\" border=\"0\" alt=\"OpenOffice Writer Document\">";
    ooCalcTag = "<img src=\"" + fEnv.getIconURL(FileType.OO_CALC.getIcon())
            + "\" border=\"0\" alt=\"OpenOffice Calc Document\">";
    ooDrawTag = "<img src=\"" + fEnv.getIconURL(FileType.OO_DRAW.getIcon())
            + "\" border=\"0\" alt=\"OpenOffice Draw Document\">";
    openDocumentTextTag = "<img src=\"" + fEnv.getIconURL(FileType.OPENDOCUMENT_TEXT.getIcon())
            + "\" border=\"0\" alt=\"OpenDocument Text Document\">";
    //
    idx = new Index(this);
    colors = new String[2];
    colors[0] = "ffeffa";
    colors[1] = "fdffda";
    if (env.isWebStart()) {
        startPageString = getClass().getResource("/" + FileEnvironment.FILENAME_START_PAGE_WS).toString();
        helpPageString = getClass().getResource("/" + FileEnvironment.FILENAME_HELP_PAGE_WS).toString();
        if (startPageString != null) {
            logger.debug("DocSearch() Start Page is: " + startPageString);
            hasStartPage = true;
        } else {
            logger.error("DocSearch() Start Page NOT FOUND where expected: " + startPageString);
        }
    } else {
        startPageString = FileUtils.addFolder(fEnv.getStartDirectory(), FileEnvironment.FILENAME_START_PAGE);
        helpPageString = FileUtils.addFolder(fEnv.getStartDirectory(), FileEnvironment.FILENAME_HELP_PAGE);
        File startPageFile = new File(startPageString);
        if (startPageFile.exists()) {
            logger.debug("DocSearch() Start Page is: " + startPageString);
            hasStartPage = true;
        } else {
            logger.error("DocSearch() Start Page NOT FOUND where expected: " + startPageString);
        }
    }

    defaultSaveFolder = FileUtils.addFolder(fEnv.getWorkingDirectory(), "saved_searches");
    searchField.setEditable(true);
    searchField.addItem("");

    bg = new ButtonGroup();
    bg.add(phrase);
    bg.add(keywords);
    keywords.setSelected(true);

    keywords.setToolTipText(I18n.getString("tooltip.keyword"));
    phrase.setToolTipText(I18n.getString("tooltip.phrase"));

    int iconInt = 2;
    searchField.setPreferredSize(new Dimension(370, 22));

    // application icon
    Image iconImage = Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/ds.gif"));
    this.setIconImage(iconImage);

    // menu bar
    JMenuBar menuBar = createMenuBar();
    // add menu to frame
    setJMenuBar(menuBar);

    // tool bar
    JToolBar toolbar = createToolBar();

    editorPane = new JEditorPane("text/html", lastSearch);
    editorPane.setEditable(false);
    editorPane.addHyperlinkListener(new Hyperactive());
    if (hasStartPage) {
        try {
            editorPane.setContentType("text/html");
            if (setPage("home")) {
                logger.info("DocSearch() loaded start page: " + startPageString);
            }
        } catch (Exception e) {
            editorPane.setText(lastSearch);
        }
    } else {
        logger.warn("DocSearch() no start page loaded");
    }

    scrollPane = new JScrollPane(editorPane);
    scrollPane.setPreferredSize(new Dimension(1024, 720));
    scrollPane.setMinimumSize(new Dimension(900, 670));
    scrollPane.setMaximumSize(new Dimension(1980, 1980));

    // create panels
    // add printing stuff
    vista = new JComponentVista(editorPane, new PageFormat());

    JPanel topPanel = new JPanel();
    topPanel.add(searchLabel);
    topPanel.add(searchField);
    topPanel.add(searchButton);

    JPanel bottomPanel = new JPanel();
    bottomPanel.add(searchTypeLabel);
    bottomPanel.add(keywords);
    bottomPanel.add(phrase);
    bottomPanel.add(searchInLabel);
    bottomPanel.add(searchIn);

    // GUI items for advanced searching
    useDate = new JCheckBox(I18n.getString("label.use_date_property"));
    fromField = new JTextField(11);
    JLabel fromLabel = new JLabel(I18n.getString("label.from"));
    JLabel toLabel = new JLabel(I18n.getString("label.to"));
    toField = new JTextField(11);
    cbl = new CheckBoxListener();
    authorPanel = new JPanel();
    useAuthor = new JCheckBox(I18n.getString("label.use_auth_property"));
    authorField = new JTextField(31);
    JLabel authorLabel = new JLabel(I18n.getString("label.author"));
    authorPanel.add(useAuthor);
    authorPanel.add(authorLabel);
    authorPanel.add(authorField);

    // combine stuff
    JPanel datePanel = new JPanel();
    datePanel.add(useDate);
    datePanel.add(fromLabel);
    datePanel.add(fromField);
    datePanel.add(toLabel);
    datePanel.add(toField);

    JPanel metaPanel = new JPanel();
    metaPanel.setLayout(new BorderLayout());
    metaPanel.setBorder(new TitledBorder(I18n.getString("label.date_and_author")));
    metaPanel.add(datePanel, BorderLayout.NORTH);
    metaPanel.add(authorPanel, BorderLayout.SOUTH);

    useDate.addActionListener(cbl);
    useAuthor.addActionListener(cbl);

    fromField.setText(DateTimeUtils.getLastYear());
    toField.setText(DateTimeUtils.getToday());
    authorField.setText(System.getProperty("user.name"));

    JPanel[] panels = new JPanel[numPanels];
    for (int i = 0; i < numPanels; i++) {
        panels[i] = new JPanel();
    }

    // add giu to panels
    panels[0].setLayout(new BorderLayout());
    panels[0].add(topPanel, BorderLayout.NORTH);
    panels[0].add(bottomPanel, BorderLayout.SOUTH);
    panels[0].setBorder(new TitledBorder(I18n.getString("label.search_critera")));
    searchButton.addActionListener(this);

    JPanel fileTypePanel = new JPanel();
    useType = new JCheckBox(I18n.getString("label.use_filetype_property"));
    useType.addActionListener(cbl);
    fileType = new JComboBox(fileTypesToFindLabel);
    JLabel fileTypeLabel = new JLabel(I18n.getString("label.find_only_these_filetypes"));
    fileTypePanel.add(useType);
    fileTypePanel.add(fileTypeLabel);
    fileTypePanel.add(fileType);

    JPanel sizePanel = new JPanel();
    useSize = new JCheckBox(I18n.getString("label.use_filesize_property"));
    useSize.addActionListener(cbl);
    // TODO l18n kbytes
    JLabel sizeFromLabel = new JLabel(I18n.getString("label.from") + " KByte");
    JLabel sizeToLabel = new JLabel(I18n.getString("label.to") + " KByte");
    sizeFromField = new JTextField(10);
    sizeFromField.setText("0");
    sizeToField = new JTextField(10);
    sizeToField.setText("100");
    sizePanel.add(useSize);
    sizePanel.add(sizeFromLabel);
    sizePanel.add(sizeFromField);
    sizePanel.add(sizeToLabel);
    sizePanel.add(sizeToField);

    JPanel sizeAndTypePanel = new JPanel();
    sizeAndTypePanel.setLayout(new BorderLayout());
    sizeAndTypePanel.setBorder(new TitledBorder(I18n.getString("label.filetype_and_size")));
    sizeAndTypePanel.add(fileTypePanel, BorderLayout.NORTH);
    sizeAndTypePanel.add(sizePanel, BorderLayout.SOUTH);

    // set up the tabbed pane
    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.addTab(I18n.getString("label.general"), null, panels[0],
            I18n.getString("tooltip.general_search_criteria"));
    tabbedPane.addTab(I18n.getString("label.date_and_author"), null, metaPanel,
            I18n.getString("tooltip.date_auth_options"));
    tabbedPane.addTab(I18n.getString("label.filetype_and_size"), null, sizeAndTypePanel,
            I18n.getString("tooltip.filetype_and_size_options"));

    // gridbag
    getContentPane().setLayout(new GridLayout(1, numPanels + iconInt + 1));
    GridBagLayout gridbaglayout = new GridBagLayout();
    GridBagConstraints gridbagconstraints = new GridBagConstraints();
    getContentPane().setLayout(gridbaglayout);

    gridbagconstraints.fill = GridBagConstraints.HORIZONTAL;
    gridbagconstraints.insets = new Insets(1, 1, 1, 1);
    gridbagconstraints.gridx = 0;
    gridbagconstraints.gridy = 0;
    gridbagconstraints.gridwidth = 1;
    gridbagconstraints.gridheight = 1;
    gridbagconstraints.weightx = 1.0D;
    gridbagconstraints.weighty = 0.0D;
    gridbaglayout.setConstraints(toolbar, gridbagconstraints);
    getContentPane().add(toolbar);

    int start = 1;
    for (int i = 0; i < numPanels; i++) {
        if (i == 0) {
            gridbagconstraints.fill = GridBagConstraints.HORIZONTAL;
            gridbagconstraints.insets = new Insets(1, 1, 1, 1);
            gridbagconstraints.gridx = 0;
            gridbagconstraints.gridy = i + start;
            gridbagconstraints.gridwidth = 1;
            gridbagconstraints.gridheight = 1;
            gridbagconstraints.weightx = 1.0D;
            gridbagconstraints.weighty = 0.0D;
            gridbaglayout.setConstraints(tabbedPane, gridbagconstraints);
            getContentPane().add(tabbedPane);
        } else {
            gridbagconstraints.fill = GridBagConstraints.HORIZONTAL;
            gridbagconstraints.insets = new Insets(1, 1, 1, 1);
            gridbagconstraints.gridx = 0;
            gridbagconstraints.gridy = i + start;
            gridbagconstraints.gridwidth = 1;
            gridbagconstraints.gridheight = 1;
            gridbagconstraints.weightx = 1.0D;
            gridbagconstraints.weighty = 0.0D;
            gridbaglayout.setConstraints(panels[i], gridbagconstraints);
            getContentPane().add(panels[i]);
        }
    }

    // now add the results area
    gridbagconstraints.fill = GridBagConstraints.HORIZONTAL;
    gridbagconstraints.insets = new Insets(1, 1, 1, 1);
    gridbagconstraints.gridx = 0;
    gridbagconstraints.gridy = iconInt;
    gridbagconstraints.gridwidth = 1;
    gridbagconstraints.gridheight = 1;
    gridbagconstraints.weightx = 1.0D;
    gridbagconstraints.weighty = 1.0D;
    gridbaglayout.setConstraints(scrollPane, gridbagconstraints);
    getContentPane().add(scrollPane);
    JPanel statusP = new JPanel();
    statusP.setLayout(new BorderLayout());
    statusP.add(dirLabel, BorderLayout.WEST);
    statusP.add(pPanel, BorderLayout.EAST);

    // now add the status label
    gridbagconstraints.fill = GridBagConstraints.HORIZONTAL;
    gridbagconstraints.insets = new Insets(1, 1, 1, 1);
    gridbagconstraints.gridx = 0;
    gridbagconstraints.gridy = numPanels + iconInt;
    gridbagconstraints.gridwidth = 1;
    gridbagconstraints.gridheight = 1;
    gridbagconstraints.weightx = 1.0D;
    gridbagconstraints.weighty = 0.0D;
    gridbaglayout.setConstraints(statusP, gridbagconstraints);
    getContentPane().add(statusP);

    //
    File testArchDir = new File(fEnv.getArchiveDirectory());
    if (!testArchDir.exists()) {
        boolean madeDir = testArchDir.mkdir();
        if (!madeDir) {
            logger.warn("DocSearch() Error creating directory: " + fEnv.getArchiveDirectory());
        } else {
            logger.info("DocSearch() Directory created: " + fEnv.getArchiveDirectory());
        }
    }
    loadIndexes();

    // DocTypeHandler
    String handlersFiName;
    if (!isCDSearchTool) {
        handlersFiName = FileUtils.addFolder(fEnv.getWorkingDirectory(), DocTypeHandlerUtils.HANDLER_FILE);
    } else {
        handlersFiName = FileUtils.addFolder(cdRomDefaultHome, DocTypeHandlerUtils.HANDLER_FILE);
    }
    DocTypeHandlerUtils dthUtils = new DocTypeHandlerUtils();
    if (!FileUtils.fileExists(handlersFiName)) {
        logger.warn("DocSearch() Handlers file not found at: " + handlersFiName);
        handlerList = dthUtils.getInitialHandler(env);
    } else {
        handlerList = dthUtils.loadHandler(handlersFiName);
    }
}

From source file:org.ngrinder.recorder.ui.RecordingControlPanel.java

/**
 * Create filter by type panel.//from   w ww .  j  a  va  2  s  .c  om
 * 
 * @return created panel
 */
protected JPanel createTypeFilterPanel() {
    JPanel panel = new JPanel();
    panel.setBorder(new TitledBorder("Recorded Type"));
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    for (FileTypeCategory each : FileTypeCategory.values()) {
        panel.add(new JExtendedCheckBox(each.name(), each.getDisplayName(), true));
    }
    return panel;
}

From source file:org.ngrinder.recorder.ui.RecordingControlPanel.java

/**
 * Create Generation Options Panel.//from  ww  w.  j  av a2s .  c  o  m
 * 
 * @return generated panel
 */
protected JPanel createGenerationOptionsPanel() {
    JPanel panel = new JPanel();
    panel.setBorder(new TitledBorder("Script Generation Options"));
    GridLayout mgr = new GridLayout(3, 1);
    panel.setLayout(mgr);
    for (GenerationOption each : GenerationOption.getOptions(null)) {
        JExtendedCheckBox comp = new JExtendedCheckBox(each.name(), each.getDisplayName(), true);
        panel.add(comp);

    }
    JPanel subPanel = new JPanel();
    subPanel.setLayout(new GridLayout(1, 2));
    JLabel languageLabel = new JLabel("Language");
    subPanel.add(languageLabel);
    JComboBox languageCombo = new JComboBox();
    for (GenerationOption each : GenerationOption.getOptions("Language")) {
        languageCombo.addItem(each);
    }
    subPanel.add(languageCombo);
    panel.add(subPanel);
    return panel;
}

From source file:org.ohdsi.whiteRabbit.WhiteRabbitMain.java

private JPanel createScanPanel() {
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());

    JPanel tablePanel = new JPanel();
    tablePanel.setLayout(new BorderLayout());
    tablePanel.setBorder(new TitledBorder("Tables to scan"));
    tableList = new JList<String>();
    tableList.setToolTipText("Specify the tables (or CSV files) to be scanned here");
    tablePanel.add(new JScrollPane(tableList), BorderLayout.CENTER);

    JPanel tableButtonPanel = new JPanel();
    tableButtonPanel.setLayout(new GridLayout(3, 1));
    addAllButton = new JButton("Add all in DB");
    addAllButton.setToolTipText("Add all tables in the database");
    addAllButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            addAllTables();//ww w. jav  a  2  s.  c om
        }
    });
    addAllButton.setEnabled(false);
    tableButtonPanel.add(addAllButton);
    JButton addButton = new JButton("Add");
    addButton.setToolTipText("Add tables to list");
    addButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            pickTables();
        }
    });
    tableButtonPanel.add(addButton);
    JButton removeButton = new JButton("Remove");
    removeButton.setToolTipText("Remove tables from list");
    removeButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            removeTables();
        }
    });
    tableButtonPanel.add(removeButton);
    tablePanel.add(tableButtonPanel, BorderLayout.EAST);

    panel.add(tablePanel, BorderLayout.CENTER);

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

    JPanel scanOptionsPanel = new JPanel();
    scanOptionsPanel.setLayout(new BoxLayout(scanOptionsPanel, BoxLayout.X_AXIS));

    scanValueScan = new JCheckBox("Scan field values", true);
    scanValueScan.setToolTipText("Include a frequency count of field values in the scan report");
    scanValueScan.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent arg0) {
            scanMinCellCount.setEnabled(((JCheckBox) arg0.getSource()).isSelected());
            scanRowCount.setEnabled(((JCheckBox) arg0.getSource()).isSelected());
            scanValuesCount.setEnabled(((JCheckBox) arg0.getSource()).isSelected());
        }
    });
    scanOptionsPanel.add(scanValueScan);
    scanOptionsPanel.add(Box.createHorizontalGlue());

    scanOptionsPanel.add(new JLabel("Min cell count "));
    scanMinCellCount = new JSpinner();
    scanMinCellCount.setValue(5);
    scanMinCellCount.setToolTipText("Minimum frequency for a field value to be included in the report");
    scanOptionsPanel.add(scanMinCellCount);
    scanOptionsPanel.add(Box.createHorizontalGlue());

    scanOptionsPanel.add(new JLabel("Max distinct values "));
    scanValuesCount = new JComboBox<String>(new String[] { "100", "1,000", "10,000" });
    scanValuesCount.setSelectedIndex(1);
    scanValuesCount.setToolTipText("Maximum number of distinct values per field to be reported");
    scanOptionsPanel.add(scanValuesCount);
    scanOptionsPanel.add(Box.createHorizontalGlue());

    scanOptionsPanel.add(new JLabel("Rows per table "));
    scanRowCount = new JComboBox<String>(new String[] { "100,000", "500,000", "1 million", "all" });
    scanRowCount.setSelectedIndex(0);
    scanRowCount.setToolTipText("Maximum number of rows per table to be scanned for field values");
    scanOptionsPanel.add(scanRowCount);

    southPanel.add(scanOptionsPanel);

    southPanel.add(Box.createVerticalStrut(3));

    JPanel scanButtonPanel = new JPanel();
    scanButtonPanel.setLayout(new BoxLayout(scanButtonPanel, BoxLayout.X_AXIS));
    scanButtonPanel.add(Box.createHorizontalGlue());

    JButton scanButton = new JButton("Scan tables");
    scanButton.setBackground(new Color(151, 220, 141));
    scanButton.setToolTipText("Scan the selected tables");
    scanButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scanRun();
        }
    });
    componentsToDisableWhenRunning.add(scanButton);
    scanButtonPanel.add(scanButton);
    southPanel.add(scanButtonPanel);

    panel.add(southPanel, BorderLayout.SOUTH);

    return panel;
}

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

/**
 * Builds the various panels used to set the parameters of the
 * projection./*from   w  ww.  j a v  a 2  s.c  om*/
 * 
 * @return See above.
 */
private JPanel buildParametersPanel() {
    JPanel p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    p.add(buildRangePanel(zrangeSelection, "Z Range: "));
    p.add(buildRangePanel(timeSelection, "Timepoint: "));

    if (pixelsType != null) {
        p.add(new JSeparator());
        p.add(buildPixelsTypePanel());
    }

    JPanel r = UIUtilities.buildComponentPanel(p);
    r.setBorder(new TitledBorder(""));
    return r;
}

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

/**
 * Builds the controls./*from  w  w  w. j av  a  2 s .  c  o  m*/
 * 
 * @return See above.
 */
private JPanel buildControls() {
    JPanel p = new JPanel();
    p.setBorder(new TitledBorder(""));
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
    p.add(selectionPane);
    p.add(Box.createHorizontalStrut(5));
    p.add(newFolderButton);
    return p;
}