private JComponent createDetails(String text, ActionListener action) { try { text = (action == null ? "<html>" : "<html><a href=\"_blank\">") + XMLUtil.toElementContent(text); //NOI18N } catch (CharConversionException ex) { throw new IllegalArgumentException(ex); } if (null == action) { return new JLabel(text); } JButton btn = new JButton(text); btn.setFocusable(false); btn.setBorder(BorderFactory.createEmptyBorder()); btn.setBorderPainted(false); btn.setFocusPainted(false); btn.setOpaque(false); btn.setContentAreaFilled(false); btn.addActionListener(action); btn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); Color c = UIManager.getColor("nb.html.link.foreground"); //NOI18N if (c != null) { btn.setForeground(c); } return btn; }
public void pSetCursor(Cursor cursor, boolean ignoreSubComponents) { XToolkit.awtLock(); try { long xcursor = XGlobalCursorManager.getCursor(cursor); XSetWindowAttributes xwa = new XSetWindowAttributes(); xwa.set_cursor(xcursor); long valuemask = XConstants.CWCursor; XlibWrapper.XChangeWindowAttributes(XToolkit.getDisplay(),getWindow(),valuemask,xwa.pData); XlibWrapper.XFlush(XToolkit.getDisplay()); xwa.dispose(); } finally { XToolkit.awtUnlock(); } }
private void dispatchResultsRendererEvent(MouseEvent e) { int column = profilingPointsTable.columnAtPoint(e.getPoint()); if (column != 3) { // if (column != 2) { // TODO: revert to 3 once Scope is enabled profilingPointsTable.setCursor(Cursor.getDefaultCursor()); // Workaround for forgotten Hand cursor from HTML renderer, TODO: fix it! return; } int row = profilingPointsTable.rowAtPoint(e.getPoint()); if (row == -1) { return; } ProfilingPoint profilingPoint = getProfilingPointAt(row); ProfilingPoint.ResultsRenderer resultsRenderer = profilingPoint.getResultsRenderer(); Rectangle cellRect = profilingPointsTable.getCellRect(row, column, true); resultsRenderer.dispatchMouseEvent(e, cellRect); }
public int closestSide(Point p, XYGraph xyg) { int n=0; double dist = 5/xScale; double dist2 = Math.abs(xyg.getXAt(p) - minX+.03*(maxX-minX)); if (dist2 < dist) {dist = dist2; n = -1;} dist2 = Math.abs(xyg.getXAt(p) - maxX-.03*(maxX-minX)); if (dist2 < dist) {dist = dist2; n = -2;} dist = 5/yScale; dist2 = Math.abs(xyg.getYAt(p) - minY+.03*(maxY-minY)); if (dist2 < dist) {dist = dist2; n = 1;} dist2 = Math.abs(xyg.getYAt(p) - maxY-.03*(maxY-minY)); if (dist2 < dist) {dist = dist2; n = 2;} if (side!=0&&n==0) if (lassoButton!=null && lassoButton.isSelected()) xyg.setCursor(Cursors.getCursor(Cursors.LASSO)); else xyg.setCursor(Cursor.getDefaultCursor()); return n; }
@Override public void mouseMoved(MouseEvent e) { if(graphics!=null){ float spacer = LayerUtilities.pixelsToUnits(graphics, 20, false); float heightOfABlock = LayerUtilities.pixelsToUnits(graphics, 30, false); int verticalOffsetOffset = -1 * (Math.round((index + 1) * spacer + index * heightOfABlock)); int startHeight = verticalOffsetOffset ; int stopHeight = verticalOffsetOffset + Math.round(heightOfABlock); Point2D pointInUnits = LayerUtilities.pixelsToUnits(graphics, e.getX(), e.getY()); int startTime = Math.round(guessedStartTimeOfStream); int stopTime = Math.round(guessedStartTimeOfStream+streamDuration); if(pointInUnits.getX() >= startTime && pointInUnits.getX() <= stopTime && pointInUnits.getY() >= startHeight && pointInUnits.getY() <= stopHeight){ ((JComponent)(e.getSource())).setCursor(new Cursor(Cursor.HAND_CURSOR)); e.consume(); } } }
public void mousePressed(MouseEvent e) { dragging = false; mouseButtonPress = e.getButton(); // If the cursor is on a point and the left button is press // the point is select if (e.getButton() == 1) { // Select the dominant if (selectedPoint != null) { selectedPoint.setSelect(true); setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); dragging = true; } else { filterStartPoint = adjustMousePoint(e.getPoint()); filterEndPoint = filterStartPoint; filtering = true; } } else if (e.getButton() == 3) { filterStartPoint = adjustMousePoint(e.getPoint()); filterEndPoint = filterStartPoint; unFiltering = true; } repaint(); }
/** * Switches the wait cursor on the NetBeans glasspane of/on * * @param on */ public static void setWaitCursor(final boolean on) { Runnable r = new Runnable() { @Override public void run() { JFrame mainWindow = (JFrame) WindowManager.getDefault().getMainWindow(); mainWindow .getGlassPane() .setCursor(Cursor.getPredefinedCursor( on ? Cursor.WAIT_CURSOR : Cursor.DEFAULT_CURSOR)); mainWindow.getGlassPane().setVisible(on); } }; if(EventQueue.isDispatchThread()) { r.run(); } else { EventQueue.invokeLater(r); } }
@Override public void showHistory() { getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { try { SQLHistoryPanel panel = new SQLHistoryPanel(getEditorPane()); Object[] options = new Object[]{ DialogDescriptor.CLOSED_OPTION }; final DialogDescriptor desc = new DialogDescriptor(panel, NbBundle.getMessage(SQLCloneableEditor.class, "LBL_SQL_HISTORY_TITLE"), false, options, DialogDescriptor.CLOSED_OPTION, DialogDescriptor.DEFAULT_ALIGN, new HelpCtx("sql_history"), null); // NOI18N Dialog dlg = DialogDisplayer.getDefault().createDialog(desc); dlg.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(SQLCloneableEditor.class, "ACSD_DLG")); dlg.setVisible(true); } finally { getComponent().setCursor(null); } } }); }
@Override public boolean mouseMoved(Point p, JComponent component) { if (bounds != null && bounds.contains(p)) { component.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); int i = item.getNextFilesToShowCount(); String tooltip; if (i > 0) { tooltip = NbBundle.getMessage(SummaryCellRenderer.class, "MSG_ShowMoreFiles", i); //NOI18N } else { tooltip = NbBundle.getMessage(SummaryCellRenderer.class, "MSG_ShowAllFiles"); //NOI18N } component.setToolTipText(tooltip); return true; } return false; }
static void setCursor(int c, Object display) { Container d = (Container) display; switch (c) { case JmolConstants.CURSOR_HAND: c = Cursor.HAND_CURSOR; break; case JmolConstants.CURSOR_MOVE: c = Cursor.MOVE_CURSOR; break; case JmolConstants.CURSOR_ZOOM: c = Cursor.N_RESIZE_CURSOR; break; case JmolConstants.CURSOR_CROSSHAIR: c = Cursor.CROSSHAIR_CURSOR; break; case JmolConstants.CURSOR_WAIT: c = Cursor.WAIT_CURSOR; break; default: d.setCursor(Cursor.getDefaultCursor()); return; } d.setCursor(Cursor.getPredefinedCursor(c)); }
public void start() { //Get things going. Request focus, set size, et cetera setSize(200, 200); setVisible(true); validate(); final Image image = new MultiResolutionCursor(); int center = sizes[0] / 2; Cursor cursor = Toolkit.getDefaultToolkit().createCustomCursor( image, new Point(center, center), "multi-resolution cursor"); Frame frame = new Frame("Test Frame"); frame.setSize(300, 300); frame.setLocation(300, 50); frame.add(new Label("Move cursor here")); frame.setCursor(cursor); frame.setVisible(true); }
void currentProjectChanged(Project newprj, NoteList nl, TaskList tl, ResourcesList rl) { // Util.debug("currentProjectChanged"); Cursor cur = App.getFrame().getCursor(); App.getFrame().setCursor(waitCursor); if (!changedByHistory) History.add(new HistoryItem(CurrentDate.get(), newprj)); if (editorPanel.isDocumentChanged()) saveNote(); /*if ((currentNote != null) && !changedByHistory && !addedToHistory) History.add(new HistoryItem(currentNote));*/ CurrentProject.save(); /*addedToHistory = false; if (!changedByHistory) { if (currentNote != null) { History.add(new HistoryItem(currentNote)); addedToHistory = true; } }*/ updateIndicators(CurrentDate.get(), tl); App.getFrame().setCursor(cur); }
/** Creates new form IsOverriddenPopup */ public IsOverriddenPopup(String caption, List<ElementDescription> declarations) { this.caption = caption; this.declarations = declarations; Collections.sort(declarations, new Comparator<ElementDescription>() { public int compare(ElementDescription o1, ElementDescription o2) { if (o1.isOverridden() == o2.isOverridden()) { return o1.getDisplayName().compareTo(o2.getDisplayName()); } if (o1.isOverridden()) { return 1; } return -1; } }); initComponents(); jList1.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); addFocusListener(this); }
@Override public void run() { final ActionsTree tree = new ActionsTree(); tree.getAccessibleContext().setAccessibleDescription( getBundleString("ACSD_ActionsTree") ); tree.getAccessibleContext().setAccessibleName( getBundleString("ACSN_ActionsTree") ); palettePanel.removeAll(); palettePanel.setBorder( BorderFactory.createEtchedBorder() ); palettePanel.add( tree, BorderLayout.CENTER ); lblHint.setLabelFor( tree ); invalidate(); validate(); repaint(); setCursor( Cursor.getDefaultCursor() ); explorerManager.setRootContext( root ); tree.expandAll(); }
protected void showDSDP() { if (whichMap == WORLDWIND) { map.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); map.getTopLevelAncestor().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if( dsdp==null ) dsdp=new DSDPDemo(this, new haxby.worldwind.db.dsdp.WWDSDP()); dsdp.show(); map.getTopLevelAncestor().setCursor(Cursor.getDefaultCursor()); map.setCursor(Cursor.getDefaultCursor()); } else super.showDSDP(); }
public RenderComponent(final Dimension size) { this.renderedConsumer = new CopyOnWriteArrayList<>(); this.fpsChangedConsumer = new CopyOnWriteArrayList<>(); // hide default cursor final BufferedImage cursorImg = ImageProcessing.getCompatibleImage(16, 16); final Cursor blankCursor = Toolkit.getDefaultToolkit().createCustomCursor(cursorImg, new Point(0, 0), "blank cursor"); this.setCursor(blankCursor); this.setSize(size); // canvas will scale when the size of this jframe gets changed this.setPreferredSize(size); }
@Override public void dragGestureRecognized(DragGestureEvent dge) { Cursor cursor = null; if(dge.getComponent() instanceof RepositoryViewer){ RepositoryViewer rv = (RepositoryViewer) dge.getComponent(); KernelRepositoryEntry kre = (KernelRepositoryEntry) rv.getSelectedValue(); if(dge.getDragAction()==DnDConstants.ACTION_COPY){ cursor = DragSource.DefaultCopyDrop; } dge.startDrag(cursor, new TransferableKernelRepositoryEntry(kre)); } }
@Override Cursor getCursor(final Point p) { final boolean isContains; synchronized (getDelegateLock()) { isContains = getDelegate().getViewport().getBounds().contains(p); } return isContains ? super.getCursor(p) : null; }
/** * Get a suitable cursor for the given component. * * @param c The component to consider. * @return A suitable {@code Cursor}, or null on failure. */ private Cursor getCursor(JComponent c) { if (c instanceof JLabel && ((JLabel)c).getIcon() instanceof ImageIcon) { Toolkit tk = Toolkit.getDefaultToolkit(); ImageIcon imageIcon = ((ImageIcon)((JLabel)c).getIcon()); Dimension bestSize = tk.getBestCursorSize(imageIcon.getIconWidth(), imageIcon.getIconHeight()); if (bestSize.width == 0 || bestSize.height == 0) return null; if (bestSize.width > bestSize.height) { bestSize.height = (int)((((double)bestSize.width) / ((double)imageIcon.getIconWidth())) * imageIcon.getIconHeight()); } else { bestSize.width = (int)((((double)bestSize.height) / ((double)imageIcon.getIconHeight())) * imageIcon.getIconWidth()); } BufferedImage scaled = ImageLibrary .createResizedImage(imageIcon.getImage(), bestSize.width, bestSize.height); Point point = new Point(bestSize.width / 2, bestSize.height / 2); try { return tk.createCustomCursor(scaled, point, "freeColDragIcon"); } catch (Exception ex) { ; // Fall through } } return null; }
private void resetCursor() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { textArea.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); }
/** * Статический метод который показывает модально диалог ввода строки. * * @param parent фрейм относительно которого будет модальность * @param modal модальный диалог или нет * @param netProperty свойства работы с сервером * @param fullscreen растягивать форму на весь экран и прятать мышку или нет * @param delay задержка перед скрытием диалога. если 0, то нет автозакрытия диалога * @return XML-описание результата предварительной записи, по сути это номерок. если null, то * отказались от предварительной записи */ public static String showInputDialog(Frame parent, boolean modal, INetProperty netProperty, boolean fullscreen, int delay, String caption) { FInputDialog.delay = delay; QLog.l().logger().info("Ввод клиентской информации"); if (inputDialog == null) { inputDialog = new FInputDialog(parent, modal); inputDialog.setTitle("Ввод клиентской информации"); } result = ""; inputDialog.setSize(1280, 768); Uses.setLocation(inputDialog); FInputDialog.netProperty = netProperty; inputDialog.jLabel2.setText(caption); inputDialog.changeTextToLocale(); if (!(QConfig.cfg().isDebug() || QConfig.cfg().isDemo() && !fullscreen)) { Uses.setFullSize(inputDialog); if (QConfig.cfg().isHideCursor()) { int[] pixels = new int[16 * 16]; Image image = Toolkit.getDefaultToolkit() .createImage(new MemoryImageSource(16, 16, pixels, 0, 16)); Cursor transparentCursor = Toolkit.getDefaultToolkit() .createCustomCursor(image, new Point(0, 0), "invisibleCursor"); inputDialog.setCursor(transparentCursor); } } inputDialog.labelKod.setText(inputDialog.resourceMap.getString("labelKod.text")); if (inputDialog.clockBack.isActive()) { inputDialog.clockBack.stop(); } inputDialog.clockBack.start(); inputDialog.setVisible(true); return result; }
@Override public void mouseMoved(MouseEvent e) { final Point p = e.getPoint(); final Polygon polygon = getTriangle(); if(polygon.contains(p)){ inTheTriangleZone = true; this.setCursor(new Cursor(Cursor.SE_RESIZE_CURSOR)); this.repaint(); } else { inTheTriangleZone = false; this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); this.repaint(); } }
private void switchDefault() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }); }
public void toPosition(boolean isDebug, int x, int y) { // Определим форму на монитор setLocation(x, y); setAlwaysOnTop(!isDebug); //setResizable(isDebug); // Отрехтуем форму в зависимости от режима. if (!isDebug) { setAlwaysOnTop(true); //setResizable(false); // спрячем курсор мыши int[] pixels = new int[16 * 16]; Image image = Toolkit.getDefaultToolkit() .createImage(new MemoryImageSource(16, 16, pixels, 0, 16)); Cursor transparentCursor = Toolkit.getDefaultToolkit() .createCustomCursor(image, new Point(0, 0), "invisibleCursor"); setCursor(transparentCursor); addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent e) { setExtendedState(JFrame.MAXIMIZED_BOTH); } }); } else { setSize(1280, 720); } }
public void run() { try { JFrame f = (JFrame) WindowManager.getDefault().getMainWindow(); Component c = f.getGlassPane(); c.setVisible(show); c.setCursor(show ? Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR) : null); } catch (NullPointerException npe) { Exceptions.printStackTrace(npe); } }
public void toPosition(boolean isDebug, int x, int y) { // Определим форму на монитор final Rectangle bounds = Uses.DISPLAYS.get(monitor); if (bounds != null) { x = bounds.x + 1; y = bounds.y + 1; } setLocation(x, y); setAlwaysOnTop(!isDebug); // setResizable(isDebug); // Отрехтуем форму в зависимости от режима. if (!isDebug) { setAlwaysOnTop(true); // setResizable(false); // спрячем курсор мыши if (QConfig.cfg().isHideCursor()) { int[] pixels = new int[16 * 16]; Image image = Toolkit.getDefaultToolkit() .createImage(new MemoryImageSource(16, 16, pixels, 0, 16)); Cursor transparentCursor = Toolkit.getDefaultToolkit() .createCustomCursor(image, new Point(0, 0), "invisibleCursor"); setCursor(transparentCursor); } setBounds(x, y, 200, 300); addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent e) { setExtendedState(JFrame.MAXIMIZED_BOTH); } }); } else { setSize(1280, 720); } }
/** * Method declaration * * * @param e * @param x * @param y */ public boolean mouseExit(Event e, int x, int y) { if (bDrag) { setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); bDrag = false; } return true; }
/** * Method declaration * * * @param e * @param x * @param y */ public boolean mouseMove(Event e, int x, int y) { if (y <= iRowHeight) { int xb = x; x += iX - iGridWidth; int i = iColCount - 1; for (; i >= 0; i--) { if (x > -7 && x < 7) { break; } x += iColWidth[i]; } if (i >= 0) { if (!bDrag) { setCursor(new Cursor(Cursor.E_RESIZE_CURSOR)); bDrag = true; iXDrag = xb - iColWidth[i]; iColDrag = i; } return true; } } return mouseExit(e, x, y); }
public void mouseMoved(MouseEvent e) { if (e.getSource().equals(textPane)) { textPane.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); linkerSupport.computeBounds(textPane, 0); linkerSupport.mouseMoved(e.getPoint(), textPane, messageOffset); } textPane.setToolTipText(""); // NOI18N }
public void testProgressCursor () { JComponent testTc = new ProgressCursorComp(); Cursor progressCursor = Utilities.createProgressCursor(testTc); testTc.setCursor(progressCursor); //testTc.open(); Cursor compCursor = testTc.getCursor(); if (!progressCursor.equals(compCursor)) { fail("Setting of progress cursor don't work: \n" + "Comp cursor: " + compCursor + "\n" + "Progress cursor: " + progressCursor); } }
public void setWaitingState(boolean wait) { Component rootPane = getRootPane(); enableInput(! wait); if (rootPane != null) { rootPane.setCursor(wait ? Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR) : null); } }
/** * create an instance with overides * * @param selectionModifiers for primary selection * @param addToSelectionModifiers for additional selection */ public MapperPickingGraphMousePlugin( int selectionModifiers, int addToSelectionModifiers ) { super( selectionModifiers ); this.addToSelectionModifiers = addToSelectionModifiers; this.lensPaintable = new LensPaintable(); this.cursor = Cursor.getPredefinedCursor( Cursor.HAND_CURSOR ); }
public void setArmed(boolean val) { if (val != armed) { this.armed = val; if (armed) { BaseTable.this.setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR)); } else { BaseTable.this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }
public void disableAll() { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); siteAdd.setEnabled(false); siteUpdate.setEnabled(false); tempDownload.setEnabled(false); close.setEnabled(false); }
private void startEdgeAdding(MouseEvent e) { // possibly start adding edge this.edgeAdding = true; this.edgeAddStart = e; getJGraph().setCursor( Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); }
private void InitElementar(FormaElementar pai) { criador = pai; if (criador != null) { this.master = criador.getMaster(); criador.getSubItens().add(this); SetFontAndBackColorFromModelo(); } this.cursor = new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR); }
/** * */ protected Cursor getCursor(MouseEvent e, int index) { if (index >= 0 && index <= CURSORS.length) { return CURSORS[index]; } return null; }
public static boolean getMayContinue(JFrame owner, int count) { QLog.l().logger() .info("Просмотр состояния очереди и принятие решения о постановки себя в очередь."); ok = false; if (confirmationForm == null) { confirmationForm = new FConfirmationStart2(owner, count); } confirmationForm.changeTextToLocale(count); //confirmationForm.labelInfo.setText("<HTML><b><p align=center><span style='font-size:60.0pt;color:green'>" + getLocaleMessage("dialod.text_before") + "</span><br>" // + "<span style='font-size:100.0pt;color:red'>" + count + "</span><br><span style='font-size:60.0pt;color:red'>" + getLocaleMessage("dialod.text_before_people") // + (((!Locale.getDefault().getLanguage().startsWith("en")) && ((count % 10) >= 2) && ((count % 10) <= 4)) ? "a" : "") + "</span></p></b>"); //confirmationForm.setBounds(owner.getLocation().x, owner.getLocation().y, owner.getWidth(), owner.getHeight()); Uses.setLocation(confirmationForm); if (!(QConfig.cfg().isDebug() || QConfig.cfg().isDemo())) { Uses.setFullSize(confirmationForm); if (QConfig.cfg().isHideCursor()) { int[] pixels = new int[16 * 16]; Image image = Toolkit.getDefaultToolkit() .createImage(new MemoryImageSource(16, 16, pixels, 0, 16)); Cursor transparentCursor = Toolkit.getDefaultToolkit() .createCustomCursor(image, new Point(0, 0), "invisibleCursor"); confirmationForm.setCursor(transparentCursor); } } else { confirmationForm.setSize(1280, 768); Uses.setLocation(confirmationForm); } // если кастомер провафлил и ушел, то надо закрыть диалог CLOCK.start(); confirmationForm.setVisible(true); return ok; }
/** * Return a button suitable for linking to another panel * (e.g. ColopediaPanel). * * @param text a {@code String} value * @param icon an {@code Icon} value * @param action a {@code String} value * @return a {@code JButton} value */ public static JButton getLinkButton(String text, Icon icon, String action) { JButton button = new JButton(text, icon); button.setMargin(EMPTY_MARGIN); button.setOpaque(false); button.setForeground(LINK_COLOR); button.setAlignmentY(0.8f); button.setBorder(blankBorder(0, 0, 0, 0)); button.setActionCommand(action); button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); return button; }
@Override public boolean mouseMoved(Point p, JComponent component) { for (int i = 0; i < start.length; i++) { if (bounds != null && bounds[i] != null && bounds[i].contains(p)) { component.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); return true; } } return false; }