Example usage for java.awt.event MouseListener MouseListener

List of usage examples for java.awt.event MouseListener MouseListener

Introduction

In this page you can find the example usage for java.awt.event MouseListener MouseListener.

Prototype

MouseListener

Source Link

Usage

From source file:typoscript.TypoScriptPluginOptions.java

protected void _init() {
    // Take a copy of the current sites config
    localSitesConfig = (Vector) TypoScriptPlugin.siteConfig.clone();

    listModel = new DefaultListModel();
    Iterator iter = localSitesConfig.iterator();
    while (iter.hasNext()) {
        listModel.addElement(iter.next());
    }/*from  w ww .  jav a  2s. c om*/

    setLayout(new BorderLayout());

    add(BorderLayout.NORTH, new JLabel("TYPO3 Sites"));

    JPanel sites = new JPanel(new BorderLayout());
    siteList = new JList(listModel);
    siteList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    siteList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            updateButtons();
        }
    });

    siteList.addMouseListener(new MouseListener() {
        public void mouseClicked(MouseEvent e) {
            // Edit if doubleclick
            if (e.getClickCount() == 2) {
                new AddEditSiteDialog(TypoScriptPluginOptions.this,
                        (T3Site) localSitesConfig.get(siteList.getSelectedIndex()));
            }
        }

        public void mouseEntered(MouseEvent e) {
            ;
        }

        public void mousePressed(MouseEvent e) {
            ;
        }

        public void mouseReleased(MouseEvent e) {
            ;
        }

        public void mouseExited(MouseEvent e) {
            ;
        }

    });
    JScrollPane scrollPane = new JScrollPane(siteList);
    sites.add(scrollPane);
    this.add(sites);

    JPanel buttons = new JPanel();
    buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
    buttons.setBorder(new EmptyBorder(6, 0, 0, 0));

    add = new RolloverButton(GUIUtilities.loadIcon("Plus.png"));
    add.setToolTipText("Add Site");
    add.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            // Open the add/edit dialog in add mode
            new AddEditSiteDialog(TypoScriptPluginOptions.this, null);
        }
    });

    buttons.add(add);
    remove = new RolloverButton(GUIUtilities.loadIcon("Minus.png"));
    remove.setToolTipText("Remove Site");
    remove.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            localSitesConfig.remove(siteList.getSelectedIndex());
            listModel.removeElementAt(siteList.getSelectedIndex());
        }
    });

    buttons.add(remove);
    edit = new RolloverButton(GUIUtilities.loadIcon("ButtonProperties.png"));
    edit.setToolTipText("Edit Site");
    edit.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            // Open add/edit dialog in edit mode
            new AddEditSiteDialog(TypoScriptPluginOptions.this,
                    (T3Site) localSitesConfig.get(siteList.getSelectedIndex()));
        }
    });

    buttons.add(edit);
    buttons.add(Box.createGlue());

    updateButtons();
    add(BorderLayout.SOUTH, buttons);
}

From source file:se.trixon.toolbox.idiot.IdiotTopComponent.java

private void init() {
    mHelpId = "se.trixon.toolbox.idiot.about";

    cronToggleButton.setIcon(MaterialIcon._Image.TIMER.get(ICON_SIZE, mIconColor));
    cronToggleButton.setToolTipText(Dict.DOWNLOADS_SCHEDULE.getString());

    downloadButton.setIcon(MaterialIcon._File.FILE_DOWNLOAD.get(ICON_SIZE, mIconColor));
    downloadButton.setToolTipText(Dict.DOWNLOAD_NOW.getString());

    openDirectoryButton.setIcon(MaterialIcon._File.FOLDER_OPEN.get(ICON_SIZE, mIconColor));
    openDirectoryButton.setToolTipText(Dict.OPEN_DIRECTORY.getString());

    addButton.setIcon(MaterialIcon._Content.ADD.get(ICON_SIZE, mIconColor));
    editButton.setIcon(MaterialIcon._Content.CREATE.get(ICON_SIZE, mIconColor));
    cloneButton.setIcon(MaterialIcon._Content.CONTENT_COPY.get(ICON_SIZE, mIconColor));
    cloneButton.setToolTipText(Dict.CLONE.getString());
    removeButton.setIcon(MaterialIcon._Content.REMOVE.get(ICON_SIZE, mIconColor));
    removeAllButton.setIcon(MaterialIcon._Content.CLEAR.get(ICON_SIZE, mIconColor));

    helpButton.setIcon(MaterialIcon._Action.HELP_OUTLINE.get(ICON_SIZE, mIconColor));
    helpButton.setToolTipText(Dict.HELP.getString());

    tasksPanel.getList().addListSelectionListener((ListSelectionEvent e) -> {

        if (!e.getValueIsAdjusting()) {
            selectionChanged();// ww  w  . ja  v  a2s. c o m
        }
    });

    tasksPanel.getList().addMouseListener(new MouseListener() {

        @Override
        public void mouseClicked(MouseEvent e) {
            initImageViewer();
        }

        @Override
        public void mouseEntered(MouseEvent e) {
        }

        @Override
        public void mouseExited(MouseEvent e) {
        }

        @Override
        public void mousePressed(MouseEvent e) {
        }

        @Override
        public void mouseReleased(MouseEvent e) {
        }
    });

    tasksPanel.getList().getModel().addListDataListener(new ListDataListener() {

        @Override
        public void contentsChanged(ListDataEvent e) {
            dataChanged();
        }

        @Override
        public void intervalAdded(ListDataEvent e) {
            dataChanged();
        }

        @Override
        public void intervalRemoved(ListDataEvent e) {
            dataChanged();
        }
    });

    selectionChanged();
}

From source file:de.tor.tribes.ui.algo.TimeFrameVisualizer.java

/** Creates new form TimeFrameVisualizer */
public TimeFrameVisualizer() {
    initComponents();/* w  w  w .ja  v  a  2s .  c om*/
    try {
        STROKED = new BufferedImage(3, 3, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2d = STROKED.createGraphics();
        g2d.setColor(Constants.DS_BACK_LIGHT);
        g2d.fillRect(0, 0, 3, 3);
        g2d.setColor(Constants.DS_BACK);
        g2d.drawLine(0, 2, 2, 0);
        g2d.dispose();
        DAILY_START_FRAME_FILL = new BufferedImage(3, 3, BufferedImage.TYPE_INT_RGB);
        g2d = DAILY_START_FRAME_FILL.createGraphics();
        g2d.setColor(Color.CYAN);
        g2d.fillRect(0, 0, 3, 3);
        g2d.setColor(Color.BLUE);
        g2d.drawLine(0, 2, 2, 0);
        g2d.dispose();
        EXACT_START_FRAME_FILL = new BufferedImage(3, 3, BufferedImage.TYPE_INT_RGB);
        g2d = EXACT_START_FRAME_FILL.createGraphics();
        g2d.setColor(Color.CYAN);
        g2d.fillRect(0, 0, 3, 3);
        g2d.dispose();
        ONE_DAY_START_FRAME_FILL = new BufferedImage(3, 3, BufferedImage.TYPE_INT_RGB);
        g2d = ONE_DAY_START_FRAME_FILL.createGraphics();
        g2d.setColor(Color.CYAN);
        g2d.fillRect(0, 0, 3, 3);
        g2d.setColor(Color.BLUE);
        g2d.drawLine(1, 0, 1, 2);
        g2d.dispose();
        ARRIVE_FRAME_FILL = new BufferedImage(3, 3, BufferedImage.TYPE_INT_RGB);
        g2d = ARRIVE_FRAME_FILL.createGraphics();
        g2d.setColor(Color.RED);
        g2d.fillRect(0, 0, 3, 3);
        g2d.setColor(Color.BLACK);
        g2d.drawLine(0, 2, 2, 0);
        g2d.dispose();
    } catch (Exception e) {
    }

    popupInfo = new HashMap<String, Object>();
    addMouseMotionListener(new MouseMotionListener() {

        @Override
        public void mouseDragged(MouseEvent e) {
        }

        @Override
        public void mouseMoved(MouseEvent e) {
            repaint();
        }
    });

    addMouseListener(new MouseListener() {

        @Override
        public void mouseClicked(MouseEvent e) {
            fireClickEvent(e);
        }

        @Override
        public void mousePressed(MouseEvent e) {
        }

        @Override
        public void mouseReleased(MouseEvent e) {
        }

        @Override
        public void mouseEntered(MouseEvent e) {
        }

        @Override
        public void mouseExited(MouseEvent e) {
        }
    });
}

From source file:com.plugin.UI.Windows.BiblePeopleSearchResultsDialog.java

/**
 * Initialize./*from w w  w.  j  ava 2s  . c o m*/
 * 
 * @param _term the _term
 * 
 * @throws Exception the exception
 */
private void initialize(String _term) throws Exception {
    ArrayList<String[]> arr = new ArrayList<String[]>();
    for (BiblePerson bp : Global.biblePersons) {
        if (isSoundexCalc(bp.getName().toUpperCase(), _term)) {
            String[] arrin = new String[5];
            arrin[0] = String.valueOf(bp.getName_id());
            arrin[1] = bp.getName();
            arrin[2] = bp.getFather();
            arrin[3] = bp.getMother();
            arrin[4] = bp.getBible_ref();
            arr.add(arrin);
        }
    }
    String[][] arr3 = new String[arr.size()][5];
    for (int i = 0; i < arr.size(); i++)
        arr3[i] = arr.get(i);
    String columns[] = new String[] { "ID", "Name", "Father", "Mother", "Reference" };
    tm = new DefaultTableModel(arr3, columns) {
        public boolean isCellEditable(int row, int column) {
            return false;
        }
    };

    table = new JTable(tm);

    table.addMouseListener(new MouseListener() {

        public void mouseClicked(MouseEvent e) {
            int member_id = Integer.parseInt((String) tm.getValueAt(table.getSelectedRow(), 0));
            BibleGenealogy.setSelectMember(member_id);
            if (e.getClickCount() == 2) {
                new BiblePersonDialog(Global._jMainFrame, member_id);
            }
        }

        public void mouseEntered(MouseEvent e) {
            // TODO Auto-generated method stub

        }

        public void mouseExited(MouseEvent e) {
            // TODO Auto-generated method stub

        }

        public void mousePressed(MouseEvent e) {
            // TODO Auto-generated method stub

        }

        public void mouseReleased(MouseEvent e) {
            // TODO Auto-generated method stub

        }
    });

    JScrollPane jsp = new JScrollPane(table);
    jsp.setSize(640, 260);
    this.getContentPane().add(jsp);
    this.pack();
    this.setTitle("Bible People Search Results - " + _term);
    this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    this.setLocationRelativeTo(null);
    this.setVisible(true);
}

From source file:com.plugin.UI.Windows.UserSearchResultsDialog.java

/**
 * Initialize.//from  w  w w.java  2s. c o m
 * 
 * @param _term the _term
 * 
 * @throws Exception the exception
 */
private void initialize(String _term) throws Exception {
    ArrayList<String[]> arr = new ArrayList<String[]>();
    for (ChurchMembersData mem : ChurchMemberUtils.getChurchMembers()) {
        if (isSoundex(mem, _term.toUpperCase())) {
            String[] arrin = new String[5];
            arrin[0] = MemberID.getTranslatedID(mem.getMember_id(), mem.getName_english());
            arrin[1] = mem.getName_english() + " (" + mem.getName_otherLang() + ")";
            arrin[2] = mem.getStreet();
            arrin[3] = mem.getSuburb();
            arrin[4] = mem.getState();
            arr.add(arrin);
        }
    }
    String[][] arr3 = new String[arr.size()][5];
    for (int i = 0; i < arr.size(); i++)
        arr3[i] = arr.get(i);
    String columns[] = new String[] { "MemberID", "Name", "Street", "Suburb", "State" };
    tm = new DefaultTableModel(arr3, columns) {
        public boolean isCellEditable(int row, int column) {
            return false;
        }
    };

    table = new JTable(tm);

    table.addMouseListener(new MouseListener() {

        public void mouseClicked(MouseEvent e) {
            String member_id = (String) tm.getValueAt(table.getSelectedRow(), 0);
            ChurchMembers.setSelectMember(member_id);
            if (e.getClickCount() == 2) {
                new MemberDialog(Global.DISPLAY_CHURCH_MEMBER, MemberID.getOriginalID(member_id));
            }
        }

        public void mouseEntered(MouseEvent e) {
            // TODO Auto-generated method stub

        }

        public void mouseExited(MouseEvent e) {
            // TODO Auto-generated method stub

        }

        public void mousePressed(MouseEvent e) {
            // TODO Auto-generated method stub

        }

        public void mouseReleased(MouseEvent e) {
            // TODO Auto-generated method stub

        }
    });

    JScrollPane jsp = new JScrollPane(table);
    jsp.setSize(640, 260);
    this.getContentPane().add(jsp);
    this.pack();
    this.setTitle("Church Members Search Results - " + _term);
    this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    this.setLocationRelativeTo(null);
    this.setVisible(true);
}

From source file:gda.gui.dv.panels.vispanels.ColourSelector.java

/**
 * The function that performs the histogram Drawing
 * //from  w w  w .  ja v  a 2s .  c om
 * @param raw
 *            the raw data
 * @return the new data in the appropriate form
 */
@Override
public ImageData cast(DoubleDataset raw) {

    dataLink = raw;

    if (max == null) {
        max = raw.max().doubleValue();
    }
    if (min == null) {
        min = raw.min().doubleValue();
    }

    ImageData result = colourCast(raw, max, min);

    // if old stuff exists then remove it.
    if (chart != null) {
        chart.removeAll();
    }

    // now plot the histogram

    HistogramDataset histData = new HistogramDataset();
    histData.addSeries("h1", raw.getData(), 100, min, max);
    histogram = ChartFactory.createHistogram("Histogram", "Value", "Counts", histData, PlotOrientation.VERTICAL,
            false, false, false);

    if (unconfigured == false) {
        this.remove(chart);
    }
    unconfigured = false;

    chart = new DrawChart(histogram);

    chart.setMouseZoomable(false);

    chart.setPreferredSize(new Dimension(300, 300));
    chart.setMinimumSize(new Dimension(200, 200));

    c.gridx = 0;
    c.gridy = 4;
    c.gridwidth = 2;

    this.add(chart, c);

    chart.addMouseListener(new MouseListener() {
        Double tmin = min;
        Double tmax = max;

        @Override
        public void mouseClicked(MouseEvent e) {

        }

        @Override
        public void mouseEntered(MouseEvent e) {

        }

        @Override
        public void mouseExited(MouseEvent e) {

        }

        @Override
        public void mousePressed(MouseEvent e) {
            SimpleDataCoordinate coordinates = convertMouseEvent(e);
            if (chart.getScreenDataArea().contains(e.getX(), e.getY())) {
                tmin = coordinates.getX();
            } else {
                if (chart.getScreenDataArea().outcode(e.getX(), e.getY()) != Rectangle2D.OUT_RIGHT) {
                    //                  System.out.println("out of bounds");
                    //                  System.out.printf("Mouse: %d\n", e.getX());
                } else {
                    tmin = max;
                }
            }

        }

        @Override
        public void mouseReleased(MouseEvent e) {
            boolean update = false;
            SimpleDataCoordinate coordinates = convertMouseEvent(e);

            if (chart.getScreenDataArea().contains(e.getX(), e.getY())) {
                tmax = coordinates.getX();
                update = true;
            } else {
                if (chart.getScreenDataArea().outcode(e.getX(), e.getY()) != Rectangle2D.OUT_LEFT) {
                    //                  System.out.println("out of bounds");
                    //                  System.out.printf("Mouse: %d\n", e.getX());
                } else {
                    tmax = min;
                    update = true;
                }
            }
            if (update && tmin != tmax) {
                if (tmin > tmax) { // check and correct limits
                    Double t = tmin;
                    tmin = tmax;
                    tmax = t;
                }
                min = tmin;
                max = tmax;

                owner.getDataSetImage().applyColorCast();
                owner.getDataSetPlot3D().applyColorCast();
                owner.getDataSetImage().repaint();
            }
        }

        public SimpleDataCoordinate convertMouseEvent(MouseEvent me) {
            return new SimpleDataCoordinate(

                    histogram.getXYPlot().getDomainAxis().java2DToValue(me.getX(), chart.getScreenDataArea(),
                            histogram.getXYPlot().getDomainAxisEdge()),

                    histogram.getXYPlot().getRangeAxis().java2DToValue(me.getY(), chart.getScreenDataArea(),
                            histogram.getXYPlot().getRangeAxisEdge()));

        }

    });

    lblchart.invalidate();
    lblchart.validate();

    this.invalidate();
    this.validate();

    return result;

}

From source file:com.emr.schemas.SavedProcessesDataMover.java

/**
 * Constructor/* ww  w .  ja va2  s  .  c o m*/
 */
public SavedProcessesDataMover() {
    initComponents();
    this.setClosable(true);
    final Action processDelete = new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JTable table = (JTable) e.getSource();
            int modelRow = Integer.valueOf(e.getActionCommand());
            String foreignKeysTable = (String) tblProcesses.getModel().getValueAt(modelRow, 0);
            if (foreignKeysTable == null || "".equals(foreignKeysTable)) {
                JOptionPane.showMessageDialog(null, "Table is Empty", "Empty Table", JOptionPane.ERROR_MESSAGE);
            } else {

            }
        }

    };
    final SQLiteGetProcesses sp = new SQLiteGetProcesses();
    sp.addPropertyChangeListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent event) {
            switch (event.getPropertyName()) {
            case "progress":
                System.out.println("Fetching data from db");
                break;
            case "state":
                switch ((SwingWorker.StateValue) event.getNewValue()) {
                case DONE:
                    try {
                        model = sp.get();
                        tblProcesses.setModel(model);
                        tblProcesses.getColumnModel().getColumn(0).setMaxWidth(300);
                        //hide irrelevant columns
                        tblProcesses.getColumnModel().getColumn(2).setMinWidth(0);
                        tblProcesses.getColumnModel().getColumn(2).setMaxWidth(0);
                        tblProcesses.getColumnModel().getColumn(3).setMinWidth(0);
                        tblProcesses.getColumnModel().getColumn(3).setMaxWidth(0);
                        tblProcesses.getColumnModel().getColumn(4).setMinWidth(0);
                        tblProcesses.getColumnModel().getColumn(4).setMaxWidth(0);
                        tblProcesses.getColumnModel().getColumn(5).setMinWidth(0);
                        tblProcesses.getColumnModel().getColumn(5).setMaxWidth(0);
                        tblProcesses.getColumnModel().getColumn(6).setMinWidth(0);
                        tblProcesses.getColumnModel().getColumn(6).setMaxWidth(0);

                        ButtonColumn buttonColumn = new ButtonColumn(tblProcesses, processDelete, 7, "Delete");
                    } catch (final CancellationException ex) {
                        Logger.getLogger(SavedProcessesDataMover.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (InterruptedException ex) {
                        Logger.getLogger(SavedProcessesDataMover.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (ExecutionException ex) {
                        Logger.getLogger(SavedProcessesDataMover.class.getName()).log(Level.SEVERE, null, ex);
                    }

                    break;
                }
                break;
            }
        }

    });
    sp.execute();

    tblProcesses.addMouseListener(new MouseListener() {

        @Override
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) {
                JTable target = (JTable) e.getSource();
                int rowIndex = target.getSelectedRow();
                String selectQry = (String) target.getModel().getValueAt(rowIndex, 2);
                String destinationTable = (String) target.getModel().getValueAt(rowIndex, 3);
                String truncateFirst = (String) target.getModel().getValueAt(rowIndex, 4);
                String destinationColumns = (String) target.getModel().getValueAt(rowIndex, 5);
                String columnsToBeMapped = (String) target.getModel().getValueAt(rowIndex, 6);
                lblUpdateText.setText("<html><b color='red'>Moving Data</b></html>");
                dbProgressBar.setIndeterminate(true);
                new DBUpdater(selectQry, destinationTable, truncateFirst, destinationColumns, columnsToBeMapped)
                        .execute();
            }
        }

        @Override
        public void mousePressed(MouseEvent e) {
            //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }

        @Override
        public void mouseReleased(MouseEvent e) {
            //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }

        @Override
        public void mouseEntered(MouseEvent e) {
            //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }

        @Override
        public void mouseExited(MouseEvent e) {
            //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
    });

}

From source file:de.tor.tribes.ui.components.TimePicker.java

private void initSpecialComponents() {
    for (int i = 0; i < hourLabels.length; i++) {
        CrossedLabel label = new CrossedLabel();
        hourLabels[i] = label;//from ww w  .jav a  2  s  .c o  m

        if (i < 10) {
            label.setText("0" + Integer.toString(i));
        } else {
            label.setText(Integer.toString(i));
        }

        label.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        label.setBorder(javax.swing.BorderFactory.createLineBorder(Constants.DS_BACK));
        label.setHorizontalAlignment(SwingConstants.CENTER);
        label.setOpaque(true);
        label.setBackground(Constants.DS_BACK_LIGHT);
        label.setFont(smallFont);
        label.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                if (selectedHour != null) {
                    selectedHour.uncross();
                }
                selectedHour = ((CrossedLabel) e.getSource());
                selectedHour.cross();

                for (int i = 0; i < hourLabels.length; i++)
                    if (hourLabels[i] == selectedHour) {
                        pHour = i;
                        break;
                    }
            }

            @Override
            public void mouseEntered(MouseEvent e) {
                ((CrossedLabel) e.getSource()).setBackground(highlight);
            }

            @Override
            public void mouseExited(MouseEvent e) {
                ((CrossedLabel) e.getSource()).setBackground(Constants.DS_BACK_LIGHT);
            }
        });
    }
    addHourLabels();

    for (int i = 0; i < minuteLabels.length; i++) {
        CrossedLabel label = new CrossedLabel();
        minuteLabels[i] = label;

        if (i < 10) {
            label.setText(":0" + Integer.toString(i));
        } else {
            label.setText(":" + Integer.toString(i));
        }

        label.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        label.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));
        label.setHorizontalAlignment(SwingConstants.CENTER);
        label.setOpaque(true);
        label.setBackground(Color.WHITE);
        label.setFont(smallFont);
        label.addMouseListener(new MouseListener() {
            @Override
            public void mouseClicked(MouseEvent e) {
                if (selectedMinute != null) {
                    selectedMinute.uncross();
                }
                selectedMinute = ((CrossedLabel) e.getSource());
                selectedMinute.cross();

                for (int i = 0; i < minuteLabels.length; i++)
                    if (minuteLabels[i] == selectedMinute) {
                        pMinute = i;
                        break;
                    }
            }

            @Override
            public void mousePressed(MouseEvent e) {
            }

            @Override
            public void mouseReleased(MouseEvent e) {
            }

            @Override
            public void mouseEntered(MouseEvent e) {
                ((CrossedLabel) e.getSource()).setBackground(highlight);
            }

            @Override
            public void mouseExited(MouseEvent e) {
                ((CrossedLabel) e.getSource()).setBackground(Color.WHITE);
            }
        });
    }
    addMinuteLabels(false);
}

From source file:net.andydvorak.intellij.lessc.ui.configurable.LessProfileConfigurableForm.java

public JComponent createOptionsPanel() {
    lessDirTextField = new TextFieldWithBrowseButtonImpl(project, UIBundle.message("file.chooser.less.title"));

    lessDirPanel.add(lessDirTextField, GRIDCONSTRAINTS_FILL_ALL);

    profileMappingTable.addMouseListener(new MouseListener() {
        @Override//from  ww  w  .  ja va 2s. c  o m
        public void mouseClicked(MouseEvent mouseEvent) {
            if (mouseEvent.getClickCount() == 2 && !mouseEvent.isConsumed()) {
                mouseEvent.consume();
                editRow();
            }
        }

        @Override
        public void mousePressed(MouseEvent mouseEvent) {
        }

        @Override
        public void mouseReleased(MouseEvent mouseEvent) {
        }

        @Override
        public void mouseEntered(MouseEvent mouseEvent) {
        }

        @Override
        public void mouseExited(MouseEvent mouseEvent) {
        }
    });

    final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(profileMappingTable);
    decorator.setAddAction(new AnActionButtonRunnable() {
        @Override
        public void run(AnActionButton button) {
            addRow();
        }
    }).setEditAction(new AnActionButtonRunnable() {
        @Override
        public void run(AnActionButton button) {
            editRow();
        }
    }).disableUpDownActions();

    cssDirPanel.add(decorator.createPanel(), GRIDCONSTRAINTS_FILL_ALL);

    resetPromptsButton.setMnemonic('r');
    resetPromptsButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            lessManager.getState().resetPrompts();
            lessProfilesPanel.setPromptButtonsEnabled(false);
        }
    });
    resetPromptsButton.setEnabled(!lessManager.getState().hasDefaultPromptSettings());

    return rootPanel;
}

From source file:vteaexploration.plottools.panels.XYChartPanel.java

public void process(int x, int y, int l, String xText, String yText, String lText) {

    chartPanel = createChart(x, y, l, xText, yText, lText, imageGateOutline);
    JFrame f = new JFrame(title);
    f.setTitle(title);/*from  ww w. j  ava2  s  . com*/
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setLayout(new BorderLayout(0, 5));
    f.add(chartPanel, BorderLayout.CENTER);

    chartPanel.setOpaque(false);
    chartPanel.setMouseWheelEnabled(false);
    chartPanel.setDomainZoomable(false);
    chartPanel.setRangeZoomable(false);
    chartPanel.setPreferredSize(new Dimension(550, 485));
    chartPanel.setBackground(new Color(0, 0, 0, 0));
    chartPanel.revalidate();
    chartPanel.repaint();
    //chartPanel.set

    chartPanel.addChartMouseListener(new ChartMouseListener() {

        @Override
        public void chartMouseClicked(ChartMouseEvent cme) {
            chartPanel.getParent().repaint();
        }

        @Override
        public void chartMouseMoved(ChartMouseEvent cme) {
        }
    });

    chartPanel.addMouseMotionListener(new MouseMotionListener() {

        @Override
        public void mouseDragged(MouseEvent e) {
            chartPanel.getParent().repaint();

        }

        @Override
        public void mouseMoved(MouseEvent e) {
            chartPanel.getParent().repaint();
        }
    });

    chartPanel.addMouseListener(new MouseListener() {

        @Override
        public void mouseClicked(MouseEvent e) {
        }

        @Override
        public void mousePressed(MouseEvent e) {
            //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }

        @Override
        public void mouseReleased(MouseEvent e) {
            //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }

        @Override
        public void mouseEntered(MouseEvent e) {
            //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }

        @Override
        public void mouseExited(MouseEvent e) {
            //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }

    });
    f.pack();
}