Search in sources :

Example 51 with ListSelectionListener

use of javax.swing.event.ListSelectionListener in project JWildfire by thargor6.

the class TinaInternalFrame method getGradientsList.

private JList getGradientsList() {
    if (gradientsList == null) {
        gradientsList = new JList();
        gradientsList.addListSelectionListener(new ListSelectionListener() {

            public void valueChanged(ListSelectionEvent e) {
                tinaController.getGradientController().gradientLibraryGradientChanged();
            }
        });
    }
    return gradientsList;
}
Also used : ListSelectionEvent(javax.swing.event.ListSelectionEvent) JList(javax.swing.JList) ListSelectionListener(javax.swing.event.ListSelectionListener)

Example 52 with ListSelectionListener

use of javax.swing.event.ListSelectionListener in project JWildfire by thargor6.

the class TinaInternalFrame method getLayersTable.

private JTable getLayersTable() {
    if (layersTable == null) {
        layersTable = new JTable();
        layersTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        layersTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

            @Override
            public void valueChanged(ListSelectionEvent e) {
                if (!e.getValueIsAdjusting()) {
                    tinaController.layersTableClicked();
                }
            }
        });
    }
    return layersTable;
}
Also used : JTable(javax.swing.JTable) ListSelectionEvent(javax.swing.event.ListSelectionEvent) ListSelectionListener(javax.swing.event.ListSelectionListener)

Example 53 with ListSelectionListener

use of javax.swing.event.ListSelectionListener in project JWildfire by thargor6.

the class TinaInternalFrame method getTabbedPane.

private JTabbedPane getTabbedPane() {
    if (tabbedPane == null) {
        tabbedPane = new JTabbedPane(JTabbedPane.TOP);
        tabbedPane.addTab("Description", null, getPanel_60(), null);
        tabbedPane.addTab("Code preview", null, getPanel_61(), null);
        JPanel panel_1 = new JPanel();
        tabbedPane.addTab("Macro buttons", null, panel_1, null);
        panel_1.setLayout(new BorderLayout(0, 0));
        JPanel panel_2 = new JPanel();
        panel_2.setPreferredSize(new Dimension(120, 10));
        panel_1.add(panel_2, BorderLayout.CENTER);
        panel_2.setLayout(new BorderLayout(0, 0));
        JScrollPane scrollPane_2 = new JScrollPane();
        scrollPane_2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        scrollPane_2.setBorder(null);
        panel_2.add(scrollPane_2, BorderLayout.CENTER);
        macroButtonsTable = new JTable();
        macroButtonsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        macroButtonsTable.setFont(Prefs.getPrefs().getFont("Dialog", Font.PLAIN, 10));
        macroButtonsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

            @Override
            public void valueChanged(ListSelectionEvent e) {
                if (!e.getValueIsAdjusting()) {
                    tinaController.getJwfScriptController().macroButtonsTableClicked();
                }
            }
        });
        scrollPane_2.setViewportView(macroButtonsTable);
        JPanel panel_3 = new JPanel();
        FlowLayout flowLayout = (FlowLayout) panel_3.getLayout();
        flowLayout.setHgap(0);
        flowLayout.setVgap(1);
        panel_3.setPreferredSize(new Dimension(124, 10));
        panel_1.add(panel_3, BorderLayout.EAST);
        JPanel panel_9 = new JPanel();
        panel_9.setPreferredSize(new Dimension(116, 4));
        panel_9.setMinimumSize(new Dimension(116, 8));
        panel_9.setMaximumSize(new Dimension(32767, 8));
        panel_3.add(panel_9);
        macroButtonMoveUpBtn = new JButton();
        macroButtonMoveUpBtn.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                tinaController.getJwfScriptController().macroButtonMoveUp();
            }
        });
        macroButtonMoveUpBtn.setToolTipText("Move the button one up in the list");
        macroButtonMoveUpBtn.setText("Up");
        macroButtonMoveUpBtn.setPreferredSize(new Dimension(58, 24));
        macroButtonMoveUpBtn.setMinimumSize(new Dimension(58, 12));
        macroButtonMoveUpBtn.setMaximumSize(new Dimension(58, 12));
        macroButtonMoveUpBtn.setFont(Prefs.getPrefs().getFont("Dialog", Font.BOLD, 10));
        macroButtonMoveUpBtn.setBounds(new Rectangle(9, 280, 125, 24));
        panel_3.add(macroButtonMoveUpBtn);
        macroButtonMoveDownBtn = new JButton();
        macroButtonMoveDownBtn.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                tinaController.getJwfScriptController().macroButtonMoveDown();
            }
        });
        macroButtonMoveDownBtn.setToolTipText("Move the button one down in the list");
        macroButtonMoveDownBtn.setText("Down");
        macroButtonMoveDownBtn.setPreferredSize(new Dimension(58, 24));
        macroButtonMoveDownBtn.setMinimumSize(new Dimension(58, 12));
        macroButtonMoveDownBtn.setMaximumSize(new Dimension(58, 12));
        macroButtonMoveDownBtn.setFont(Prefs.getPrefs().getFont("Dialog", Font.BOLD, 10));
        macroButtonMoveDownBtn.setBounds(new Rectangle(9, 280, 125, 24));
        panel_3.add(macroButtonMoveDownBtn);
        JPanel panel_8 = new JPanel();
        panel_8.setPreferredSize(new Dimension(116, 4));
        panel_8.setMinimumSize(new Dimension(116, 8));
        panel_8.setMaximumSize(new Dimension(32767, 8));
        panel_3.add(panel_8);
        macroButtonDeleteBtn = new JButton();
        macroButtonDeleteBtn.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                tinaController.getJwfScriptController().macroButtonDelete();
            }
        });
        macroButtonDeleteBtn.setToolTipText("Delete the button");
        macroButtonDeleteBtn.setText("Delete");
        macroButtonDeleteBtn.setPreferredSize(new Dimension(116, 24));
        macroButtonDeleteBtn.setFont(Prefs.getPrefs().getFont("Dialog", Font.BOLD, 10));
        macroButtonDeleteBtn.setBounds(new Rectangle(9, 280, 125, 24));
        panel_3.add(macroButtonDeleteBtn);
    }
    return tabbedPane;
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) ActionEvent(java.awt.event.ActionEvent) JTabbedPane(javax.swing.JTabbedPane) ListSelectionEvent(javax.swing.event.ListSelectionEvent) JButton(javax.swing.JButton) Rectangle(java.awt.Rectangle) Dimension(java.awt.Dimension) ListSelectionListener(javax.swing.event.ListSelectionListener) BorderLayout(java.awt.BorderLayout) ActionListener(java.awt.event.ActionListener) JTable(javax.swing.JTable)

Example 54 with ListSelectionListener

use of javax.swing.event.ListSelectionListener in project JWildfire by thargor6.

the class TinaInternalFrame method getTinaTransformationsTable.

/**
 * This method initializes tinaTransformationsTable
 *
 * @return javax.swing.JTable
 */
private JTable getTinaTransformationsTable() {
    if (tinaTransformationsTable == null) {
        tinaTransformationsTable = new JTable();
        tinaTransformationsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        tinaTransformationsTable.setFont(Prefs.getPrefs().getFont("Dialog", Font.PLAIN, 10));
        tinaTransformationsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

            @Override
            public void valueChanged(ListSelectionEvent e) {
                if (!e.getValueIsAdjusting()) {
                    tinaController.transformationTableClicked();
                }
            }
        });
    }
    return tinaTransformationsTable;
}
Also used : JTable(javax.swing.JTable) ListSelectionEvent(javax.swing.event.ListSelectionEvent) ListSelectionListener(javax.swing.event.ListSelectionListener)

Example 55 with ListSelectionListener

use of javax.swing.event.ListSelectionListener in project sldeditor by robward-scisys.

the class DataSourceConfigPanel method createTable.

/**
 * Creates the table.
 *
 * @return the component
 */
private Component createTable() {
    final UndoActionInterface parentObj = this;
    dataModel = new DataSourceAttributeModel();
    dataModel.addTableModelListener(new TableModelListener() {

        /**
         * Table changed.
         *
         * @param arg0 the arg0
         */
        @Override
        public void tableChanged(TableModelEvent arg0) {
            if (!isPopulatingTable()) {
                dataChanged = true;
                updateButtonState();
            }
        }
    });
    table = new JTable();
    table.setModel(dataModel);
    table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent arg0) {
            updateButtonState();
        }
    });
    TableColumn tmpColum = table.getColumnModel().getColumn(1);
    JComboBox<String> comboBox = new JComboBox<String>(dataModel.getTypeData());
    DefaultCellEditor defaultCellEditor = new DefaultCellEditor(comboBox);
    tmpColum.setCellEditor(defaultCellEditor);
    tmpColum.setCellRenderer(new ComboBoxCellRenderer(comboBox));
    JPanel buttonPanel = new JPanel();
    FlowLayout flowLayout = (FlowLayout) buttonPanel.getLayout();
    flowLayout.setHgap(1);
    flowLayout.setAlignment(FlowLayout.TRAILING);
    add(buttonPanel, BorderLayout.SOUTH);
    btnDisconnect = new JButton(Localisation.getString(DataSourceConfigPanel.class, "DataSourceConfigPanel.disconnect"));
    btnDisconnect.setEnabled(false);
    btnDisconnect.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            SLDEditorFile.getInstance().getSLDData().setDataSourceProperties(DataSourceConnectorFactory.getNoDataSource());
            applyData(parentObj);
        }
    });
    buttonPanel.add(btnDisconnect);
    btnAddField = new JButton(Localisation.getString(DataSourceConfigPanel.class, "DataSourceConfigPanel.add"));
    btnAddField.setEnabled(false);
    btnAddField.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            addNewField();
        }
    });
    buttonPanel.add(btnAddField);
    btnRemoveField = new JButton(Localisation.getString(DataSourceConfigPanel.class, "DataSourceConfigPanel.remove"));
    btnRemoveField.setEnabled(false);
    btnRemoveField.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            removeField();
        }
    });
    buttonPanel.add(btnRemoveField);
    btnApply = new JButton(Localisation.getString(DataSourceConfigPanel.class, "common.apply"));
    btnApply.setEnabled(false);
    btnApply.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            applyData(parentObj);
        }
    });
    buttonPanel.add(btnApply);
    btnCancel = new JButton(Localisation.getString(DataSourceConfigPanel.class, "common.cancel"));
    btnCancel.setEnabled(false);
    btnCancel.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            cancelData();
        }
    });
    buttonPanel.add(btnCancel);
    JScrollPane scrollPane = new JScrollPane(table);
    return scrollPane;
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) JComboBox(javax.swing.JComboBox) TableModelEvent(javax.swing.event.TableModelEvent) ActionEvent(java.awt.event.ActionEvent) ListSelectionEvent(javax.swing.event.ListSelectionEvent) JButton(javax.swing.JButton) TableColumn(javax.swing.table.TableColumn) UndoActionInterface(com.sldeditor.common.undo.UndoActionInterface) ListSelectionListener(javax.swing.event.ListSelectionListener) DefaultCellEditor(javax.swing.DefaultCellEditor) ActionListener(java.awt.event.ActionListener) TableModelListener(javax.swing.event.TableModelListener) JTable(javax.swing.JTable)

Aggregations

ListSelectionListener (javax.swing.event.ListSelectionListener)216 ListSelectionEvent (javax.swing.event.ListSelectionEvent)210 ActionEvent (java.awt.event.ActionEvent)90 ActionListener (java.awt.event.ActionListener)76 JScrollPane (javax.swing.JScrollPane)72 JPanel (javax.swing.JPanel)67 JButton (javax.swing.JButton)61 BorderLayout (java.awt.BorderLayout)53 MouseEvent (java.awt.event.MouseEvent)47 Dimension (java.awt.Dimension)44 JLabel (javax.swing.JLabel)40 MouseAdapter (java.awt.event.MouseAdapter)37 JTable (javax.swing.JTable)36 FlowLayout (java.awt.FlowLayout)28 Insets (java.awt.Insets)28 JList (javax.swing.JList)27 List (java.util.List)24 ArrayList (java.util.ArrayList)22 KeyEvent (java.awt.event.KeyEvent)21 GridBagConstraints (java.awt.GridBagConstraints)20