Example usage for javax.swing SwingConstants CENTER

List of usage examples for javax.swing SwingConstants CENTER

Introduction

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

Prototype

int CENTER

To view the source code for javax.swing SwingConstants CENTER.

Click Source Link

Document

The central position in an area.

Usage

From source file:org.piraso.ui.api.views.BaseEntryViewTopComponent.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor./*from  w  w w  . ja  v a2s  .co m*/
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    jSeparator1 = new javax.swing.JToolBar.Separator();
    buttonGroup1 = new javax.swing.ButtonGroup();
    btnPin = new javax.swing.JToggleButton();
    toolbar = new javax.swing.JToolBar();
    toolbar2 = new javax.swing.JToolBar();

    btnPin.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/piraso/ui/api/icons/pin_small.png"))); // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(btnPin, org.openide.util.NbBundle
            .getMessage(BaseEntryViewTopComponent.class, "BaseEntryViewTopComponent.btnPin.text")); // NOI18N
    btnPin.setToolTipText(org.openide.util.NbBundle.getMessage(BaseEntryViewTopComponent.class,
            "BaseEntryViewTopComponent.btnPin.toolTipText")); // NOI18N
    btnPin.setFocusable(false);
    btnPin.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnPin.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    btnPin.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnPinActionPerformed(evt);
        }
    });

    setLayout(new java.awt.BorderLayout());

    toolbar.setBackground(new java.awt.Color(226, 226, 226));
    toolbar.setFloatable(false);
    toolbar.setRollover(true);
    add(toolbar, java.awt.BorderLayout.NORTH);

    toolbar2.setBackground(new java.awt.Color(226, 226, 226));
    toolbar2.setFloatable(false);
    toolbar2.setOrientation(1);
    toolbar2.setRollover(true);
    toolbar2.setVisible(false);
    add(toolbar2, java.awt.BorderLayout.WEST);
}

From source file:org.piraso.ui.base.ContextMonitorTopComponent.java

/** This method is called from within the constructor to
 * initialize the form./* ww w.  j  a v a 2s  .com*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    toolbar = new javax.swing.JToolBar();
    jSeparator2 = new javax.swing.JToolBar.Separator();
    btnSearch = new javax.swing.JToggleButton();
    btnClear = new javax.swing.JButton();
    jSeparator1 = new javax.swing.JToolBar.Separator();
    btnAutoScroll = new javax.swing.JToggleButton();
    cboUrl = new javax.swing.JComboBox();
    tableScrollPane = new javax.swing.JScrollPane();
    table = new javax.swing.JTable();
    searchBar = new javax.swing.JToolBar();
    jLabel1 = new javax.swing.JLabel();
    txtSearch = new javax.swing.JTextField();
    jSeparator3 = new javax.swing.JToolBar.Separator();
    btnPrevious = new javax.swing.JButton();
    btnNext = new javax.swing.JButton();
    jSeparator5 = new javax.swing.JToolBar.Separator();
    chkMatchCase = new javax.swing.JCheckBox();
    chkWholeWord = new javax.swing.JCheckBox();
    chkRegex = new javax.swing.JCheckBox();
    btnCloseSearchBar = new javax.swing.JButton();

    setLayout(new java.awt.BorderLayout());

    toolbar.setBackground(new java.awt.Color(226, 226, 226));
    toolbar.setFloatable(false);
    toolbar.setRollover(true);
    toolbar.add(jSeparator2);

    btnSearch.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/piraso/ui/base/icons/find.png"))); // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(btnSearch, org.openide.util.NbBundle
            .getMessage(ContextMonitorTopComponent.class, "ContextMonitorTopComponent.btnSearch.text")); // NOI18N
    btnSearch.setToolTipText(org.openide.util.NbBundle.getMessage(ContextMonitorTopComponent.class,
            "ContextMonitorTopComponent.btnSearch.toolTipText")); // NOI18N
    btnSearch.setFocusable(false);
    btnSearch.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnSearch.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    btnSearch.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnSearchActionPerformed(evt);
        }
    });
    toolbar.add(btnSearch);

    btnClear.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/org/piraso/ui/base/icons/edit_clear.png"))); // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(btnClear, org.openide.util.NbBundle
            .getMessage(ContextMonitorTopComponent.class, "ContextMonitorTopComponent.btnClear.text")); // NOI18N
    btnClear.setToolTipText(org.openide.util.NbBundle.getMessage(ContextMonitorTopComponent.class,
            "ContextMonitorTopComponent.btnClear.toolTipText")); // NOI18N
    btnClear.setBorder(javax.swing.BorderFactory.createEmptyBorder(7, 7, 7, 7));
    btnClear.setFocusable(false);
    btnClear.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnClear.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    btnClear.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnClearActionPerformed(evt);
        }
    });
    toolbar.add(btnClear);
    toolbar.add(jSeparator1);

    btnAutoScroll.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/org/piraso/ui/base/icons/arrow-switch-270.png"))); // NOI18N
    btnAutoScroll.setSelected(true);
    org.openide.awt.Mnemonics.setLocalizedText(btnAutoScroll, org.openide.util.NbBundle
            .getMessage(ContextMonitorTopComponent.class, "ContextMonitorTopComponent.btnAutoScroll.text")); // NOI18N
    btnAutoScroll.setToolTipText(org.openide.util.NbBundle.getMessage(ContextMonitorTopComponent.class,
            "ContextMonitorTopComponent.btnAutoScroll.toolTipText")); // NOI18N
    btnAutoScroll.setFocusable(false);
    btnAutoScroll.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnAutoScroll.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    btnAutoScroll.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnAutoScrollActionPerformed(evt);
        }
    });
    toolbar.add(btnAutoScroll);

    cboUrl.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N
    cboUrl.setModel(comboBoxModel);
    toolbar.add(cboUrl);

    add(toolbar, java.awt.BorderLayout.NORTH);

    tableScrollPane.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
    tableScrollPane.setFont(new java.awt.Font("Monospaced", 0, 10)); // NOI18N

    table.setFont(FontProviderManager.INSTANCE.getEditorDefaultFont());
    table.setModel(tableModel);
    table.setGridColor(new java.awt.Color(204, 0, 0));
    table.setRowMargin(0);
    table.setShowHorizontalLines(false);
    table.setShowVerticalLines(false);
    tableScrollPane.setViewportView(table);

    add(tableScrollPane, java.awt.BorderLayout.CENTER);

    searchBar.setBackground(new java.awt.Color(226, 226, 226));
    searchBar.setFloatable(false);
    searchBar.setRollover(true);
    searchBar.setVisible(false);

    org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle
            .getMessage(ContextMonitorTopComponent.class, "ContextMonitorTopComponent.jLabel1.text")); // NOI18N
    searchBar.add(jLabel1);

    txtSearch.setText(org.openide.util.NbBundle.getMessage(ContextMonitorTopComponent.class,
            "ContextMonitorTopComponent.txtSearch.text")); // NOI18N
    txtSearch.setMaximumSize(new java.awt.Dimension(200, 2147483647));
    txtSearch.setPreferredSize(new java.awt.Dimension(200, 28));
    searchBar.add(txtSearch);
    searchBar.add(jSeparator3);

    btnPrevious.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/org/piraso/ui/base/icons/previous.png"))); // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(btnPrevious, org.openide.util.NbBundle
            .getMessage(ContextMonitorTopComponent.class, "ContextMonitorTopComponent.btnPrevious.text")); // NOI18N
    btnPrevious.setToolTipText(org.openide.util.NbBundle.getMessage(ContextMonitorTopComponent.class,
            "ContextMonitorTopComponent.btnPrevious.toolTipText")); // NOI18N
    btnPrevious.setBorder(javax.swing.BorderFactory.createEmptyBorder(7, 7, 7, 7));
    btnPrevious.setFocusable(false);
    btnPrevious.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnPrevious.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    btnPrevious.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnPreviousActionPerformed(evt);
        }
    });
    searchBar.add(btnPrevious);

    btnNext.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/piraso/ui/base/icons/next.png"))); // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(btnNext, org.openide.util.NbBundle
            .getMessage(ContextMonitorTopComponent.class, "ContextMonitorTopComponent.btnNext.text")); // NOI18N
    btnNext.setToolTipText(org.openide.util.NbBundle.getMessage(ContextMonitorTopComponent.class,
            "ContextMonitorTopComponent.btnNext.toolTipText")); // NOI18N
    btnNext.setBorder(javax.swing.BorderFactory.createEmptyBorder(7, 7, 7, 7));
    btnNext.setFocusable(false);
    btnNext.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnNext.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    btnNext.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnNextActionPerformed(evt);
        }
    });
    searchBar.add(btnNext);
    searchBar.add(jSeparator5);

    chkMatchCase.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(chkMatchCase, org.openide.util.NbBundle
            .getMessage(ContextMonitorTopComponent.class, "ContextMonitorTopComponent.chkMatchCase.text")); // NOI18N
    chkMatchCase.setContentAreaFilled(false);
    chkMatchCase.setFocusable(false);
    chkMatchCase.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
    searchBar.add(chkMatchCase);

    chkWholeWord.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(chkWholeWord, org.openide.util.NbBundle
            .getMessage(ContextMonitorTopComponent.class, "ContextMonitorTopComponent.chkWholeWord.text")); // NOI18N
    chkWholeWord.setContentAreaFilled(false);
    chkWholeWord.setFocusable(false);
    chkWholeWord.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
    searchBar.add(chkWholeWord);

    chkRegex.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(chkRegex, org.openide.util.NbBundle
            .getMessage(ContextMonitorTopComponent.class, "ContextMonitorTopComponent.chkRegex.text")); // NOI18N
    chkRegex.setContentAreaFilled(false);
    chkRegex.setFocusable(false);
    chkRegex.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
    searchBar.add(chkRegex);

    btnCloseSearchBar
            .setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/piraso/ui/base/icons/close.png"))); // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(btnCloseSearchBar, org.openide.util.NbBundle
            .getMessage(ContextMonitorTopComponent.class, "ContextMonitorTopComponent.btnCloseSearchBar.text")); // NOI18N
    btnCloseSearchBar.setToolTipText(org.openide.util.NbBundle.getMessage(ContextMonitorTopComponent.class,
            "ContextMonitorTopComponent.btnCloseSearchBar.toolTipText")); // NOI18N
    btnCloseSearchBar.setBorder(javax.swing.BorderFactory.createEmptyBorder(7, 2, 7, 2));
    btnCloseSearchBar.setFocusable(false);
    btnCloseSearchBar.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    btnCloseSearchBar.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
    btnCloseSearchBar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    btnCloseSearchBar.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnCloseSearchBarActionPerformed(evt);
        }
    });
    searchBar.add(Box.createHorizontalGlue());
    searchBar.add(btnCloseSearchBar);

    add(searchBar, java.awt.BorderLayout.PAGE_END);
}

From source file:org.piraso.ui.base.RequestTreeTopComponent.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.//from   www .  j a v  a  2  s  .  c  om
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    jScrollPane1 = new javax.swing.JScrollPane();
    jTree = new javax.swing.JTree();
    toolbar = new javax.swing.JToolBar();
    btnCollapse = new javax.swing.JButton();
    btnColorLatest = new javax.swing.JToggleButton();
    jSeparator1 = new javax.swing.JToolBar.Separator();
    btnTarget = new javax.swing.JButton();

    setLayout(new java.awt.BorderLayout());

    jTree.setModel(model);
    jTree.setCellRenderer(new TreeCellRenderer());
    jTree.setRootVisible(false);
    jTree.setShowsRootHandles(true);
    jScrollPane1.setViewportView(jTree);

    add(jScrollPane1, java.awt.BorderLayout.CENTER);

    toolbar.setBackground(new java.awt.Color(226, 226, 226));
    toolbar.setFloatable(false);
    toolbar.setRollover(true);
    toolbar.setOpaque(false);

    btnCollapse.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/org/piraso/ui/base/icons/gh-icon-collapse.png"))); // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(btnCollapse, org.openide.util.NbBundle
            .getMessage(RequestTreeTopComponent.class, "RequestTreeTopComponent.btnCollapse.text")); // NOI18N
    btnCollapse.setToolTipText(org.openide.util.NbBundle.getMessage(RequestTreeTopComponent.class,
            "RequestTreeTopComponent.btnCollapse.toolTipText")); // NOI18N
    btnCollapse.setBorder(javax.swing.BorderFactory.createEmptyBorder(7, 7, 7, 7));
    btnCollapse.setFocusable(false);
    btnCollapse.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnCollapse.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    btnCollapse.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnCollapseActionPerformed(evt);
        }
    });
    toolbar.add(btnCollapse);

    btnColorLatest
            .setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/piraso/ui/base/icons/time.png"))); // NOI18N
    btnColorLatest.setSelected(true);
    org.openide.awt.Mnemonics.setLocalizedText(btnColorLatest, org.openide.util.NbBundle
            .getMessage(RequestTreeTopComponent.class, "RequestTreeTopComponent.btnColorLatest.text")); // NOI18N
    btnColorLatest.setToolTipText(org.openide.util.NbBundle.getMessage(RequestTreeTopComponent.class,
            "RequestTreeTopComponent.btnColorLatest.toolTipText")); // NOI18N
    btnColorLatest.setFocusable(false);
    btnColorLatest.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnColorLatest.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    btnColorLatest.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnColorLatestActionPerformed(evt);
        }
    });
    toolbar.add(btnColorLatest);
    toolbar.add(jSeparator1);

    btnTarget.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/org/piraso/ui/base/icons/target_arrow.png"))); // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(btnTarget, org.openide.util.NbBundle
            .getMessage(RequestTreeTopComponent.class, "RequestTreeTopComponent.btnTarget.text")); // NOI18N
    btnTarget.setToolTipText(org.openide.util.NbBundle.getMessage(RequestTreeTopComponent.class,
            "RequestTreeTopComponent.btnTarget.toolTipText")); // NOI18N
    btnTarget.setBorder(javax.swing.BorderFactory.createEmptyBorder(7, 7, 7, 7));
    btnTarget.setFocusable(false);
    btnTarget.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnTarget.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    btnTarget.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnTargetActionPerformed(evt);
        }
    });
    toolbar.add(Box.createHorizontalGlue());
    toolbar.add(btnTarget);

    add(toolbar, java.awt.BorderLayout.NORTH);
}

From source file:org.piraso.ui.sql.SQLViewTopComponent.java

/** This method is called from within the constructor to
 * initialize the form./*from  w ww  .  j  av a2  s.c o  m*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    scrollSQLPane = new javax.swing.JScrollPane();
    txtSQL = new javax.swing.JEditorPane();
    scrollTable = new javax.swing.JScrollPane();
    table = new javax.swing.JTable();
    jToolBar1 = new javax.swing.JToolBar();
    btnProperties = new javax.swing.JToggleButton();
    btnReplaceParameters = new javax.swing.JToggleButton();
    btnFormat = new javax.swing.JToggleButton();
    btnCopy = new javax.swing.JButton();
    jSplitPane1 = new javax.swing.JSplitPane();

    txtSQL.setFont(FontProviderManager.INSTANCE.getEditorDefaultFont());
    scrollSQLPane.setViewportView(txtSQL);

    table.setFont(FontProviderManager.INSTANCE.getEditorDefaultFont());
    table.setModel(tableModel);
    scrollTable.setViewportView(table);

    setLayout(new java.awt.BorderLayout());

    jToolBar1.setBackground(new java.awt.Color(226, 226, 226));
    jToolBar1.setFloatable(false);
    jToolBar1.setOrientation(1);
    jToolBar1.setRollover(true);

    btnProperties.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/org/piraso/ui/sql/icons/properties.png"))); // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(btnProperties, org.openide.util.NbBundle
            .getMessage(SQLViewTopComponent.class, "SQLViewTopComponent.btnProperties.text")); // NOI18N
    btnProperties.setToolTipText(org.openide.util.NbBundle.getMessage(SQLViewTopComponent.class,
            "SQLViewTopComponent.btnProperties.toolTipText")); // NOI18N
    btnProperties.setFocusable(false);
    btnProperties.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnProperties.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    btnProperties.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnPropertiesActionPerformed(evt);
        }
    });
    jToolBar1.add(btnProperties);

    btnReplaceParameters.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/org/piraso/ui/sql/icons/replace_variables.png"))); // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(btnReplaceParameters, org.openide.util.NbBundle
            .getMessage(SQLViewTopComponent.class, "SQLViewTopComponent.btnReplaceParameters.text")); // NOI18N
    btnReplaceParameters.setToolTipText(org.openide.util.NbBundle.getMessage(SQLViewTopComponent.class,
            "SQLViewTopComponent.btnReplaceParameters.toolTipText")); // NOI18N
    btnReplaceParameters.setFocusable(false);
    btnReplaceParameters.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnReplaceParameters.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    btnReplaceParameters.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnReplaceParametersActionPerformed(evt);
        }
    });
    jToolBar1.add(btnReplaceParameters);

    btnFormat.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/piraso/ui/sql/icons/format.png"))); // NOI18N
    btnFormat.setSelected(true);
    org.openide.awt.Mnemonics.setLocalizedText(btnFormat, org.openide.util.NbBundle
            .getMessage(SQLViewTopComponent.class, "SQLViewTopComponent.btnFormat.text")); // NOI18N
    btnFormat.setToolTipText(org.openide.util.NbBundle.getMessage(SQLViewTopComponent.class,
            "SQLViewTopComponent.btnFormat.toolTipText")); // NOI18N
    btnFormat.setFocusable(false);
    btnFormat.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnFormat.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    btnFormat.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnFormatActionPerformed(evt);
        }
    });
    jToolBar1.add(btnFormat);

    btnCopy.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/piraso/ui/sql/icons/copy.png"))); // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(btnCopy, org.openide.util.NbBundle
            .getMessage(SQLViewTopComponent.class, "SQLViewTopComponent.btnCopy.text")); // NOI18N
    btnCopy.setToolTipText(org.openide.util.NbBundle.getMessage(SQLViewTopComponent.class,
            "SQLViewTopComponent.btnCopy.toolTipText")); // NOI18N
    btnCopy.setBorder(javax.swing.BorderFactory.createEmptyBorder(7, 7, 7, 7));
    btnCopy.setEnabled(false);
    btnCopy.setFocusable(false);
    btnCopy.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnCopy.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    btnCopy.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnCopyActionPerformed(evt);
        }
    });
    jToolBar1.add(btnCopy);

    add(jToolBar1, java.awt.BorderLayout.LINE_START);
    add(jSplitPane1, java.awt.BorderLayout.CENTER);
}

From source file:org.pmedv.blackboard.commands.OpenBoardCommand.java

@Override
public void execute(ActionEvent e) {

    final ApplicationWindow win = ctx.getBean(ApplicationWindow.class);

    // No file selected before, popup a dialog and query the user which file to open.
    if (file == null) {
        String path = System.getProperty("user.home");
        if (AppContext.getLastSelectedFolder() != null) {
            path = AppContext.getLastSelectedFolder();
        }//from www . j a va2  s. c  o  m
        JFileChooser fc = new JFileChooser(path);
        fc.setDialogTitle(resources.getResourceByKey("OpenBoardCommand.name"));
        fc.setFileFilter(new FefaultFileFilter());
        int result = fc.showOpenDialog(win);
        if (result == JFileChooser.APPROVE_OPTION) {
            if (fc.getSelectedFile() == null)
                return;
            file = fc.getSelectedFile();
            AppContext.setLastSelectedFolder(file.getParentFile().getAbsolutePath());
        } else {
            return;
        }
    }

    final JWindow topWindow = new JWindow();
    topWindow.setSize(390, 50);
    topWindow.setLayout(new BorderLayout());
    topWindow.setBackground(Color.WHITE);

    final JPanel content = new JPanel(new BorderLayout());
    content.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.BLACK),
            BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    content.setBackground(Color.WHITE);
    final JLabel infoLabel = new JLabel(
            resources.getResourceByKey("OpenBoardCommand.waitMsg") + " " + file.getName());
    infoLabel.setVerticalAlignment(SwingConstants.CENTER);
    content.add(infoLabel, BorderLayout.SOUTH);

    final JBusyComponent<JPanel> busyPanel = new JBusyComponent<JPanel>(content);
    busyPanel.setBusy(true);

    topWindow.getContentPane().add(busyPanel, BorderLayout.CENTER);
    topWindow.setLocationRelativeTo(null);
    topWindow.add(busyPanel, BorderLayout.CENTER);

    final SwingWorker<Boolean, Void> worker = new SwingWorker<Boolean, Void>() {

        @Override
        protected Boolean doInBackground() {
            topWindow.setVisible(true);
            doOpen();
            return Boolean.valueOf(true);
        }

        @Override
        protected void done() {
            topWindow.setVisible(false);
            topWindow.dispose();
            for (Runnable r : postConfigurators) {
                SwingUtilities.invokeLater(r);
            }
        }
    };

    worker.execute();

}

From source file:org.p_vcd.ui.VcdDialog.java

public VcdDialog() {
    setSize(700, 450);/*from ww w  .j a  v  a  2s.co  m*/
    setTitle("P-VCD - Video Copy Detection");
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    this.currentStep = 1;

    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new CardLayout(0, 0));
    {
        JPanel panel_Step1 = new JPanel();
        contentPanel.add(panel_Step1, "card_step1");
        panel_Step1.setLayout(new BorderLayout(0, 0));
        JLabel lblTitle = new JLabel("STEP 1 - Video Database (the \"known\")");
        panel_Step1.add(lblTitle, BorderLayout.NORTH);
        lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
        lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 18));

        JPanel panel_1 = new JPanel();
        panel_Step1.add(panel_1, BorderLayout.CENTER);
        panel_1.setLayout(new MigLayout("", "[250px,grow][20px][250px,grow]", "[][][230px,grow][][][]"));

        JLabel lblNewLabel = new JLabel("Please select the video databases to search in:");
        panel_1.add(lblNewLabel, "cell 0 0");

        panel_1.add(lbl_refDbTitle, "cell 2 1");

        JScrollPane scrollPane_1 = new JScrollPane();
        panel_1.add(scrollPane_1, "cell 0 1 1 3,grow");
        panel_refDatabasesList.setBackground(Color.WHITE);

        scrollPane_1.setViewportView(panel_refDatabasesList);
        panel_refDatabasesList.setLayout(new MigLayout("gapy 10", "[200px]", "[][]"));

        JScrollPane scrollPane = new JScrollPane();
        scrollPane.setBorder(null);
        panel_1.add(scrollPane, "cell 2 2,grow");

        scrollPane.setViewportView(lbl_refDbFiles);

        panel_1.add(lbl_refDbMetadata, "cell 2 3");

        JButton btnNewDatabase = new JButton("New database...");
        panel_1.add(btnNewDatabase, "cell 0 4");
        btnNewDatabase.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                newDatabaseButton();
            }
        });
    }
    {
        JPanel panel_Step2 = new JPanel();
        contentPanel.add(panel_Step2, "card_step2");
        panel_Step2.setLayout(new BorderLayout(0, 0));
        JLabel lblTitle = new JLabel("STEP 2 - Query (the \"unknown\")");
        panel_Step2.add(lblTitle, BorderLayout.NORTH);
        lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
        lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 18));

        JPanel panel = new JPanel();
        panel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Query",
                TitledBorder.LEADING, TitledBorder.TOP, null, null));
        panel_Step2.add(panel, BorderLayout.CENTER);
        panel.setLayout(
                new MigLayout("", "[160px][grow]", "[25px][grow,top][25px][grow,top][25px][grow,top][grow]"));

        ButtonGroup queryButtonGroup = new ButtonGroup();

        queryButtonGroup.add(radio_queryFile);
        radio_queryFile.setFont(new Font("Tahoma", Font.PLAIN, 13));
        panel.add(radio_queryFile, "cell 0 0");

        lbl_queryFile.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                radio_queryFile.setSelected(true);
            }
        });
        panel.add(lbl_queryFile, "flowy,cell 1 0");

        JButton btnSelectFile = new JButton("Select File...");
        btnSelectFile.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                selectFileButton();
            }
        });
        panel.add(btnSelectFile, "cell 1 0");

        JLabel lblIumageOrVideo = new JLabel("Select an image or video in the local machine.");
        panel.add(lblIumageOrVideo, "cell 1 1");

        queryButtonGroup.add(radio_queryUrl);
        radio_queryUrl.setFont(new Font("Tahoma", Font.PLAIN, 13));
        panel.add(radio_queryUrl, "cell 0 2");

        txt_queryUrl.addKeyListener(new KeyAdapter() {
            @Override
            public void keyReleased(KeyEvent e) {
                radio_queryUrl.setSelected(true);
            }
        });
        txt_queryUrl.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                radio_queryUrl.setSelected(true);
            }
        });
        txt_queryUrl.addFocusListener(new FocusAdapter() {
            @Override
            public void focusGained(FocusEvent e) {
                radio_queryUrl.setSelected(true);
            }
        });
        txt_queryUrl.setText("http://");
        panel.add(txt_queryUrl, "flowy,cell 1 2");
        txt_queryUrl.setColumns(50);

        JLabel lblUrlToA = new JLabel(
                "<html>Enter the URL to download an image or video.<br>You can use a URL like: http://www.youtube.com/watch?v=... </html>");
        panel.add(lblUrlToA, "flowy,cell 1 3");

        queryButtonGroup.add(radio_queryDb);
        radio_queryDb.setFont(new Font("Tahoma", Font.PLAIN, 13));
        panel.add(radio_queryDb, "cell 0 4");

        comboBox_queryDb.setMaximumRowCount(12);
        comboBox_queryDb.setPreferredSize(new Dimension(100, 20));
        comboBox_queryDb.setMinimumSize(new Dimension(100, 20));
        comboBox_queryDb.addPropertyChangeListener(new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent evt) {
                if (comboBox_queryDb.getSelectedIndex() > 0)
                    radio_queryDb.setSelected(true);
                updateQueryDbDetail();
            }
        });
        comboBox_queryDb.addKeyListener(new KeyAdapter() {
            @Override
            public void keyReleased(KeyEvent e) {
                if (comboBox_queryDb.getSelectedIndex() > 0)
                    radio_queryDb.setSelected(true);
                updateQueryDbDetail();
            }
        });

        panel.add(comboBox_queryDb, "flowx,cell 1 4");

        panel.add(lbl_queryDb, "cell 1 4");

        JLabel lblPleaseNopteThe = new JLabel("<html>A search is run for each video in the database.</html>");
        panel.add(lblPleaseNopteThe, "cell 1 5");

    }
    {
        JPanel panel_Step3 = new JPanel();
        contentPanel.add(panel_Step3, "card_step3");
        panel_Step3.setLayout(new BorderLayout(0, 0));

        JLabel lblTitle = new JLabel("STEP 3 - Search Options");
        lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 18));
        lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
        panel_Step3.add(lblTitle, BorderLayout.NORTH);

        JPanel panel2 = new JPanel();
        panel2.setLayout(new FlowLayout());
        panel_Step3.add(panel2, BorderLayout.CENTER);
        JPanel panel = new JPanel();
        panel2.add(panel);
        panel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Basic Options",
                TitledBorder.LEADING, TitledBorder.TOP, null, null));
        panel.setLayout(new MigLayout("gapy 5px", "[30px][101px]", "[][][][][][][20px]"));

        ButtonGroup buttonGroup = new ButtonGroup();

        buttonGroup.add(radio_searchByGlobal);
        radio_searchByGlobal.setFont(new Font("Tahoma", Font.PLAIN, 13));
        radio_searchByGlobal.setSelected(true);
        panel.add(radio_searchByGlobal, "cell 0 0 2 1,alignx left,aligny top");

        JLabel lblNewLabel_2 = new JLabel(
                "Detects most of the copies that are visually alike to the original.");
        panel.add(lblNewLabel_2, "cell 1 1");

        JButton btnOptions = new JButton("Advanced Options...");
        btnOptions.setEnabled(false);
        panel.add(btnOptions, "cell 1 2");

        buttonGroup.add(radio_searchByLocal);
        radio_searchByLocal.setFont(new Font("Tahoma", Font.PLAIN, 13));
        panel.add(radio_searchByLocal, "cell 0 4 2 1,alignx left,aligny top");

        JLabel lblNewLabel_3 = new JLabel(
                "Requires more resources (disk space, search time, memory) but can detect more copies.");
        panel.add(lblNewLabel_3, "cell 1 5");

        JButton btnOptions_1 = new JButton("Advanced Options...");
        btnOptions_1.setEnabled(false);
        panel.add(btnOptions_1, "cell 1 6");

    }
    {
        JPanel panel_Step4 = new JPanel();
        contentPanel.add(panel_Step4, "card_step4");
        panel_Step4.setLayout(new BorderLayout(0, 0));

        JLabel lblTitle = new JLabel("STEP 4 - Search");
        lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
        lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 18));
        panel_Step4.add(lblTitle, BorderLayout.NORTH);

        JScrollPane scrollPane = new JScrollPane();
        panel_Step4.add(scrollPane, BorderLayout.CENTER);

        textConsole.setFont(new Font("Monospaced", Font.PLAIN, 11));
        textConsole.setForeground(Color.WHITE);
        textConsole.setBackground(Color.BLACK);
        textConsole.setEditable(false);
        textConsole.setCursor(new Cursor(Cursor.TEXT_CURSOR));
        textConsole.setText(
                "Press 'Next' button to start the search...\nNote: Depending on the selected options, the search may take up to several hours.");
        scrollPane.setViewportView(textConsole);

        JPanel panel = new JPanel();
        panel_Step4.add(panel, BorderLayout.SOUTH);
        panel.setLayout(new GridLayout(0, 1, 0, 0));

        JSeparator separator = new JSeparator();
        separator.setPreferredSize(new Dimension(0, 1));
        panel.add(separator);
        progressBar.setStringPainted(true);
        progressBar.setPreferredSize(new Dimension(350, 20));
        panel.add(progressBar);

        lblProgress.setHorizontalAlignment(SwingConstants.CENTER);
        lblProgress.setFont(new Font("Tahoma", Font.PLAIN, 14));
        panel.add(lblProgress);
    }
    {
        JPanel panel_Step5 = new JPanel();
        contentPanel.add(panel_Step5, "card_step5");
        panel_Step5.setLayout(new BorderLayout(0, 0));

        JLabel lblTitle = new JLabel("STEP 5 - Results");
        lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
        lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 18));
        panel_Step5.add(lblTitle, BorderLayout.NORTH);

        JScrollPane scrollPane = new JScrollPane();
        panel_Step5.add(scrollPane, BorderLayout.CENTER);

        scrollPane.setViewportView(panelResults);
        panelResults.setLayout(new MigLayout("gapy 10, gapx 20",
                "[120px,center][150px,center,grow][150px,center,grow]", "[25px][]"));

    }
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            JButton prevButton = new JButton("Previous");
            prevButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    previousButton();
                }
            });
            prevButton.setActionCommand("Previous");
            buttonPane.add(prevButton);
        }
        {
            JButton okButton = new JButton("Next");
            okButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    nextButton();
                }
            });
            okButton.setActionCommand("OK");
            buttonPane.add(okButton);
            getRootPane().setDefaultButton(okButton);
        }
        {
            JButton cancelButton = new JButton("Cancel");
            cancelButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    cancelButton();
                }
            });
            cancelButton.setActionCommand("Cancel");
            buttonPane.add(cancelButton);
        }
    }
    this.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosed(WindowEvent e) {
            closeWindow();
        }
    });
    updateDatabases(null);
}

From source file:org.sonarlint.intellij.config.global.SonarQubeServerMgmtPanel.java

public void create() {
    Application app = ApplicationManager.getApplication();
    serverManager = app.getComponent(SonarLintServerManager.class);
    serverChangeListener = app.getMessageBus()
            .syncPublisher(GlobalConfigurationListener.SONARLINT_GLOBAL_CONFIG_TOPIC);
    serverList = new JBList();
    serverList.getEmptyText().setText(LABEL_NO_SERVERS);
    serverList.addMouseListener(new MouseAdapter() {
        @Override/*from   w ww  . j a v  a2 s. co  m*/
        public void mouseClicked(MouseEvent evt) {
            if (evt.getClickCount() == 2) {
                editServer();
            }
        }
    });
    serverList.addListSelectionListener(e -> {
        if (!e.getValueIsAdjusting()) {
            onServerSelect();
        }
    });

    serversPanel = new JPanel(new BorderLayout());

    ToolbarDecorator toolbarDecorator = ToolbarDecorator.createDecorator(serverList).setEditActionName("Edit")
            .setEditAction(e -> editServer()).disableUpDownActions();

    toolbarDecorator.setAddAction(new AddServerAction());
    toolbarDecorator.setRemoveAction(new RemoveServerAction());

    serversPanel.add(toolbarDecorator.createPanel(), BorderLayout.CENTER);
    splitter = new Splitter(true);
    splitter.setFirstComponent(serversPanel);
    splitter.setSecondComponent(createServerStatus());

    JBLabel emptyLabel = new JBLabel("No server selected", SwingConstants.CENTER);
    emptyPanel = new JPanel(new BorderLayout());
    emptyPanel.add(emptyLabel, BorderLayout.CENTER);

    Border b = IdeBorderFactory.createTitledBorder("SonarQube servers");
    panel = new JPanel(new BorderLayout());
    panel.setBorder(b);
    panel.add(splitter);

    serverList.setCellRenderer(new ColoredListCellRenderer() {
        @Override
        protected void customizeCellRenderer(JList list, Object value, int index, boolean selected,
                boolean hasFocus) {
            SonarQubeServer server = (SonarQubeServer) value;
            try {
                setIcon(ResourceLoader.getIcon(LIST_ICON));
            } catch (IOException e) {
                LOGGER.error("Error loading SonarLint icon", e);
            }

            append(server.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
        }
    });
}

From source file:org.sonarlint.intellij.ui.SonarLintRulePanel.java

private void nothingToDisplay(boolean error) {
    editor = null;/*  ww  w  . j  a  va 2 s. c o m*/
    panel.removeAll();

    String txt;
    if (error) {
        txt = "Couldn't find an extended description for the rule";
    } else {
        txt = "Select an issue to see extended rule description";
    }

    JComponent titleComp = new JLabel(txt, SwingConstants.CENTER);
    panel.add(titleComp, BorderLayout.CENTER);
    panel.revalidate();
}

From source file:org.spiderplan.tools.visulization.GraphFrame.java

/**
 * @param graph//from w  w w .  ja  v  a 2  s . c o m
 * @param history optional history of the graph
 * @param title 
 * @param lC the layout
 * @param edgeLabels map from edges to string labels
 * @param w width of the window
 * @param h height of the window
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
public GraphFrame(AbstractTypedGraph<V, E> graph, Vector<AbstractTypedGraph<V, E>> history, String title,
        LayoutClass lC, Map<E, String> edgeLabels, int w, int h) {
    super(title);
    this.edgeLabels = edgeLabels;
    this.g = new ObservableGraph<V, E>(graph);
    this.g.addGraphEventListener(this);

    this.defaultEdgeType = this.g.getDefaultEdgeType();

    this.layoutClass = lC;

    this.history = history;

    this.setLayout(lC);

    layout.setSize(new Dimension(w, h));

    try {
        Relaxer relaxer = new VisRunner((IterativeContext) layout);
        relaxer.stop();
        relaxer.prerelax();
    } catch (java.lang.ClassCastException e) {
    }

    //      Layout<V,E> staticLayout = new StaticLayout<V,E>(g, layout);
    //      Layout<V,E> staticLayout = new SpringLayout<V, E>(g);

    vv = new VisualizationViewer<V, E>(layout, new Dimension(w, h));

    JRootPane rp = this.getRootPane();
    rp.putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);

    getContentPane().setLayout(new BorderLayout());
    getContentPane().setBackground(java.awt.Color.lightGray);
    getContentPane().setFont(new Font("Serif", Font.PLAIN, 10));

    vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.S);
    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<V>());
    vv.setForeground(Color.black);

    graphMouse = new EditingModalGraphMouse<V, E>(vv.getRenderContext(), null, null);
    graphMouse.setMode(ModalGraphMouse.Mode.PICKING);
    vv.setGraphMouse(graphMouse);
    vv.addKeyListener(graphMouse.getModeKeyListener());

    //        vv.getRenderContext().setEd
    vv.getRenderContext().setEdgeLabelTransformer(this);
    vv.getRenderContext().setEdgeDrawPaintTransformer(
            new PickableEdgePaintTransformer<E>(vv.getPickedEdgeState(), Color.black, Color.cyan));

    vv.addComponentListener(new ComponentAdapter() {

        /**
         * @see java.awt.event.ComponentAdapter#componentResized(java.awt.event.ComponentEvent)
         */
        @Override
        public void componentResized(ComponentEvent arg0) {
            super.componentResized(arg0);
            layout.setSize(arg0.getComponent().getSize());
        }
    });

    getContentPane().add(vv);

    /**
     * Create simple container for stuff on SOUTH border of this JFrame
     */
    Container c = new Container();
    c.setLayout(new FlowLayout());
    c.setBackground(java.awt.Color.lightGray);
    c.setFont(new Font("Serif", Font.PLAIN, 10));

    /**
     * Button to dump jpeg
     */
    dumpJPEG = new JButton("Dump");
    dumpJPEG.addActionListener(this);
    dumpJPEG.setName("Dump");
    c.add(dumpJPEG);

    /**
     * Button that creates offspring frame for selected vertices
     */
    subGraphButton = new JButton("Subgraph");
    subGraphButton.addActionListener(this);
    subGraphButton.setName("Subgraph");
    c.add(subGraphButton);

    subGraphDepthLabel = new JLabel("Depth");
    c.add(subGraphDepthLabel);
    subGraphDepth = new JTextField("0", 2);
    subGraphDepth.setHorizontalAlignment(SwingConstants.CENTER);
    subGraphDepth.setToolTipText("Depth of sub-graph created from selected nodes.");
    c.add(subGraphDepth);

    /**
     * Button that switches mouse mode
     */
    switchMode = new JButton("Transformation");
    switchMode.addActionListener(this);
    switchMode.setName("SwitchMode");
    c.add(switchMode);

    /**
     * ComboBox for Layout selection:
     */
    JComboBox layoutList;
    if (graph instanceof Forest) {
        String[] layoutStrings = { "Static", "Circle", "DAG", "Spring", "Spring2", "FR", "FR2", "Baloon",
                "ISOM", "KK", "PolarPoint", "RadialTree", "Tree" };
        layoutList = new JComboBox(layoutStrings);
    } else {
        String[] layoutStrings = { "Static", "Circle", "DAG", "Spring", "Spring2", "FR", "FR2", "ISOM", "KK",
                "PolarPoint" };
        layoutList = new JComboBox(layoutStrings);
    }

    layoutList.setSelectedIndex(5);
    layoutList.addActionListener(this);
    layoutList.setName("SelectLayout");
    c.add(layoutList);

    /**
     * Add container to layout
     */
    c.setVisible(true);
    getContentPane().add(c, BorderLayout.SOUTH);

    /**
     * Setup history scroll bar
     */
    if (history != null) {
        historySlider = new JSlider(0, history.size() - 1, history.size() - 1);
        historySlider.addChangeListener(this);
        historySlider.setMajorTickSpacing(10);
        historySlider.setMinorTickSpacing(1);
        historySlider.setPaintTicks(true);
        historySlider.setPaintLabels(true);

        historySlider.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
        Font font = new Font("Serif", Font.ITALIC, 15);
        historySlider.setFont(font);

        getContentPane().add(historySlider, BorderLayout.NORTH);

    }
    this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    this.pack();
    this.setVisible(true);
}

From source file:org.spottedplaid.ui.Mainframe.java

/**
 * Create the frame.//from  w w w .j a v  a  2s.c o  m
 *
 * @param _Sqliteops the _ sqliteops
 * @param _Crypto the _ crypto
 */
public Mainframe(SQliteOps _Sqliteops, Crypto _Crypto) {

    l_sqliteops = _Sqliteops;
    l_crypto = _Crypto;

    setTitle("The Password Saver - Management");
    setResizable(false);
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setBounds(100, 100, 982, 656);

    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);

    JMenu mnFile = new JMenu("File");
    menuBar.add(mnFile);

    JMenuItem mntmExit = new JMenuItem("Exit");
    mntmExit.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            System.exit(0);
        }
    });

    mnFile.add(mntmExit);

    JMenu mnTools = new JMenu("Tools");
    menuBar.add(mnTools);

    JMenuItem mntmChgpwd = new JMenuItem("Change Passphrase");
    mntmChgpwd.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            Changepwd changePwd = new Changepwd(l_crypto, l_sqliteops);
            changePwd.setVisible(true);
        }
    });

    mnTools.add(mntmChgpwd);

    JMenuItem mntmExpirationReport = new JMenuItem("Expiration Report");
    mntmExpirationReport.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            DbRecord dbRecExp = new DbRecord();
            dbRecExp.setType(Pwdtypes.S_EXP_RPT);
            ArrayList<String> arrData = l_sqliteops.getRecords(dbRecExp);
            String[] sRecord = new String[3];
            String sData = "";
            int iElement = 0;

            /// Cycle through the data, output to text file, and open in WordPad
            if (arrData != null && arrData.size() > 0) {
                try {
                    String sFilename = "ExpirationReport.txt";
                    File fileExpRpt = new File(sFilename);

                    BufferedWriter buffWriter = new BufferedWriter(new FileWriter(fileExpRpt));
                    buffWriter.write("URL/Application                Challenge            Expiration");
                    buffWriter.write("\n");
                    buffWriter.write("--------------------------------------------------------------");
                    buffWriter.write("\n");
                    for (int iCount = 0; iCount < arrData.size(); iCount++) {
                        sData = arrData.get(iCount);
                        System.out.println("DEBUG->sData [" + sData + "]");
                        StringTokenizer st = new StringTokenizer(sData, "|");
                        iElement = 0;
                        while (st.hasMoreTokens()) {
                            sRecord[iElement] = st.nextToken();
                            iElement++;
                        }

                        /// Define the padding for the output
                        int iPadValue1 = 35 - sRecord[0].length();
                        if (iPadValue1 < 0) {
                            iPadValue1 = 2;
                        }

                        int iPadValue2 = 55 - (35 + sRecord[1].length());
                        if (iPadValue2 < 0) {
                            iPadValue2 = 2;
                        }

                        iPadValue1 += sRecord[1].length();
                        iPadValue2 += sRecord[2].length();

                        buffWriter.write(sRecord[0] + StringUtils.leftPad(sRecord[1], iPadValue1)
                                + StringUtils.leftPad(sRecord[2], iPadValue2) + "\n");
                        buffWriter.write("\n");
                    }
                    buffWriter.close();

                    /// Opens WordPad on Windows systems.  This could be changed to use a property in order to work on a linux/unix/apple system
                    ProcessBuilder pb = new ProcessBuilder("write.exe", sFilename);
                    pb.start();
                } catch (IOException ie) {
                    System.out.println("Expiration Report IO Exception [" + ie.getMessage() + "]");
                    ie.printStackTrace();
                }

            } else {
                JOptionPane.showMessageDialog(null, "No expiring records found");
            }
        }
    });
    mnTools.add(mntmExpirationReport);

    JMenuItem mntmViewLogs = new JMenuItem("View Logs");
    mntmViewLogs.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            DbRecord dbRecLogs = new DbRecord();
            dbRecLogs.setType(Pwdtypes.S_LOG_TYPE);
            ArrayList<String> arrData = l_sqliteops.getRecords(dbRecLogs);
            String[] sRecord = new String[3];
            String sData = "";
            String sTitle = "Display Data Changes";
            String sDisplay = "Date                  Log Message";
            sDisplay += "\n";
            int iElement = 0;

            /// Cycle through the data, output to text file, and open in WordPad
            if (arrData != null) {
                for (int iCount = 0; iCount < arrData.size(); iCount++) {
                    sData = arrData.get(iCount);
                    System.out.println("DEBUG->sData [" + sData + "]");
                    StringTokenizer st = new StringTokenizer(sData, "|");
                    iElement = 0;
                    while (st.hasMoreTokens()) {
                        sRecord[iElement] = st.nextToken();
                        iElement++;
                    }
                    sDisplay += sRecord[2] + ":" + sRecord[1];
                    sDisplay += "\n";
                }

                if (arrData.size() > 0) {
                    JOptionPane.showMessageDialog(null, sDisplay, sTitle, JOptionPane.INFORMATION_MESSAGE);
                }

            }
        }
    });

    mnTools.add(mntmViewLogs);

    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);

    JLabel lblThePasswordSaver = new JLabel("The Password Saver - Manage Passwords");
    lblThePasswordSaver.setFont(new Font("Arial", Font.BOLD, 16));
    lblThePasswordSaver.setHorizontalAlignment(SwingConstants.CENTER);

    JLabel lblUrlapplication = new JLabel("URL/Application");

    jtxtApp = new JTextField();
    jtxtApp.setColumns(10);

    JLabel lblDescription = new JLabel("Description");

    jtxtDesc = new JTextField();
    jtxtDesc.setColumns(10);

    /// Button - Add button for clients/apps
    JButton btnAdd = new JButton("Add");
    btnAdd.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (FormValidation.verifyAppData(jtxtApp.getText().toString(), jtxtDesc.getText().toString()) < 0) {
                JOptionPane.showMessageDialog(null, "URL/Application and Description are required");
            } else {
                dbRec = new DbRecord();
                dbRec.setType(Pwdtypes.S_CLIENT_TYPE);
                dbRec.setClientName(jtxtApp.getText().toString());
                dbRec.setClientDesc(jtxtDesc.getText().toString());
                int l_iClientId = l_sqliteops.insertRecord(dbRec);
                if (l_iClientId <= 0) {
                    JOptionPane.showMessageDialog(null, "Insert record failed [" + dbRec.getResult() + "]");
                } else {
                    dbRec.setClientId(l_iClientId);
                    addToTable();
                }
            }
        }
    });

    /// Buttons - Replace button for clients/apps
    btnReplace = new JButton("Replace");
    btnReplace.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            if (iClientId <= 0) {
                JOptionPane.showMessageDialog(null, "Update record warning: Please select record to continue");
                return;
            }
            dbRec = new DbRecord();
            dbRec.setType(Pwdtypes.S_CLIENT_TYPE);
            dbRec.setClientId(iClientId);
            dbRec.setClientName(jtxtApp.getText().toString());
            dbRec.setClientDesc(jtxtDesc.getText().toString());
            if (l_sqliteops.updateRecord(dbRec) < 0) {
                JOptionPane.showMessageDialog(null, "Update record failed [" + dbRec.getResult() + "]");
            } else {
                int iRow = jtabApps.getSelectedRow();
                jtabApps.setValueAt(jtxtApp.getText().toString(), iRow, 1);
                jtabApps.setValueAt(jtxtDesc.getText().toString(), iRow, 2);

                clearFields();
            }
        }
    });

    btnReplace.setEnabled(false);

    /// Button - Delete button for clients/apps
    btnDelete = new JButton("Delete");
    btnDelete.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (iClientId <= 0) {
                JOptionPane.showMessageDialog(null,
                        "Delete record failed: Please select a record then click Delete");
                return;
            }
            dbRec = new DbRecord();
            dbRec.setType("clients");
            dbRec.setClientId(iClientId);
            dbRec.setDelCreds(0);

            if (chkDelAssoc.isSelected()) {
                dbRec.setDelCreds(1);
            }

            if (l_sqliteops.deleteRecord(dbRec) < 0) {
                JOptionPane.showMessageDialog(null, "Delete record failed [" + dbRec.getResult() + "]");
            } else {
                DefaultTableModel jtabModel = (DefaultTableModel) jtabApps.getModel();
                jtabModel.removeRow(jtabApps.getSelectedRow());
                if (chkDelAssoc.isSelected()) {
                    DefaultTableModel model = (DefaultTableModel) jtabCreds.getModel();
                    model.setRowCount(0);
                }
                clearFields();
            }
        }
    });
    btnDelete.setEnabled(false);

    /// Buttons - Search button for clients/apps
    btnSearch = new JButton("Search");
    btnSearch.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            dbRec = new DbRecord();
            dbRec.setType(Pwdtypes.S_CLIENT_TYPE);
            dbRec.setClientName(jtxtApp.getText().toString());
            dbRec.setClientDesc(jtxtDesc.getText().toString());
            loadTable(dbRec);
        }
    });

    btnClear = new JButton("Clear");
    btnClear.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            clearFields();
        }
    });

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);

    /// Begin section for credentials challenges/responses - text fields and buttons
    JLabel lblChallenge = new JLabel("Challenge");

    JLabel lblResponse = new JLabel("Response");

    jtxtChlng = new JTextField();
    jtxtChlng.setColumns(10);

    jtxtRsp = new JTextField();
    jtxtRsp.setColumns(10);

    /// Buttons - Add button for credentials
    btnCredAdd = new JButton("Add");
    btnCredAdd.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (FormValidation.verifyCredData(jtxtChlng.getText().toString(),
                    jtxtRsp.getText().toString()) < 0) {
                JOptionPane.showMessageDialog(null, "Challenge and Response are required");
            } else {
                dbRec = new DbRecord();
                dbRec.setType(Pwdtypes.S_CREDS_TYPE);
                dbRec.setClientId(iClientId);
                dbRec.setChallenge(jtxtChlng.getText().toString());
                dbRec.setResponse(l_crypto.encrypt(jtxtRsp.getText().toString()));
                dbRec.setTrack(jcbTrack.getSelectedItem().toString());

                /// Set the modify date if the track days are > 0
                if (!jcbTrack.getSelectedItem().toString().equals("0")) {
                    Calendar calNow = Calendar.getInstance();
                    SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
                    int iDaysToAdd = Integer.parseInt(jcbTrack.getSelectedItem().toString());

                    calNow.add(Calendar.DATE, iDaysToAdd);
                    String sValue = sdf.format(calNow.getTime());
                    dbRec.setModifyDate(sValue);
                }

                int l_iClientId = l_sqliteops.insertRecord(dbRec);
                if (l_iClientId <= 0) {
                    JOptionPane.showMessageDialog(null, "Insert record failed [" + dbRec.getResult() + "]");
                } else {
                    dbRec.setCredId(l_iClientId);
                    addToCredsTable();
                }
            }
        }
    });

    /// Button - Replace button for credentials
    btnCredReplace = new JButton("Replace");
    btnCredReplace.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            DbRecord dbRecLog = new DbRecord();
            int iDaysToAdd = 0;
            Calendar calNow = Calendar.getInstance();
            SimpleDateFormat sdf1 = new SimpleDateFormat("MM/dd/yyyy");

            String sCurDate = sdf1.format(calNow.getTime());
            String sValue = sDateModified;
            String sLogMsg = "";
            StringBuilder sbLogMsg = new StringBuilder(sLogMsg);

            if (dbRec.getType().equals(Pwdtypes.S_CREDS_TYPE) && (dbRec.getCredId() > 0)) {
                dbRec.setClientId(iClientId);
                dbRec.setCredId(iCredId);
                dbRec.setChallenge(jtxtChlng.getText().toString());
                dbRec.setResponse(l_crypto.encrypt(jtxtRsp.getText().toString()));
                dbRec.setTrack(jcbTrack.getSelectedItem().toString());

                /** Check for changes and insert log if necessary */
                if (!sChallenge.equals(jtxtChlng.getText())) {
                    sbLogMsg.append("Application [" + jtxtApp.getText() + "], Challenge modified, old ["
                            + sChallenge + "], new [" + jtxtChlng.getText() + "]");
                }

                if (!sResponse.equals(jtxtRsp.getText())) {
                    if (sbLogMsg.toString().length() > 0) {
                        sbLogMsg.append(",");
                    } else {
                        sbLogMsg.append("Application [" + jtxtApp.getText() + "],");
                    }
                    sbLogMsg.append("Response modified, old [" + sResponse + "]");
                }

                if (sbLogMsg.toString().length() > 0) {
                    dbRecLog.setType(Pwdtypes.S_LOG_TYPE);
                    dbRecLog.setLog(sbLogMsg.toString());
                    dbRecLog.setModifyDate(sCurDate);
                    if (l_sqliteops.insertRecord(dbRecLog) < 0) {
                        JOptionPane.showMessageDialog(null,
                                "Insert log record failed [" + dbRecLog.getResult() + "]");
                    }
                }

                if (!jcbTrack.getSelectedItem().toString().equals("0")) {
                    iDaysToAdd = Integer.parseInt(jcbTrack.getSelectedItem().toString());

                    calNow.add(Calendar.DATE, iDaysToAdd);
                    sValue = sdf1.format(calNow.getTime());

                    System.out.println("DEBUG->Date (sValue) [" + sValue + "]");
                    dbRec.setModifyDate(sValue);
                }
                /// Update the record
                if (l_sqliteops.updateRecord(dbRec) < 0) {
                    JOptionPane.showMessageDialog(null, "Update record failed [" + dbRec.getResult() + "]");
                } else {
                    int iRow = jtabCreds.getSelectedRow();
                    jtabCreds.setValueAt(jtxtChlng.getText().toString(), iRow, 1);
                    jtabCreds.setValueAt(l_crypto.encrypt(jtxtRsp.getText().toString()), iRow, 2);
                    jtabCreds.setValueAt(jcbTrack.getSelectedItem().toString(), iRow, 3);
                    jtabCreds.setValueAt(sValue, iRow, 4);

                    jtabCreds.setValueAt(sValue, iRow, 4);
                    clearCredsFields();
                    enableCredsButtons();
                }
            }
        }
    });

    /// Button - Delete button for credentials
    btnCredDelete = new JButton("Delete");
    btnCredDelete.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            dbRec.setType(Pwdtypes.S_CREDS_TYPE);
            dbRec.setCredId(iCredId);
            dbRec.setChallenge(jtxtChlng.getText().toString());
            dbRec.setResponse(jtxtRsp.getText().toString());
            if (l_sqliteops.deleteRecord(dbRec) < 0) {
                JOptionPane.showMessageDialog(null,
                        "Delete credential record failed [" + dbRec.getResult() + "]");
            } else {
                DefaultTableModel jtabModel = (DefaultTableModel) jtabCreds.getModel();
                jtabModel.removeRow(jtabCreds.getSelectedRow());
                clearCredsFields();
                enableCredsButtons();
            }
        }
    });

    /// Button - Clear button for credentials
    btnCredClear = new JButton("Clear");
    btnCredClear.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            clearCredsFields();
            enableCredsButtons();
        }
    });

    /// End section for credentials challenges/responses - text fields and buttons

    JScrollPane scrollPane_1 = new JScrollPane();
    scrollPane_1.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);

    btnShowAssoc = new JButton("Display Associated Challenges/Responses in new window");

    /// Display the challenges/responses associated to the application in a popup window. 
    /// This is to make it easier to view when all of the values are needed
    btnShowAssoc.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String sTitle = "Credentials for: " + jtxtApp.getText();
            String sDisplay = "";

            sDisplay += "\n";
            DefaultTableModel jTmpModel = (DefaultTableModel) jtabCreds.getModel();
            for (int i = 0; i < jTmpModel.getRowCount(); i++) {
                sDisplay += "Q. " + jTmpModel.getValueAt(i, 1).toString() + "  A. "
                        + l_crypto.decrypt(jTmpModel.getValueAt(i, 2).toString()) + "\n";
            }

            JOptionPane.showMessageDialog(null, sDisplay, sTitle, JOptionPane.INFORMATION_MESSAGE);
        }
    });

    JLabel lblTrackUpdates = new JLabel("Exp Days");

    /// Values for expiration days are hardcoded, may want to move to a table for metadata
    jcbTrack.addItem("0");
    jcbTrack.addItem("30");
    jcbTrack.addItem("45");
    jcbTrack.addItem("60");
    jcbTrack.addItem("90");
    jcbTrack.addItem("180");
    jcbTrack.addItem("365");
    jcbTrack.setSelectedItem("0");

    btnEdit = new JButton("Edit");
    btnEdit.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            jtxtChlng.setEnabled(true);
            jtxtRsp.setEnabled(true);
            jcbTrack.setEnabled(true);
            btnCredReplace.setEnabled(true);
            btnCredAdd.setEnabled(true);
        }
    });
    btnEdit.setEnabled(false);

    GroupLayout gl_contentPane = new GroupLayout(contentPane);
    gl_contentPane.setHorizontalGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_contentPane.createSequentialGroup().addGroup(gl_contentPane
                    .createParallelGroup(Alignment.LEADING)
                    .addGroup(gl_contentPane.createSequentialGroup().addGap(207)
                            .addComponent(lblThePasswordSaver))
                    .addGroup(gl_contentPane.createSequentialGroup().addGap(23).addGroup(gl_contentPane
                            .createParallelGroup(Alignment.LEADING)
                            .addGroup(gl_contentPane.createSequentialGroup().addComponent(btnAdd)
                                    .addPreferredGap(ComponentPlacement.RELATED).addComponent(btnReplace)
                                    .addPreferredGap(ComponentPlacement.RELATED).addComponent(btnDelete)
                                    .addPreferredGap(ComponentPlacement.RELATED).addComponent(btnSearch)
                                    .addPreferredGap(ComponentPlacement.RELATED).addComponent(btnClear))
                            .addGroup(gl_contentPane.createSequentialGroup().addGroup(gl_contentPane
                                    .createParallelGroup(Alignment.LEADING)
                                    .addGroup(gl_contentPane.createSequentialGroup()
                                            .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
                                                    .addComponent(lblUrlapplication)
                                                    .addComponent(lblDescription))
                                            .addPreferredGap(ComponentPlacement.RELATED)
                                            .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
                                                    .addComponent(jtxtApp, GroupLayout.PREFERRED_SIZE, 154,
                                                            GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(jtxtDesc, GroupLayout.PREFERRED_SIZE, 260,
                                                            GroupLayout.PREFERRED_SIZE)))
                                    .addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 355,
                                            GroupLayout.PREFERRED_SIZE))
                                    .addPreferredGap(ComponentPlacement.RELATED, 18, Short.MAX_VALUE)
                                    .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
                                            .addComponent(btnShowAssoc)
                                            .addGroup(gl_contentPane.createSequentialGroup()
                                                    .addGroup(gl_contentPane
                                                            .createParallelGroup(Alignment.TRAILING)
                                                            .addComponent(lblResponse)
                                                            .addComponent(lblChallenge))
                                                    .addGap(18)
                                                    .addGroup(gl_contentPane
                                                            .createParallelGroup(Alignment.LEADING)
                                                            .addGroup(gl_contentPane.createSequentialGroup()
                                                                    .addComponent(jtxtRsp, 272, 272, 272)
                                                                    .addGap(26).addComponent(lblTrackUpdates)
                                                                    .addPreferredGap(
                                                                            ComponentPlacement.UNRELATED)
                                                                    .addComponent(jcbTrack,
                                                                            GroupLayout.PREFERRED_SIZE, 55,
                                                                            GroupLayout.PREFERRED_SIZE))
                                                            .addComponent(jtxtChlng, GroupLayout.PREFERRED_SIZE,
                                                                    440, GroupLayout.PREFERRED_SIZE)))
                                            .addGroup(gl_contentPane
                                                    .createParallelGroup(Alignment.LEADING, false)
                                                    .addGroup(gl_contentPane.createSequentialGroup()
                                                            .addComponent(btnCredAdd,
                                                                    GroupLayout.PREFERRED_SIZE, 78,
                                                                    GroupLayout.PREFERRED_SIZE)
                                                            .addPreferredGap(ComponentPlacement.RELATED)
                                                            .addComponent(btnCredReplace)
                                                            .addPreferredGap(ComponentPlacement.RELATED)
                                                            .addComponent(btnCredDelete,
                                                                    GroupLayout.PREFERRED_SIZE, 75,
                                                                    GroupLayout.PREFERRED_SIZE)
                                                            .addPreferredGap(ComponentPlacement.UNRELATED)
                                                            .addComponent(btnCredClear)
                                                            .addPreferredGap(ComponentPlacement.RELATED,
                                                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                            .addComponent(btnEdit))
                                                    .addComponent(scrollPane_1, GroupLayout.PREFERRED_SIZE,
                                                            GroupLayout.DEFAULT_SIZE,
                                                            GroupLayout.PREFERRED_SIZE))))))
                    .addGroup(gl_contentPane.createSequentialGroup().addGap(36).addComponent(chkDelAssoc)))
                    .addContainerGap(57, Short.MAX_VALUE)));
    gl_contentPane.setVerticalGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_contentPane.createSequentialGroup().addContainerGap().addComponent(lblThePasswordSaver)
                    .addGap(45)
                    .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
                            .addGroup(gl_contentPane.createSequentialGroup().addGroup(gl_contentPane
                                    .createParallelGroup(Alignment.BASELINE).addComponent(lblUrlapplication)
                                    .addComponent(jtxtApp, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblChallenge)).addPreferredGap(ComponentPlacement.UNRELATED)
                                    .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
                                            .addComponent(lblDescription)
                                            .addComponent(jtxtDesc, GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                            .addComponent(lblResponse)))
                            .addGroup(gl_contentPane.createSequentialGroup()
                                    .addComponent(jtxtChlng, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(ComponentPlacement.UNRELATED)
                                    .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
                                            .addComponent(jtxtRsp, GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                            .addComponent(lblTrackUpdates)
                                            .addComponent(jcbTrack, GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))))
                    .addGap(18)
                    .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE).addComponent(btnAdd)
                            .addComponent(btnReplace).addComponent(btnDelete).addComponent(btnSearch)
                            .addComponent(btnClear).addComponent(btnCredAdd).addComponent(btnCredReplace)
                            .addComponent(btnCredDelete).addComponent(btnCredClear).addComponent(btnEdit))
                    .addPreferredGap(ComponentPlacement.UNRELATED)
                    .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
                            .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 208,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(scrollPane_1, GroupLayout.PREFERRED_SIZE, 109,
                                            GroupLayout.PREFERRED_SIZE))
                            .addGroup(gl_contentPane.createSequentialGroup().addGap(120)
                                    .addComponent(btnShowAssoc)))
                    .addGap(18).addComponent(chkDelAssoc).addContainerGap(170, Short.MAX_VALUE)));

    /// JTable - Credentials table setup/definition - BEGIN
    jtabCreds = new JTable();
    jtabCreds.setModel(new DefaultTableModel(new Object[][] {},
            new String[] { "ID", "Challenge", "Response", "Exp Days", "Expiration Date" }) {
        Class[] columnTypes = new Class[] { Integer.class, String.class, String.class, String.class,
                String.class };

        public Class getColumnClass(int columnIndex) {
            return columnTypes[columnIndex];
        }
    });
    jtabCreds.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));
    scrollPane_1.setViewportView(jtabCreds);
    /// JTable - Credentials table setup/definition - END

    jtabApps = new JTable();
    scrollPane.setViewportView(jtabApps);

    jtabApps.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    jtabApps.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));
    jtabApps.setModel(
            new DefaultTableModel(new Object[][] {}, new String[] { "ID", "URL/Application", "Description" }) {
                Class[] columnTypes = new Class[] { Integer.class, String.class, String.class };

                public Class getColumnClass(int columnIndex) {
                    return columnTypes[columnIndex];
                }

                @Override
                public boolean isCellEditable(int row, int column) {
                    //all cells false
                    return false;
                }
            });
    jtabApps.getColumnModel().getColumn(1).setMinWidth(55);
    jtabApps.getColumnModel().getColumn(2).setMinWidth(55);
    contentPane.setLayout(gl_contentPane);
    contentPane.setFocusTraversalPolicy(new FocusTraversalOnArray(new Component[] { jtxtChlng,
            lblThePasswordSaver, jtxtApp, jtxtDesc, btnAdd, btnReplace, btnDelete, btnSearch, btnClear, jtxtRsp,
            btnCredAdd, btnCredReplace, btnCredDelete, btnCredClear, scrollPane, jtabApps, lblUrlapplication,
            lblDescription, chkDelAssoc, lblChallenge, lblResponse, scrollPane_1, jtabCreds }));
    setFocusTraversalPolicy(new FocusTraversalOnArray(
            new Component[] { menuBar, jtxtApp, jtxtDesc, btnAdd, btnReplace, btnDelete, btnSearch, btnClear,
                    jtxtChlng, jtxtRsp, btnCredAdd, btnCredReplace, btnCredDelete, btnCredClear, contentPane,
                    mnFile, mntmExit, lblThePasswordSaver, scrollPane, jtabApps, lblUrlapplication,
                    lblDescription, chkDelAssoc, lblChallenge, lblResponse, scrollPane_1, jtabCreds }));

    /// Initial data load
    dbRec = new DbRecord();
    dbRec.setType(Pwdtypes.S_CLIENT_TYPE);
    dbRec.setClientName("");
    dbRec.setClientDesc("");
    loadTable(dbRec);
    disableCredsButtons();

    ListSelectionModel rowSM = jtabApps.getSelectionModel();

    //Listener for client row change;
    rowSM.addListSelectionListener(new ListSelectionListener() {

        /// Fill the form values when a row is selected in the JTable
        @Override
        public void valueChanged(ListSelectionEvent e) {
            ListSelectionModel lsmData = (ListSelectionModel) e.getSource();
            if (!lsmData.isSelectionEmpty()) {
                int iRow = lsmData.getMinSelectionIndex();
                iClientId = Integer.parseInt(jtabApps.getValueAt(iRow, 0).toString());
                jtxtApp.setText(jtabApps.getValueAt(iRow, 1).toString());
                jtxtDesc.setText(jtabApps.getValueAt(iRow, 2).toString());

                dbRec.setType(Pwdtypes.S_CREDS_TYPE);
                dbRec.setClientId(iClientId);
                loadTable(dbRec);
                enableButtons();
                clearCredsFields();
                enableCredsButtons();
            }
        }
    });

    ListSelectionModel rowCred = jtabCreds.getSelectionModel();

    //Listener for credential row change;
    rowCred.addListSelectionListener(new ListSelectionListener() {

        /// Fill the form values when a row is selected in the JTable
        @Override
        public void valueChanged(ListSelectionEvent e) {
            ListSelectionModel lsmData = (ListSelectionModel) e.getSource();
            if (!lsmData.isSelectionEmpty()) {
                int iRow = lsmData.getMinSelectionIndex();
                iCredId = Integer.parseInt(jtabCreds.getValueAt(iRow, 0).toString());
                jtxtChlng.setText(jtabCreds.getValueAt(iRow, 1).toString());
                jtxtRsp.setText(l_crypto.decrypt(jtabCreds.getValueAt(iRow, 2).toString()));
                jcbTrack.setSelectedItem(jtabCreds.getValueAt(iRow, 3).toString());
                if (null == jtabCreds.getValueAt(iRow, 4)) {
                    sDateModified = "";
                } else {
                    sDateModified = jtabCreds.getValueAt(iRow, 4).toString();
                }
                sChallenge = jtxtChlng.getText();
                sResponse = jtxtRsp.getText();
                dbRec.setType(Pwdtypes.S_CREDS_TYPE);
                dbRec.setCredId(iClientId);
                jtxtChlng.setEnabled(false);
                jtxtRsp.setEnabled(false);
                jcbTrack.setEnabled(false);
                btnEdit.setEnabled(true);
                btnCredDelete.setEnabled(true);
                btnCredClear.setEnabled(true);
            }
        }
    });

}