java.awt.event.MouseMotionAdapter Java Examples
The following examples show how to use
java.awt.event.MouseMotionAdapter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: frmMap.java From MeteoInfo with GNU Lesser General Public License v3.0 | 6 votes |
private void setMapView() { //Add map view mapView.setLockViewUpdate(true); this.jPanel_MapTab.removeAll(); this.jPanel_MapTab.add(mapView, BorderLayout.CENTER); mapView.setLockViewUpdate(false); mapView.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) { //mapView_MouseMoved(e); } }); mapView.setFocusable(true); mapView.requestFocusInWindow(); }
Example #2
Source File: HistogramPanel.java From pdfxtk with Apache License 2.0 | 6 votes |
/** Constructs the histogram panel object. @param histogram Histogram to display */ public HistogramPanel(Histogram h) { this.histogram = h; initClass(); addMouseMotionListener(new MouseMotionAdapter() { public void mouseMoved(MouseEvent e) { int x = e.getX(); int bin = x*maxBins / size.width; int[][] bins = histogram.getBins(); int numBands = bins.length; String txt = Integer.toString(bins[0][bin]); for (int i = 1; i < numBands; i++) { txt = txt+","+bins[i][bin]; } setToolTipText("Bin: "+bin+" ["+txt+"]"); } }); }
Example #3
Source File: MacButtonlessScrollbarUI.java From consulo with Apache License 2.0 | 6 votes |
protected MacButtonlessScrollbarUI() { myMouseMotionListener = new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) { boolean inside = isOverThumb(e.getPoint()); if (inside != myMouseIsOverThumb) { myMouseIsOverThumb = inside; e.getComponent().repaint(); } } }; myMouseListener = new MouseAdapter() { @Override public void mouseExited(MouseEvent e) { if (myMouseIsOverThumb) { myMouseIsOverThumb = false; e.getComponent().repaint(); } } }; }
Example #4
Source File: ImagePermanentViewer.java From magarena with GNU General Public License v3.0 | 6 votes |
private void setMouseMotionListener() { addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(final MouseEvent event) { final int cardIndex = getPermanentInfoIndexAt(event.getX(), event.getY()); final boolean isCardChanged = (currentCardIndex != cardIndex); if (cardIndex >= 0) { if (isCardChanged) { if (!CONFIG.isMouseWheelPopup() || viewer.getController().isPopupVisible()) { showCardPopup(cardIndex); } } } else { viewer.getController().hideInfo(); } currentCardIndex = cardIndex; if (linkedScreenRectangles.size() > 1) { redrawCachedImage(); } } }); }
Example #5
Source File: UI.java From txtUML with Eclipse Public License 1.0 | 6 votes |
GaragePanel(UI p) { super("src/hu/elte/txtuml/examples/garage/images/garage.jpg"); parent = p; try { doorImg = ImageIO.read(new File("src/hu/elte/txtuml/examples/garage/images/door.jpg")); sirenImg1 = ImageIO.read(new File("src/hu/elte/txtuml/examples/garage/images/siren1.jpg")); sirenImg2 = ImageIO.read(new File("src/hu/elte/txtuml/examples/garage/images/siren2.jpg")); } catch (IOException e) { System.out.println("Error: Cannot load some image."); } addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent me) { Rectangle doorRect = new Rectangle(doorX, doorY, doorImg.getWidth(), doorImg.getHeight()); if (doorRect.contains(me.getPoint())) { parent.control.motionSensorActivated(); parent.control.alarmSensorActivated(); setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); } else { setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); }
Example #6
Source File: GanttTreeTable.java From ganttproject with GNU General Public License v3.0 | 6 votes |
GanttTreeTable(IGanttProject project, final UIFacade uifacade, GanttTreeTableModel model) { super(project, uifacade, project.getTaskCustomColumnManager(), model); myUIfacade = uifacade; getTableHeaderUiFacade().createDefaultColumns(TaskDefaultColumn.getColumnStubs()); setDropMode(DropMode.ON); final GPTreeTransferHandler transferHandler = new GPTreeTransferHandler(this, project.getTaskManager(), new Supplier<GanttChart>() { @Override public GanttChart get() { return uifacade.getGanttChart(); } }, uifacade.getUndoManager()); setTransferHandler(transferHandler); addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseDragged(MouseEvent e) { setEditingStartExpected(false); transferHandler.exportAsDrag(getTable(), e, TransferHandler.MOVE); } }); }
Example #7
Source File: bug7154841.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
private static void initAndShowUI() { popupMenu = new JPopupMenu(); for (int i = 0; i < 100; i++) { JRadioButtonMenuItem item = new JRadioButtonMenuItem(" Test " + i); item.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) { passed = true; } }); popupMenu.add(item); } frame = new JFrame(); screenBounds.set(getScreenBounds()); frame.setBounds(screenBounds.get()); frame.setVisible(true); }
Example #8
Source File: bug7154841.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private static void initAndShowUI() { popupMenu = new JPopupMenu(); for (int i = 0; i < 100; i++) { JRadioButtonMenuItem item = new JRadioButtonMenuItem(" Test " + i); item.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) { passed = true; } }); popupMenu.add(item); } frame = new JFrame(); screenBounds.set(getScreenBounds()); frame.setBounds(screenBounds.get()); frame.setVisible(true); }
Example #9
Source File: ProgressGlassPane.java From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** Creates a new instance of ProgressGlassPane */ public ProgressGlassPane() { // blocks all user input addMouseListener(new MouseAdapter() { }); addMouseMotionListener(new MouseMotionAdapter() { }); addKeyListener(new KeyAdapter() { }); setFocusTraversalKeysEnabled(false); addComponentListener(new ComponentAdapter() { public void componentShown(ComponentEvent evt) { requestFocusInWindow(); } }); setBackground(Color.WHITE); setFont(new Font("Default", Font.BOLD, 16)); }
Example #10
Source File: ComponentsFactory.java From MercuryTrade with MIT License | 6 votes |
public JSlider getSlider(int min, int max, int value) { JSlider slider = new JSlider(JSlider.HORIZONTAL, min, max, value); slider.setMajorTickSpacing(10); slider.setMinorTickSpacing(1); // slider.setPaintLabels(true); // slider.setUI(new WindowsSliderUI(slider)); slider.setForeground(AppThemeColor.TEXT_DEFAULT); slider.setFont(REGULAR_FONT.deriveFont(15f)); slider.setRequestFocusEnabled(false); slider.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseDragged(MouseEvent e) { slider.getParent().repaint(); } }); slider.setBackground(AppThemeColor.FRAME); return slider; }
Example #11
Source File: bug7154841.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private static void initAndShowUI() { popupMenu = new JPopupMenu(); for (int i = 0; i < 100; i++) { JRadioButtonMenuItem item = new JRadioButtonMenuItem(" Test " + i); item.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) { passed = true; } }); popupMenu.add(item); } frame = new JFrame(); screenBounds.set(getScreenBounds()); frame.setBounds(screenBounds.get()); frame.setVisible(true); }
Example #12
Source File: AutocompleteTextField.java From pumpernickel with MIT License | 6 votes |
/** * Install listeners during construction that are unique for the * AutocompleteTextField. */ private void setup() { suggestionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); popup.add(scrollPane); suggestionList.setFixedCellHeight(20); suggestionList.setFocusable(false); scrollPane.setFocusable(false); popup.setFocusable(false); suggestionList.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) { int i = suggestionList.getUI().locationToIndex(suggestionList, e.getPoint()); getModel().setSuggestions(model.suggestions, model.selectedIndex, i); } }); getDocument().addDocumentListener(docListener); addKeyListener(keyListener); model.addChangeListener(modelListener); suggestionList.addListSelectionListener(listListener); }
Example #13
Source File: bug7154841.java From hottub with GNU General Public License v2.0 | 6 votes |
private static void initAndShowUI() { popupMenu = new JPopupMenu(); for (int i = 0; i < 100; i++) { JRadioButtonMenuItem item = new JRadioButtonMenuItem(" Test " + i); item.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) { passed = true; } }); popupMenu.add(item); } frame = new JFrame(); screenBounds.set(getScreenBounds()); frame.setBounds(screenBounds.get()); frame.setVisible(true); }
Example #14
Source File: bug7154841.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private static void initAndShowUI() { popupMenu = new JPopupMenu(); for (int i = 0; i < 100; i++) { JRadioButtonMenuItem item = new JRadioButtonMenuItem(" Test " + i); item.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) { passed = true; } }); popupMenu.add(item); } frame = new JFrame(); screenBounds.set(getScreenBounds()); frame.setBounds(screenBounds.get()); frame.setVisible(true); }
Example #15
Source File: bug7154841.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private static void initAndShowUI() { popupMenu = new JPopupMenu(); for (int i = 0; i < 100; i++) { JRadioButtonMenuItem item = new JRadioButtonMenuItem(" Test " + i); item.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) { passed = true; } }); popupMenu.add(item); } frame = new JFrame(); screenBounds.set(getScreenBounds()); frame.setBounds(screenBounds.get()); frame.setVisible(true); }
Example #16
Source File: bug7154841.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private static void initAndShowUI() { popupMenu = new JPopupMenu(); for (int i = 0; i < 100; i++) { JRadioButtonMenuItem item = new JRadioButtonMenuItem(" Test " + i); item.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) { passed = true; } }); popupMenu.add(item); } frame = new JFrame(); screenBounds.set(getScreenBounds()); frame.setBounds(screenBounds.get()); frame.setVisible(true); }
Example #17
Source File: bug7154841.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private static void initAndShowUI() { popupMenu = new JPopupMenu(); for (int i = 0; i < 100; i++) { JRadioButtonMenuItem item = new JRadioButtonMenuItem(" Test " + i); item.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) { passed = true; } }); popupMenu.add(item); } frame = new JFrame(); screenBounds.set(getScreenBounds()); frame.setBounds(screenBounds.get()); frame.setVisible(true); }
Example #18
Source File: bug7154841.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private static void initAndShowUI() { popupMenu = new JPopupMenu(); for (int i = 0; i < 100; i++) { JRadioButtonMenuItem item = new JRadioButtonMenuItem(" Test " + i); item.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) { passed = true; } }); popupMenu.add(item); } frame = new JFrame(); screenBounds.set(getScreenBounds()); frame.setBounds(screenBounds.get()); frame.setVisible(true); }
Example #19
Source File: SplitPanel.java From ghidra with Apache License 2.0 | 6 votes |
Divider() { if (isHorizontal) { setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR)); } else { setCursor(Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR)); } addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseDragged(MouseEvent e) { if (isHorizontal) { dividerPosition += (float) e.getX() / (float) SplitPanel.this.getWidth(); } else { dividerPosition += (float) e.getY() / (float) SplitPanel.this.getHeight(); } SplitPanel.this.doLayout(); SplitPanel.this.validate(); } }); }
Example #20
Source File: bug7154841.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private static void initAndShowUI() { popupMenu = new JPopupMenu(); for (int i = 0; i < 100; i++) { JRadioButtonMenuItem item = new JRadioButtonMenuItem(" Test " + i); item.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) { passed = true; } }); popupMenu.add(item); } frame = new JFrame(); screenBounds.set(getScreenBounds()); frame.setBounds(screenBounds.get()); frame.setVisible(true); }
Example #21
Source File: bug7154841.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private static void initAndShowUI() { popupMenu = new JPopupMenu(); for (int i = 0; i < 100; i++) { JRadioButtonMenuItem item = new JRadioButtonMenuItem(" Test " + i); item.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) { passed = true; } }); popupMenu.add(item); } frame = new JFrame(); screenBounds.set(getScreenBounds()); frame.setBounds(screenBounds.get()); frame.setVisible(true); }
Example #22
Source File: Outline.java From netbeans with Apache License 2.0 | 6 votes |
@Override public JToolTip createToolTip() { JToolTip t = toolTip; toolTip = null; if (t != null) { t.addMouseMotionListener(new MouseMotionAdapter() { // #233642 boolean initialized = false; @Override public void mouseMoved(MouseEvent e) { if (!initialized) { initialized = true; // ignore the first event } else { // hide the tooltip if mouse moves over it ToolTipManager.sharedInstance().mousePressed(e); } } }); return t; } else { return super.createToolTip(); } }
Example #23
Source File: AutoHidingMenuBarManualTestApp.java From netbeans with Apache License 2.0 | 6 votes |
private void initComponents() { addFakeMenuItems(); frame.setJMenuBar(mainMenuBar); frame.setSize(400, 280); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); JEditorPane pane = new JEditorPane(); // Make sure that consumed events do not cause problems. pane.addMouseMotionListener(new MouseMotionAdapter() { }); frame.add(pane, BorderLayout.CENTER); frame.add(new JLabel("This is a label"), BorderLayout.SOUTH); /* Simulate a full-screen window so that the very top (y=0) of the JFrame can receive mouse motion events. The Window will end up aligned to the top of the screen. */ frame.setUndecorated(true); new AutoHidingMenuBar(frame).setAutoHideEnabled(true); }
Example #24
Source File: PopupTreeAdapter.java From consulo with Apache License 2.0 | 5 votes |
@Override public JScrollPane createScrollPane() { TreeUtil.expandAll(myTree); JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree); scrollPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); if (myTree.getSelectionCount() == 0) { myTree.setSelectionRow(0); } if (myTree.getRowCount() >= 20) { scrollPane.getViewport().setPreferredSize(new Dimension(myTree.getPreferredScrollableViewportSize().width, 300)); } else { scrollPane.getViewport().setPreferredSize(myTree.getPreferredSize()); } if (myBuilder.isAutoselectOnMouseMove()) { myTree.addMouseMotionListener(new MouseMotionAdapter() { boolean myIsEngaged = false; @Override public void mouseMoved(MouseEvent e) { if (myIsEngaged) { final Point p = e.getPoint(); int index = myTree.getRowForLocation(p.x, p.y); myTree.setSelectionRow(index); } else { myIsEngaged = true; } } }); } return scrollPane; }
Example #25
Source File: PopupTableAdapter.java From consulo with Apache License 2.0 | 5 votes |
@Override public JScrollPane createScrollPane() { if (myTable instanceof TreeTable) { TreeUtil.expandAll(((TreeTable)myTable).getTree()); } JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTable); scrollPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); if (myTable.getSelectedRow() == -1) { myTable.getSelectionModel().setSelectionInterval(0, 0); } if (myTable.getRowCount() >= 20) { scrollPane.getViewport().setPreferredSize(new Dimension(myTable.getPreferredScrollableViewportSize().width, 300)); } else { scrollPane.getViewport().setPreferredSize(myTable.getPreferredSize()); } if (myBuilder.isAutoselectOnMouseMove()) { myTable.addMouseMotionListener(new MouseMotionAdapter() { boolean myIsEngaged = false; @Override public void mouseMoved(MouseEvent e) { if (myIsEngaged) { int index = myTable.rowAtPoint(e.getPoint()); myTable.getSelectionModel().setSelectionInterval(index, index); } else { myIsEngaged = true; } } }); } return scrollPane; }
Example #26
Source File: IdeRootPane.java From consulo with Apache License 2.0 | 5 votes |
public IdeRootPane(ActionManager actionManager, DataManager dataManager, Application application, final IdeFrame frame) { myActionManager = actionManager; myContentPane.add(myNorthPanel, BorderLayout.NORTH); myContentPane.addMouseMotionListener(new MouseMotionAdapter() {}); // listen to mouse motion events for a11y createStatusBar(frame); updateStatusBarVisibility(); myContentPane.add(myStatusBar, BorderLayout.SOUTH); if (WindowManagerEx.getInstanceEx().isFloatingMenuBarSupported()) { menuBar = new IdeMenuBar(actionManager, dataManager); getLayeredPane().add(menuBar, new Integer(JLayeredPane.DEFAULT_LAYER - 1)); if (frame instanceof IdeFrameEx) { addPropertyChangeListener(WindowManagerEx.FULL_SCREEN, __ -> myFullScreen = ((IdeFrameEx)frame).isInFullScreen()); } } else { setJMenuBar(new IdeMenuBar(actionManager, dataManager)); } IdeGlassPaneImpl glassPane = new IdeGlassPaneImpl(this, true); setGlassPane(glassPane); myGlassPaneInitialized = true; SwingUIDecorator.apply(SwingUIDecorator::decorateWindowTitle, this); glassPane.setVisible(false); }
Example #27
Source File: ImageCardListViewer.java From magarena with GNU General Public License v3.0 | 5 votes |
private void setMouseMotionListener() { addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(final MouseEvent event) { final int cardIndex = getCardIndexAt(event.getX(), event.getY()); final boolean isCardChanged = (currentCardIndex != cardIndex); if (cardIndex >= 0) { if (isCardChanged && imageMode != CardImageViewerMode.FACEDOWN) { if (!CONFIG.isMouseWheelPopup() || controller.isPopupVisible()) { showCardPopup(cardIndex); } else { // handles case where mousewheel popup is enabled and the mouseExited // event does not fire because cards overlap. controller.hideInfo(); } } } else if (isCardChanged) { controller.hideInfo(); } if (isCardChanged) { // highlight new card mouse cursor is over. currentCardIndex = cardIndex; repaint(); } } }); }
Example #28
Source File: TopTablePanel.java From ramus with GNU General Public License v3.0 | 5 votes |
public TopTablePanel(final ElistTablePanel panel, JTable table) { super(table.getColumnModel()); this.panel = panel; this.table = table; this.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) { setToolTipText(panel.getToolTipText(getHeight() - e.getY(), e .getX())); } }); setResizingAllowed(false); panel.setSize(getSize().height, getSize().width); }
Example #29
Source File: CardsCanvas.java From magarena with GNU General Public License v3.0 | 5 votes |
private void setMouseMotionListener() { addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(final MouseEvent event) { final int cardIndex = getCardIndexAt(event.getX(), event.getY()); if (currentCardIndex != cardIndex) { if (cardIndex >= 0) { listener.cardSelected(cards.get(cardIndex).getCardDefinition()); } currentCardIndex = cardIndex; repaint(); } } }); }
Example #30
Source File: AnnotatedCardPanel.java From magarena with GNU General Public License v3.0 | 5 votes |
private void setMouseMovedListener() { addMouseMotionListener(new MouseMotionAdapter() { private CardIcon currentIcon; @Override public void mouseMoved(MouseEvent e) { if (popupMode == PopupMode.Prompt) { setVisible(false); return; } if (!cardIcons.isEmpty() && !iconShapes.isEmpty()) { final Shape lastShape = iconShapes.get(iconShapes.size() - 1); final Dimension lastShapeSize = new Dimension(lastShape.getBounds().width, lastShape.getBounds().y + lastShape.getBounds().height); final Rectangle rect = new Rectangle(0, 0, lastShapeSize.width, lastShapeSize.height); if (rect.contains(e.getPoint())) { for (Shape iconShape : iconShapes) { if (iconShape.contains(e.getPoint())) { final CardIcon cardIcon = cardIcons.get(iconShapes.indexOf(iconShape)); if (currentIcon != cardIcon) { currentIcon = cardIcon; showInfoTip(cardIcon, new Point(e.getXOnScreen(), e.getYOnScreen())); } break; } } } else if (infoWindow.isVisible()) { boolean hideInfo = true; currentIcon = null; if (hideInfo) { infoWindow.setVisible(false); } } } } }); }