Example usage for javax.swing JTable AUTO_RESIZE_ALL_COLUMNS

List of usage examples for javax.swing JTable AUTO_RESIZE_ALL_COLUMNS

Introduction

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

Prototype

int AUTO_RESIZE_ALL_COLUMNS

To view the source code for javax.swing JTable AUTO_RESIZE_ALL_COLUMNS.

Click Source Link

Document

During all resize operations, proportionately resize all columns.

Usage

From source file:com.osparking.attendant.AttListForm.java

private void SetTableColumnWidth() {
    usersTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    TableColumnModel tcm = usersTable.getColumnModel();

    // Adjust column width one by one
    // Adjust email address column width
    tcm.getColumn(2).setCellRenderer(putCellCenter);

    SetAColumnWidth(tcm.getColumn(0), 10, 80, 500); // 0: User ID
    SetAColumnWidth(tcm.getColumn(1), 10, 80, 500); // 1: User name
    SetAColumnWidth(tcm.getColumn(2), 10, 60, 500); // 2: Is Administrator or not
    SetAColumnWidth(tcm.getColumn(3), 10, 100, 32767); // 2: Cell Phone 
    SetAColumnWidth(tcm.getColumn(4), 10, 100, 32767); // 3: Phone number
    SetAColumnWidth(tcm.getColumn(5), 10, 120, 32767); // 5: E-mail address
    SetAColumnWidth(tcm.getColumn(6), 10, 120, 32767); // 6: Latest modification date and time
}

From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositPresenter.java

private void setJobQueueTableDefaults(JTable jobQueueTable, JobQueueTableModel jobQueueTableModel) {
    jobQueueTableModel.addTableModelListener(new JobQueueTableModelListener());
    jobQueueTable.setModel(jobQueueTableModel);
    jobQueueTable.setSurrendersFocusOnKeystroke(true);
    jobQueueTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    jobQueueTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    jobQueueTable.setColumnSelectionAllowed(true);
    jobQueueTable.setRowSelectionAllowed(true);
    TableRenderer renderer = new TableRenderer();
    TableColumn col = jobQueueTable.getColumnModel().getColumn(0);
    int width = 200;
    col.setPreferredWidth(width);/*from w  ww. j  ava 2 s  .c om*/
    col.setWidth(width);
    col.setCellRenderer(renderer);

    col = jobQueueTable.getColumnModel().getColumn(1);
    width = 1400;
    col.setPreferredWidth(width);
    col.setWidth(width);
    col.setCellRenderer(renderer);
}

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

/**
 * This method is called from within the constructor to
 * initialize the form./* w  w w.j  a v a2  s. 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() {
    jPanel5 = new JPanel();
    lblTopic = new JLabel();
    txtStichwort = new JTextField();
    lblCat = new JLabel();
    cmbKategorie = new JComboBox<>();
    panel4 = new JPanel();
    lblSituation = new JLabel();
    btnPopoutSituation = new JButton();
    jScrollPane3 = new JScrollPane();
    txtSituation = new JTextArea();
    panel5 = new JPanel();
    lblGoal = new JLabel();
    btnPopoutGoal = new JButton();
    jScrollPane1 = new JScrollPane();
    txtZiele = new JTextArea();
    lblFirstRevision = new JLabel();
    jdcKontrolle = new JDateChooser();
    panel2 = new JPanel();
    jspPlanung = new JScrollPane();
    tblPlanung = new JTable();
    panel3 = new JPanel();
    btnAddIntervention = new JButton();
    panel1 = new JPanel();
    btnCancel = new JButton();
    btnSave = new JButton();

    //======== this ========
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    Container contentPane = getContentPane();
    contentPane.setLayout(new FormLayout("14dlu, $lcgap, 280dlu:grow, $ugap, pref, $lcgap, 14dlu",
            "fill:14dlu, $lgap, fill:default:grow, $rgap, pref, $lgap, 14dlu"));

    //======== jPanel5 ========
    {
        jPanel5.setLayout(new FormLayout("default, $lcgap, default:grow",
                "fill:default, $rgap, default, 2*($lgap, fill:default:grow), $lgap, 70dlu, $lgap, pref"));

        //---- lblTopic ----
        lblTopic.setFont(new Font("Arial", Font.PLAIN, 14));
        lblTopic.setText("Stichwort");
        jPanel5.add(lblTopic, CC.xy(1, 1, CC.DEFAULT, CC.TOP));

        //---- txtStichwort ----
        txtStichwort.setFont(new Font("Arial", Font.BOLD, 20));
        txtStichwort.addFocusListener(new FocusAdapter() {
            @Override
            public void focusGained(FocusEvent e) {
                txtStichwortFocusGained(e);
            }
        });
        jPanel5.add(txtStichwort, CC.xy(3, 1));

        //---- lblCat ----
        lblCat.setFont(new Font("Arial", Font.PLAIN, 14));
        lblCat.setText("Kategorie");
        jPanel5.add(lblCat, CC.xy(1, 3));

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

        //======== panel4 ========
        {
            panel4.setLayout(new BorderLayout());

            //---- lblSituation ----
            lblSituation.setFont(new Font("Arial", Font.PLAIN, 14));
            lblSituation.setText("Situation");
            panel4.add(lblSituation, BorderLayout.CENTER);

            //---- btnPopoutSituation ----
            btnPopoutSituation.setText(null);
            btnPopoutSituation.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/popup.png")));
            btnPopoutSituation.setBorderPainted(false);
            btnPopoutSituation.setContentAreaFilled(false);
            btnPopoutSituation
                    .setSelectedIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/pressed.png")));
            btnPopoutSituation.setBorder(null);
            btnPopoutSituation.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnPopoutSituation.addActionListener(e -> btnPopoutSituationActionPerformed(e));
            panel4.add(btnPopoutSituation, BorderLayout.EAST);
        }
        jPanel5.add(panel4, CC.xy(1, 5, CC.DEFAULT, CC.TOP));

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

            //---- txtSituation ----
            txtSituation.setColumns(20);
            txtSituation.setLineWrap(true);
            txtSituation.setRows(5);
            txtSituation.setWrapStyleWord(true);
            txtSituation.setFont(new Font("Arial", Font.PLAIN, 14));
            txtSituation.addFocusListener(new FocusAdapter() {
                @Override
                public void focusGained(FocusEvent e) {
                    txtSituationFocusGained(e);
                }
            });
            jScrollPane3.setViewportView(txtSituation);
        }
        jPanel5.add(jScrollPane3, CC.xy(3, 5));

        //======== panel5 ========
        {
            panel5.setLayout(new BorderLayout());

            //---- lblGoal ----
            lblGoal.setFont(new Font("Arial", Font.PLAIN, 14));
            lblGoal.setText("Ziele");
            panel5.add(lblGoal, BorderLayout.CENTER);

            //---- btnPopoutGoal ----
            btnPopoutGoal.setText(null);
            btnPopoutGoal.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/popup.png")));
            btnPopoutGoal.setBorderPainted(false);
            btnPopoutGoal.setContentAreaFilled(false);
            btnPopoutGoal
                    .setSelectedIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/pressed.png")));
            btnPopoutGoal.setBorder(null);
            btnPopoutGoal.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnPopoutGoal.addActionListener(e -> btnPopoutGoalActionPerformed(e));
            panel5.add(btnPopoutGoal, BorderLayout.EAST);
        }
        jPanel5.add(panel5, CC.xy(1, 7, CC.DEFAULT, CC.TOP));

        //======== jScrollPane1 ========
        {

            //---- txtZiele ----
            txtZiele.setColumns(20);
            txtZiele.setLineWrap(true);
            txtZiele.setRows(5);
            txtZiele.setWrapStyleWord(true);
            txtZiele.setFont(new Font("Arial", Font.PLAIN, 14));
            txtZiele.addFocusListener(new FocusAdapter() {
                @Override
                public void focusGained(FocusEvent e) {
                    txtZieleFocusGained(e);
                }
            });
            jScrollPane1.setViewportView(txtZiele);
        }
        jPanel5.add(jScrollPane1, CC.xy(3, 7));

        //---- lblFirstRevision ----
        lblFirstRevision.setFont(new Font("Arial", Font.PLAIN, 14));
        lblFirstRevision.setText("Erste Kontrolle am");
        jPanel5.add(lblFirstRevision, CC.xy(1, 11));

        //---- jdcKontrolle ----
        jdcKontrolle.setFont(new Font("Arial", Font.PLAIN, 14));
        jPanel5.add(jdcKontrolle, CC.xy(3, 11));
    }
    contentPane.add(jPanel5, CC.xy(3, 3, CC.DEFAULT, CC.FILL));

    //======== panel2 ========
    {
        panel2.setLayout(new FormLayout("default:grow", "default, $lgap, default"));

        //======== jspPlanung ========
        {
            jspPlanung.addComponentListener(new ComponentAdapter() {
                @Override
                public void componentResized(ComponentEvent e) {
                    jspPlanungComponentResized(e);
                }
            });

            //---- tblPlanung ----
            tblPlanung.setModel(new DefaultTableModel(
                    new Object[][] { { null, null, null, null }, { null, null, null, null },
                            { null, null, null, null }, { null, null, null, null }, },
                    new String[] { "Title 1", "Title 2", "Title 3", "Title 4" }));
            tblPlanung.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
            tblPlanung.addMouseListener(new MouseAdapter() {
                @Override
                public void mousePressed(MouseEvent e) {
                    tblPlanungMousePressed(e);
                }
            });
            jspPlanung.setViewportView(tblPlanung);
        }
        panel2.add(jspPlanung, CC.xy(1, 1));

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

            //---- btnAddIntervention ----
            btnAddIntervention.setText(null);
            btnAddIntervention.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png")));
            btnAddIntervention.setContentAreaFilled(false);
            btnAddIntervention.setBorderPainted(false);
            btnAddIntervention.setBorder(null);
            btnAddIntervention
                    .setPressedIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png")));
            btnAddIntervention.addActionListener(e -> btnAddInterventionActionPerformed(e));
            panel3.add(btnAddIntervention);
        }
        panel2.add(panel3, CC.xy(1, 3));
    }
    contentPane.add(panel2, CC.xy(5, 3));

    //======== panel1 ========
    {
        panel1.setLayout(new HorizontalLayout(5));

        //---- btnCancel ----
        btnCancel.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/cancel.png")));
        btnCancel.setText(null);
        btnCancel.addActionListener(e -> btnCancelActionPerformed(e));
        panel1.add(btnCancel);

        //---- btnSave ----
        btnSave.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png")));
        btnSave.setText(null);
        btnSave.addActionListener(e -> btnSaveActionPerformed(e));
        panel1.add(btnSave);
    }
    contentPane.add(panel1, CC.xy(5, 5, CC.RIGHT, CC.DEFAULT));
    setSize(1145, 695);
    setLocationRelativeTo(getOwner());
}

From source file:org.geworkbench.engine.ccm.ComponentConfigurationManagerWindow.java

/**
 * Set up the GUI/*from  ww w.j  a va2 s . c  o  m*/
 * 
 * @param void
 * @return void
 */
private void initComponents() {
    frame = new JFrame("geWorkbench - Component Configuration Manager");

    topPanel = new JPanel();
    displayLabel = new JLabel();
    String[] displayChoices = { DISPLAY_FILTER_ALL, DISPLAY_ONLY_LOADED, DISPLAY_ONLY_UNLOADED };
    displayComboBox = new JComboBox(displayChoices);
    showByTypeLabel = new JLabel();
    String[] showByTypeChoices = new String[PluginComponent.categoryList.size() + 2];
    showByTypeChoices[0] = SHOW_BY_TYPE_ALL;
    int index = 1;
    for (String s : PluginComponent.categoryList) {
        showByTypeChoices[index] = s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase();
        index++;
    }
    ;
    showByTypeChoices[index] = SHOW_BY_TYPE_OTHERS;
    Arrays.sort(showByTypeChoices);
    showByTypeComboBox = new JComboBox(showByTypeChoices);
    showByTypeComboBox.setMaximumRowCount(showByTypeChoices.length);
    keywordSearchLabel = new JLabel("Keyword search:");
    keywordSearchField = new JTextField("Enter Text");
    splitPane = new JSplitPane();
    scrollPaneForTextPane = new JScrollPane();
    textPane = new JTextPane();
    bottompanel = new JPanel();
    CellConstraints cc = new CellConstraints();

    frame.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            ccmWindow = null;
        }
    });

    viewLicenseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            viewLicense_actionPerformed(e);
        }
    });

    applyButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            applyCcmSelections_actionPerformed(e);
        }
    });
    resetButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            resetCcmSelections_actionPerformed(e);
        }

    });
    closeButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            closeCcmSelections_actionPerformed(e);
        }

    });

    //======== frame ========
    {
        Container frameContentPane = frame.getContentPane();
        frameContentPane.setLayout(new BorderLayout());

        //======== outerPanel ========
        {

            frameContentPane.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
                public void propertyChange(java.beans.PropertyChangeEvent e) {
                    if ("border".equals(e.getPropertyName()))
                        throw new RuntimeException();
                }
            });

            //======== topPanel ========
            {
                FormLayout topPanelLayout = new FormLayout(
                        " 32dlu, default,  4dlu, default,  32dlu, default,  4dlu, default, 32dlu, default,  4dlu, 64dlu, 32dlu",
                        "center:25dlu");
                topPanel.setLayout(topPanelLayout);

                //---- displayLabel ----
                displayLabel.setText("Display:");
                topPanel.add(displayLabel, cc.xy(2, 1));
                //======== scrollPaneForTopList1 ========
                {
                    //---- displayComboBox ----
                    ActionListener actionListener = new ActionListener() {
                        public void actionPerformed(ActionEvent actionEvent) {
                            ItemSelectable is = (ItemSelectable) actionEvent.getSource();
                            Object[] selections = is.getSelectedObjects();
                            String selection = (String) selections[0];
                            ccmTableModel.setLoadedFilterValue(selection);
                            sorter.setRowFilter(combinedFilter);
                            ccmTableModel.fireTableDataChanged();
                        }
                    };

                    displayComboBox.addActionListener(actionListener);
                }
                topPanel.add(displayComboBox, cc.xy(4, 1));

                //---- showByTypeLabel ----
                showByTypeLabel.setText("Show by type:");
                topPanel.add(showByTypeLabel, cc.xy(6, 1));
                //======== scrollPaneForTopList2 ========
                {
                    //---- showByTypeComboBox ----
                    ActionListener actionListener2 = new ActionListener() {
                        public void actionPerformed(ActionEvent actionEvent) {
                            ItemSelectable is = (ItemSelectable) actionEvent.getSource();
                            Object[] selections = is.getSelectedObjects();
                            String selection = (String) selections[0];
                            ccmTableModel.setTypeFilterValue(selection);
                            sorter.setRowFilter(combinedFilter);
                            ccmTableModel.fireTableDataChanged();
                        }
                    };

                    showByTypeComboBox.addActionListener(actionListener2);
                }
                topPanel.add(showByTypeComboBox, cc.xy(8, 1));

                //---- topLabel3 ----               
                topPanel.add(keywordSearchLabel, cc.xy(10, 1));

                //======== scrollPaneForTopList3 ========
                {
                    // ---- keywordSearchField ----
                    KeyListener actionListener3 = new KeyListener() {

                        public void keyPressed(KeyEvent e) {
                        }

                        public void keyReleased(KeyEvent e) {
                            String text = keywordSearchField.getText();
                            ccmTableModel.setKeywordFilterValue(text);
                            sorter.setRowFilter(combinedFilter);
                            ccmTableModel.fireTableDataChanged();
                        }

                        public void keyTyped(KeyEvent e) {
                        }
                    };

                    keywordSearchField.setText("Enter Text");
                    keywordSearchField.addKeyListener(actionListener3);
                }
                topPanel.add(keywordSearchField, cc.xy(12, 1));
            } // Top Panel
            frameContentPane.add(topPanel, BorderLayout.NORTH);

            //======== splitPane ========
            {
                splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
                splitPane.setResizeWeight(0.5);

                //======== scrollPaneForTable ========
                {
                    //---- table ----
                    ccmTableModel = new CCMTableModel(manager);
                    setOriginalChoices();
                    table = new JTable(ccmTableModel);
                    sorter = new TableRowSorter<CCMTableModel>(ccmTableModel);
                    table.setRowSorter(sorter);

                    table.setDefaultRenderer(Object.class, new CellRenderer());
                    table.setDefaultRenderer(CCMTableModel.ImageLink.class, new ImageLinkRenderer());
                    table.setDefaultRenderer(CCMTableModel.HyperLink.class, new HyperLinkRenderer());
                    table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);

                    ListSelectionModel cellSM = table.getSelectionModel();
                    cellSM.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                    cellSM.addListSelectionListener(new ListSelectionListener() {
                        public void valueChanged(ListSelectionEvent e) {
                            boolean adjusting = e.getValueIsAdjusting();
                            if (adjusting) {
                                return;
                            }
                            int selectedRow = table.getSelectedRow();
                            ListSelectionModel lsm = (ListSelectionModel) e.getSource();
                            if (lsm.isSelectionEmpty()) {
                                textPane.setText(" ");
                            } else {
                                String description = (String) ccmTableModel.getValueAt(
                                        table.convertRowIndexToModel(selectedRow),
                                        CCMTableModel.DESCRIPTION_INDEX);
                                textPane.setText(description);

                                if (textPane.getCaretPosition() > 1) {
                                    textPane.setCaretPosition(1);
                                }
                            }
                        }
                    });

                    table.addMouseListener(new MouseAdapter() {

                        @Override
                        public void mouseClicked(java.awt.event.MouseEvent event) {
                            launchBrowser();
                        }
                    });

                    TableColumn column = table.getColumnModel().getColumn(CCMTableModel.SELECTION_INDEX);
                    column.setMaxWidth(50);
                    column = table.getColumnModel().getColumn(CCMTableModel.VERSION_INDEX);
                    column.setMaxWidth(60);
                    column = table.getColumnModel().getColumn(CCMTableModel.TUTORIAL_URL_INDEX);
                    column.setMaxWidth(70);
                    column = table.getColumnModel().getColumn(CCMTableModel.TOOL_URL_INDEX);
                    column.setMaxWidth(70);

                    scrollPaneForTable = new JScrollPane(table);
                }
                splitPane.setTopComponent(scrollPaneForTable);

                //======== scrollPaneForTextPane ========
                {
                    //---- textPane ----
                    textPane.setEditable(false);
                    scrollPaneForTextPane.setViewportView(textPane);
                }
                splitPane.setBottomComponent(scrollPaneForTextPane);
            } //======== splitPane ========.
            frameContentPane.add(splitPane, BorderLayout.CENTER);

            //======== bottompanel ========
            {
                bottompanel.setLayout(new FormLayout("20dlu," + "default,  4dlu, " + // view License
                        "default,200dlu, " + // Apply
                        "default,  4dlu, " + // Reset
                        "default,  4dlu, " + // Cancel
                        "default " // Close
                        , "center:25dlu"));

                viewLicenseButton.setText("View License");
                bottompanel.add(viewLicenseButton, cc.xy(2, 1));

                //---- applyButton ----
                applyButton.setText("Apply");
                bottompanel.add(applyButton, cc.xy(6, 1));

                //---- resetButton ----
                resetButton.setText("Reset");
                bottompanel.add(resetButton, cc.xy(8, 1));

                //---- closeButton ----
                closeButton.setText("Close");
                bottompanel.add(closeButton, cc.xy(10, 1));

            } //======== bottompanel ========.
            frameContentPane.add(bottompanel, BorderLayout.SOUTH);
        } //======== outerPanel ========
        frame.pack();
        frame.setLocationRelativeTo(frame.getOwner());
    } // ============ frame ============

    topPanel.setVisible(true);
    splitPane.setVisible(true);
    scrollPaneForTable.setVisible(true);
    table.setVisible(true);
    scrollPaneForTextPane.setVisible(true);
    textPane.setVisible(true);
    bottompanel.setVisible(true);
    sorter.setRowFilter(combinedFilter);
    frame.setVisible(true);
    splitPane.setDividerLocation(.7d);
}

From source file:org.geworkbench.engine.ccm.ComponentConfigurationManagerWindow2.java

/**
 * Set up the GUI/* ww  w  . j av a  2 s .  c o m*/
 * 
 * @param void
 * @return void
 */
private void initComponents() {
    frame = new JFrame("geWorkbench - Component Configuration Manager");

    topPanel = new JPanel();
    displayLabel = new JLabel();
    String[] displayChoices = { DISPLAY_FILTER_ALL, DISPLAY_ONLY_LOADED, DISPLAY_ONLY_UNLOADED };
    displayComboBox = new JComboBox(displayChoices);
    showByTypeLabel = new JLabel();
    String[] showByTypeChoices = new String[PluginComponent.categoryList.size() + 2];
    showByTypeChoices[0] = SHOW_BY_TYPE_ALL;
    int index = 1;
    for (String s : PluginComponent.categoryList) {
        showByTypeChoices[index] = s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase();
        index++;
    }
    ;
    showByTypeChoices[index] = SHOW_BY_TYPE_OTHERS;
    Arrays.sort(showByTypeChoices);
    showByTypeComboBox = new JComboBox(showByTypeChoices);
    showByTypeComboBox.setMaximumRowCount(showByTypeChoices.length);
    keywordSearchLabel = new JLabel("Keyword search:");
    keywordSearchField = new JTextField("Enter Text");
    splitPane = new JSplitPane();
    scrollPaneForTextPane = new JScrollPane();
    textPane = new JTextPane();
    bottompanel = new JPanel();
    CellConstraints cc = new CellConstraints();

    frame.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            ccmWindow = null;
        }
    });

    viewLicenseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            viewLicense_actionPerformed(e);
        }
    });

    applyButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            applyCcmSelections_actionPerformed(e);
        }
    });
    resetButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            resetCcmSelections_actionPerformed(e);
        }

    });
    closeButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            closeCcmSelections_actionPerformed(e);
        }

    });
    componentUpdateButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            componentRemoteUpdate_actionPerformed(e);
        }

    });

    //======== frame ========
    {
        Container frameContentPane = frame.getContentPane();
        frameContentPane.setLayout(new BorderLayout());

        //======== outerPanel ========
        {

            frameContentPane.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
                public void propertyChange(java.beans.PropertyChangeEvent e) {
                    if ("border".equals(e.getPropertyName()))
                        throw new RuntimeException();
                }
            });

            //======== topPanel ========
            {
                FormLayout topPanelLayout = new FormLayout(
                        " 32dlu, default,  4dlu, default,  32dlu, default,  4dlu, default, 32dlu, default,  4dlu, 64dlu, 32dlu",
                        "center:25dlu");
                topPanel.setLayout(topPanelLayout);

                //---- displayLabel ----
                displayLabel.setText("Display:");
                topPanel.add(displayLabel, cc.xy(2, 1));
                //======== scrollPaneForTopList1 ========
                {
                    //---- displayComboBox ----
                    ActionListener actionListener = new ActionListener() {
                        public void actionPerformed(ActionEvent actionEvent) {
                            ItemSelectable is = (ItemSelectable) actionEvent.getSource();
                            Object[] selections = is.getSelectedObjects();
                            String selection = (String) selections[0];
                            ccmTableModel.setLoadedFilterValue(selection);
                            sorter.setRowFilter(combinedFilter);
                            ccmTableModel.fireTableDataChanged();
                        }
                    };

                    displayComboBox.addActionListener(actionListener);
                }
                topPanel.add(displayComboBox, cc.xy(4, 1));

                //---- showByTypeLabel ----
                showByTypeLabel.setText("Show by type:");
                topPanel.add(showByTypeLabel, cc.xy(6, 1));
                //======== scrollPaneForTopList2 ========
                {
                    //---- showByTypeComboBox ----
                    ActionListener actionListener2 = new ActionListener() {
                        public void actionPerformed(ActionEvent actionEvent) {
                            ItemSelectable is = (ItemSelectable) actionEvent.getSource();
                            Object[] selections = is.getSelectedObjects();
                            String selection = (String) selections[0];
                            ccmTableModel.setTypeFilterValue(selection);
                            sorter.setRowFilter(combinedFilter);
                            ccmTableModel.fireTableDataChanged();
                        }
                    };

                    showByTypeComboBox.addActionListener(actionListener2);
                }
                topPanel.add(showByTypeComboBox, cc.xy(8, 1));

                //---- topLabel3 ----               
                topPanel.add(keywordSearchLabel, cc.xy(10, 1));

                //======== scrollPaneForTopList3 ========
                {
                    // ---- keywordSearchField ----
                    KeyListener actionListener3 = new KeyListener() {

                        public void keyPressed(KeyEvent e) {
                        }

                        public void keyReleased(KeyEvent e) {
                            String text = keywordSearchField.getText();
                            ccmTableModel.setKeywordFilterValue(text);
                            sorter.setRowFilter(combinedFilter);
                            ccmTableModel.fireTableDataChanged();
                        }

                        public void keyTyped(KeyEvent e) {
                        }
                    };

                    keywordSearchField.setText("Enter Text");
                    keywordSearchField.addKeyListener(actionListener3);
                }
                topPanel.add(keywordSearchField, cc.xy(12, 1));
            } // Top Panel
            frameContentPane.add(topPanel, BorderLayout.NORTH);

            //======== splitPane ========
            {
                splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
                splitPane.setResizeWeight(0.5);

                //======== scrollPaneForTable ========
                {
                    //---- table ----
                    ccmTableModel = new CCMTableModel2(manager.componentConfigurationManager);
                    setOriginalChoices();
                    table = new JTable(ccmTableModel);
                    sorter = new TableRowSorter<CCMTableModel2>(ccmTableModel);
                    table.setRowSorter(sorter);

                    table.setDefaultRenderer(Object.class, new CellRenderer());
                    table.setDefaultRenderer(CCMTableModel2.ImageLink.class, new ImageLinkRenderer());
                    table.setDefaultRenderer(CCMTableModel2.HyperLink.class, new HyperLinkRenderer());
                    table.setDefaultRenderer(CCMTableModel2.DownloadLink.class, new DownloadLinkRenderer());
                    table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);

                    ListSelectionModel cellSM = table.getSelectionModel();
                    cellSM.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                    cellSM.addListSelectionListener(new ListSelectionListener() {
                        public void valueChanged(ListSelectionEvent e) {
                            boolean adjusting = e.getValueIsAdjusting();
                            if (adjusting) {
                                return;
                            }
                            int[] selectedRow = table.getSelectedRows();
                            ListSelectionModel lsm = (ListSelectionModel) e.getSource();
                            if (lsm.isSelectionEmpty()) {
                                textPane.setText(" ");
                            } else {
                                String description = (String) ccmTableModel.getValueAt(
                                        table.convertRowIndexToModel(selectedRow[0]),
                                        CCMTableModel2.DESCRIPTION_INDEX);
                                textPane.setText(description);

                                if (textPane.getCaretPosition() > 1) {
                                    textPane.setCaretPosition(1);
                                }
                            }

                            if (table.getSelectedRow() >= 0) {
                                int modelColumn = table.convertColumnIndexToModel(table.getSelectedColumn());
                                if (modelColumn == CCMTableModel2.AVAILABLE_UPDATE_INDEX)
                                    installRemoteComponent();
                                else
                                    launchBrowser();
                            }
                        }
                    });

                    TableColumn column = table.getColumnModel().getColumn(CCMTableModel2.SELECTION_INDEX);
                    column.setMaxWidth(50);
                    column = table.getColumnModel().getColumn(CCMTableModel2.VERSION_INDEX);
                    column.setMaxWidth(60);
                    column = table.getColumnModel().getColumn(CCMTableModel2.AVAILABLE_UPDATE_INDEX);
                    column.setMaxWidth(60);
                    column = table.getColumnModel().getColumn(CCMTableModel2.TUTORIAL_URL_INDEX_2);
                    column.setMaxWidth(70);
                    column = table.getColumnModel().getColumn(CCMTableModel2.TOOL_URL_INDEX_2);
                    column.setMaxWidth(70);

                    scrollPaneForTable = new JScrollPane(table);
                }
                splitPane.setTopComponent(scrollPaneForTable);

                //======== scrollPaneForTextPane ========
                {
                    //---- textPane ----
                    textPane.setEditable(false);
                    scrollPaneForTextPane.setViewportView(textPane);
                }
                splitPane.setBottomComponent(scrollPaneForTextPane);
            } //======== splitPane ========.
            frameContentPane.add(splitPane, BorderLayout.CENTER);

            //======== bottompanel ========
            {
                bottompanel.setLayout(new FormLayout("20dlu," + "default,  4dlu, " + // view License
                        "default,100dlu, " + // Component Update
                        "default,  4dlu, " + // Apply
                        "default,  4dlu, " + // Reset
                        "default,  4dlu, " + // Cancel
                        "default " // Close
                        , "center:25dlu"));

                viewLicenseButton.setText("View License");
                bottompanel.add(viewLicenseButton, cc.xy(2, 1));

                //---- componentUpdateButton ----
                bottompanel.add(componentUpdateButton, cc.xy(6, 1));

                //---- applyButton ----
                applyButton.setText("Apply");
                bottompanel.add(applyButton, cc.xy(8, 1));

                //---- resetButton ----
                resetButton.setText("Reset");
                bottompanel.add(resetButton, cc.xy(10, 1));

                //---- closeButton ----
                closeButton.setText("Close");
                bottompanel.add(closeButton, cc.xy(12, 1));

            } //======== bottompanel ========.
            frameContentPane.add(bottompanel, BorderLayout.SOUTH);
        } //======== outerPanel ========
        frame.pack();
        frame.setLocationRelativeTo(frame.getOwner());
    } // ============ frame ============

    topPanel.setVisible(true);
    splitPane.setVisible(true);
    scrollPaneForTable.setVisible(true);
    table.setVisible(true);
    scrollPaneForTextPane.setVisible(true);
    textPane.setVisible(true);
    bottompanel.setVisible(true);
    sorter.setRowFilter(combinedFilter);
    frame.setVisible(true);
    splitPane.setDividerLocation(.7d);
}

From source file:org.tinymediamanager.ui.moviesets.dialogs.MovieSetChooserDialog.java

/**
 * Instantiates a new movie set chooser panel.
 * /*from www  . j  a v  a  2  s.co  m*/
 * @param movieSet
 *          the movie set
 */
public MovieSetChooserDialog(MovieSet movieSet, boolean inQueue) {
    super(BUNDLE.getString("movieset.search"), "movieSetChooser"); //$NON-NLS-1$
    setBounds(5, 5, 865, 578);

    movieSetToScrape = movieSet;

    getContentPane().setLayout(new BorderLayout(0, 0));

    JPanel panelHeader = new JPanel();
    getContentPane().add(panelHeader, BorderLayout.NORTH);
    panelHeader.setLayout(new FormLayout(
            new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("114px:grow"),
                    FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("100px"), ColumnSpec.decode("2dlu"), },
            new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("25px"),
                    FormFactory.RELATED_GAP_ROWSPEC, }));
    {
        tfMovieSetName = new JTextField();
        panelHeader.add(tfMovieSetName, "2, 2, fill, fill");
        tfMovieSetName.setColumns(10);
    }
    {
        JButton btnSearch = new JButton("");
        btnSearch.setAction(actionSearch);
        panelHeader.add(btnSearch, "4, 2, fill, top");
    }
    {
        JSplitPane splitPane = new JSplitPane();
        splitPane.setContinuousLayout(true);
        splitPane.setResizeWeight(0.5);
        getContentPane().add(splitPane, BorderLayout.CENTER);
        {
            JPanel panelResults = new JPanel();
            panelResults.setLayout(new FormLayout(
                    new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("300px:grow"), },
                    new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("fill:403px:grow"), }));
            JScrollPane panelSearchResults = new JScrollPane();
            panelResults.add(panelSearchResults, "2, 2, fill, fill");
            splitPane.setLeftComponent(panelResults);
            {
                tableMovieSets = new JTable();
                panelSearchResults.setViewportView(tableMovieSets);
                tableMovieSets.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                tableMovieSets.setBorder(new LineBorder(new Color(0, 0, 0)));
                ListSelectionModel rowSM = tableMovieSets.getSelectionModel();
                rowSM.addListSelectionListener(new ListSelectionListener() {
                    public void valueChanged(ListSelectionEvent e) {
                        // Ignore extra messages.
                        if (e.getValueIsAdjusting())
                            return;

                        ListSelectionModel lsm = (ListSelectionModel) e.getSource();
                        if (!lsm.isSelectionEmpty()) {
                            int selectedRow = lsm.getMinSelectionIndex();
                            selectedRow = tableMovieSets.convertRowIndexToModel(selectedRow);
                            try {
                                MovieSetChooserModel model = movieSetsFound.get(selectedRow);
                                if (model != MovieSetChooserModel.emptyResult && !model.isScraped()) {
                                    ScrapeTask task = new ScrapeTask(model);
                                    task.execute();

                                }
                            } catch (Exception ex) {
                                LOGGER.warn(ex.getMessage());
                            }
                        }
                    }
                });
            }
        }
        {
            JPanel panelSearchDetail = new JPanel();
            splitPane.setRightComponent(panelSearchDetail);
            panelSearchDetail.setLayout(new FormLayout(
                    new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("left:150px"),
                            FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(300px;default):grow"),
                            FormFactory.RELATED_GAP_COLSPEC, },
                    new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                            RowSpec.decode("250px"), FormFactory.PARAGRAPH_GAP_ROWSPEC,
                            RowSpec.decode("top:default:grow"), FormFactory.RELATED_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC }));
            {
                lblMovieSetName = new JTextArea("");
                lblMovieSetName.setLineWrap(true);
                lblMovieSetName.setOpaque(false);
                lblMovieSetName.setWrapStyleWord(true);
                TmmFontHelper.changeFont(lblMovieSetName, 1.166, Font.BOLD);
                panelSearchDetail.add(lblMovieSetName, "2, 1, 3, 1, fill, top");
            }
            {
                lblMovieSetPoster = new ImageLabel();
                lblMovieSetPoster.setAlternativeText(BUNDLE.getString("image.notfound.poster")); //$NON-NLS-1$
                panelSearchDetail.add(lblMovieSetPoster, "2, 3, fill, fill");
            }
            {
                JPanel panel = new JPanel();
                panelSearchDetail.add(panel, "4, 3, fill, fill");
                panel.setLayout(new FormLayout(
                        new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                                FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), },
                        new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, }));
            }
            {

                JScrollPane scrollPane = new JScrollPane();
                panelSearchDetail.add(scrollPane, "2, 5, 3, 1, fill, fill");
                {
                    tableMovies = new JTable();
                    scrollPane.setViewportView(tableMovies);
                }

            }
            {
                cbAssignMovies = new JCheckBox(BUNDLE.getString("movieset.movie.assign")); //$NON-NLS-1$
                cbAssignMovies.setSelected(true);
                panelSearchDetail.add(cbAssignMovies, "2, 7, 3, 1");
            }
        }
    }

    {
        JPanel bottomPane = new JPanel();
        getContentPane().add(bottomPane, BorderLayout.SOUTH);
        {
            bottomPane.setLayout(new FormLayout(new ColumnSpec[] { ColumnSpec.decode("2dlu"),
                    ColumnSpec.decode("185px"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("18px:grow"),
                    FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, ColumnSpec.decode("2dlu"), },
                    new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                            FormFactory.LINE_GAP_ROWSPEC }));
            {
                progressBar = new JProgressBar();
                bottomPane.add(progressBar, "2, 2, fill, center");
            }
            {
                lblProgressAction = new JLabel("");
                bottomPane.add(lblProgressAction, "4, 2, fill, center");
            }
            {
                JPanel buttonPane = new JPanel();
                bottomPane.add(buttonPane, "6, 2, fill, fill");
                EqualsLayout layout = new EqualsLayout(5);
                buttonPane.setBorder(new EmptyBorder(4, 4, 4, 4));
                layout.setMinWidth(100);
                buttonPane.setLayout(layout);

                btnOk = new JButton(BUNDLE.getString("Button.ok")); //$NON-NLS-1$
                btnOk.setActionCommand("Save");
                btnOk.setToolTipText(BUNDLE.getString("Button.ok")); //$NON-NLS-1$
                btnOk.setIcon(IconManager.APPLY);
                btnOk.addActionListener(this);
                buttonPane.add(btnOk);

                JButton btnCancel = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$
                btnCancel.setActionCommand("Cancel");
                btnCancel.setToolTipText(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$
                btnCancel.setIcon(IconManager.CANCEL);
                btnCancel.addActionListener(this);
                buttonPane.add(btnCancel);

                if (inQueue) {
                    JButton btnAbort = new JButton(BUNDLE.getString("Button.abortqueue")); //$NON-NLS-1$
                    btnAbort.setActionCommand("Abort");
                    btnAbort.setToolTipText(BUNDLE.getString("Button.abortqueue")); //$NON-NLS-1$
                    btnAbort.setIcon(IconManager.PROCESS_STOP);
                    btnAbort.addActionListener(this);
                    buttonPane.add(btnAbort, "6, 1, fill, top");
                }
            }
        }
    }
    initDataBindings();

    // adjust table columns
    tableMovies.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    tableMovies.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);

    tableMovieSets.getColumnModel().getColumn(0).setHeaderValue(BUNDLE.getString("chooser.searchresult"));
    tfMovieSetName.setText(movieSet.getTitle());
    searchMovie();

}

From source file:pcgen.gui2.tabs.CompanionInfoTab.java

private void initComponents() {
    {//from w  ww. j a v  a  2 s  .  com
        DefaultTableColumnModel model = new DefaultTableColumnModel();
        TableColumn column = new TableColumn(0);
        column.setResizable(true);
        model.addColumn(column);

        column = new TableColumn(1, 120, new ButtonCellRenderer(), null);
        column.setMaxWidth(120);
        column.setResizable(false);
        model.addColumn(column);

        companionsTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
        companionsTable.getTableHeader().setResizingAllowed(false);
        companionsTable.setAutoCreateColumnsFromModel(false);
        companionsTable.setColumnModel(model);
    }
    companionsTable.setIntercellSpacing(new Dimension(0, 0));
    companionsTable.setFocusable(false);
    companionsTable.setRowHeight(23);
    companionsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    setLeftComponent(new JScrollPane(companionsTable));
    JPanel rightPane = new JPanel(new BorderLayout());
    infoPane.setOpaque(false);
    infoPane.setEditable(false);
    infoPane.setFocusable(true);
    infoPane.setContentType("text/html"); //$NON-NLS-1$
    rightPane.add(new JScrollPane(infoPane), BorderLayout.CENTER);
    JPanel buttonPane = new JPanel(new FlowLayout());
    buttonPane.add(loadButton);
    rightPane.add(buttonPane, BorderLayout.SOUTH);
    setRightComponent(rightPane);
}

From source file:pl.otros.logview.gui.LogViewPanel.java

private JPopupMenu initTableContextMenu() {
    JPopupMenu menu = new JPopupMenu("Menu");
    JMenuItem mark = new JMenuItem("Mark selected rows");
    mark.addActionListener(new MarkRowAction(otrosApplication));
    JMenuItem unmark = new JMenuItem("Unmark selected rows");
    unmark.addActionListener(new UnMarkRowAction(otrosApplication));

    JMenuItem autoResizeMenu = new JMenu("Table auto resize mode");
    autoResizeMenu.setIcon(Icons.TABLE_RESIZE);
    JMenuItem autoResizeSubsequent = new JMenuItem("Subsequent columns");
    autoResizeSubsequent/*from   w  ww.  ja v a 2s.co m*/
            .addActionListener(new TableResizeActionListener(table, JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS));
    JMenuItem autoResizeLast = new JMenuItem("Last column");
    autoResizeLast.addActionListener(new TableResizeActionListener(table, JTable.AUTO_RESIZE_LAST_COLUMN));
    JMenuItem autoResizeNext = new JMenuItem("Next column");
    autoResizeNext.addActionListener(new TableResizeActionListener(table, JTable.AUTO_RESIZE_NEXT_COLUMN));
    JMenuItem autoResizeAll = new JMenuItem("All columns");
    autoResizeAll.addActionListener(new TableResizeActionListener(table, JTable.AUTO_RESIZE_ALL_COLUMNS));
    JMenuItem autoResizeOff = new JMenuItem("Auto resize off");
    autoResizeOff.addActionListener(new TableResizeActionListener(table, JTable.AUTO_RESIZE_OFF));
    autoResizeMenu.add(autoResizeSubsequent);
    autoResizeMenu.add(autoResizeOff);
    autoResizeMenu.add(autoResizeNext);
    autoResizeMenu.add(autoResizeLast);
    autoResizeMenu.add(autoResizeAll);
    JMenu removeMenu = new JMenu("Remove log events");
    removeMenu.setFont(menuLabelFont);
    removeMenu.setIcon(Icons.BIN);
    JLabel removeLabel = new JLabel("Remove by:");
    removeLabel.setFont(menuLabelFont);
    removeMenu.add(removeLabel);

    Map<String, Set<String>> propKeyValue = getPropertiesOfSelectedLogEvents();
    for (AcceptCondition acceptCondition : acceptConditionList) {
        removeMenu.add(new JMenuItem(new RemoveByAcceptanceCriteria(acceptCondition, otrosApplication)));
    }
    for (String propertyKey : propKeyValue.keySet()) {
        for (String propertyValue : propKeyValue.get(propertyKey)) {
            PropertyAcceptCondition propAcceptCondition = new PropertyAcceptCondition(propertyKey,
                    propertyValue);
            removeMenu
                    .add(new JMenuItem(new RemoveByAcceptanceCriteria(propAcceptCondition, otrosApplication)));
        }
    }

    menu.add(new JSeparator());
    JLabel labelMarkingRows = new JLabel("Marking/unmarking rows");
    labelMarkingRows.setFont(menuLabelFont);
    menu.add(labelMarkingRows);
    menu.add(new JSeparator());
    menu.add(mark);
    menu.add(unmark);
    JMenu[] markersMenu = getAutomaticMarkersMenu();
    menu.add(markersMenu[0]);
    menu.add(markersMenu[1]);
    menu.add(new ClearMarkingsAction(otrosApplication));
    menu.add(new JSeparator());
    JLabel labelQuickFilters = new JLabel("Quick filters");
    labelQuickFilters.setFont(menuLabelFont);
    menu.add(labelQuickFilters);
    menu.add(new JSeparator());
    menu.add(focusOnThisThreadAction);
    menu.add(focusOnEventsAfter);
    menu.add(focusOnEventsBefore);
    menu.add(focusOnSelectedClassesAction);
    menu.add(ignoreSelectedEventsClasses);
    menu.add(focusOnSelectedLoggerNameAction);
    menu.add(showCallHierarchyAction);
    for (String propertyKey : propKeyValue.keySet()) {
        for (String propertyValue : propKeyValue.get(propertyKey)) {
            menu.add(new FocusOnSelectedPropertyAction(propertyFilter, propertyFilterPanel.getEnableCheckBox(),
                    otrosApplication, propertyKey, propertyValue));
        }
    }
    menu.add(new JSeparator());
    menu.add(removeMenu);
    menu.add(new JSeparator());
    JLabel labelTableOptions = new JLabel("Table options");
    labelTableOptions.setFont(menuLabelFont);
    menu.add(labelTableOptions);
    menu.add(new JSeparator());
    menu.add(autoResizeMenu);

    menu.add(new JSeparator());
    List<MenuActionProvider> menuActionProviders = otrosApplication.getLogViewPanelMenuActionProvider();
    for (MenuActionProvider menuActionProvider : menuActionProviders) {
        try {
            List<OtrosAction> actions = menuActionProvider.getActions(otrosApplication, this);
            if (actions == null) {
                continue;
            }
            for (OtrosAction action : actions) {
                menu.add(action);
            }
        } catch (Exception e) {
            LOGGER.log(Level.SEVERE, "Cant get action from from provider " + menuActionProvider, e);
        }
    }

    return menu;
}

From source file:sms.Form1Exams.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 .j  a  v a 2s.  c  o  m
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    buttonGroup1 = new javax.swing.ButtonGroup();
    buttonGroup2 = new javax.swing.ButtonGroup();
    jPanel2 = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    table = new javax.swing.JTable();
    sname = new javax.swing.JTextField();
    jComboBoxSubjects = new javax.swing.JComboBox<>();
    subject = new javax.swing.JTextField();
    sid = new javax.swing.JTextField();
    jLabel2 = new javax.swing.JLabel();
    jLabel3 = new javax.swing.JLabel();
    icon = new javax.swing.JLabel();
    jButtonEnter = new javax.swing.JButton();
    jButtonClear = new javax.swing.JButton();
    jComboBox2 = new javax.swing.JComboBox<>();
    jButtonUpdate = new javax.swing.JButton();
    subjectup = new javax.swing.JTextField();
    lblsubject = new javax.swing.JLabel();
    jComboBoxExam = new javax.swing.JComboBox<>();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

    table.setBackground(new java.awt.Color(204, 255, 204));
    table.setModel(new javax.swing.table.DefaultTableModel(new Object[][] { {}, {}, {}, {} }, new String[] {

    }));
    table.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_ALL_COLUMNS);
    table.setRowHeight(40);
    table.setRowMargin(4);
    table.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            tableMouseClicked(evt);
        }
    });
    jScrollPane1.setViewportView(table);

    sname.setEditable(false);

    jComboBoxSubjects.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            jComboBoxSubjectsItemStateChanged(evt);
        }
    });
    jComboBoxSubjects.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jComboBoxSubjectsActionPerformed(evt);
        }
    });

    sid.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            sidActionPerformed(evt);
        }
    });
    sid.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyReleased(java.awt.event.KeyEvent evt) {
            sidKeyReleased(evt);
        }
    });

    jLabel2.setText("ADM NO");

    jLabel3.setText("NAME");

    icon.setText("image");

    jButtonEnter.setText("ENTER");
    jButtonEnter.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            jButtonEnterStateChanged(evt);
        }
    });
    jButtonEnter.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButtonEnterActionPerformed(evt);
        }
    });

    jButtonClear.setText("CLEAR");
    jButtonClear.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButtonClearActionPerformed(evt);
        }
    });

    jComboBox2.setModel(new javax.swing.DefaultComboBoxModel<>(
            new String[] { "Chose Term", "Term 1", "Term 2", "Term 3" }));
    jComboBox2.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            jComboBox2ItemStateChanged(evt);
        }
    });

    jButtonUpdate.setText("UPDATE");
    jButtonUpdate.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButtonUpdateActionPerformed(evt);
        }
    });

    subjectup.setEditable(false);

    lblsubject.setText("Subject");

    jComboBoxExam.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            jComboBoxExamItemStateChanged(evt);
        }
    });

    javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(jPanel2Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup().addGroup(jPanel2Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(icon, javax.swing.GroupLayout.Alignment.LEADING,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 170,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jComboBoxSubjects, javax.swing.GroupLayout.Alignment.LEADING,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 170,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(sid, javax.swing.GroupLayout.Alignment.LEADING,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 170,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jButtonClear, javax.swing.GroupLayout.Alignment.LEADING,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jButtonUpdate, javax.swing.GroupLayout.Alignment.LEADING,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(subjectup, javax.swing.GroupLayout.Alignment.LEADING))
                                    .addGap(18, 18, 18)
                                    .addGroup(jPanel2Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                                    false)
                                            .addComponent(sname).addComponent(subject).addComponent(jLabel3)
                                            .addComponent(jButtonEnter, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    141, Short.MAX_VALUE)
                                            .addComponent(jComboBoxExam,
                                                    javax.swing.GroupLayout.Alignment.TRAILING, 0,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(jComboBox2,
                                                    javax.swing.GroupLayout.Alignment.TRAILING, 0, 141,
                                                    Short.MAX_VALUE)))
                            .addComponent(lblsubject))
                    .addGap(24, 24, 24)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 618, Short.MAX_VALUE)));
    jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup().addGap(5, 5, 5)
                                    .addComponent(icon, javax.swing.GroupLayout.PREFERRED_SIZE, 159,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addGroup(jPanel2Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(jLabel2).addComponent(jLabel3))
                                    .addGap(18, 18, 18)
                                    .addGroup(jPanel2Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(sid, javax.swing.GroupLayout.PREFERRED_SIZE, 30,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(sname, javax.swing.GroupLayout.PREFERRED_SIZE, 29,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGap(44, 44, 44)
                                    .addGroup(jPanel2Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(subject, javax.swing.GroupLayout.PREFERRED_SIZE, 31,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jComboBoxSubjects,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 31,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addGroup(jPanel2Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(jButtonEnter).addComponent(jButtonClear))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42,
                                            Short.MAX_VALUE)
                                    .addComponent(lblsubject)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(
                                            subjectup, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(18, 18, 18).addComponent(jButtonUpdate)
                                    .addGap(0, 36, Short.MAX_VALUE))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout
                                    .createSequentialGroup().addContainerGap()
                                    .addGroup(jPanel2Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(jPanel2Layout.createSequentialGroup()
                                                    .addComponent(jComboBox2,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addGap(68, 68, 68).addComponent(jComboBoxExam,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addComponent(jScrollPane1))))
                    .addContainerGap()));

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jPanel2,
                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(
            jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE,
            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));

    pack();
}

From source file:ui.panel.UILicenseDetail.java

private JPanel createDetailsPnl() {
    JPanel panel = p.createPanel(Layouts.flow);
    panel.setLayout(new BorderLayout());

    tblInfo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    tblInfo.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    tblInfo.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            int selected = tblInfo.getSelectedRow();
            DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
            getData((String) tblInfo.getModel().getValueAt(selected, 0));
            model.setRoot(root);//w w w.j  ava2s  .c  o  m
        }
    });
    spTable = new JScrollPane(tblInfo);
    spTable.setPreferredSize(new Dimension(600, 100));

    panel.add(spTable, BorderLayout.CENTER);
    return panel;
}