Search in sources :

Example 56 with ListSelectionModel

use of javax.swing.ListSelectionModel in project com.revolsys.open by revolsys.

the class ListReorderableTransferHandler method importData.

@Override
public boolean importData(final TransferHandler.TransferSupport info) {
    final JList target = (JList) info.getComponent();
    final JList.DropLocation dropLocation = (JList.DropLocation) info.getDropLocation();
    int dropIndex = dropLocation.getIndex();
    final ListModel model = this.list.getModel();
    final int max = model.getSize();
    if (dropIndex < 0 || dropIndex > max) {
        dropIndex = max;
    }
    target.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    try {
        final Transferable transferable = info.getTransferable();
        final int[] indices = (int[]) transferable.getTransferData(this.localObjectFlavor);
        if (indices.length > 0) {
            final Reorderable reorderable = (Reorderable) model;
            int currentIndex = dropIndex;
            int count = 0;
            for (int index : indices) {
                if (count > 0) {
                    if (currentIndex > index) {
                        index -= count;
                    }
                }
                count++;
                if (index == currentIndex) {
                    currentIndex++;
                } else {
                    reorderable.reorder(index, currentIndex);
                    if (index > currentIndex) {
                        currentIndex++;
                    }
                }
            }
            final ListSelectionModel selectionModel = target.getSelectionModel();
            selectionModel.clearSelection();
            selectionModel.addSelectionInterval(currentIndex - indices.length, currentIndex - 1);
            return true;
        }
    } catch (final Throwable e) {
        Logs.error(this, "Unexpected error", e);
    }
    return false;
}
Also used : ListModel(javax.swing.ListModel) Transferable(java.awt.datatransfer.Transferable) ListSelectionModel(javax.swing.ListSelectionModel) Reorderable(com.revolsys.util.Reorderable) JList(javax.swing.JList)

Example 57 with ListSelectionModel

use of javax.swing.ListSelectionModel in project keystore-explorer by kaikramer.

the class JGeneralNames method initComponents.

private void initComponents() {
    jbAdd = new JButton(new ImageIcon(Toolkit.getDefaultToolkit().createImage(getClass().getResource(res.getString("JGeneralNames.jbAdd.image")))));
    jbAdd.setMargin(new Insets(2, 2, 0, 0));
    jbAdd.setToolTipText(res.getString("JGeneralNames.jbAdd.tooltip"));
    jbAdd.setMnemonic(res.getString("JGeneralNames.jbAdd.mnemonic").charAt(0));
    jbAdd.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(JGeneralNames.this);
                addPressed();
            } finally {
                CursorUtil.setCursorFree(JGeneralNames.this);
            }
        }
    });
    jbEdit = new JButton(new ImageIcon(Toolkit.getDefaultToolkit().createImage(getClass().getResource(res.getString("JGeneralNames.jbEdit.image")))));
    jbEdit.setMargin(new Insets(2, 2, 0, 0));
    jbEdit.setToolTipText(res.getString("JGeneralNames.jbEdit.tooltip"));
    jbEdit.setMnemonic(res.getString("JGeneralNames.jbEdit.mnemonic").charAt(0));
    jbEdit.setEnabled(false);
    jbEdit.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(JGeneralNames.this);
                editPressed();
            } finally {
                CursorUtil.setCursorFree(JGeneralNames.this);
            }
        }
    });
    jbRemove = new JButton(new ImageIcon(Toolkit.getDefaultToolkit().createImage(getClass().getResource(res.getString("JGeneralNames.jbRemove.image")))));
    jbRemove.setMargin(new Insets(2, 2, 0, 0));
    jbRemove.setToolTipText(res.getString("JGeneralNames.jbRemove.tooltip"));
    jbRemove.setMnemonic(res.getString("JGeneralNames.jbRemove.mnemonic").charAt(0));
    jbRemove.setEnabled(false);
    jbRemove.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(JGeneralNames.this);
                removePressed();
            } finally {
                CursorUtil.setCursorFree(JGeneralNames.this);
            }
        }
    });
    jpGeneralNameButtons = new JPanel();
    jpGeneralNameButtons.setLayout(new BoxLayout(jpGeneralNameButtons, BoxLayout.Y_AXIS));
    jpGeneralNameButtons.add(Box.createVerticalGlue());
    jpGeneralNameButtons.add(jbAdd);
    jpGeneralNameButtons.add(Box.createVerticalStrut(3));
    jpGeneralNameButtons.add(jbEdit);
    jpGeneralNameButtons.add(Box.createVerticalStrut(3));
    jpGeneralNameButtons.add(jbRemove);
    jpGeneralNameButtons.add(Box.createVerticalGlue());
    GeneralNamesTableModel generalNamesTableModel = new GeneralNamesTableModel();
    jtGeneralNames = new JKseTable(generalNamesTableModel);
    TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(generalNamesTableModel);
    sorter.setComparator(0, new GeneralNamesTableModel.GeneralNameComparator());
    jtGeneralNames.setRowSorter(sorter);
    jtGeneralNames.setShowGrid(false);
    jtGeneralNames.setRowMargin(0);
    jtGeneralNames.getColumnModel().setColumnMargin(0);
    jtGeneralNames.getTableHeader().setReorderingAllowed(false);
    jtGeneralNames.setAutoResizeMode(JKseTable.AUTO_RESIZE_ALL_COLUMNS);
    jtGeneralNames.setRowHeight(Math.max(18, jtGeneralNames.getRowHeight()));
    for (int i = 0; i < jtGeneralNames.getColumnCount(); i++) {
        TableColumn column = jtGeneralNames.getColumnModel().getColumn(i);
        column.setHeaderRenderer(new GeneralNamesTableHeadRend(jtGeneralNames.getTableHeader().getDefaultRenderer()));
        column.setCellRenderer(new GeneralNamesTableCellRend());
    }
    ListSelectionModel selectionModel = jtGeneralNames.getSelectionModel();
    selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    selectionModel.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent evt) {
            if (!evt.getValueIsAdjusting()) {
                updateButtonControls();
            }
        }
    });
    jtGeneralNames.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent evt) {
            maybeEditGeneralName(evt);
        }
    });
    jtGeneralNames.addKeyListener(new KeyAdapter() {

        boolean deleteLastPressed = false;

        @Override
        public void keyPressed(KeyEvent evt) {
            // Record delete pressed on non-Macs
            if (!OperatingSystem.isMacOs()) {
                deleteLastPressed = evt.getKeyCode() == KeyEvent.VK_DELETE;
            }
        }

        @Override
        public void keyReleased(KeyEvent evt) {
            // Delete on non-Mac if delete was pressed and is now released
            if (!OperatingSystem.isMacOs() && deleteLastPressed && evt.getKeyCode() == KeyEvent.VK_DELETE) {
                try {
                    CursorUtil.setCursorBusy(JGeneralNames.this);
                    deleteLastPressed = false;
                    removeSelectedGeneralName();
                } finally {
                    CursorUtil.setCursorFree(JGeneralNames.this);
                }
            }
        }

        @Override
        public void keyTyped(KeyEvent evt) {
            // Delete on Mac if back space typed
            if (OperatingSystem.isMacOs() && evt.getKeyChar() == 0x08) {
                try {
                    CursorUtil.setCursorBusy(JGeneralNames.this);
                    removeSelectedGeneralName();
                } finally {
                    CursorUtil.setCursorFree(JGeneralNames.this);
                }
            }
        }
    });
    jspGeneralNames = PlatformUtil.createScrollPane(jtGeneralNames, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    jspGeneralNames.getViewport().setBackground(jtGeneralNames.getBackground());
    this.setLayout(new BorderLayout(5, 5));
    setPreferredSize(new Dimension(250, 150));
    add(jspGeneralNames, BorderLayout.CENTER);
    add(jpGeneralNameButtons, BorderLayout.EAST);
    selectFirstGeneralNameInTable();
    updateButtonControls();
}
Also used : ImageIcon(javax.swing.ImageIcon) JPanel(javax.swing.JPanel) Insets(java.awt.Insets) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) KeyAdapter(java.awt.event.KeyAdapter) JButton(javax.swing.JButton) ListSelectionEvent(javax.swing.event.ListSelectionEvent) KeyEvent(java.awt.event.KeyEvent) BorderLayout(java.awt.BorderLayout) TableRowSorter(javax.swing.table.TableRowSorter) MouseEvent(java.awt.event.MouseEvent) JKseTable(org.kse.gui.JKseTable) MouseAdapter(java.awt.event.MouseAdapter) ListSelectionModel(javax.swing.ListSelectionModel) Dimension(java.awt.Dimension) TableColumn(javax.swing.table.TableColumn) Point(java.awt.Point) ListSelectionListener(javax.swing.event.ListSelectionListener) ActionListener(java.awt.event.ActionListener) TableModel(javax.swing.table.TableModel)

Example 58 with ListSelectionModel

use of javax.swing.ListSelectionModel in project keystore-explorer by kaikramer.

the class JPolicyQualifierInfo method initComponents.

private void initComponents() {
    jbAdd = new JButton(new ImageIcon(Toolkit.getDefaultToolkit().createImage(getClass().getResource(res.getString("JPolicyQualifierInfo.jbAdd.image")))));
    jbAdd.setMargin(new Insets(2, 2, 0, 0));
    jbAdd.setToolTipText(res.getString("JPolicyQualifierInfo.jbAdd.tooltip"));
    jbAdd.setMnemonic(res.getString("JPolicyQualifierInfo.jbAdd.mnemonic").charAt(0));
    jbAdd.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(JPolicyQualifierInfo.this);
                addPressed();
            } finally {
                CursorUtil.setCursorFree(JPolicyQualifierInfo.this);
            }
        }
    });
    jbEdit = new JButton(new ImageIcon(Toolkit.getDefaultToolkit().createImage(getClass().getResource(res.getString("JPolicyQualifierInfo.jbEdit.image")))));
    jbEdit.setMargin(new Insets(2, 2, 0, 0));
    jbEdit.setToolTipText(res.getString("JPolicyQualifierInfo.jbEdit.tooltip"));
    jbEdit.setMnemonic(res.getString("JPolicyQualifierInfo.jbEdit.mnemonic").charAt(0));
    jbEdit.setEnabled(false);
    jbEdit.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(JPolicyQualifierInfo.this);
                editPressed();
            } finally {
                CursorUtil.setCursorFree(JPolicyQualifierInfo.this);
            }
        }
    });
    jbRemove = new JButton(new ImageIcon(Toolkit.getDefaultToolkit().createImage(getClass().getResource(res.getString("JPolicyQualifierInfo.jbRemove.image")))));
    jbRemove.setMargin(new Insets(2, 2, 0, 0));
    jbRemove.setToolTipText(res.getString("JPolicyQualifierInfo.jbRemove.tooltip"));
    jbRemove.setMnemonic(res.getString("JPolicyQualifierInfo.jbRemove.mnemonic").charAt(0));
    jbRemove.setEnabled(false);
    jbRemove.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(JPolicyQualifierInfo.this);
                removePressed();
            } finally {
                CursorUtil.setCursorFree(JPolicyQualifierInfo.this);
            }
        }
    });
    jpPolicyQualifierInfoButtons = new JPanel();
    jpPolicyQualifierInfoButtons.setLayout(new BoxLayout(jpPolicyQualifierInfoButtons, BoxLayout.Y_AXIS));
    jpPolicyQualifierInfoButtons.add(Box.createVerticalGlue());
    jpPolicyQualifierInfoButtons.add(jbAdd);
    jpPolicyQualifierInfoButtons.add(Box.createVerticalStrut(3));
    jpPolicyQualifierInfoButtons.add(jbEdit);
    jpPolicyQualifierInfoButtons.add(Box.createVerticalStrut(3));
    jpPolicyQualifierInfoButtons.add(jbRemove);
    jpPolicyQualifierInfoButtons.add(Box.createVerticalGlue());
    PolicyQualifierInfoTableModel policyQualifierInfoTableModel = new PolicyQualifierInfoTableModel();
    jtPolicyQualifierInfo = new JKseTable(policyQualifierInfoTableModel);
    TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(policyQualifierInfoTableModel);
    sorter.setComparator(0, new PolicyQualifierInfoTableModel.PolicyQualifierInfoComparator());
    jtPolicyQualifierInfo.setRowSorter(sorter);
    jtPolicyQualifierInfo.setShowGrid(false);
    jtPolicyQualifierInfo.setRowMargin(0);
    jtPolicyQualifierInfo.getColumnModel().setColumnMargin(0);
    jtPolicyQualifierInfo.getTableHeader().setReorderingAllowed(false);
    jtPolicyQualifierInfo.setAutoResizeMode(JKseTable.AUTO_RESIZE_ALL_COLUMNS);
    jtPolicyQualifierInfo.setRowHeight(Math.max(18, jtPolicyQualifierInfo.getRowHeight()));
    for (int i = 0; i < jtPolicyQualifierInfo.getColumnCount(); i++) {
        TableColumn column = jtPolicyQualifierInfo.getColumnModel().getColumn(i);
        column.setHeaderRenderer(new PolicyQualifierInfoTableHeadRend(jtPolicyQualifierInfo.getTableHeader().getDefaultRenderer()));
        column.setCellRenderer(new PolicyQualifierInfoTableCellRend());
    }
    ListSelectionModel selectionModel = jtPolicyQualifierInfo.getSelectionModel();
    selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    selectionModel.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent evt) {
            if (!evt.getValueIsAdjusting()) {
                updateButtonControls();
            }
        }
    });
    jtPolicyQualifierInfo.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent evt) {
            maybeEditPolicyQualifierInfo(evt);
        }
    });
    jtPolicyQualifierInfo.addKeyListener(new KeyAdapter() {

        boolean deleteLastPressed = false;

        @Override
        public void keyPressed(KeyEvent evt) {
            // Record delete pressed on non-Macs
            if (!OperatingSystem.isMacOs()) {
                deleteLastPressed = evt.getKeyCode() == KeyEvent.VK_DELETE;
            }
        }

        @Override
        public void keyReleased(KeyEvent evt) {
            // Delete on non-Mac if delete was pressed and is now released
            if (!OperatingSystem.isMacOs() && deleteLastPressed && evt.getKeyCode() == KeyEvent.VK_DELETE) {
                try {
                    CursorUtil.setCursorBusy(JPolicyQualifierInfo.this);
                    deleteLastPressed = false;
                    removeSelectedPolicyQualifierInfo();
                } finally {
                    CursorUtil.setCursorFree(JPolicyQualifierInfo.this);
                }
            }
        }

        @Override
        public void keyTyped(KeyEvent evt) {
            // Delete on Mac if back space typed
            if (OperatingSystem.isMacOs() && evt.getKeyChar() == 0x08) {
                try {
                    CursorUtil.setCursorBusy(JPolicyQualifierInfo.this);
                    removeSelectedPolicyQualifierInfo();
                } finally {
                    CursorUtil.setCursorFree(JPolicyQualifierInfo.this);
                }
            }
        }
    });
    jspPolicyQualifierInfo = PlatformUtil.createScrollPane(jtPolicyQualifierInfo, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    jspPolicyQualifierInfo.getViewport().setBackground(jtPolicyQualifierInfo.getBackground());
    this.setLayout(new BorderLayout(5, 5));
    setPreferredSize(new Dimension(400, 150));
    add(jspPolicyQualifierInfo, BorderLayout.CENTER);
    add(jpPolicyQualifierInfoButtons, BorderLayout.EAST);
    populate();
}
Also used : ImageIcon(javax.swing.ImageIcon) JPanel(javax.swing.JPanel) Insets(java.awt.Insets) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) KeyAdapter(java.awt.event.KeyAdapter) JButton(javax.swing.JButton) ListSelectionEvent(javax.swing.event.ListSelectionEvent) KeyEvent(java.awt.event.KeyEvent) BorderLayout(java.awt.BorderLayout) TableRowSorter(javax.swing.table.TableRowSorter) MouseEvent(java.awt.event.MouseEvent) JKseTable(org.kse.gui.JKseTable) MouseAdapter(java.awt.event.MouseAdapter) ListSelectionModel(javax.swing.ListSelectionModel) Dimension(java.awt.Dimension) TableColumn(javax.swing.table.TableColumn) Point(java.awt.Point) ListSelectionListener(javax.swing.event.ListSelectionListener) ActionListener(java.awt.event.ActionListener) TableModel(javax.swing.table.TableModel)

Example 59 with ListSelectionModel

use of javax.swing.ListSelectionModel in project keystore-explorer by kaikramer.

the class DViewExtensions method initComponents.

private void initComponents() {
    ExtensionsTableModel extensionsTableModel = new ExtensionsTableModel();
    jtExtensions = new JKseTable(extensionsTableModel);
    TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(extensionsTableModel);
    sorter.setComparator(2, new ObjectIdComparator());
    jtExtensions.setRowSorter(sorter);
    jtExtensions.setShowGrid(false);
    jtExtensions.setRowMargin(0);
    jtExtensions.getColumnModel().setColumnMargin(0);
    jtExtensions.getTableHeader().setReorderingAllowed(false);
    jtExtensions.setAutoResizeMode(JKseTable.AUTO_RESIZE_ALL_COLUMNS);
    jtExtensions.setRowHeight(Math.max(18, jtExtensions.getRowHeight()));
    for (int i = 0; i < jtExtensions.getColumnCount(); i++) {
        TableColumn column = jtExtensions.getColumnModel().getColumn(i);
        column.setHeaderRenderer(new ExtensionsTableHeadRend(jtExtensions.getTableHeader().getDefaultRenderer()));
        column.setCellRenderer(new ExtensionsTableCellRend());
    }
    TableColumn criticalCol = jtExtensions.getColumnModel().getColumn(0);
    criticalCol.setResizable(false);
    criticalCol.setMinWidth(28);
    criticalCol.setMaxWidth(28);
    criticalCol.setPreferredWidth(28);
    ListSelectionModel selectionModel = jtExtensions.getSelectionModel();
    selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    selectionModel.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent evt) {
            if (!evt.getValueIsAdjusting()) {
                try {
                    CursorUtil.setCursorBusy(DViewExtensions.this);
                    updateExtensionValue();
                } finally {
                    CursorUtil.setCursorFree(DViewExtensions.this);
                }
            }
        }
    });
    jspExtensionsTable = PlatformUtil.createScrollPane(jtExtensions, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    jspExtensionsTable.getViewport().setBackground(jtExtensions.getBackground());
    jpExtensionsTable = new JPanel(new BorderLayout(5, 5));
    jpExtensionsTable.setPreferredSize(new Dimension(500, 200));
    jpExtensionsTable.add(jspExtensionsTable, BorderLayout.CENTER);
    jpExtensionValue = new JPanel(new BorderLayout(5, 5));
    jlExtensionValue = new JLabel(res.getString("DViewExtensions.jlExtensionValue.text"));
    jpExtensionValue.add(jlExtensionValue, BorderLayout.NORTH);
    jepExtensionValue = new JEditorPane();
    jepExtensionValue.setFont(new Font(Font.MONOSPACED, Font.PLAIN, LnfUtil.getDefaultFontSize()));
    jepExtensionValue.setEditable(false);
    jepExtensionValue.setToolTipText(res.getString("DViewExtensions.jtaExtensionValue.tooltip"));
    // JGoodies - keep uneditable color same as editable
    jepExtensionValue.putClientProperty("JTextArea.infoBackground", Boolean.TRUE);
    // for displaying URLs in extensions as clickable links
    jepExtensionValue.setContentType("text/html");
    jepExtensionValue.addHyperlinkListener(this);
    // use default font and foreground color from the component
    jepExtensionValue.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
    jspExtensionValue = PlatformUtil.createScrollPane(jepExtensionValue, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    jpExtensionValueTextArea = new JPanel(new BorderLayout(5, 5));
    jpExtensionValueTextArea.setPreferredSize(new Dimension(500, 200));
    jpExtensionValueTextArea.add(jspExtensionValue, BorderLayout.CENTER);
    jpExtensionValue.add(jpExtensionValueTextArea, BorderLayout.CENTER);
    jbAsn1 = new JButton(res.getString("DViewExtensions.jbAsn1.text"));
    PlatformUtil.setMnemonic(jbAsn1, res.getString("DViewExtensions.jbAsn1.mnemonic").charAt(0));
    jbAsn1.setToolTipText(res.getString("DViewExtensions.jbAsn1.tooltip"));
    jbAsn1.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DViewExtensions.this);
                asn1DumpPressed();
            } finally {
                CursorUtil.setCursorFree(DViewExtensions.this);
            }
        }
    });
    jpExtensionValueAsn1 = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    jpExtensionValueAsn1.add(jbAsn1);
    jpExtensionValue.add(jpExtensionValueAsn1, BorderLayout.SOUTH);
    jpExtensions = new JPanel(new GridLayout(2, 1, 5, 5));
    jpExtensions.setBorder(new CompoundBorder(new EmptyBorder(5, 5, 5, 5), new CompoundBorder(new EtchedBorder(), new EmptyBorder(5, 5, 5, 5))));
    jpExtensions.add(jpExtensionsTable);
    jpExtensions.add(jpExtensionValue);
    jbOK = new JButton(res.getString("DViewExtensions.jbOK.text"));
    jbOK.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            okPressed();
        }
    });
    jpOK = PlatformUtil.createDialogButtonPanel(jbOK, false);
    extensionsTableModel.load(extensions);
    if (extensionsTableModel.getRowCount() > 0) {
        jtExtensions.changeSelection(0, 0, false, false);
    }
    getContentPane().add(jpExtensions, BorderLayout.CENTER);
    getContentPane().add(jpOK, BorderLayout.SOUTH);
    setResizable(false);
    addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent evt) {
            closeDialog();
        }
    });
    getRootPane().setDefaultButton(jbOK);
    pack();
    SwingUtilities.invokeLater(new Runnable() {

        @Override
        public void run() {
            jbOK.requestFocus();
        }
    });
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) ActionEvent(java.awt.event.ActionEvent) ListSelectionEvent(javax.swing.event.ListSelectionEvent) JButton(javax.swing.JButton) WindowAdapter(java.awt.event.WindowAdapter) ObjectIdComparator(org.kse.utilities.oid.ObjectIdComparator) Font(java.awt.Font) GridLayout(java.awt.GridLayout) BorderLayout(java.awt.BorderLayout) CompoundBorder(javax.swing.border.CompoundBorder) EmptyBorder(javax.swing.border.EmptyBorder) TableRowSorter(javax.swing.table.TableRowSorter) JKseTable(org.kse.gui.JKseTable) ListSelectionModel(javax.swing.ListSelectionModel) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) TableColumn(javax.swing.table.TableColumn) ListSelectionListener(javax.swing.event.ListSelectionListener) EtchedBorder(javax.swing.border.EtchedBorder) ActionListener(java.awt.event.ActionListener) WindowEvent(java.awt.event.WindowEvent) JEditorPane(javax.swing.JEditorPane) TableModel(javax.swing.table.TableModel)

Example 60 with ListSelectionModel

use of javax.swing.ListSelectionModel in project vcell by virtualcell.

the class OverlayEditorPanelJAI method initialize.

/**
 * This method initializes this
 */
private void initialize() {
    this.setSize(734, 710);
    final GridBagLayout gridBagLayout_1 = new GridBagLayout();
    gridBagLayout_1.rowWeights = new double[] { 0.0, 1.0, 0 };
    gridBagLayout_1.columnWeights = new double[] { 1.0 };
    gridBagLayout_1.rowHeights = new int[] { 0, 0, 0 };
    this.setLayout(gridBagLayout_1);
    editROIPanel = new JPanel();
    final GridBagLayout gridBagLayout_2 = new GridBagLayout();
    gridBagLayout_2.rowHeights = new int[] { 0, 0, 7 };
    gridBagLayout_2.columnWidths = new int[] { 0, 7 };
    editROIPanel.setLayout(gridBagLayout_2);
    final GridBagConstraints gridBagConstraints_6 = new GridBagConstraints();
    gridBagConstraints_6.anchor = GridBagConstraints.WEST;
    gridBagConstraints_6.insets = new Insets(2, 2, 5, 2);
    gridBagConstraints_6.weightx = 1.0;
    gridBagConstraints_6.gridy = 0;
    gridBagConstraints_6.gridx = 0;
    add(editROIPanel, gridBagConstraints_6);
    final JLabel infoLabel = new JLabel();
    infoLabel.setText("Data Info:");
    final GridBagConstraints gridBagConstraints_12 = new GridBagConstraints();
    gridBagConstraints_12.insets = new Insets(0, 0, 0, 4);
    gridBagConstraints_12.anchor = GridBagConstraints.EAST;
    gridBagConstraints_12.gridy = 0;
    gridBagConstraints_12.gridx = 0;
    editROIPanel.add(infoLabel, gridBagConstraints_12);
    textLabel = new JLabel();
    textLabel.setPreferredSize(new Dimension(500, 20));
    textLabel.setMinimumSize(new Dimension(500, 20));
    final GridBagConstraints gridBagConstraints_2 = new GridBagConstraints();
    gridBagConstraints_2.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints_2.weightx = 1;
    gridBagConstraints_2.insets = new Insets(0, 2, 0, 0);
    gridBagConstraints_2.anchor = GridBagConstraints.WEST;
    gridBagConstraints_2.gridy = 0;
    gridBagConstraints_2.gridx = 1;
    gridBagConstraints_2.gridwidth = 2;
    editROIPanel.add(textLabel, gridBagConstraints_2);
    textLabel.setText("No FRAP DataSet loaded.");
    autoCropButton = new JButton(new ImageIcon(getClass().getResource("/images/autoCrop.gif")));
    autoCropButton.setName("roiAutoCropBtn");
    autoCropButton.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent e) {
            firePropertyChange(FRAP_DATA_AUTOCROP_PROPERTY, null, null);
        }
    });
    clearROIbutton = new JButton(new ImageIcon(getClass().getResource("/images/clearROI.gif")));
    clearROIbutton.setEnabled(false);
    clearROIbutton.setName("clearROIBtn");
    clearROIbutton.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent e) {
            if (roiComboBox.getItemCount() == 0) {
                giveROIRequiredWarning("Clear Domain");
                return;
            }
            firePropertyChange(FRAP_DATA_CLEARROI_PROPERTY, ((ROIMultiPaintManager.ComboboxROIName) roiComboBox.getSelectedItem()), null);
        }
    });
    viewZLabel = new JLabel();
    viewZLabel.setText("View Z:");
    final GridBagConstraints gridBagConstraints_17 = new GridBagConstraints();
    gridBagConstraints_17.insets = new Insets(0, 0, 0, 4);
    gridBagConstraints_17.anchor = GridBagConstraints.EAST;
    gridBagConstraints_17.gridy = 1;
    gridBagConstraints_17.gridx = 0;
    editROIPanel.add(viewZLabel, gridBagConstraints_17);
    final JPanel panel_1 = new JPanel();
    final GridBagLayout gridBagLayout_4 = new GridBagLayout();
    gridBagLayout_4.columnWeights = new double[] { 1.0 };
    gridBagLayout_4.columnWidths = new int[] { 7 };
    panel_1.setLayout(gridBagLayout_4);
    final GridBagConstraints gridBagConstraints_18 = new GridBagConstraints();
    gridBagConstraints_18.anchor = GridBagConstraints.WEST;
    gridBagConstraints_18.insets = new Insets(0, 2, 0, 0);
    gridBagConstraints_18.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints_18.weightx = 0;
    gridBagConstraints_18.gridy = 1;
    gridBagConstraints_18.gridx = 1;
    editROIPanel.add(panel_1, gridBagConstraints_18);
    final GridBagConstraints gridBagConstraints_19 = new GridBagConstraints();
    gridBagConstraints_19.insets = new Insets(0, 0, 5, 0);
    gridBagConstraints_19.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints_19.anchor = GridBagConstraints.WEST;
    gridBagConstraints_19.weightx = 1;
    gridBagConstraints_19.gridy = 0;
    gridBagConstraints_19.gridx = 0;
    panel_1.add(getZSlider(), gridBagConstraints_19);
    viewTLabel = new JLabel();
    viewTLabel.setText("View Time:");
    final GridBagConstraints gridBagConstraints_13 = new GridBagConstraints();
    gridBagConstraints_13.insets = new Insets(0, 0, 0, 4);
    gridBagConstraints_13.anchor = GridBagConstraints.EAST;
    gridBagConstraints_13.gridy = 2;
    gridBagConstraints_13.gridx = 0;
    editROIPanel.add(viewTLabel, gridBagConstraints_13);
    final JPanel panel = new JPanel();
    panel.setLayout(new GridBagLayout());
    final GridBagConstraints gridBagConstraints_15 = new GridBagConstraints();
    gridBagConstraints_15.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints_15.weightx = 1;
    gridBagConstraints_15.insets = new Insets(0, 0, 0, 0);
    gridBagConstraints_15.anchor = GridBagConstraints.WEST;
    gridBagConstraints_15.gridy = 0;
    gridBagConstraints_15.gridx = 0;
    panel.add(getTimeSlider(), gridBagConstraints_15);
    final GridBagConstraints gridBagConstraints_14 = new GridBagConstraints();
    gridBagConstraints_14.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints_14.insets = new Insets(0, 2, 0, 0);
    gridBagConstraints_14.anchor = GridBagConstraints.WEST;
    gridBagConstraints_14.gridy = 2;
    gridBagConstraints_14.gridx = 1;
    editROIPanel.add(panel, gridBagConstraints_14);
    final JPanel editROIButtonPanel = new JPanel();
    final GridBagLayout gridBagLayout_3 = new GridBagLayout();
    gridBagLayout_3.rowWeights = new double[] { 0.0, 1.0 };
    gridBagLayout_3.columnWeights = new double[] { 0.0, 1.0, 0.0, 0.0, 0.0, 0.0 };
    gridBagLayout_3.columnWidths = new int[] { 0, 0, 7, 7, 0, 0 };
    editROIButtonPanel.setLayout(gridBagLayout_3);
    final GridBagConstraints gridBagConstraints_8 = new GridBagConstraints();
    gridBagConstraints_8.gridwidth = 2;
    gridBagConstraints_8.weightx = 0;
    gridBagConstraints_8.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints_8.insets = new Insets(0, 2, 0, 0);
    gridBagConstraints_8.anchor = GridBagConstraints.WEST;
    gridBagConstraints_8.gridy = 3;
    gridBagConstraints_8.gridx = 0;
    editROIPanel.add(editROIButtonPanel, gridBagConstraints_8);
    panel_2 = new JPanel();
    GridBagConstraints gbc_panel_2 = new GridBagConstraints();
    gbc_panel_2.insets = new Insets(2, 2, 2, 2);
    gbc_panel_2.weighty = 1.0;
    gbc_panel_2.weightx = 1.0;
    gbc_panel_2.fill = GridBagConstraints.BOTH;
    gbc_panel_2.gridx = 0;
    gbc_panel_2.gridy = 1;
    add(panel_2, gbc_panel_2);
    GridBagLayout gbl_panel_2 = new GridBagLayout();
    gbl_panel_2.columnWidths = new int[] { 0, 0, 0 };
    gbl_panel_2.rowHeights = new int[] { 0 };
    gbl_panel_2.columnWeights = new double[] { 0, 1.0, 0.0 };
    gbl_panel_2.rowWeights = new double[] { 0.0 };
    panel_2.setLayout(gbl_panel_2);
    panel_3 = new JPanel();
    panel_3.setBorder(new LineBorder(new Color(0, 0, 0)));
    GridBagConstraints gbc_panel_3 = new GridBagConstraints();
    gbc_panel_3.fill = GridBagConstraints.BOTH;
    gbc_panel_3.insets = new Insets(2, 2, 2, 2);
    gbc_panel_3.gridx = 0;
    gbc_panel_3.gridy = 0;
    panel_2.add(panel_3, gbc_panel_3);
    GridBagLayout gbl_panel_3 = new GridBagLayout();
    gbl_panel_3.columnWidths = new int[] { 0, 0 };
    gbl_panel_3.rowHeights = new int[] { 0, 0, 0, 0 };
    gbl_panel_3.columnWeights = new double[] { 0.0, Double.MIN_VALUE };
    gbl_panel_3.rowWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE };
    panel_3.setLayout(gbl_panel_3);
    domainRegionLabel = new JLabel(DOMAIN_LIST_TEXT);
    GridBagConstraints gbc_domainRegionLabel = new GridBagConstraints();
    gbc_domainRegionLabel.insets = new Insets(0, 0, 2, 0);
    gbc_domainRegionLabel.gridx = 0;
    gbc_domainRegionLabel.gridy = 0;
    panel_3.add(domainRegionLabel, gbc_domainRegionLabel);
    scrollPane = new JScrollPane();
    GridBagConstraints gbc_scrollPane = new GridBagConstraints();
    gbc_scrollPane.insets = new Insets(0, 2, 0, 0);
    gbc_scrollPane.weighty = 1.0;
    gbc_scrollPane.fill = GridBagConstraints.BOTH;
    gbc_scrollPane.gridx = 0;
    gbc_scrollPane.gridy = 1;
    panel_3.add(scrollPane, gbc_scrollPane);
    scrollPane.setPreferredSize(new Dimension(125, 10));
    scrollPane.setMinimumSize(new Dimension(125, 10));
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    resolvedList = new JList();
    resolvedList.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            super.mouseClicked(e);
            if (showConvertPopup(e, false) == SHOWCONVERT.HANDLED) {
                return;
            }
            if (e.getClickCount() == 2) {
                firePropertyChange(FRAP_DATA_FINDROI_PROPERTY, null, resolvedList.getSelectedValue());
            }
        }

        @Override
        public void mousePressed(MouseEvent e) {
            // TODO Auto-generated method stub
            super.mousePressed(e);
            if (showConvertPopup(e, false) == SHOWCONVERT.HANDLED) {
                return;
            }
        }

        @Override
        public void mouseReleased(MouseEvent e) {
            // TODO Auto-generated method stub
            super.mouseReleased(e);
            if (showConvertPopup(e, false) == SHOWCONVERT.HANDLED) {
                return;
            }
        }
    });
    resolvedList.addListSelectionListener(resolvedListSelectionListener);
    resolvedList.setCellRenderer(resolvedObjectListCellRenderer);
    scrollPane.setViewportView(resolvedList);
    mergeButton = new JButton("Auto-Merge");
    mergeButton.setToolTipText("Remove regions by merging with neighbor");
    mergeButton.setEnabled(false);
    mergeButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            resolvedListSelection(true);
        }
    });
    GridBagConstraints gbc_mergeButton = new GridBagConstraints();
    gbc_mergeButton.gridx = 0;
    gbc_mergeButton.gridy = 2;
    panel_3.add(mergeButton, gbc_mergeButton);
    GridBagConstraints gbc_jScrollPane2 = new GridBagConstraints();
    gbc_jScrollPane2.weighty = 1.0;
    gbc_jScrollPane2.weightx = 1.0;
    gbc_jScrollPane2.fill = GridBagConstraints.BOTH;
    gbc_jScrollPane2.insets = new Insets(2, 2, 2, 2);
    gbc_jScrollPane2.gridx = 1;
    gbc_jScrollPane2.gridy = 0;
    panel_2.add(getJScrollPane2(), gbc_jScrollPane2);
    GridBagConstraints gbc_toolButtonPanel = new GridBagConstraints();
    gbc_toolButtonPanel.weighty = 1.0;
    gbc_toolButtonPanel.insets = new Insets(2, 2, 0, 2);
    gbc_toolButtonPanel.anchor = GridBagConstraints.NORTH;
    gbc_toolButtonPanel.gridx = 2;
    gbc_toolButtonPanel.gridy = 0;
    panel_2.add(getToolButtonPanel(), gbc_toolButtonPanel);
    roiComboBox = new JComboBox();
    roiComboBox.setName("activeROIComboBox");
    roiComboBox.setRenderer(new ListCellRenderer() {

        private DefaultListCellRenderer listCellRender = new DefaultListCellRenderer();

        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            ROIMultiPaintManager.ComboboxROIName comboboxROIName = (ROIMultiPaintManager.ComboboxROIName) value;
            if (comboboxROIName == null) {
                // return blank
                return listCellRender.getListCellRendererComponent(list, null, index, isSelected, cellHasFocus);
            }
            if (comboboxROIName.getHighlightColor() == null) {
                // return text only
                return listCellRender.getListCellRendererComponent(list, comboboxROIName.getROIName(), index, isSelected, cellHasFocus);
            }
            // return text with small color box
            Icon icon = new ColorIcon(20, 20, comboboxROIName.getHighlightColor());
            JLabel jlable = (JLabel) listCellRender.getListCellRendererComponent(list, icon, index, isSelected, cellHasFocus);
            jlable.setText(comboboxROIName.getROIName());
            return jlable;
        }
    });
    roiComboBox.addActionListener(ROI_COMBOBOX_ACTIONLISTENER);
    lblNewLabel = new JLabel("Active Domain:");
    GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
    gbc_lblNewLabel.insets = new Insets(4, 4, 4, 4);
    gbc_lblNewLabel.anchor = GridBagConstraints.EAST;
    gbc_lblNewLabel.gridx = 0;
    gbc_lblNewLabel.gridy = 0;
    editROIButtonPanel.add(lblNewLabel, gbc_lblNewLabel);
    final GridBagConstraints gridBagConstraints_1 = new GridBagConstraints();
    gridBagConstraints_1.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints_1.insets = new Insets(4, 4, 5, 5);
    gridBagConstraints_1.weightx = 1;
    gridBagConstraints_1.gridy = 0;
    gridBagConstraints_1.gridx = 1;
    editROIButtonPanel.add(roiComboBox, gridBagConstraints_1);
    addROIButton = new JButton();
    addROIButton.setName("roiAddBtn");
    addROIButton.addActionListener(addROIActionListener);
    addROIButton.setText("Add Domain...");
    final GridBagConstraints gridBagConstraints_3 = new GridBagConstraints();
    gridBagConstraints_3.insets = new Insets(4, 4, 5, 5);
    gridBagConstraints_3.gridy = 0;
    gridBagConstraints_3.gridx = 2;
    editROIButtonPanel.add(addROIButton, gridBagConstraints_3);
    delROIButton = new JButton();
    delROIButton.setName("roiDeleteBtn");
    delROIButton.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent e) {
            firePropertyChange(FRAP_DATA_DELETEROI_PROPERTY, ((ROIMultiPaintManager.ComboboxROIName) roiComboBox.getSelectedItem()), null);
        }
    });
    delROIButton.setText("Delete Domain...");
    delROIButton.setEnabled(false);
    final GridBagConstraints gridBagConstraints_4 = new GridBagConstraints();
    gridBagConstraints_4.insets = new Insets(4, 4, 5, 5);
    gridBagConstraints_4.gridy = 0;
    gridBagConstraints_4.gridx = 3;
    editROIButtonPanel.add(delROIButton, gridBagConstraints_4);
    discardHighlightsButton = new JButton("Clear Selections");
    discardHighlightsButton.setEnabled(false);
    discardHighlightsButton.setName("clearHighlightsBtn");
    discardHighlightsButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            firePropertyChange(FRAP_DATA_DISCARDHIGHLIGHT_PROPERTY, null, null);
        }
    });
    GridBagConstraints gbc_specialActionsButton = new GridBagConstraints();
    gbc_specialActionsButton.insets = new Insets(4, 4, 5, 5);
    gbc_specialActionsButton.gridx = 4;
    gbc_specialActionsButton.gridy = 0;
    editROIButtonPanel.add(discardHighlightsButton, gbc_specialActionsButton);
    channelComboBox = new JComboBox();
    GridBagConstraints gbc_channelComboBox = new GridBagConstraints();
    gbc_channelComboBox.insets = new Insets(4, 4, 5, 4);
    gbc_channelComboBox.gridx = 5;
    gbc_channelComboBox.gridy = 0;
    editROIButtonPanel.add(channelComboBox, gbc_channelComboBox);
    channelComboBox.addActionListener(channelActionListener);
    channelComboBox.setPreferredSize(new Dimension(100, 22));
    channelComboBox.setMinimumSize(new Dimension(100, 20));
    blendPercentPanel = new JPanel();
    blendPercentPanel.setBorder(new LineBorder(new Color(0, 0, 0)));
    GridBagConstraints gbc_panel_2a = new GridBagConstraints();
    gbc_panel_2a.gridwidth = 6;
    gbc_panel_2a.insets = new Insets(4, 4, 4, 4);
    gbc_panel_2a.fill = GridBagConstraints.BOTH;
    gbc_panel_2a.gridx = 0;
    gbc_panel_2a.gridy = 1;
    editROIButtonPanel.add(blendPercentPanel, gbc_panel_2a);
    GridBagLayout gbl_panel_2a = new GridBagLayout();
    blendPercentPanel.setLayout(gbl_panel_2a);
    blendPercentROILabel = new JLabel("Domains");
    GridBagConstraints gbc_blendPercentROILabel = new GridBagConstraints();
    gbc_blendPercentROILabel.anchor = GridBagConstraints.WEST;
    gbc_blendPercentROILabel.gridx = 0;
    gbc_blendPercentROILabel.gridy = 0;
    blendPercentPanel.add(blendPercentROILabel, gbc_blendPercentROILabel);
    blendPercentSlider = new JSlider();
    blendPercentSlider.setToolTipText("Mix view of Domains and background image");
    blendPercentSlider.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent e) {
            setBlendPercent(blendPercentSlider.getValue());
        // if(!blendPercentSlider.getValueIsAdjusting()){
        // setBlendPercent(blendPercentSlider.getValue());
        // }
        }
    });
    GridBagConstraints gbc_blendPercentSlider = new GridBagConstraints();
    gbc_blendPercentSlider.fill = GridBagConstraints.HORIZONTAL;
    gbc_blendPercentSlider.weightx = 0.5;
    gbc_blendPercentSlider.gridx = 1;
    gbc_blendPercentSlider.gridy = 0;
    blendPercentPanel.add(blendPercentSlider, gbc_blendPercentSlider);
    blendPercentImageLabel = new JLabel("Image");
    GridBagConstraints gbc_blendPercentImageLabel = new GridBagConstraints();
    gbc_blendPercentImageLabel.anchor = GridBagConstraints.EAST;
    gbc_blendPercentImageLabel.gridx = 2;
    gbc_blendPercentImageLabel.gridy = 0;
    blendPercentPanel.add(blendPercentImageLabel, gbc_blendPercentImageLabel);
    smoothOrigLabel = new JLabel("Original");
    GridBagConstraints gbc_smoothOrigLabel = new GridBagConstraints();
    gbc_smoothOrigLabel.insets = new Insets(0, 20, 0, 0);
    gbc_smoothOrigLabel.gridx = 3;
    gbc_smoothOrigLabel.gridy = 0;
    blendPercentPanel.add(smoothOrigLabel, gbc_smoothOrigLabel);
    smoothslider = new JSlider();
    smoothslider.setToolTipText("Smooth background image");
    smoothslider.setSnapToTicks(true);
    smoothslider.setPaintTicks(true);
    smoothslider.setMajorTickSpacing(1);
    smoothslider.setMaximum(10);
    smoothslider.setValue(0);
    smoothslider.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent e) {
            if (!smoothslider.getValueIsAdjusting()) {
                firePropertyChange(FRAP_DATA_UNDERLAY_SMOOTH_PROPERTY, null, new Integer(smoothslider.getValue()));
            }
        }
    });
    GridBagConstraints gbc_smoothslider = new GridBagConstraints();
    gbc_smoothslider.fill = GridBagConstraints.HORIZONTAL;
    gbc_smoothslider.weightx = 0.5;
    gbc_smoothslider.gridx = 4;
    gbc_smoothslider.gridy = 0;
    blendPercentPanel.add(smoothslider, gbc_smoothslider);
    smootherLabel = new JLabel("Smoother");
    GridBagConstraints gbc_smootherLabel = new GridBagConstraints();
    gbc_smootherLabel.gridx = 5;
    gbc_smootherLabel.gridy = 0;
    blendPercentPanel.add(smootherLabel, gbc_smootherLabel);
    roiDrawButtonGroup.add(selectButton);
    roiDrawButtonGroup.add(paintButton);
    roiDrawButtonGroup.add(eraseButton);
    roiDrawButtonGroup.add(fillButton);
    roiDrawButtonGroup.add(cropButton);
    roiDrawButtonGroup.add(translateToolButton);
    roiDrawButtonGroup.add(scaleToolButton);
    BeanUtils.enableComponents(getToolButtonPanel(), false);
    BeanUtils.enableComponents(editROIPanel, false);
    histogramPanel = new HistogramPanel();
    histogramPanel.addPropertyChangeListener(new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equals(HistogramPanel.HISTOGRAM_SELECT_PROPERTY)) {
                OverlayEditorPanelJAI.this.firePropertyChange(OverlayEditorPanelJAI.FRAP_DATA_HISTOUPDATEHIGHLIGHT_PROPERTY, null, (ListSelectionModel) evt.getNewValue());
            } else if (evt.getPropertyName().equals(HistogramPanel.HISTOGRAM_APPLY_ACTION)) {
                firePropertyChange(OverlayEditorPanelJAI.FRAP_DATA_UPDATEROI_WITHHIGHLIGHT_PROPERTY, null, null);
            }
        }
    });
    histogramPanel.setVisible(false);
    histogramPanel.setBorder(new LineBorder(new Color(0, 0, 0)));
    GridBagConstraints gbc_histogramButton = new GridBagConstraints();
    gbc_histogramButton.fill = GridBagConstraints.BOTH;
    gbc_histogramButton.insets = new Insets(2, 2, 2, 2);
    gbc_histogramButton.gridx = 0;
    gbc_histogramButton.gridy = 2;
    add(histogramPanel, gbc_histogramButton);
}
Also used : JPanel(javax.swing.JPanel) ImageIcon(javax.swing.ImageIcon) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) ComboboxROIName(cbit.vcell.geometry.gui.ROIMultiPaintManager.ComboboxROIName) GridBagLayout(java.awt.GridBagLayout) PropertyChangeListener(java.beans.PropertyChangeListener) ActionEvent(java.awt.event.ActionEvent) LineBorder(javax.swing.border.LineBorder) JButton(javax.swing.JButton) DefaultListCellRenderer(javax.swing.DefaultListCellRenderer) DefaultListCellRenderer(javax.swing.DefaultListCellRenderer) ListCellRenderer(javax.swing.ListCellRenderer) JSlider(javax.swing.JSlider) ChangeListener(javax.swing.event.ChangeListener) PropertyChangeListener(java.beans.PropertyChangeListener) Component(java.awt.Component) JComponent(javax.swing.JComponent) JScrollPane(javax.swing.JScrollPane) PropertyChangeEvent(java.beans.PropertyChangeEvent) MouseEvent(java.awt.event.MouseEvent) ColorIcon(org.vcell.util.gui.ColorIcon) JComboBox(javax.swing.JComboBox) Color(java.awt.Color) MouseAdapter(java.awt.event.MouseAdapter) JLabel(javax.swing.JLabel) ListSelectionModel(javax.swing.ListSelectionModel) Dimension(java.awt.Dimension) Point(java.awt.Point) ActionListener(java.awt.event.ActionListener) ChangeEvent(javax.swing.event.ChangeEvent) PropertyChangeEvent(java.beans.PropertyChangeEvent) ColorIcon(org.vcell.util.gui.ColorIcon) Icon(javax.swing.Icon) ZoomShapeIcon(cbit.vcell.graph.gui.ZoomShapeIcon) ImageIcon(javax.swing.ImageIcon) JList(javax.swing.JList)

Aggregations

ListSelectionModel (javax.swing.ListSelectionModel)80 BorderLayout (java.awt.BorderLayout)20 Dimension (java.awt.Dimension)20 JButton (javax.swing.JButton)20 JPanel (javax.swing.JPanel)19 ListSelectionEvent (javax.swing.event.ListSelectionEvent)19 ListSelectionListener (javax.swing.event.ListSelectionListener)19 ActionEvent (java.awt.event.ActionEvent)18 JTable (javax.swing.JTable)18 ActionListener (java.awt.event.ActionListener)17 Point (java.awt.Point)16 JScrollPane (javax.swing.JScrollPane)15 MouseEvent (java.awt.event.MouseEvent)14 MouseAdapter (java.awt.event.MouseAdapter)13 DefaultListSelectionModel (javax.swing.DefaultListSelectionModel)13 TableColumn (javax.swing.table.TableColumn)13 Insets (java.awt.Insets)12 TableModel (javax.swing.table.TableModel)11 TableRowSorter (javax.swing.table.TableRowSorter)10 FlowLayout (java.awt.FlowLayout)9