예제 #1
0
 public void showPopupMenu(java.awt.event.MouseEvent evt) {
   int r = m_table.rowAtPoint(new Point(evt.getX(), evt.getY()));
   if (r != -1) {
     m_table.setRowSelectionInterval(r, r);
   }
   m_popupMenu.show(this, evt.getX(), evt.getY());
 }
예제 #2
0
    public void mousePressed(java.awt.event.MouseEvent e) {
      isClick = true;
      JButton b = (JButton) e.getSource();
      // check to see if the target button can be moved
      if (!solved && check(buttons.indexOf(b))) {
        // hide the target button
        b.setVisible(false);

        // Figure out the bounds of the areas where source
        // and target buttons are located
        int menuOffset = getJMenuBar().getHeight();
        dragSourceArea = b.getBounds();
        dragTargetArea = ((JButton) buttons.get(hiddenIndex)).getBounds();
        dragSourceArea.translate(0, menuOffset);
        dragTargetArea.translate(0, menuOffset);

        // setup the bounds of the panel to limit the locations on the drag
        // layer
        panelArea = new Rectangle(0, menuOffset, getJPanel().getWidth(), getJPanel().getHeight());

        // Setup and show the drag button on the upper layer
        getDragButton().setText(b.getText());
        getDragButton().setBounds(dragSourceArea);
        getDragButton().setVisible(true);

        // Offset when repositioning the drag button later
        cursorOffset = new Point(e.getX(), e.getY());
      }
    }
예제 #3
0
    public void mouseDragged(java.awt.event.MouseEvent e) {
      if (dragTargetArea != null) {
        // Since we're dragging, this is no longer considered a click
        isClick = false;

        // Draw the target feedback and position the drag button based
        // on the mouse's new location
        e.translatePoint(dragSourceArea.x, dragSourceArea.y);
        Point p = makeSafePoint(e.getX(), e.getY());
        paintTargetFeedback(p.x, p.y);
        getDragButton().setLocation(p.x - cursorOffset.x, p.y - cursorOffset.y);
      }
    }
 /**
  * DOCUMENT ME!
  *
  * @param evt DOCUMENT ME!
  */
 private void lstKassenzeichenMouseClicked(final java.awt.event.MouseEvent evt) {
   if (evt.getClickCount() == 2) {
     if (lstKassenzeichen.getSelectedValue() != null) {
       gotoSelectedKassenzeichen();
     }
   }
 }
예제 #5
0
 private void tableMousePressed(java.awt.event.MouseEvent evt) // GEN-FIRST:event_tableMousePressed
     { // GEN-HEADEREND:event_tableMousePressed
   System.out.println("pressed !");
   // Add your handling code here:
   if (evt.isPopupTrigger()) {
     System.out.println("trigger !");
     showPopupMenu(evt);
   }
 } // GEN-LAST:event_tableMousePressed
예제 #6
0
    public void mouseReleased(java.awt.event.MouseEvent e) {
      if (dragTargetArea != null) {

        // Turn off the drag button and feedback
        getDragButton().setVisible(false);
        paintTargetFeedback(-1, -1);

        e.translatePoint(dragSourceArea.x, dragSourceArea.y);
        Point p = makeSafePoint(e.getX(), e.getY());

        JButton b = (JButton) e.getSource();
        if (isClick || dragTargetArea.contains(p.x, p.y)) {
          // if we're considered a simple click, or the dragging ended
          // within the target area, perform the move.
          slide(buttons.indexOf(b));
        } else {
          // The drag finished outside the target, so just show the
          // hidden button and don't move anything.
          b.setVisible(true);
        }
        dragTargetArea = null;
        dragSourceArea = null;
      }
    }
예제 #7
0
  private void jList1MouseClicked(
      java.awt.event.MouseEvent evt) { // GEN-FIRST:event_jList1MouseClicked

    if (evt.getClickCount() == 1 && evt.getButton() == evt.BUTTON3) {
      jMenuItemCopy.setEnabled(jList1.getSelectedIndex() >= 0);
      jMenuItemPaste.setEnabled(
          it.businesslogic.ireport.gui.MainFrame.getMainInstance().getChartSeriesClipBoard() != null
              && it.businesslogic.ireport.gui.MainFrame.getMainInstance()
                      .getChartSeriesClipBoard()
                      .size()
                  > 0);

      jPopupMenuCategorySeries.show(jList1, evt.getPoint().x, evt.getPoint().y);
    } else if (evt.getClickCount() == 2 && evt.getButton() == evt.BUTTON1) {
      jButtonModifyActionPerformed(null);
    }
  } // GEN-LAST:event_jList1MouseClicked
예제 #8
0
 private void bookmarksListMouseClicked(
     java.awt.event.MouseEvent evt) { // GEN-FIRST:event_bookmarksListMouseClicked
   if (evt.getClickCount() == 2) {
     gotoButtonActionPerformed(null);
   }
 } // GEN-LAST:event_bookmarksListMouseClicked