Example usage for java.awt.event MouseAdapter MouseAdapter

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

Introduction

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

Prototype

MouseAdapter

Source Link

Usage

From source file:de.tor.tribes.ui.views.DSWorkbenchConquersFrame.java

private void buildMenu() {
    JXTaskPane transferPane = new JXTaskPane();
    transferPane.setTitle("bertragen");

    JXButton button2 = new JXButton(
            new ImageIcon(DSWorkbenchChurchFrame.class.getResource("/res/ui/att_browser.png")));
    button2.setToolTipText("Zentriert die markierte Eroberungen im Spiel");
    button2.addMouseListener(new MouseAdapter() {

        @Override/*from  w  w w  .j  a v  a2 s.  c  om*/
        public void mouseReleased(MouseEvent e) {
            centerVillageInGame();
        }
    });

    transferPane.getContentPane().add(button2);
    if (!GlobalOptions.isMinimal()) {
        JXButton centerOnMap = new JXButton(
                new ImageIcon(DSWorkbenchChurchFrame.class.getResource("/res/center_24x24.png")));
        centerOnMap.setToolTipText("Zentriert die markierte Eroberung auf der Hauptkarte");
        centerOnMap.addMouseListener(new MouseAdapter() {

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

        transferPane.getContentPane().add(centerOnMap);
    }

    /* JXTaskPane miscPane = new JXTaskPane();
     miscPane.setTitle("Sonstiges");
            
     JXButton borderControlButton = new JXButton(new ImageIcon(DSWorkbenchChurchFrame.class.getResource("/res/ui/att_browser.png")));
     borderControlButton.setToolTipText("Zentriert die markierte Eroberungen im Spiel");
     borderControlButton.addMouseListener(new MouseAdapter() {
            
    @Override
    public void mouseReleased(MouseEvent e) {
       DSWorkbenchBorderControl.getSingleton().setupAndShow();
    }
     });
     miscPane.getContentPane().add(borderControlButton);*/

    centerPanel.setupTaskPane(transferPane);//, miscPane);
}

From source file:biz.wolschon.finance.jgnucash.accountProperties.AccountProperties.java

/**
 * {@inheritDoc}//from w  w w.j  a v a2s.c  om
 */
@Override
public void actionPerformed(final ActionEvent aE) {
    JPanel newPanel = new JPanel(new GridLayout(2, 2));

    newPanel.add(new JLabel("GUID:"));
    final JTextField disabledIDInput = new JTextField(myAccount.getId());
    final JPopupMenu accountIDPopupMenu = createAccountIDPopupMenu();
    disabledIDInput.setEditable(false);
    disabledIDInput.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseReleased(final MouseEvent arg0) {
            if (arg0.isPopupTrigger()) {
                accountIDPopupMenu.show(disabledIDInput, arg0.getX(), arg0.getY());
            }
        }

        @Override
        public void mousePressed(final MouseEvent arg0) {
            if (arg0.isPopupTrigger()) {
                accountIDPopupMenu.show(disabledIDInput, arg0.getX(), arg0.getY());
            }
        }

    });
    newPanel.add(disabledIDInput);

    newPanel.add(new JLabel("name:"));
    final JTextField nameInput = new JTextField(myAccount.getName());
    nameInput.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent aE) {
            myAccount.setName(nameInput.getText());
        }

    });
    newPanel.add(nameInput);

    myFrame = new JFrame(myAccount.getName());
    myFrame.getContentPane().setLayout(new BorderLayout());
    myFrame.getContentPane().add(newPanel, BorderLayout.NORTH);
    myFrame.getContentPane().add(getButtonsPanel(), BorderLayout.SOUTH);

    myFrame.getContentPane().add(getMySettingsPanel(), BorderLayout.CENTER);
    myFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    myFrame.pack();
    myFrame.setVisible(true);
}

From source file:aurelienribon.gdxsetupui.ui.MainPanel.java

private void initUI() {
    startSetupBtn.addActionListener(new ActionListener() {
        @Override//from w  ww .  j a  v a 2 s . c  om
        public void actionPerformed(ActionEvent e) {
            showSetupView();
        }
    });

    startUpdateBtn.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            showUpdateView();
        }
    });

    changeModeBtn.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            showInitView();
        }
    });

    JLabel aboutLabel = new JLabel("About this app >");
    Style.registerCssClasses(aboutLabel, ".linkLabel");
    aboutLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    versionLabel.setLayout(new BorderLayout());
    versionLabel.add(aboutLabel, BorderLayout.EAST);

    aboutLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            showAboutPanel();
        }
    });
}

From source file:de.codesourcery.eve.skills.ui.components.impl.BlueprintChooserComponent.java

@Override
protected JPanel createPanel() {

    final JPanel panel = new JPanel();
    panel.setLayout(new GridBagLayout());

    // add tree/*  w w  w  .jav  a 2s  .  co m*/
    tree.setRootVisible(false);

    tree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {

        @Override
        public void valueChanged(TreeSelectionEvent e) {
            treeNodeSelected(e.getPath());
        }
    });

    tree.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() != 2) {
                return;
            }

            final int row = tree.getRowForLocation(e.getX(), e.getY());

            if (row == -1) {
                return;
            }

            final TreePath selectionPath = tree.getSelectionPath();

            final TreePath path = tree.getPathForRow(row);

            if (path == null) {
                return;
            }

            // tree expansion is also triggered by a double-click,
            // make sure the double-click wasn't just an expansion trigger
            if (ObjectUtils.equals(selectionPath, path)) {
                treeNodeDoubleClicked(path);
            }
        }
    });
    tree.setCellRenderer(new BlueprintTreeRendererer());

    byNameTextField.setColumns(10);

    panel.add(new JLabel("Filter:"),
            constraints().x(0).y(0).width(1).height(1).noResizing().anchorCenter().end());
    panel.add(byNameTextField,
            constraints().x(1).y(0).width(1).height(1).resizeHorizontally().weightX(1).weightY(0).end());
    panel.add(new JScrollPane(tree),
            constraints().x(0).y(1).width(2).height(1).resizeBoth().weightX(1).weightY(1).end());
    return panel;
}

From source file:de.tbuchloh.kiskis.gui.widgets.PasswordElement.java

private void initCreatePopup() {
    _pwdCreateMenu = new JPopupMenu();
    final JMenuItem secure = new JMenuItem(M.getString("secure_item")); //$NON-NLS-1$
    secure.addActionListener(new PasswordActionListener(PasswordFactory.SECURE));
    _pwdCreateMenu.add(secure);/*from w ww.  j  a va 2 s .  com*/

    final JMenuItem human = new JMenuItem(M.getString("human_readable_item")); //$NON-NLS-1$
    human.addActionListener(new PasswordActionListener(PasswordFactory.HUMAN_READABLE));
    _pwdCreateMenu.add(human);

    final JMenuItem template = new JMenuItem(M.createAction(this, "onCreateByTemplate"));
    _pwdCreateMenu.add(template);

    _specialActionsMenu = new JPopupMenu();
    _specialActionsMenu.add(M.createAction(this, "onCopyToClipboard"));

    _pwdField.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(final MouseEvent e) {
            if (e.getButton() != MouseEvent.BUTTON3) {
                return;
            }
            final int x = e.getX(); // _pwdField.getWidth()
            // - _specialActionsMenu.getWidth();
            final int y = e.getY();

            LOG.debug("Show context menu x=" + x + ", y=" + y);
            _specialActionsMenu.show(_pwdField, x, y);
        }
    });
}

From source file:com.dnsoft.inmobiliaria.controllers.ConsultaCCPropietariosController.java

final void configuraTblPropietarios() {
    ((DefaultTableCellRenderer) view.tblPropietario.getTableHeader().getDefaultRenderer())
            .setHorizontalAlignment(SwingConstants.CENTER);

    listPropietarios = new ArrayList<>();

    tableModelPropietarios = new PropietariosTableModel(listPropietarios);
    view.tblPropietario.setModel(tableModelPropietarios);
    view.tblPropietario.setRowHeight(25);
    view.tblPropietario.getColumn("Activo").setMaxWidth(0);
    view.tblPropietario.getColumn("Activo").setMinWidth(0);
    view.tblPropietario.getColumn("Activo").setPreferredWidth(0);
    view.tblPropietario.getColumn("Activo").setWidth(0);
    view.tblPropietario.setDefaultRenderer(Object.class, new TableRendererColorActivo(2));
    ListSelectionModel listModel = view.tblPropietario.getSelectionModel();
    listModel.addListSelectionListener(new ListSelectionListener() {
        @Override//from  w w  w . j ava 2s  .com
        public void valueChanged(ListSelectionEvent lse) {
            if (view.tblPropietario.getSelectedRow() != -1) {
                view.btnCuenta.setEnabled(true);
                view.btnPropietario.setEnabled(true);
            } else {
                view.btnCuenta.setEnabled(false);
                view.btnPropietario.setEnabled(false);
            }
        }
    });

    view.tblPropietario.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent me) {

            if (me.getClickCount() == 2) {
                detallesCCPropietario();
            }
        }
    });

}

From source file:de.tor.tribes.ui.views.DSWorkbenchNotepad.java

private void buildMenu() {
    JXTaskPane editTaskPane = new JXTaskPane();
    editTaskPane.setTitle("Bearbeiten");

    JXButton newNote = new JXButton(
            new ImageIcon(DSWorkbenchChurchFrame.class.getResource("/res/ui/document_new_24x24.png")));
    newNote.setToolTipText("Erstellt eine leere Notiz");
    newNote.addMouseListener(new MouseAdapter() {

        @Override//from  w ww .j a va  2s.  c  o  m
        public void mouseReleased(MouseEvent e) {
            NoteTableTab tab = getActiveTab();
            if (tab != null) {
                tab.createNote();
            }
        }
    });
    editTaskPane.getContentPane().add(newNote);

    JXTaskPane transferTaskPane = new JXTaskPane();
    transferTaskPane.setTitle("bertragen");
    JXButton transferVillageList = new JXButton(
            new ImageIcon(DSWorkbenchChurchFrame.class.getResource("/res/ui/center_ingame.png")));
    transferVillageList.setToolTipText("Zentriert das gewhlte Notizdorf im Spiel");
    transferVillageList.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseReleased(MouseEvent e) {
            NoteTableTab tab = getActiveTab();
            if (tab != null) {
                tab.centerNoteVillageInGame();
            }
        }
    });
    transferTaskPane.getContentPane().add(transferVillageList);

    if (!GlobalOptions.isMinimal()) {
        JXButton centerVillage = new JXButton(
                new ImageIcon(DSWorkbenchChurchFrame.class.getResource("/res/center_24x24.png")));
        centerVillage.setToolTipText("Zentriert das gewhlte Notizdorf auf der Hauptkarte");
        centerVillage.setSize(transferVillageList.getSize());
        centerVillage.setMinimumSize(transferVillageList.getMinimumSize());
        centerVillage.setMaximumSize(transferVillageList.getMaximumSize());
        centerVillage.setPreferredSize(transferVillageList.getPreferredSize());
        centerVillage.addMouseListener(new MouseAdapter() {

            @Override
            public void mouseReleased(MouseEvent e) {
                NoteTableTab tab = getActiveTab();
                if (tab != null) {
                    tab.centerNoteVillage();
                }
            }
        });

        transferTaskPane.getContentPane().add(centerVillage);
    }
    centerPanel.setupTaskPane(editTaskPane, transferTaskPane);
}

From source file:com.floreantpos.ui.model.PizzaItemForm.java

private void initData() {
    MenuGroupDAO foodGroupDAO = new MenuGroupDAO();
    List<MenuGroup> foodGroups = foodGroupDAO.findAll();
    cbGroup.setModel(new ComboBoxModel(foodGroups));

    TaxDAO taxDAO = new TaxDAO();
    List<Tax> taxes = taxDAO.findAll();
    cbTax.setModel(new ComboBoxModel(taxes));

    menuItemModifierGroups = menuItem.getMenuItemModiferGroups();
    shiftTable.setModel(shiftTableModel = new ShiftTableModel(menuItem.getShifts()));

    priceTableModel = new BeanTableModel<PizzaPrice>(PizzaPrice.class) {
        @Override/*from www  . ja v a  2 s. co  m*/
        public boolean isCellEditable(int rowIndex, int columnIndex) {
            if (columnIndex == 2) {
                return true;
            }
            return false;
        }

        @Override
        public void setValueAt(Object value, int rowIndex, int columnIndex) {
            if (columnIndex == 2) {
                PizzaPrice price = priceTableModel.getRow(rowIndex);
                price.setPrice((double) value);
            }
        }
    };
    priceTableModel.addColumn("SIZE", "size");
    priceTableModel.addColumn("CRUST", "crust");
    priceTableModel.addColumn("PRICE", "price");

    List<PizzaPrice> pizzaPriceList = menuItem.getPizzaPriceList();

    if (pizzaPriceList == null || pizzaPriceList.isEmpty())
        priceTableModel.addRows(generatedPossiblePizzaItemSizeAndPriceList());
    else
        priceTableModel.addRows(pizzaPriceList);

    priceTable.setModel(priceTableModel);
    setBean(menuItem);

    priceTable.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent me) {
            if (me.getClickCount() == 2) {
                editEvent();
            }
        }
    });
}

From source file:de.jakop.ngcalsync.application.TrayStarter.java

private MouseAdapter createLogMouseListener(final JFrame logWindow) {
    return new MouseAdapter() {

        @Override//  w  w  w  . j  ava2s  .  c  o m
        public void mouseClicked(final MouseEvent e) {
            if (e.getClickCount() == 1 && e.getButton() == MouseEvent.BUTTON1) {
                logWindow.setVisible(!logWindow.isVisible());
            }
        }

    };
}

From source file:com.github.cric.app.ui.SettingPanel.java

private Component helpLabel() {

    JLabel help = new JLabel(HELP_TEXT);
    help.addMouseListener(new MouseAdapter() {

        @Override//from  w  ww  .  java 2s . c o m
        public void mouseEntered(MouseEvent e) {

            help.setCursor(new Cursor(Cursor.HAND_CURSOR));
        }

        @Override
        public void mouseExited(MouseEvent e) {

            help.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
        }

        @Override
        public void mouseClicked(MouseEvent e) {

            if (Desktop.isDesktopSupported()) {
                try {
                    Desktop.getDesktop().browse(HELP_PAGE);
                } catch (Exception ex) {
                    LOG.warn("unable to open link", ex);
                }
            }
        }
    });
    return help;
}