Example usage for java.awt.event MouseEvent getPoint

List of usage examples for java.awt.event MouseEvent getPoint

Introduction

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

Prototype

public Point getPoint() 

Source Link

Document

Returns the x,y position of the event relative to the source component.

Usage

From source file:jmupen.MyListSelectionListener.java

@Override
public void mousePressed(MouseEvent e) {
    list.setSelectedIndex(list.locationToIndex(e.getPoint()));
    int index = list.getSelectedIndex();
    if (SwingUtilities.isRightMouseButton(e)) {
        JPopupMenu menu = new JPopupMenu();
        JMenuItem item = new JMenuItem("Remove");
        item.addActionListener(new ActionListener() {
            @Override/*ww w  .  java  2s . c om*/
            public void actionPerformed(ActionEvent e) {
                if (index != -1) {
                    try {
                        System.out.println("Linea: " + index + " " + model.get(index));
                        model.removeElementAt(index);
                        removeLines(index, JMupenUtils.getRecents().toFile());
                        JMupenUtils.setGames(JMupenUtils.getGamesFromFile(JMupenUtils.getRecents()));
                    } catch (IOException ex) {
                        System.err.println("Error removing recent game. " + ex.getLocalizedMessage());
                    }
                }
            }
        });
        menu.add(item);
        menu.show(list, e.getX(), e.getY());
    }
}

From source file:ru.codemine.pos.ui.windows.devices.kkm.KkmListWindow.java

@Override
public void setupActionListeners() {
    setNewActionListener(newKkmDevice);//from  w w w  .  j ava  2s .  c o  m
    setEditActionListener(editKkmDevice);
    setDeleteActionListener(deleteKkm);
    setProcessActionListener(setActiveKkm);
    setRefreshActionListener(refreshKkmDeviceList);
    toolButtonTestCheque.addActionListener(testKkmDevice);

    table.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            Point p = e.getPoint();
            int row = table.rowAtPoint(p);
            if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) {
                menuItemEdit.doClick();
            }
        }
    });

    actionListenersInit = true;
}

From source file:ru.codemine.pos.ui.windows.products.ProductsListWindow.java

@Override
public void setupActionListeners() {
    setNewActionListener(newProduct);/*  www  . j a  v  a2  s. c  o m*/
    setEditActionListener(editProduct);
    setDeleteActionListener(deleteProduct);
    setRefreshActionListener(refreshProductList);

    toolButtonPrintStickers.addActionListener(printProductStickers);
    menuItemPrintStickers.addActionListener(printProductStickers);

    table.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            Point p = e.getPoint();
            int row = table.rowAtPoint(p);
            if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) {
                menuItemEdit.doClick();
            }
        }
    });

    actionListenersInit = true;
}

From source file:com.db2eshop.gui.component.tab.ArticleTab.java

/**
 * <p>registerMouseListener.</p>
 *
 * @param jScrollPane a {@link javax.swing.JScrollPane} object.
 * @param table a {@link com.db2eshop.gui.component.table.api.GenericTable} object.
 *///from w ww . jav a  2s. c o  m
public void registerMouseListener(JScrollPane jScrollPane, GenericTable<?> table) {
    jScrollPane.addMouseListener(new BaseMouseListener() {
        @Override
        public void mouseClicked(MouseEvent arg0) {
            if (arg0.getButton() == MouseEvent.BUTTON3) {
                tabRightClickPopupMenu.showMenu(arg0.getPoint(), null, null, articleTable);
            }
        }
    });
}

From source file:com.db2eshop.gui.component.tab.ArticleTypeTab.java

/**
 * <p>registerMouseListener.</p>
 *
 * @param jScrollPane a {@link javax.swing.JScrollPane} object.
 * @param table a {@link com.db2eshop.gui.component.table.api.GenericTable} object.
 *///from   w w  w .  j a v  a2 s.co m
public void registerMouseListener(JScrollPane jScrollPane, GenericTable<?> table) {
    jScrollPane.addMouseListener(new BaseMouseListener() {
        @Override
        public void mouseClicked(MouseEvent arg0) {
            if (arg0.getButton() == MouseEvent.BUTTON3) {
                tabRightClickPopupMenu.showMenu(arg0.getPoint(), null, null, articleTypeTable);
            }
        }
    });
}

From source file:com.db2eshop.gui.component.tab.CustomerTab.java

/**
 * <p>registerMouseListener.</p>
 *
 * @param jScrollPane a {@link javax.swing.JScrollPane} object.
 * @param table a {@link com.db2eshop.gui.component.table.api.GenericTable} object.
 *//*from   w w  w .  ja  v a2s . c om*/
public void registerMouseListener(JScrollPane jScrollPane, GenericTable<?> table) {
    jScrollPane.addMouseListener(new BaseMouseListener() {
        @Override
        public void mouseClicked(MouseEvent arg0) {
            if (arg0.getButton() == MouseEvent.BUTTON3) {
                tabRightClickPopupMenu.showMenu(arg0.getPoint(), null, null, customerTable);
            }
        }
    });
}

From source file:com.db2eshop.gui.component.tab.EmployeeTab.java

/**
 * <p>registerMouseListener.</p>
 *
 * @param jScrollPane a {@link javax.swing.JScrollPane} object.
 * @param table a {@link com.db2eshop.gui.component.table.api.GenericTable} object.
 *//*from w  w w. ja  va 2s  . c o m*/
public void registerMouseListener(JScrollPane jScrollPane, GenericTable<?> table) {
    jScrollPane.addMouseListener(new BaseMouseListener() {
        @Override
        public void mouseClicked(MouseEvent arg0) {
            if (arg0.getButton() == MouseEvent.BUTTON3) {
                tabRightClickPopupMenu.showMenu(arg0.getPoint(), null, null, employeeTable);
            }
        }
    });
}

From source file:com.db2eshop.gui.component.tab.ImportTab.java

/**
 * <p>registerMouseListener.</p>
 *
 * @param jScrollPane a {@link javax.swing.JScrollPane} object.
 * @param table a {@link com.db2eshop.gui.component.table.api.GenericTable} object.
 *///from  w  w w  .  j  ava  2 s .  c o m
public void registerMouseListener(JScrollPane jScrollPane, GenericTable<?> table) {
    jScrollPane.addMouseListener(new BaseMouseListener() {
        @Override
        public void mouseClicked(MouseEvent arg0) {
            if (arg0.getButton() == MouseEvent.BUTTON3) {
                tabRightClickPopupMenu.showMenu(arg0.getPoint(), null, null, importTable);
            }
        }
    });
}

From source file:com.db2eshop.gui.component.tab.SaleTab.java

/**
 * <p>registerMouseListener.</p>
 *
 * @param jScrollPane a {@link javax.swing.JScrollPane} object.
 * @param table a {@link com.db2eshop.gui.component.table.api.GenericTable} object.
 *///from  w  w  w .  ja va 2  s.  c  o m
public void registerMouseListener(JScrollPane jScrollPane, GenericTable<?> table) {
    jScrollPane.addMouseListener(new BaseMouseListener() {
        @Override
        public void mouseClicked(MouseEvent arg0) {
            if (arg0.getButton() == MouseEvent.BUTTON3) {
                tabRightClickPopupMenu.showMenu(arg0.getPoint(), null, null, saleTable);
            }
        }
    });
}

From source file:com.db2eshop.gui.component.tab.ShippingTab.java

/**
 * <p>registerMouseListener.</p>
 *
 * @param jScrollPane a {@link javax.swing.JScrollPane} object.
 * @param table a {@link com.db2eshop.gui.component.table.api.GenericTable} object.
 *///from  w ww .j ava  2 s  .c o m
public void registerMouseListener(JScrollPane jScrollPane, GenericTable<?> table) {
    jScrollPane.addMouseListener(new BaseMouseListener() {
        @Override
        public void mouseClicked(MouseEvent arg0) {
            if (arg0.getButton() == MouseEvent.BUTTON3) {
                tabRightClickPopupMenu.showMenu(arg0.getPoint(), null, null, shippingTable);
            }
        }
    });
}