List of usage examples for java.awt Cursor getPredefinedCursor
public static Cursor getPredefinedCursor(int type)
From source file:edu.uci.ics.jung.visualization.control.LabelEditingGraphMousePlugin.java
/** * create an instance with overides// ww w. ja v a2 s . c om * @param selectionModifiers for primary selection * @param addToSelectionModifiers for additional selection */ public LabelEditingGraphMousePlugin(int selectionModifiers) { super(selectionModifiers); this.cursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR); }
From source file:com.igormaznitsa.zxpoly.ui.AboutDialog.java
public AboutDialog(final java.awt.Frame parent) { super(parent, true); initComponents();/* w ww . jav a2 s. co m*/ this.editorPane.addHyperlinkListener(new HyperlinkListener() { @Override public void hyperlinkUpdate(final HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { try { Desktop.getDesktop().browse(e.getURL().toURI()); } catch (Exception ex) { } } else if (e.getEventType() == HyperlinkEvent.EventType.ENTERED) { editorPane.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } else if (e.getEventType() == HyperlinkEvent.EventType.EXITED) { editorPane.setCursor(Cursor.getDefaultCursor()); } } }); this.editorPane.setContentType("text/html"); try { final String htmlText = IOUtils.toString(openAboutResource("index.html"), "UTF-8"); this.editorPane.setText(htmlText); } catch (Exception ex) { ex.printStackTrace(); } setLocationRelativeTo(parent); }
From source file:com.ts.ch.gui.CertifiedHelperController.java
public CertifiedHelperController(PmDatabase database) { this.database = database; setModelAndView(new CertifiedHelperModel(), new CertifiedHelperView()); new Task<Void, Void>(Application.getInstance()) { public Void doInBackground() { CertifiedHelperModel m = (CertifiedHelperModel) CertifiedHelperController.this.getModel(); CertifiedHelperView v = (CertifiedHelperView) CertifiedHelperController.this.getView(); v.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try { dymoAddIn = ClassFactory.createDymoAddIn(); dymoLabels = ClassFactory.createDymoLabels(); dymoAddIn.open(LABEL_FILE); // Setup printer list List<String> printerArray = new ArrayList<String>(); String prtNames = dymoAddIn.getDymoPrinters(); if (prtNames != null) { // parse the result String[] names = prtNames.split("\\|"); for (String name : names) { printerArray.add(name); }/*from w ww. jav a 2 s .co m*/ m.setPrinters(printerArray); prtNames = dymoAddIn.getCurrentPrinterName(); if (prtNames != null) { m.setSelectedPrinter(prtNames); } else { m.setSelectedPrinter(""); } } // Check if selected/current printer is a twin tubro printer m.setTwinTurboPrinter(dymoAddIn.isTwinTurboPrinter(m.getSelectedPrinter())); } catch (Exception e) { } finally { v.setCursor(Cursor.getDefaultCursor()); } return null; } }.execute(); }
From source file:net.sf.mzmine.modules.peaklistmethods.peakpicking.adap3decompositionV1_5.SimpleScatterPlot.java
public SimpleScatterPlot(double[] xValues, double[] yValues, double[] colors, String xLabel, String yLabel) { super(null, true); setBackground(Color.white);//from w w w. j av a 2s .co m setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); xAxis = new NumberAxis(xLabel); xAxis.setAutoRangeIncludesZero(false); xAxis.setUpperMargin(0); xAxis.setLowerMargin(0); yAxis = new NumberAxis(yLabel); yAxis.setAutoRangeIncludesZero(false); yAxis.setUpperMargin(0); yAxis.setLowerMargin(0); xyDataset = new DefaultXYZDataset(); int length = Math.min(xValues.length, yValues.length); double[][] data = new double[3][length]; System.arraycopy(xValues, 0, data[0], 0, length); System.arraycopy(yValues, 0, data[1], 0, length); System.arraycopy(colors, 0, data[2], 0, length); xyDataset.addSeries(SERIES_ID, data); XYDotRenderer renderer = new XYDotRenderer() { @Override public Paint getItemPaint(int row, int col) { double c = xyDataset.getZ(row, col).doubleValue(); return Color.getHSBColor((float) c, 1.0f, 1.0f); } }; renderer.setDotHeight(3); renderer.setDotWidth(3); plot = new XYPlot(xyDataset, xAxis, yAxis, renderer); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinesVisible(true); chart = new JFreeChart("", new Font("SansSerif", Font.BOLD, 12), plot, false); chart.setBackgroundPaint(Color.white); super.setChart(chart); }
From source file:Main.java
public GrabAndScrollLabel(ImageIcon i) { super(i);//from w w w. j a v a 2 s . c o m MouseInputAdapter mia = new MouseInputAdapter() { int xDiff, yDiff; 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:ste.travian.gui.WorldChartPanel.java
@Override public void chartProgress(ChartProgressEvent event) { if (event.getType() == ChartProgressEvent.DRAWING_STARTED) { mainWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); } else {/*from ww w .ja v a2s . c o m*/ mainWindow.setCursor(Cursor.getDefaultCursor()); } }
From source file:Main.java
public static void addMiddleButtonDragSupport(Component targetComponent) { MouseInputAdapter mia = new MouseInputAdapter() { int m_XDifference, m_YDifference; boolean m_dragging = false; public void mouseDragged(MouseEvent e) { if (!m_dragging) return; Component target = e.getComponent(); Container c = target.getParent(); if (c instanceof JViewport) { JViewport jv = (JViewport) c; Point p = jv.getViewPosition(); int newX = p.x - (e.getX() - m_XDifference); int newY = p.y - (e.getY() - m_YDifference); int maxX = target.getWidth() - jv.getWidth(); int maxY = target.getHeight() - jv.getHeight(); if (newX < 0) newX = 0;/*from ww w .j a v a 2s. c om*/ if (newX > maxX) newX = maxX; if (newY < 0) newY = 0; if (newY > maxY) newY = maxY; jv.setViewPosition(new Point(newX, newY)); } } Cursor oldCursor; public void mousePressed(MouseEvent e) { if (SwingUtilities.isMiddleMouseButton(e)) { m_dragging = true; oldCursor = e.getComponent().getCursor(); e.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); m_XDifference = e.getX(); m_YDifference = e.getY(); } } public void mouseReleased(MouseEvent e) { if (m_dragging) { e.getComponent().setCursor(oldCursor); m_dragging = false; } } }; targetComponent.addMouseMotionListener(mia); targetComponent.addMouseListener(mia); }
From source file:Main.java
@Override public void run() { for (int i = 0; i < fnt.length; i++) { StyleConstants.setBold(mas, false); StyleConstants.setItalic(mas, false); StyleConstants.setFontFamily(mas, fnt[i]); StyleConstants.setFontSize(mas, 16); dis(fnt[i]);/* w w w .j a v a2s .c o m*/ try { Thread.sleep(75); } catch (Exception e) { e.printStackTrace(); } StyleConstants.setBold(mas, true); dis(fnt[i] + " Bold"); try { Thread.sleep(75); } catch (Exception e) { e.printStackTrace(); } } jta.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }
From source file:net.sf.mzmine.modules.peaklistmethods.peakpicking.adap3decompositionV1_5.EICPlot.java
public EICPlot(List<List<NavigableMap<Double, Double>>> clusters, List<Double> colors, List<List<String>> info, List<NavigableMap<Double, Double>> modelPeaks) { super(null, true); setBackground(Color.white);/*from w ww .j av a 2 s .c om*/ setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); NumberAxis xAxis = new NumberAxis("Retention Time"); xAxis.setAutoRangeIncludesZero(false); xAxis.setUpperMargin(0); xAxis.setLowerMargin(0); NumberAxis yAxis = new NumberAxis("Intensity"); yAxis.setAutoRangeIncludesZero(false); yAxis.setUpperMargin(0); yAxis.setLowerMargin(0); xyDataset = new XYSeriesCollection(); colorDataset = new ArrayList<>(); toolTips = new ArrayList<>(); int seriesID = 0; for (int i = 0; i < clusters.size(); ++i) { List<NavigableMap<Double, Double>> cluster = clusters.get(i); double color = colors.get(i); for (int j = 0; j < cluster.size(); ++j) { XYSeries series = new XYSeries(seriesID++); for (Entry<Double, Double> e : cluster.get(j).entrySet()) series.add(e.getKey(), e.getValue()); xyDataset.addSeries(series); colorDataset.add(color); toolTips.add(info.get(i).get(j)); } } XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer() { @Override public Paint getItemPaint(int row, int col) { double c = colorDataset.get(row); return Color.getHSBColor((float) c, 1.0f, 1.0f); } }; renderer.setDefaultShapesVisible(false); renderer.setDefaultToolTipGenerator(new XYToolTipGenerator() { @Override public String generateToolTip(XYDataset dataset, int series, int item) { try { return toolTips.get(series); } catch (NullPointerException | IndexOutOfBoundsException e) { return ""; } } }); XYPlot plot = new XYPlot(xyDataset, xAxis, yAxis, renderer); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinesVisible(true); JFreeChart chart = new JFreeChart("", new Font("SansSerif", Font.BOLD, 12), plot, false); chart.setBackgroundPaint(Color.white); super.setChart(chart); }
From source file:GrabAndDragDemo.java
public GrabAndScrollLabel(ImageIcon i) { super(i);//from www . j a va 2 s .c o 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); }