Search in sources :

Example 21 with MouseEvent

use of java.awt.event.MouseEvent in project libgdx by libgdx.

the class ExternalExtensionsDialog method uiLayout.

private void uiLayout() {
    topPanel = new JPanel(new GridBagLayout());
    topPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    warningNotice = new JLabel("List of third party extensions for LibGDX");
    warningNotice2 = new JLabel("These are not maintained by the LibGDX team, please see the support links for info and help");
    warningNotice.setHorizontalAlignment(JLabel.CENTER);
    warningNotice2.setHorizontalAlignment(JLabel.CENTER);
    topPanel.add(warningNotice, new GridBagConstraints(0, 0, 1, 1, 1, 0, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    topPanel.add(warningNotice2, new GridBagConstraints(0, 1, 1, 1, 1, 0, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    JSeparator separator = new JSeparator();
    separator.setForeground(new Color(85, 85, 85));
    separator.setBackground(new Color(85, 85, 85));
    topPanel.add(separator, new GridBagConstraints(0, 2, 1, 1, 1, 1, NORTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    tableModel = new ExtensionTableModel();
    table = new JTable(tableModel) {

        @Override
        public String getToolTipText(MouseEvent e) {
            return ((ExtensionTableModel) getModel()).getToolTip(e);
        }
    };
    table.getColumnModel().getColumn(0).setPreferredWidth(10);
    table.getColumnModel().getColumn(1).setPreferredWidth(50);
    table.getColumnModel().getColumn(2).setPreferredWidth(100);
    table.getColumnModel().getColumn(3).setPreferredWidth(20);
    table.getColumnModel().getColumn(4).setPreferredWidth(30);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
    table.getTableHeader().setReorderingAllowed(false);
    table.getModel().addTableModelListener(this);
    table.addMouseListener(new MouseAdapter() {

        public void mouseClicked(MouseEvent e) {
            int row = table.getSelectedRow();
            int column = table.getSelectedColumn();
            if (column == 5) {
                URI uri = ((ExtensionTableModel) table.getModel()).getURI(row, column);
                if (uri != null) {
                    try {
                        Desktop.getDesktop().browse(uri);
                    } catch (IOException e1) {
                        e1.printStackTrace();
                    }
                }
            }
        }
    });
    scrollPane = new JScrollPane(table);
    bottomPanel = new JPanel(new GridBagLayout());
    buttonPanel = new JPanel(new GridBagLayout());
    buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    buttonOK = new SetupButton("Save");
    buttonCancel = new SetupButton("Cancel");
    buttonPanel.add(buttonOK, new GridBagConstraints(0, 0, 1, 1, 0, 0, CENTER, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    buttonPanel.add(buttonCancel, new GridBagConstraints(1, 0, 1, 1, 0, 0, CENTER, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    bottomPanel.add(buttonPanel, new GridBagConstraints(3, 0, 1, 1, 1, 1, SOUTHEAST, NONE, new Insets(0, 0, 0, 0), 0, 0));
    contentPane.add(topPanel, new GridBagConstraints(0, 0, 1, 1, 1, 0.1, NORTH, BOTH, new Insets(0, 0, 0, 0), 0, 0));
    contentPane.add(scrollPane, new GridBagConstraints(0, 1, 1, 1, 1, 1, NORTH, BOTH, new Insets(0, 0, 0, 0), 0, 0));
    contentPane.add(bottomPanel, new GridBagConstraints(0, 2, 1, 1, 1, 0, SOUTH, HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    try {
        initData();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) MouseEvent(java.awt.event.MouseEvent) SetupButton(com.badlogic.gdx.setup.GdxSetupUI.SetupButton) GridBagLayout(java.awt.GridBagLayout) Color(java.awt.Color) MouseAdapter(java.awt.event.MouseAdapter) JLabel(javax.swing.JLabel) IOException(java.io.IOException) URI(java.net.URI) JSeparator(javax.swing.JSeparator) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) SAXException(org.xml.sax.SAXException) JTable(javax.swing.JTable)

Example 22 with MouseEvent

use of java.awt.event.MouseEvent in project libgdx by libgdx.

the class EditorPanel method initializeComponents.

protected void initializeComponents() {
    setLayout(new GridBagLayout());
    {
        titlePanel = new JPanel(new GridBagLayout());
        add(titlePanel, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(3, 0, 3, 0), 0, 0));
        titlePanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        {
            nameLabel = new JLabel(name);
            titlePanel.add(nameLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(3, 6, 3, 6), 0, 0));
            nameLabel.setFont(nameLabel.getFont().deriveFont(Font.BOLD));
        }
        {
            descriptionLabel = new JLabel(description);
            titlePanel.add(descriptionLabel, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(3, 6, 3, 6), 0, 0));
        }
        {
            advancedButton = new JToggleButton("Advanced");
            titlePanel.add(advancedButton, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0));
            advancedButton.setVisible(false);
        }
        {
            activeButton = new JToggleButton("Active");
            titlePanel.add(activeButton, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0));
        }
        {
            removeButton = new JButton("X");
            titlePanel.add(removeButton, new GridBagConstraints(4, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0));
        }
    }
    {
        contentPanel = new JPanel(new GridBagLayout());
        add(contentPanel, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 6, 6, 6), 0, 0));
        contentPanel.setVisible(false);
    }
    {
        advancedPanel = new JPanel(new GridBagLayout());
        add(advancedPanel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 6, 6, 6), 0, 0));
        advancedPanel.setVisible(false);
    }
    titlePanel.addMouseListener(new MouseAdapter() {

        public void mouseClicked(MouseEvent event) {
            if (!isAlwaysShown)
                showContent(!contentPanel.isVisible());
        }
    });
    activeButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent event) {
            activate();
        }
    });
    advancedButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent event) {
            advancedPanel.setVisible(advancedButton.isSelected());
        }
    });
    removeButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent event) {
            removePanel();
        }
    });
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) MouseEvent(java.awt.event.MouseEvent) GridBagLayout(java.awt.GridBagLayout) JToggleButton(javax.swing.JToggleButton) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) MouseAdapter(java.awt.event.MouseAdapter) JLabel(javax.swing.JLabel)

Example 23 with MouseEvent

use of java.awt.event.MouseEvent in project libgdx by libgdx.

the class Hiero method initializeEvents.

private void initializeEvents() {
    fontList.addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent evt) {
            if (evt.getValueIsAdjusting())
                return;
            prefs.put("system.font", (String) fontList.getSelectedValue());
            updateFont();
        }
    });
    class FontUpdateListener implements ChangeListener, ActionListener {

        public void stateChanged(ChangeEvent evt) {
            updateFont();
        }

        public void actionPerformed(ActionEvent evt) {
            updateFont();
        }

        public void addSpinners(JSpinner[] spinners) {
            for (int i = 0; i < spinners.length; i++) {
                final JSpinner spinner = spinners[i];
                spinner.addChangeListener(this);
                ((JSpinner.DefaultEditor) spinner.getEditor()).getTextField().addKeyListener(new KeyAdapter() {

                    String lastText;

                    public void keyReleased(KeyEvent evt) {
                        JFormattedTextField textField = ((JSpinner.DefaultEditor) spinner.getEditor()).getTextField();
                        String text = textField.getText();
                        if (text.length() == 0)
                            return;
                        if (text.equals(lastText))
                            return;
                        lastText = text;
                        int caretPosition = textField.getCaretPosition();
                        try {
                            spinner.setValue(Integer.valueOf(text));
                        } catch (NumberFormatException ex) {
                        }
                        textField.setCaretPosition(caretPosition);
                    }
                });
            }
        }
    }
    FontUpdateListener listener = new FontUpdateListener();
    listener.addSpinners(new JSpinner[] { padTopSpinner, padRightSpinner, padBottomSpinner, padLeftSpinner, padAdvanceXSpinner, padAdvanceYSpinner });
    fontSizeSpinner.addChangeListener(listener);
    gammaSpinner.addChangeListener(listener);
    glyphPageWidthCombo.addActionListener(listener);
    glyphPageHeightCombo.addActionListener(listener);
    boldCheckBox.addActionListener(listener);
    italicCheckBox.addActionListener(listener);
    monoCheckBox.addActionListener(listener);
    resetCacheButton.addActionListener(listener);
    javaRadio.addActionListener(listener);
    nativeRadio.addActionListener(listener);
    freeTypeRadio.addActionListener(listener);
    sampleTextRadio.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            glyphCachePanel.setVisible(false);
        }
    });
    glyphCacheRadio.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            glyphCachePanel.setVisible(true);
        }
    });
    fontFileText.getDocument().addDocumentListener(new DocumentListener() {

        public void removeUpdate(DocumentEvent evt) {
            changed();
        }

        public void insertUpdate(DocumentEvent evt) {
            changed();
        }

        public void changedUpdate(DocumentEvent evt) {
            changed();
        }

        private void changed() {
            File file = new File(fontFileText.getText());
            if (fontList.isEnabled() && (!file.exists() || !file.isFile()))
                return;
            prefs.put("font.file", fontFileText.getText());
            updateFont();
        }
    });
    final ActionListener al = new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            updateFontSelector();
            updateFont();
        }
    };
    systemFontRadio.addActionListener(al);
    fontFileRadio.addActionListener(al);
    browseButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            FileDialog dialog = new FileDialog(Hiero.this, "Choose TrueType font file", FileDialog.LOAD);
            dialog.setLocationRelativeTo(null);
            dialog.setFile("*.ttf");
            dialog.setDirectory(prefs.get("dir.font", ""));
            dialog.setVisible(true);
            if (dialog.getDirectory() != null) {
                prefs.put("dir.font", dialog.getDirectory());
            }
            String fileName = dialog.getFile();
            if (fileName == null)
                return;
            fontFileText.setText(new File(dialog.getDirectory(), fileName).getAbsolutePath());
        }
    });
    backgroundColorLabel.addMouseListener(new MouseAdapter() {

        public void mouseClicked(MouseEvent evt) {
            java.awt.Color color = JColorChooser.showDialog(null, "Choose a background color", EffectUtil.fromString(prefs.get("background", "000000")));
            if (color == null)
                return;
            renderingBackgroundColor = new Color(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, 1);
            backgroundColorLabel.setIcon(getColorIcon(color));
            prefs.put("background", EffectUtil.toString(color));
        }
    });
    effectsList.addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent evt) {
            ConfigurableEffect selectedEffect = (ConfigurableEffect) effectsList.getSelectedValue();
            boolean enabled = selectedEffect != null;
            for (Iterator iter = effectPanels.iterator(); iter.hasNext(); ) {
                ConfigurableEffect effect = ((EffectPanel) iter.next()).getEffect();
                if (effect == selectedEffect) {
                    enabled = false;
                    break;
                }
            }
            addEffectButton.setEnabled(enabled);
        }
    });
    effectsList.addMouseListener(new MouseAdapter() {

        public void mouseClicked(MouseEvent evt) {
            if (evt.getClickCount() == 2 && addEffectButton.isEnabled())
                addEffectButton.doClick();
        }
    });
    addEffectButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            new EffectPanel((ConfigurableEffect) effectsList.getSelectedValue());
        }
    });
    openMenuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            FileDialog dialog = new FileDialog(Hiero.this, "Open Hiero settings file", FileDialog.LOAD);
            dialog.setLocationRelativeTo(null);
            dialog.setFile("*.hiero");
            dialog.setDirectory(prefs.get("dir.open", ""));
            dialog.setVisible(true);
            if (dialog.getDirectory() != null) {
                prefs.put("dir.open", dialog.getDirectory());
            }
            String fileName = dialog.getFile();
            if (fileName == null)
                return;
            lastOpenFilename = fileName;
            open(new File(dialog.getDirectory(), fileName));
        }
    });
    saveMenuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            FileDialog dialog = new FileDialog(Hiero.this, "Save Hiero settings file", FileDialog.SAVE);
            dialog.setLocationRelativeTo(null);
            dialog.setFile("*.hiero");
            dialog.setDirectory(prefs.get("dir.save", ""));
            if (lastSaveFilename.length() > 0) {
                dialog.setFile(lastSaveFilename);
            } else if (lastOpenFilename.length() > 0) {
                dialog.setFile(lastOpenFilename);
            }
            dialog.setVisible(true);
            if (dialog.getDirectory() != null) {
                prefs.put("dir.save", dialog.getDirectory());
            }
            String fileName = dialog.getFile();
            if (fileName == null)
                return;
            if (!fileName.endsWith(".hiero"))
                fileName += ".hiero";
            lastSaveFilename = fileName;
            File file = new File(dialog.getDirectory(), fileName);
            try {
                save(file);
            } catch (IOException ex) {
                throw new RuntimeException("Error saving Hiero settings file: " + file.getAbsolutePath(), ex);
            }
        }
    });
    saveBMFontMenuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            FileDialog dialog = new FileDialog(Hiero.this, "Save BMFont files", FileDialog.SAVE);
            dialog.setLocationRelativeTo(null);
            dialog.setFile("*.fnt");
            dialog.setDirectory(prefs.get("dir.savebm", ""));
            if (lastSaveBMFilename.length() > 0) {
                dialog.setFile(lastSaveBMFilename);
            } else if (lastOpenFilename.length() > 0) {
                dialog.setFile(lastOpenFilename.replace(".hiero", ".fnt"));
            }
            dialog.setVisible(true);
            if (dialog.getDirectory() != null) {
                prefs.put("dir.savebm", dialog.getDirectory());
            }
            String fileName = dialog.getFile();
            if (fileName == null)
                return;
            lastSaveBMFilename = fileName;
            saveBm(new File(dialog.getDirectory(), fileName));
        }
    });
    exitMenuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            dispose();
        }
    });
    sampleNeheButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            sampleTextPane.setText(NEHE_CHARS);
            resetCacheButton.doClick();
        }
    });
    sampleAsciiButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            StringBuilder buffer = new StringBuilder();
            buffer.append(NEHE_CHARS);
            buffer.append('\n');
            int count = 0;
            for (int i = 33; i <= 255; i++) {
                if (buffer.indexOf(Character.toString((char) i)) != -1)
                    continue;
                buffer.append((char) i);
                if (++count % 30 == 0)
                    buffer.append('\n');
            }
            sampleTextPane.setText(buffer.toString());
            resetCacheButton.doClick();
        }
    });
    sampleExtendedButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            sampleTextPane.setText(EXTENDED_CHARS);
            resetCacheButton.doClick();
        }
    });
}
Also used : DocumentListener(javax.swing.event.DocumentListener) StringBuilder(com.badlogic.gdx.utils.StringBuilder) ActionEvent(java.awt.event.ActionEvent) ConfigurableEffect(com.badlogic.gdx.tools.hiero.unicodefont.effects.ConfigurableEffect) KeyAdapter(java.awt.event.KeyAdapter) ListSelectionEvent(javax.swing.event.ListSelectionEvent) KeyEvent(java.awt.event.KeyEvent) Iterator(java.util.Iterator) ChangeListener(javax.swing.event.ChangeListener) MouseEvent(java.awt.event.MouseEvent) Color(com.badlogic.gdx.graphics.Color) JFormattedTextField(javax.swing.JFormattedTextField) MouseAdapter(java.awt.event.MouseAdapter) IOException(java.io.IOException) DocumentEvent(javax.swing.event.DocumentEvent) ListSelectionListener(javax.swing.event.ListSelectionListener) ChangeEvent(javax.swing.event.ChangeEvent) ActionListener(java.awt.event.ActionListener) JSpinner(javax.swing.JSpinner) File(java.io.File) FileDialog(java.awt.FileDialog)

Example 24 with MouseEvent

use of java.awt.event.MouseEvent in project libgdx by libgdx.

the class GradientPanel method initializeComponents.

private void initializeComponents() {
    JPanel contentPanel = getContentPanel();
    {
        gradientEditor = new GradientEditor() {

            public void handleSelected(Color color) {
                GradientPanel.this.setColor(color);
            }
        };
        contentPanel.add(gradientEditor, new GridBagConstraints(0, 1, 3, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 10));
    }
    {
        hueSlider = new ColorSlider(new Color[] { Color.red, Color.yellow, Color.green, Color.cyan, Color.blue, Color.magenta, Color.red }) {

            protected void colorPicked() {
                saturationSlider.setColors(new Color[] { new Color(Color.HSBtoRGB(getPercentage(), 1, 1)), Color.white });
                updateColor();
            }
        };
        contentPanel.add(hueSlider, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0));
    }
    {
        saturationSlider = new ColorSlider(new Color[] { Color.red, Color.white }) {

            protected void colorPicked() {
                updateColor();
            }
        };
        contentPanel.add(saturationSlider, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 6), 0, 0));
    }
    {
        lightnessSlider = new ColorSlider(new Color[0]) {

            protected void colorPicked() {
                updateColor();
            }
        };
        contentPanel.add(lightnessSlider, new GridBagConstraints(2, 3, 1, 1, 1, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    }
    {
        colorPanel = new JPanel() {

            public Dimension getPreferredSize() {
                Dimension size = super.getPreferredSize();
                size.width = 52;
                return size;
            }
        };
        contentPanel.add(colorPanel, new GridBagConstraints(0, 2, 1, 2, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(3, 0, 0, 6), 0, 0));
    }
    colorPanel.addMouseListener(new MouseAdapter() {

        public void mouseClicked(MouseEvent e) {
            Color color = JColorChooser.showDialog(colorPanel, "Set Color", colorPanel.getBackground());
            if (color != null)
                setColor(color);
        }
    });
    colorPanel.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.black));
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) MouseEvent(java.awt.event.MouseEvent) Color(java.awt.Color) MouseAdapter(java.awt.event.MouseAdapter) Dimension(java.awt.Dimension)

Example 25 with MouseEvent

use of java.awt.event.MouseEvent in project CoreNLP by stanfordnlp.

the class JarFileChooser method showListSelectionDialog.

public String showListSelectionDialog(List<String> files, Point location) {
    Frame frame = new Frame();
    //System.out.println(location);
    //frame.setLocation(location);
    final JDialog dialog = new JDialog(frame, "Jar File Chooser", true);
    dialog.setLocation(location);
    final JList fileList = new JList(new Vector<>(files));
    fileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    MouseListener mouseListener = new MouseAdapter() {

        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) {
                // double clicked
                dialog.setVisible(false);
            }
        }
    };
    fileList.addMouseListener(mouseListener);
    final JScrollPane scroll = new JScrollPane(fileList);
    JButton okay = new javax.swing.JButton();
    okay.setText("Okay");
    okay.setToolTipText("Okay");
    okay.addActionListener(evt -> dialog.setVisible(false));
    JButton cancel = new javax.swing.JButton();
    cancel.setText("Cancel");
    cancel.setToolTipText("Cancel");
    cancel.addActionListener(evt -> {
        fileList.clearSelection();
        dialog.setVisible(false);
    });
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints constraints = new GridBagConstraints();
    dialog.setLayout(gridbag);
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    constraints.fill = GridBagConstraints.BOTH;
    constraints.weightx = 1.0;
    constraints.weighty = 1.0;
    gridbag.setConstraints(scroll, constraints);
    dialog.add(scroll);
    constraints.gridwidth = GridBagConstraints.RELATIVE;
    constraints.fill = GridBagConstraints.NONE;
    constraints.weighty = 0.0;
    gridbag.setConstraints(okay, constraints);
    dialog.add(okay);
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    gridbag.setConstraints(cancel, constraints);
    dialog.add(cancel);
    dialog.pack();
    dialog.setSize(dialog.getPreferredSize());
    dialog.setVisible(true);
    if (fileList.isSelectionEmpty())
        return null;
    return files.get(fileList.getSelectedIndex());
}
Also used : MouseListener(java.awt.event.MouseListener) MouseEvent(java.awt.event.MouseEvent) MouseAdapter(java.awt.event.MouseAdapter)

Aggregations

MouseEvent (java.awt.event.MouseEvent)322 MouseAdapter (java.awt.event.MouseAdapter)144 ActionEvent (java.awt.event.ActionEvent)50 JLabel (javax.swing.JLabel)45 JPanel (javax.swing.JPanel)44 ActionListener (java.awt.event.ActionListener)43 JButton (javax.swing.JButton)39 KeyEvent (java.awt.event.KeyEvent)33 JScrollPane (javax.swing.JScrollPane)30 BorderLayout (java.awt.BorderLayout)27 KeyAdapter (java.awt.event.KeyAdapter)27 MouseListener (java.awt.event.MouseListener)26 Point (java.awt.Point)23 Dimension (java.awt.Dimension)22 ListSelectionEvent (javax.swing.event.ListSelectionEvent)22 JTable (javax.swing.JTable)21 JTextField (javax.swing.JTextField)21 ListSelectionListener (javax.swing.event.ListSelectionListener)21 NotNull (org.jetbrains.annotations.NotNull)21 Nullable (org.jetbrains.annotations.Nullable)18