List of usage examples for java.awt AWTEvent MOUSE_EVENT_MASK
long MOUSE_EVENT_MASK
To view the source code for java.awt AWTEvent MOUSE_EVENT_MASK.
Click Source Link
From source file:com.hp.alm.ali.idea.content.taskboard.TaskBoardPanel.java
public TaskBoardPanel(final Project project) { super(new BorderLayout()); this.project = project; status = new EntityStatusPanel(project); queue = new QueryQueue(project, status, false); entityService = project.getComponent(EntityService.class); entityService.addEntityListener(this); sprintService = project.getComponent(SprintService.class); sprintService.addListener(this); loadTasks();//from w w w .j a va 2 s . c o m header = new Header(); columnHeader = new ColumnHeader(); content = new Content(); add(content, BorderLayout.NORTH); header.assignedTo.reload(); // force mouse-over task as visible (otherwise events are captured by the overlay and repaint quirks) Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { @Override public void eventDispatched(AWTEvent event) { if (isShowing() && event.getID() == MouseEvent.MOUSE_MOVED) { MouseEvent m = (MouseEvent) event; TaskPanel currentPanel = locateContainer(m, TaskPanel.class); if (currentPanel != null) { if (forcedTaskPanel == currentPanel) { return; } else if (forcedTaskPanel != null) { forcedTaskPanel.removeForcedMatch(this); } forcedTaskPanel = currentPanel; forcedTaskPanel.addForcedMatch(this); } else if (forcedTaskPanel != null) { forcedTaskPanel.removeForcedMatch(this); forcedTaskPanel = null; } } } }, AWTEvent.MOUSE_MOTION_EVENT_MASK); Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { @Override public void eventDispatched(AWTEvent event) { if (isShowing()) { MouseEvent m = (MouseEvent) event; switch (event.getID()) { case MouseEvent.MOUSE_PRESSED: case MouseEvent.MOUSE_RELEASED: // implement backlog item popup if (m.isPopupTrigger()) { final BacklogItemPanel itemPanel = locateContainer(m, BacklogItemPanel.class); if (itemPanel != null) { ActionPopupMenu popupMenu = ActionUtil.createEntityActionPopup("taskboard"); Point p = SwingUtilities.convertPoint(m.getComponent(), m.getPoint(), itemPanel); popupMenu.getComponent().show(itemPanel, p.x, p.y); } } break; case MouseEvent.MOUSE_CLICKED: // implement backlog item double click if (m.getClickCount() > 1) { BacklogItemPanel itemPanel = locateContainer(m, BacklogItemPanel.class); if (itemPanel != null) { Entity backlogItem = itemPanel.getItem(); Entity workItem = new Entity(backlogItem.getPropertyValue("entity-type"), Integer.valueOf(backlogItem.getPropertyValue("entity-id"))); AliContentFactory.loadDetail(project, workItem, true, true); } } } } } }, AWTEvent.MOUSE_EVENT_MASK); }
From source file:org.gvsig.remotesensing.scatterplot.chart.ScatterPlotDiagram.java
/** * Constructs a JFreeChart panel./*from w ww .ja v a 2s .c om*/ * * @param chart the chart. * @param width the preferred width of the panel. * @param height the preferred height of the panel. * @param minimumDrawWidth the minimum drawing width. * @param minimumDrawHeight the minimum drawing height. * @param maximumDrawWidth the maximum drawing width. * @param maximumDrawHeight the maximum drawing height. * @param useBuffer a flag that indicates whether to use the off-screen * buffer to improve performance (at the expense of * memory). * @param properties a flag indicating whether or not the chart property * editor should be available via the popup menu. * @param save a flag indicating whether or not save options should be * available via the popup menu. * @param print a flag indicating whether or not the print option * should be available via the popup menu. * @param zoom a flag indicating whether or not zoom options should be * added to the popup menu. * @param tooltips a flag indicating whether or not tooltips should be * enabled for the chart. */ public ScatterPlotDiagram(JFreeChart chart, int width, int height, int minimumDrawWidth, int minimumDrawHeight, int maximumDrawWidth, int maximumDrawHeight, boolean useBuffer, boolean properties, boolean save, boolean print, boolean zoom, boolean tooltips) { this.setChart(chart); this.chartMouseListeners = new EventListenerList(); this.info = new ChartRenderingInfo(); setPreferredSize(new Dimension(width, height)); this.useBuffer = useBuffer; this.refreshBuffer = false; this.minimumDrawWidth = minimumDrawWidth; this.minimumDrawHeight = minimumDrawHeight; this.maximumDrawWidth = maximumDrawWidth; this.maximumDrawHeight = maximumDrawHeight; this.zoomTriggerDistance = DEFAULT_ZOOM_TRIGGER_DISTANCE; this.popup = null; if (properties || save || print || zoom) { this.popup = createPopupMenu(properties, save, print, zoom); } enableEvents(AWTEvent.MOUSE_EVENT_MASK); enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK); setDisplayToolTips(tooltips); addMouseListener(this); addMouseMotionListener(this); this.defaultDirectoryForSaveAs = null; this.enforceFileExtensions = true; }
From source file:com.projity.contrib.calendar.JXXMonthView.java
/** * Create a new instance of the <code>JXMonthView</code> class using the * month and year from <code>initialTime</code> as the first date to * display./* ww w.j a v a 2s. co m*/ * * @param initialTime * The first month to display. */ public JXXMonthView(long initialTime) { super(); _ltr = getComponentOrientation().isLeftToRight(); // Set up calendar instance. _cal = calendarInstance(); //PROJITY_MODIFICATION _cal.setFirstDayOfWeek(_firstDayOfWeek); _cal.setMinimalDaysInFirstWeek(1); //PROJITY_MODIFICATION // needed for weeks with less than 3 days so that they start on week 1 instead of week 0 // Keep track of today. _cal.set(Calendar.HOUR_OF_DAY, 0); _cal.set(Calendar.MINUTE, 0); _cal.set(Calendar.SECOND, 0); _cal.set(Calendar.MILLISECOND, 0); _today = _cal.getTimeInMillis(); _cal.setTimeInMillis(initialTime); setFirstDisplayedDate(_cal.getTimeInMillis()); // Get string representation of the months of the year. _cal.set(Calendar.MONTH, _cal.getMinimum(Calendar.MONTH)); _cal.set(Calendar.DAY_OF_MONTH, _cal.getActualMinimum(Calendar.DAY_OF_MONTH)); _monthsOfTheYear = new String[MONTHS_IN_YEAR]; SimpleDateFormat fullMonthNameFormatter = dateFormatInstance("MMMM"); for (int i = 0; i < MONTHS_IN_YEAR; i++) { _monthsOfTheYear[i] = fullMonthNameFormatter.format(_cal.getTime()); _cal.add(Calendar.MONTH, 1); } setOpaque(true); setBackground(Color.WHITE); setFont(new Font("Dialog", Font.PLAIN, 12)); _todayBackgroundColor = getForeground(); // Restore original time value. _cal.setTimeInMillis(_firstDisplayedDate); enableEvents(AWTEvent.MOUSE_EVENT_MASK); enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK); updateUI(); }
From source file:com.googlecode.vfsjfilechooser2.VFSJFileChooser.java
/** * Performs common constructor initialization and setup. * @param view//from w ww . j a v a2 s . co m */ protected void setup(AbstractVFSFileSystemView view) { installShowFilesListener(); if (view == null) { view = AbstractVFSFileSystemView.getFileSystemView(); } setFileSystemView(view); updateUI(); if (isAcceptAllFileFilterUsed()) { setFileFilter(getAcceptAllFileFilter()); } enableEvents(AWTEvent.MOUSE_EVENT_MASK); }
From source file:com.rapidminer.gui.plotter.charts.AbstractChartPanel.java
/** * Constructs a JFreeChart panel./*ww w.j a va 2 s . co m*/ * * @param chart * the chart. * @param width * the preferred width of the panel. * @param height * the preferred height of the panel. * @param minimumDrawWidth * the minimum drawing width. * @param minimumDrawHeight * the minimum drawing height. * @param maximumDrawWidth * the maximum drawing width. * @param maximumDrawHeight * the maximum drawing height. * @param useBuffer * a flag that indicates whether to use the off-screen buffer to improve performance * (at the expense of memory). * @param properties * a flag indicating whether or not the chart property editor should be available via * the popup menu. * @param copy * a flag indicating whether or not a copy option should be available via the popup * menu. * @param save * a flag indicating whether or not save options should be available via the popup * menu. * @param print * a flag indicating whether or not the print option should be available via the * popup menu. * @param zoom * a flag indicating whether or not zoom options should be added to the popup menu. * @param tooltips * a flag indicating whether or not tooltips should be enabled for the chart. * * @since 1.0.13 */ public AbstractChartPanel(JFreeChart chart, int width, int height, int minimumDrawWidth, int minimumDrawHeight, int maximumDrawWidth, int maximumDrawHeight, boolean useBuffer, boolean properties, boolean copy, boolean save, boolean print, boolean zoom, boolean tooltips) { super(chart, width, height, minimumDrawWidth, minimumDrawHeight, maximumDrawWidth, maximumDrawHeight, false, properties, copy, save, print, zoom, tooltips); setChart(chart); this.chartMouseListeners = new EventListenerList(); this.info = new ChartRenderingInfo(); setPreferredSize(new Dimension(width, height)); this.minimumDrawWidth = minimumDrawWidth; this.minimumDrawHeight = minimumDrawHeight; this.maximumDrawWidth = maximumDrawWidth; this.maximumDrawHeight = maximumDrawHeight; this.zoomTriggerDistance = DEFAULT_ZOOM_TRIGGER_DISTANCE; // set up popup menu... this.popup = null; if (properties || copy || save || print || zoom) { this.popup = createPopupMenu(properties, copy, save, print, zoom); } enableEvents(AWTEvent.MOUSE_EVENT_MASK); enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK); setDisplayToolTips(tooltips); // mouse listener registered in super class // addMouseListener(this); // addMouseMotionListener(this); this.defaultDirectoryForSaveAs = null; this.enforceFileExtensions = true; // initialize ChartPanel-specific tool tip delays with // values the from ToolTipManager.sharedInstance() ToolTipManager ttm = ToolTipManager.sharedInstance(); this.ownToolTipInitialDelay = ttm.getInitialDelay(); this.ownToolTipDismissDelay = ttm.getDismissDelay(); this.ownToolTipReshowDelay = ttm.getReshowDelay(); this.zoomAroundAnchor = false; this.selectionOutlinePaint = Color.blue; this.selectionFillPaint = new Color(0, 0, 255, 63); this.panMask = InputEvent.CTRL_MASK; // for MacOSX we can't use the CTRL key for mouse drags, see: // http://developer.apple.com/qa/qa2004/qa1362.html String osName = System.getProperty("os.name").toLowerCase(); if (osName.startsWith("mac os x")) { this.panMask = InputEvent.ALT_MASK; } this.overlays = new java.util.ArrayList<>(); // adding wheel listener addMouseWheelListener(new MouseWheelListener() { @Override public void mouseWheelMoved(MouseWheelEvent e) { if (e.getScrollType() != MouseWheelEvent.WHEEL_UNIT_SCROLL) { return; } if (e.getWheelRotation() < 0) { shrinkSelectionOnCenter(e.getX(), e.getY(), e); } else { enlargeSelectionOnCenter(e.getX(), e.getY(), e); } } }); }
From source file:brainflow.app.toplevel.BrainFlow.java
private void initializeToolBar() { CommandGroup mainToolbarGroup = new CommandGroup("main-toolbar"); mainToolbarGroup.bind(getApplicationFrame()); ToggleGroup interpToggleGroup = new ToggleGroup("toggle-interp-group"); interpToggleGroup.bind(getApplicationFrame()); bindCommand(new OpenImageCommand(), true); bindCommand(new SnapshotCommand(), true); bindCommand(new NewCanvasCommand(), true); bindCommand(new CreateAxialViewCommand(), true); bindCommand(new CreateSagittalViewCommand(), true); bindCommand(new CreateCoronalViewCommand(), true); bindCommand(new CreateMontageViewCommand(), true); bindCommand(new CreateVerticalOrthogonalCommand(), true); bindCommand(new CreateHorizontalOrthogonalCommand(), true); bindCommand(new CreateTriangularOrthogonalCommand(), true); CommandGroup orthoGroup = new CommandGroup("ortho-view-group"); orthoGroup.bind(getApplicationFrame()); final NextSliceCommand nextSliceCommand = new NextSliceCommand(); bindCommand(nextSliceCommand, false); final PreviousSliceCommand previousSliceCommand = new PreviousSliceCommand(); bindCommand(previousSliceCommand, false); bindCommand(new PageBackSliceCommand(), true); bindCommand(new PageForwardSliceCommand(), true); bindCommand(new IncreaseContrastCommand(), true); bindCommand(new DecreaseContrastCommand(), true); bindCommand(new NearestInterpolationToggleCommand(), true); bindCommand(new LinearInterpolationToggleCommand(), true); bindCommand(new CubicInterpolationToggleCommand(), true); bindCommand(new ToggleAxisLabelCommand(), true); bindCommand(new ToggleCrossCommand(), true); //JToolBar mainToolbar = mainToolbarGroup.createToolBar(); final CommandBar mainToolbar = new CommandBar(); // for nimbus look and feel mainToolbar.setPaintBackground(false); // for nimbus look and feel mainToolbar.setBorder(new EmptyBorder(0, 0, 0, 0)); final ButtonFactory buttonFactory = createToolBarButtonFactory(); mainToolbarGroup.visitMembers(new GroupVisitor() { @Override//from w ww . j a v a 2 s . c o m public void visit(ActionCommand actionCommand) { JideButton jb = new JideButton(actionCommand.getActionAdapter()); jb.setButtonStyle(JideButton.TOOLBAR_STYLE); jb.setText(""); mainToolbar.add(jb); } @Override public void visit(CommandGroup commandGroup) { JComponent jc = commandGroup.createButton(buttonFactory); mainToolbar.add(jc); } }); mainToolbar.setKey("toolbar"); brainFrame.getDockableBarManager().addDockableBar(mainToolbar); Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { public void eventDispatched(AWTEvent event) { if (event.getID() == KeyEvent.KEY_PRESSED) { KeyEvent ke = (KeyEvent) event; Component comp = ke.getComponent(); if (ke.getKeyCode() == KeyEvent.VK_LEFT) { ImageView view = BrainFlow.get().getSelectedView(); if (/*view.hasFocus() || */ parentIsImageView(comp)) { previousSliceCommand.execute(); } } else if (ke.getKeyCode() == KeyEvent.VK_RIGHT) { ImageView view = BrainFlow.get().getSelectedView(); if ( /*view.hasFocus() */ parentIsImageView(comp)) { nextSliceCommand.execute(); } else { System.out.println("no focus"); } } } } }, AWTEvent.KEY_EVENT_MASK); Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { public void eventDispatched(AWTEvent event) { if (event.getID() == MouseEvent.MOUSE_RELEASED) { MouseEvent me = (MouseEvent) event; if (me.isPopupTrigger()) { showActionMenu(me); } } } }, AWTEvent.MOUSE_EVENT_MASK); }
From source file:com.isti.traceview.common.TraceViewChartPanel.java
/** * Constructs a JFreeChart panel./* w w w .j a va2s. co m*/ * * @param chart * the chart. * @param width * the preferred width of the panel. * @param height * the preferred height of the panel. * @param minimumDrawWidth * the minimum drawing width. * @param minimumDrawHeight * the minimum drawing height. * @param maximumDrawWidth * the maximum drawing width. * @param maximumDrawHeight * the maximum drawing height. * @param useBuffer * a flag that indicates whether to use the off-screen buffer to improve performance * (at the expense of memory). * @param properties * a flag indicating whether or not the chart property editor should be available via * the popup menu. * @param save * a flag indicating whether or not save options should be available via the popup * menu. * @param print * a flag indicating whether or not the print option should be available via the * popup menu. * @param zoom * a flag indicating whether or not zoom options should be added to the popup menu. * @param tooltips * a flag indicating whether or not tooltips should be enabled for the chart. */ public TraceViewChartPanel(JFreeChart chart, int width, int height, int minimumDrawWidth, int minimumDrawHeight, int maximumDrawWidth, int maximumDrawHeight, boolean useBuffer, boolean properties, boolean save, boolean print, boolean zoom, boolean tooltips) { this.setChart(chart); this.chartMouseListeners = new EventListenerList(); this.info = new ChartRenderingInfo(); setPreferredSize(new Dimension(width, height)); this.useBuffer = useBuffer; this.refreshBuffer = false; this.minimumDrawWidth = minimumDrawWidth; this.minimumDrawHeight = minimumDrawHeight; this.maximumDrawWidth = maximumDrawWidth; this.maximumDrawHeight = maximumDrawHeight; this.zoomTriggerDistance = DEFAULT_ZOOM_TRIGGER_DISTANCE; // set up popup menu... this.popup = null; if (properties || save || print || zoom) { this.popup = createPopupMenu(properties, save, print, zoom); } enableEvents(AWTEvent.MOUSE_EVENT_MASK); enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK); setDisplayToolTips(tooltips); addMouseListener(this); addMouseMotionListener(this); this.enforceFileExtensions = true; // initialize ChartPanel-specific tool tip delays with // values the from ToolTipManager.sharedInstance() ToolTipManager ttm = ToolTipManager.sharedInstance(); this.ownToolTipInitialDelay = ttm.getInitialDelay(); this.ownToolTipDismissDelay = ttm.getDismissDelay(); this.ownToolTipReshowDelay = ttm.getReshowDelay(); }
From source file:org.rdv.viz.chart.ChartPanel.java
/** * Constructs a JFreeChart panel.// ww w .j av a2 s .c om * * @param chart the chart. * @param width the preferred width of the panel. * @param height the preferred height of the panel. * @param minimumDrawWidth the minimum drawing width. * @param minimumDrawHeight the minimum drawing height. * @param maximumDrawWidth the maximum drawing width. * @param maximumDrawHeight the maximum drawing height. * @param useBuffer a flag that indicates whether to use the off-screen * buffer to improve performance (at the expense of * memory). * @param properties a flag indicating whether or not the chart property * editor should be available via the popup menu. * @param save a flag indicating whether or not save options should be * available via the popup menu. * @param print a flag indicating whether or not the print option * should be available via the popup menu. * @param zoom a flag indicating whether or not zoom options should be * added to the popup menu. * @param tooltips a flag indicating whether or not tooltips should be * enabled for the chart. */ public ChartPanel(JFreeChart chart, int width, int height, int minimumDrawWidth, int minimumDrawHeight, int maximumDrawWidth, int maximumDrawHeight, boolean useBuffer, boolean properties, boolean save, boolean print, boolean zoom, boolean tooltips) { this.setChart(chart); this.chartMouseListeners = new EventListenerList(); this.info = new ChartRenderingInfo(); setPreferredSize(new Dimension(width, height)); this.useBuffer = useBuffer; this.refreshBuffer = false; this.minimumDrawWidth = minimumDrawWidth; this.minimumDrawHeight = minimumDrawHeight; this.maximumDrawWidth = maximumDrawWidth; this.maximumDrawHeight = maximumDrawHeight; this.zoomTriggerDistance = DEFAULT_ZOOM_TRIGGER_DISTANCE; // set up popup menu... this.popup = null; if (properties || save || print || zoom) { this.popup = createPopupMenu(properties, save, print, zoom); } enableEvents(AWTEvent.MOUSE_EVENT_MASK); enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK); setDisplayToolTips(tooltips); addMouseListener(this); addMouseMotionListener(this); this.defaultDirectoryForSaveAs = null; this.enforceFileExtensions = true; // initialize ChartPanel-specific tool tip delays with // values the from ToolTipManager.sharedInstance() ToolTipManager ttm = ToolTipManager.sharedInstance(); this.ownToolTipInitialDelay = ttm.getInitialDelay(); this.ownToolTipDismissDelay = ttm.getDismissDelay(); this.ownToolTipReshowDelay = ttm.getReshowDelay(); this.zoomAroundAnchor = false; this.rangeHistory = new Stack<Range>(); }
From source file:javazoom.jlgui.player.amp.Player.java
/** * Instantiate Buttons Panel with ActiveComponent. * Add them to window and ActionListener. *//*from ww w . j av a 2 s. c o m*/ protected void setButtonsPanel() { int l = 0; setLayout(null); acPrevious = new ActiveComponent(releasedImage[0], pressedImage[0], AWTEvent.MOUSE_EVENT_MASK); acPrevious.setLocation(panelLocation[l++], panelLocation[l++]); add(acPrevious); acPrevious.setActionCommand("Previous"); acPrevious.addActionListener(this); acPlay = new ActiveComponent(releasedImage[1], pressedImage[1], AWTEvent.MOUSE_EVENT_MASK); acPlay.setLocation(panelLocation[l++], panelLocation[l++]); add(acPlay); acPlay.setActionCommand("Play"); acPlay.addActionListener(this); acPause = new ActiveComponent(releasedImage[2], pressedImage[2], AWTEvent.MOUSE_EVENT_MASK); acPause.setLocation(panelLocation[l++], panelLocation[l++]); add(acPause); acPause.setActionCommand("Pause"); acPause.addActionListener(this); acStop = new ActiveComponent(releasedImage[3], pressedImage[3], AWTEvent.MOUSE_EVENT_MASK); acStop.setLocation(panelLocation[l++], panelLocation[l++]); add(acStop); acStop.setActionCommand("Stop"); acStop.addActionListener(this); acNext = new ActiveComponent(releasedImage[4], pressedImage[4], AWTEvent.MOUSE_EVENT_MASK); acNext.setLocation(panelLocation[l++], panelLocation[l++]); add(acNext); acNext.setActionCommand("Next"); acNext.addActionListener(this); acEject = new ActiveComponent(releasedImage[5], pressedImage[5], AWTEvent.MOUSE_EVENT_MASK | AWTEvent.KEY_EVENT_MASK); acEject.setLocation(panelLocation[l++], panelLocation[l++]); add(acEject); acEject.setActionCommand("Eject"); acEject.addActionListener(this); }
From source file:javazoom.jlgui.player.amp.Player.java
/** * Instantiate Title Panel with ActiveComponent. * Add them to window and ActionListener. *//*from w w w . ja v a 2 s . c o m*/ protected void setTitleBarPanel() { int l = 0; acTitleBar = new ActiveComponent(releasedTitleIm[0], pressedTitleIm[0], AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK); acTitleBar.setLocation(titleBarLocation[l++], titleBarLocation[l++]); add(acTitleBar); acTitleBar.setActionCommand("TitleBar"); acTitleBar.addActionListener(this); }