List of usage examples for java.awt Cursor DEFAULT_CURSOR
int DEFAULT_CURSOR
To view the source code for java.awt Cursor DEFAULT_CURSOR.
Click Source Link
From source file:GrabAndDragDemo.java
public GrabAndScrollLabel(ImageIcon i) { super(i);/*from w w w . j ava2 s . co m*/ MouseInputAdapter mia = new MouseInputAdapter() { int xDiff, yDiff; boolean isDragging; Container c; public void mouseDragged(MouseEvent e) { c = GrabAndScrollLabel.this.getParent(); if (c instanceof JViewport) { JViewport jv = (JViewport) c; Point p = jv.getViewPosition(); int newX = p.x - (e.getX() - xDiff); int newY = p.y - (e.getY() - yDiff); int maxX = GrabAndScrollLabel.this.getWidth() - jv.getWidth(); int maxY = GrabAndScrollLabel.this.getHeight() - jv.getHeight(); if (newX < 0) newX = 0; if (newX > maxX) newX = maxX; if (newY < 0) newY = 0; if (newY > maxY) newY = maxY; jv.setViewPosition(new Point(newX, newY)); } } public void mousePressed(MouseEvent e) { setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); xDiff = e.getX(); yDiff = e.getY(); } public void mouseReleased(MouseEvent e) { setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }; addMouseMotionListener(mia); addMouseListener(mia); }
From source file:Simulator.java
private void AddMouseListeners() { map().addMouseListener(new MouseAdapter() { @Override//from www . ja va2s. c o m public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { map().getAttribution().handleAttribution(e.getPoint(), true); } } }); map().addMouseMotionListener(new MouseAdapter() { @Override public void mouseMoved(MouseEvent e) { Point p = e.getPoint(); boolean cursorHand = map().getAttribution().handleAttributionCursor(p); if (cursorHand) { map().setCursor(new Cursor(Cursor.HAND_CURSOR)); } else { map().setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } } }); }
From source file:com.ssn.listener.SSNFacebookAlbumSelectionListener.java
@Override public void valueChanged(TreeSelectionEvent event) { DefaultMutableTreeNode node = treeHelper.getTreeNode(event.getPath()); if (this.form.getHiveTree() != null) { this.form.getHiveTree().clearSelection(); }//from w ww . j a va 2 s. com if (this.form.getInstagramTree() != null) { this.form.getInstagramTree().clearSelection(); } if (node.isLeaf()) { this.form.setCursor(new Cursor(Cursor.WAIT_CURSOR)); SSNAlbumNode fnode = null; try { if (((SSNIconData) node.getUserObject()).getObject() instanceof SSNAlbumNode) fnode = (SSNAlbumNode) ((SSNIconData) node.getUserObject()).getObject(); } catch (ClassCastException ee) { ee.printStackTrace(); this.form.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } String facebookDirPath = SSNHelper.getFacebookPhotosDirPath(); if (fnode != null) fileTree.m_display.setText(facebookDirPath + File.separator + fnode); SSNIconData iconData = (SSNIconData) node.getUserObject(); SSNAlbumNode albumNode = (SSNAlbumNode) iconData.getObject(); MediaOperations mediaOperations = facebook.mediaOperations(); List<Photo> listPhoto, completePhotoList = new ArrayList<Photo>(); do { PagingParameters pagingParameters = new PagingParameters(100, completePhotoList.size(), null, Calendar.getInstance().getTimeInMillis()); listPhoto = mediaOperations.getPhotos(albumNode.getAlbum().getId(), pagingParameters); completePhotoList.addAll(listPhoto); } while (listPhoto.size() > 0); createComponents(this.form, completePhotoList, albumNode); } }
From source file:Main.java
protected void setState(boolean active) { isActive = active;/*w w w .ja va 2 s . c om*/ repaint(); if (active) { if (button != null) button.setState(false); setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } else { button = null; setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
From source file:de.mendelson.comm.as2.client.HTMLPanel.java
/**Listen to be a HyperlinkListener*/ @Override//from w w w. j av a 2s . co m public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { try { URI uri = new URI(e.getURL().toExternalForm()); Desktop.getDesktop().browse(uri); } catch (Exception ex) { //nop } } if (e.getEventType() == HyperlinkEvent.EventType.ENTERED) { jEditorPane.setCursor(new Cursor(Cursor.HAND_CURSOR)); } if (e.getEventType() == HyperlinkEvent.EventType.EXITED) { jEditorPane.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }
From source file:org.jtheque.ui.utils.windows.WindowState.java
@Override public void stopWait() { if (waitUI != null) { waitUI.setLocked(false);/*ww w . j a va2 s . c o m*/ window.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); content.setUI(null); } }
From source file:com.quinsoft.zeidon.objectbrowser.EntitySquare.java
EntitySquare(OiDisplay display, BrowserEnvironment environment, EntityDefLayout layout) { super();/*from w w w. j a v a2 s .c o m*/ this.env = environment; oiDisplay = display; entityDefLayout = layout; size = new Dimension(SMALLEST_WIDTH * env.getPainterScaleFactor(), SMALLEST_HEIGHT * env.getPainterScaleFactor()); paddedSize = new Dimension((SMALLEST_WIDTH + HORIZONTAL_PAD * 2) * env.getPainterScaleFactor(), (SMALLEST_HEIGHT + VERTICAL_PAD * 2) * env.getPainterScaleFactor()); setSize(size); font = new Font(Font.SANS_SERIF, Font.PLAIN, env.getPainterScaleFactor()); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); addMouseListener(this); getInputMap().put(KeyStroke.getKeyStroke("HOME"), "setFirst"); getActionMap().put("setFirst", new SetCursorAction(CursorPosition.FIRST)); getInputMap().put(KeyStroke.getKeyStroke("PAGE_UP"), "setPrev"); getActionMap().put("setPrev", new SetCursorAction(CursorPosition.PREV)); getInputMap().put(KeyStroke.getKeyStroke("PAGE_DOWN"), "setNext"); getActionMap().put("setNext", new SetCursorAction(CursorPosition.NEXT)); getInputMap().put(KeyStroke.getKeyStroke("END"), "setLast"); getActionMap().put("setLast", new SetCursorAction(CursorPosition.LAST)); getInputMap().put(KeyStroke.getKeyStroke("UP"), "moveUp"); getActionMap().put("moveUp", new ChangeSelectedEntityDefAction(1)); getInputMap().put(KeyStroke.getKeyStroke("DOWN"), "moveDown"); getActionMap().put("moveDown", new ChangeSelectedEntityDefAction(2)); getInputMap().put(KeyStroke.getKeyStroke("LEFT"), "moveLeft"); getActionMap().put("moveLeft", new ChangeSelectedEntityDefAction(3)); getInputMap().put(KeyStroke.getKeyStroke("RIGHT"), "moveRight"); getActionMap().put("moveRight", new ChangeSelectedEntityDefAction(4)); getInputMap().put(KeyStroke.getKeyStroke("ctrl DOWN"), "resetParent"); getActionMap().put("resetParent", new ChangeSelectedEntityDefAction(5)); getInputMap().put(KeyStroke.getKeyStroke("ctrl UP"), "setSubobject"); getActionMap().put("setSubobject", new ChangeSelectedEntityDefAction(6)); }
From source file:com.ssn.listener.SSNHiveAlbumSelectionListner.java
@Override public void valueChanged(TreeSelectionEvent e) { iT = 0;/* w w w . j a va2 s . c o m*/ dT = 0; DefaultMutableTreeNode node = treeHelper.getTreeNode(e.getPath()); List hiveFiles = new ArrayList(); if (this.form.getHiveTree() != null) { this.form.getHiveTree().clearSelection(); } this.form.setCursor(new Cursor(Cursor.WAIT_CURSOR)); SSNFileNode fnode = null; try { if (((SSNIconData) node.getUserObject()).getObject() instanceof SSNFileNode) { fnode = (SSNFileNode) ((SSNIconData) node.getUserObject()).getObject(); } } catch (ClassCastException ee) { logger.error(ee); this.form.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } getAlbumMedia(form.getHomeModel().getLoggedInUserAccessToken(), 1, fileTree.hiveAlbumMap.get(fnode.getFile().getName())); /** * ******* * */ if (fnode != null) { if (fileTree.m_display.getText() != null && !fileTree.m_display.getText().equals("viewAllAlbums") && !fileTree.m_display.getText().equals("instagramMedia") && !fileTree.m_display.getText().equals("tagUnTaggedMedia")) { fileTree.m_display.setText(fnode.getFile().getAbsolutePath()); } if (fnode.getFile().isDirectory()) { this.fileTree.setSelectedFolder(fnode.getFile().getName()); getSSNMediaFolderProperties(fnode.getFile().getPath()); File[] file = fnode.getFile().listFiles(); for (File f : file) { if (f.isFile()) { hiveFiles.add(f.getName()); } else { } } } if (hiveFiles != null && hiveFiles.size() > 0) { createCompontents(fnode.getFile().getAbsolutePath(), form, true); } else { createCompontents(fnode.getFile().getAbsolutePath(), form, false); } } else { SSNHelper.toggleDeleteAndShareImages(false, form); String path = SSNHelper.getSsnHiveDirPath(); path = SSNHelper.getSsnTempDirPath(); form.getFileNamesToBeDeleted().clear(); getSSNMediaFolderProperties(path); if (fileTree.m_display.getText() != null && !fileTree.m_display.getText().equals("viewAllAlbums") && !fileTree.m_display.getText().equals("instagramMedia") && !fileTree.m_display.getText().equals("tagUnTaggedMedia")) { fileTree.m_display.setText(path); } getForm().ssnFileExplorer.m_tree.setSelectionRow(1); long size = FileUtils.sizeOfDirectory(new File(path)); if (size > 0) { File file1 = new File(path); if (fileTree.m_display.getText() != null && !fileTree.m_display.getText().equals("viewAllAlbums") && !fileTree.m_display.getText().equals("instagramMedia") && !fileTree.m_display.getText().equals("tagUnTaggedMedia")) { fileTree.m_display.setText(file1.getAbsolutePath()); } //just copied from above if block if (file1.isDirectory()) { this.form.setCurrentSelectedFile(null); fileTree.setSelectedFolder(file1.getName()); File[] file = file1.listFiles(); for (File f : file) { if (f.isFile()) { hiveFiles.add(f.getName()); } else { } } } if (hiveFiles != null && hiveFiles.size() > 0) { createCompontents(file1.getAbsolutePath(), form, true); } else { createCompontents(file1.getAbsolutePath(), form, false); } } else { // show welcome screen addWelcomeIcons(); } this.form.getSsnHomeCenterMainPanel().revalidate(); this.form.getSsnHomeCenterMainPanel().repaint(); this.form.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } this.form.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); }
From source file:org.kepler.gui.kar.ActorUploaderAction.java
/** * Invoked when an action occurs./*from www.j av a 2s. com*/ * *@param e * ActionEvent */ public void actionPerformed(ActionEvent e) { super.actionPerformed(e); ExportActorArchiveAction eaaa = new ExportActorArchiveAction(_parent); eaaa.useTempFile = true; _parent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); eaaa.actionPerformed(e); _parent.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); // ComponentEntity object; // SaveKAR sk = eaaa.getSaveKAR(); // // ArrayList<ComponentEntity> components = sk.getSaveInitiatorList(); // if (components.size() == 1) { // object = components.get(0); // } else { // return; // } // // ComponentUploader uploader = new ComponentUploader(_parent); // uploader.upload(sk.getFile(), object); }
From source file:es.emergya.ui.base.BasicWindow.java
/** * Initialize the window with default values. *//* w w w.jav a 2 s .c o m*/ private void inicializar() { frame = new JFrame(i18n.getString("title")); //$NON-NLS-1$ getFrame().setBackground(Color.WHITE); getFrame().setIconImage(ICON_IMAGE); //$NON-NLS-1$ getFrame().addWindowListener(new RemoveClientesConectadosListener()); getFrame().setMinimumSize(new Dimension(900, 600)); getFrame().addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { resize(); } }); busyCursor = new Cursor(Cursor.WAIT_CURSOR); defaultCursor = new Cursor(Cursor.DEFAULT_CURSOR); Toolkit toolkit = Toolkit.getDefaultToolkit(); Image image = getImageIcon("/images/hand.gif"); if (image != null) handCursor = toolkit.createCustomCursor(image, new Point(0, 0), "hand"); //$NON-NLS-1$ }