List of usage examples for java.awt Cursor CROSSHAIR_CURSOR
int CROSSHAIR_CURSOR
To view the source code for java.awt Cursor CROSSHAIR_CURSOR.
Click Source Link
From source file:net.sf.mzmine.modules.peaklistmethods.peakpicking.adap3decompositionV2.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 w w . j a v a2 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<>(); widths = 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) { String type = xyDataset.getSeries(row).getDescription(); Paint color; if (type.equals(PeakType.MODEL.name())) color = COLORS[row % COLORS.length]; else color = new Color(0, 0, 0, 50); return color; } @Override public Stroke getSeriesStroke(int series) { XYSeries s = xyDataset.getSeries(series); String type = s.getDescription(); float width; if (type.equals((PeakType.MODEL.name()))) width = 2.0f; else width = 1.0f; return new BasicStroke(width); } }; 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:net.sf.mzmine.modules.visualization.twod.TwoDPlot.java
TwoDPlot(RawDataFile rawDataFile, TwoDVisualizerWindow visualizer, TwoDDataSet dataset, Range rtRange, Range mzRange) {//from ww w. j ava2s. c o m super(null, true); this.rawDataFile = rawDataFile; this.rtRange = rtRange; this.mzRange = mzRange; setBackground(Color.white); setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); // set the X axis (retention time) properties xAxis = new NumberAxis("Retention time"); xAxis.setAutoRangeIncludesZero(false); xAxis.setNumberFormatOverride(rtFormat); xAxis.setUpperMargin(0); xAxis.setLowerMargin(0); // set the Y axis (intensity) properties yAxis = new NumberAxis("m/z"); yAxis.setAutoRangeIncludesZero(false); yAxis.setNumberFormatOverride(mzFormat); yAxis.setUpperMargin(0); yAxis.setLowerMargin(0); // set the plot properties plot = new TwoDXYPlot(dataset, rtRange, mzRange, xAxis, yAxis); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinesVisible(false); plot.setRangeGridlinesVisible(false); // chart properties chart = new JFreeChart("", titleFont, plot, false); chart.setBackgroundPaint(Color.white); setChart(chart); // title chartTitle = chart.getTitle(); chartTitle.setMargin(5, 0, 0, 0); chartTitle.setFont(titleFont); chartSubTitle = new TextTitle(); chartSubTitle.setFont(subTitleFont); chartSubTitle.setMargin(5, 0, 0, 0); chart.addSubtitle(chartSubTitle); // disable maximum size (we don't want scaling) setMaximumDrawWidth(Integer.MAX_VALUE); setMaximumDrawHeight(Integer.MAX_VALUE); // set crosshair (selection) properties plot.setRangeCrosshairVisible(false); plot.setDomainCrosshairVisible(true); plot.setDomainCrosshairPaint(crossHairColor); plot.setDomainCrosshairStroke(crossHairStroke); // set rendering order plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); peakDataRenderer = new PeakDataRenderer(); JMenuItem plotTypeMenuItem = new JMenuItem("Toggle centroid/continuous mode"); plotTypeMenuItem.addActionListener(visualizer); plotTypeMenuItem.setActionCommand("SWITCH_PLOTMODE"); add(plotTypeMenuItem); JPopupMenu popupMenu = getPopupMenu(); popupMenu.addSeparator(); popupMenu.add(plotTypeMenuItem); }
From source file:net.sf.mzmine.modules.visualization.neutralloss.NeutralLossPlot.java
NeutralLossPlot(NeutralLossVisualizerWindow visualizer, NeutralLossDataSet dataset, Object xAxisType) { super(null, true); this.visualizer = visualizer; setBackground(Color.white);//from w ww . ja v a 2 s . c o m setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); NumberFormat rtFormat = MZmineCore.getConfiguration().getRTFormat(); NumberFormat mzFormat = MZmineCore.getConfiguration().getMZFormat(); // set the X axis (retention time) properties NumberAxis xAxis; if (xAxisType.equals(NeutralLossParameters.xAxisPrecursor)) { xAxis = new NumberAxis("Precursor m/z"); xAxis.setNumberFormatOverride(mzFormat); } else { xAxis = new NumberAxis("Retention time"); xAxis.setNumberFormatOverride(rtFormat); } xAxis.setUpperMargin(0); xAxis.setLowerMargin(0); xAxis.setAutoRangeIncludesZero(false); // set the Y axis (intensity) properties NumberAxis yAxis = new NumberAxis("Neutral loss (Da)"); yAxis.setAutoRangeIncludesZero(false); yAxis.setNumberFormatOverride(mzFormat); yAxis.setUpperMargin(0); yAxis.setLowerMargin(0); // set the renderer properties defaultRenderer = new NeutralLossDataPointRenderer(false, true); defaultRenderer.setTransparency(0.4f); setSeriesColorRenderer(0, pointColor, dataPointsShape); setSeriesColorRenderer(1, searchPrecursorColor, dataPointsShape2); setSeriesColorRenderer(2, searchNeutralLossColor, dataPointsShape2); // tooltips defaultRenderer.setBaseToolTipGenerator(dataset); // set the plot properties plot = new XYPlot(dataset, xAxis, yAxis, defaultRenderer); plot.setBackgroundPaint(Color.white); plot.setRenderer(defaultRenderer); plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD); // chart properties chart = new JFreeChart("", titleFont, plot, false); chart.setBackgroundPaint(Color.white); setChart(chart); // title chartTitle = chart.getTitle(); chartTitle.setMargin(5, 0, 0, 0); chartTitle.setFont(titleFont); // disable maximum size (we don't want scaling) setMaximumDrawWidth(Integer.MAX_VALUE); setMaximumDrawHeight(Integer.MAX_VALUE); // set crosshair (selection) properties plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); plot.setDomainCrosshairPaint(crossHairColor); plot.setRangeCrosshairPaint(crossHairColor); plot.setDomainCrosshairStroke(crossHairStroke); plot.setRangeCrosshairStroke(crossHairStroke); plot.addRangeMarker(new ValueMarker(0)); // set focusable state to receive key events setFocusable(true); // register key handlers GUIUtils.registerKeyHandler(this, KeyStroke.getKeyStroke("SPACE"), visualizer, "SHOW_SPECTRUM"); // add items to popup menu JPopupMenu popupMenu = getPopupMenu(); popupMenu.addSeparator(); JMenuItem highLightPrecursorRange = new JMenuItem("Highlight precursor m/z range..."); highLightPrecursorRange.addActionListener(visualizer); highLightPrecursorRange.setActionCommand("HIGHLIGHT_PRECURSOR"); popupMenu.add(highLightPrecursorRange); JMenuItem highLightNeutralLossRange = new JMenuItem("Highlight neutral loss m/z range..."); highLightNeutralLossRange.addActionListener(visualizer); highLightNeutralLossRange.setActionCommand("HIGHLIGHT_NEUTRALLOSS"); popupMenu.add(highLightNeutralLossRange); }
From source file:net.panthema.BispanningGame.MyEditingGraphMousePlugin.java
/** * create instance and prepare shapes for visual effects * /* w w w.jav a2s .c o m*/ * @param modifiers */ public MyEditingGraphMousePlugin(int modifiers, Factory<V> vertexFactory, Factory<E> edgeFactory) { super(modifiers); this.vertexFactory = vertexFactory; this.edgeFactory = edgeFactory; rawEdge.setCurve(0.0f, 0.0f, 0.33f, 100, .66f, -50, 1.0f, 0.0f); rawArrowShape = ArrowFactory.getNotchedArrow(20, 16, 8); edgePaintable = new EdgePaintable(); this.cursor = Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR); }
From source file:net.sf.mzmine.modules.visualization.spectra.SpectraPlot.java
public SpectraPlot(ActionListener masterPlot) { super(null, true); setBackground(Color.white);//from ww w . j a va 2s .co m setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); // initialize the chart by default time series chart from factory chart = ChartFactory.createXYLineChart("", // title "m/z", // x-axis label "Intensity", // y-axis label null, // data set PlotOrientation.VERTICAL, // orientation true, // isotopeFlag, // create legend? true, // generate tooltips? false // generate URLs? ); chart.setBackgroundPaint(Color.white); setChart(chart); // title chartTitle = chart.getTitle(); chartTitle.setMargin(5, 0, 0, 0); chartTitle.setFont(titleFont); chartSubTitle = new TextTitle(); chartSubTitle.setFont(subTitleFont); chartSubTitle.setMargin(5, 0, 0, 0); chart.addSubtitle(chartSubTitle); // legend constructed by ChartFactory LegendTitle legend = chart.getLegend(); legend.setItemFont(legendFont); legend.setFrame(BlockBorder.NONE); // disable maximum size (we don't want scaling) setMaximumDrawWidth(Integer.MAX_VALUE); setMaximumDrawHeight(Integer.MAX_VALUE); setMinimumDrawHeight(0); // set the plot properties plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); // set rendering order plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); // set grid properties plot.setDomainGridlinePaint(gridColor); plot.setRangeGridlinePaint(gridColor); // set crosshair (selection) properties plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); NumberFormat mzFormat = MZmineCore.getConfiguration().getMZFormat(); NumberFormat intensityFormat = MZmineCore.getConfiguration().getIntensityFormat(); // set the X axis (retention time) properties NumberAxis xAxis = (NumberAxis) plot.getDomainAxis(); xAxis.setNumberFormatOverride(mzFormat); xAxis.setUpperMargin(0.001); xAxis.setLowerMargin(0.001); xAxis.setTickLabelInsets(new RectangleInsets(0, 0, 20, 20)); // set the Y axis (intensity) properties NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); yAxis.setNumberFormatOverride(intensityFormat); // set focusable state to receive key events setFocusable(true); // register key handlers GUIUtils.registerKeyHandler(this, KeyStroke.getKeyStroke("LEFT"), masterPlot, "PREVIOUS_SCAN"); GUIUtils.registerKeyHandler(this, KeyStroke.getKeyStroke("RIGHT"), masterPlot, "NEXT_SCAN"); GUIUtils.registerKeyHandler(this, KeyStroke.getKeyStroke('+'), this, "ZOOM_IN"); GUIUtils.registerKeyHandler(this, KeyStroke.getKeyStroke('-'), this, "ZOOM_OUT"); // add items to popup menu if (masterPlot instanceof SpectraVisualizerWindow) { JPopupMenu popupMenu = getPopupMenu(); popupMenu.addSeparator(); GUIUtils.addMenuItem(popupMenu, "Toggle centroid/continuous mode", masterPlot, "TOGGLE_PLOT_MODE"); GUIUtils.addMenuItem(popupMenu, "Toggle displaying of data points in continuous mode", masterPlot, "SHOW_DATA_POINTS"); GUIUtils.addMenuItem(popupMenu, "Toggle displaying of peak values", masterPlot, "SHOW_ANNOTATIONS"); GUIUtils.addMenuItem(popupMenu, "Toggle displaying of picked peaks", masterPlot, "SHOW_PICKED_PEAKS"); popupMenu.addSeparator(); GUIUtils.addMenuItem(popupMenu, "Set axes range", masterPlot, "SETUP_AXES"); GUIUtils.addMenuItem(popupMenu, "Set same range to all windows", masterPlot, "SET_SAME_RANGE"); popupMenu.addSeparator(); GUIUtils.addMenuItem(popupMenu, "Add isotope pattern", masterPlot, "ADD_ISOTOPE_PATTERN"); } }
From source file:org.kalypso.model.wspm.ui.action.selection.AbstractProfilePointSelectionWidget.java
@Override public void activate(final ICommandTarget commandPoster, final IMapPanel mapPanel) { super.activate(commandPoster, mapPanel); /* Add myself as selection changed listener. */ mapPanel.addSelectionChangedListener(m_mapPanelListener); /* Initialize widget with the selection. */ final ISelection selection = mapPanel.getSelection(); setSelection(new ProfilesSelection(selection)); /* Reset. *///from ww w .j ava 2 s . co m reset(); /* init the cursor. */ final Cursor cursor = Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR); mapPanel.setCursor(cursor); }
From source file:net.sf.maltcms.chromaui.foldChangeViewer.ui.panel.FoldChangeViewPanel.java
/** * Creates new form Chromatogram1DViewPanel *///w w w . j av a2s. c om public FoldChangeViewPanel(InstanceContent topComponentInstanceContent, Lookup tcLookup, ADataset1D<StatisticsContainer, FoldChangeElement> ds) { initComponents(); this.content = topComponentInstanceContent; this.lookup = tcLookup; chart = new JFreeChart(new XYPlot()); chartPanel = new ContextAwareChartPanel(chart, true, true, true, true, true); Cursor crosshairCursor = new Cursor(Cursor.CROSSHAIR_CURSOR); chartPanel.setCursor(crosshairCursor); chartPanel.setInitialDelay(100); chartPanel.setDismissDelay(30000); chartPanel.setReshowDelay(0); chartPanel.setFocusable(true); chartPanel.setMouseWheelEnabled(true); add(chartPanel, BorderLayout.CENTER); content.add(chartPanel); }
From source file:org.lmn.fc.frameworks.starbase.plugins.observatory.ui.tabs.fft.impl.AveragingFFTCanvas.java
/*********************************************************************************************** * Initialise this UIComponent./* w w w . j a v a 2 s.c om*/ */ public void initialiseUI() { final Border compoundBorder; super.initialiseUI(); removeAll(); setBackground(getBackgroundColour().getColor()); setOpaque(true); // Make sure that the Canvas uses all available space... setPreferredSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE)); setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR)); // Add a Border to the Canvas panel compoundBorder = BorderFactory.createCompoundBorder(BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder()); setBorder(compoundBorder); // There is only ever one Chart, a special version with no Toolbar setChartViewer(new LogLinChartUIComponent(getHostFrameUI().getHostTask(), getHostInstrument(), "FFT", null, REGISTRY.getFrameworkResourceKey(), DataUpdateType.PRESERVE, REGISTRY.getIntegerProperty( getHostInstrument().getHostAtom().getResourceKey() + KEY_DISPLAY_DATA_MAX), -1000.0, 1000.0, -1000.0, 1000.0) { final static long serialVersionUID = -2433194350569140263L; /********************************************************************************** * Customise the XYPlot of a new chart, e.g. for fixed range axes. * * @param datasettype * @param primarydataset * @param secondarydatasets * @param updatetype * @param displaylimit * @param channelselector * @param debug * * @return JFreeChart */ public JFreeChart createCustomisedChart(final DatasetType datasettype, final XYDataset primarydataset, final List<XYDataset> secondarydatasets, final DataUpdateType updatetype, final int displaylimit, final ChannelSelectorUIComponentInterface channelselector, final boolean debug) { final JFreeChart jFreeChart; jFreeChart = super.createCustomisedChart(datasettype, primarydataset, secondarydatasets, updatetype, displaylimit, channelselector, debug); // Remove all labels jFreeChart.setTitle(EMPTY_STRING); if ((jFreeChart.getXYPlot() != null) && (jFreeChart.getXYPlot().getDomainAxis() != null)) { jFreeChart.getXYPlot().getDomainAxis().setLabel(EMPTY_STRING); } if ((jFreeChart.getXYPlot() != null) && (jFreeChart.getXYPlot().getRangeAxis() != null)) { jFreeChart.getXYPlot().getRangeAxis().setLabel(EMPTY_STRING); } return (jFreeChart); } /********************************************************************************** * Initialise the Chart. */ public synchronized void initialiseUI() { final String SOURCE = "ChartUIComponent.initialiseUI() "; setChannelSelector(false); setDatasetDomainControl(false); super.initialiseUI(); // Indicate if the Chart can Autorange, and is currently Autoranging setCanAutorange(true); setLinearMode(true); // Configure the Chart for this specific use if (getChannelSelectorOccupant() != null) { getChannelSelectorOccupant().setAutoranging(true); getChannelSelectorOccupant().setLinearMode(true); getChannelSelectorOccupant().setDecimating(false); getChannelSelectorOccupant().setLegend(false); getChannelSelectorOccupant().setShowChannels(false); getChannelSelectorOccupant().debugSelector(LOADER_PROPERTIES.isChartDebug(), SOURCE); } } }); getChartViewer().initialiseUI(); add((Component) getChartViewer(), BorderLayout.CENTER); }
From source file:net.sf.maltcms.chromaui.chromatogram1Dviewer.ui.panel.Chromatogram1DViewPanel.java
/** * Creates new form Chromatogram1DViewPanel *//*from ww w. ja v a 2 s . com*/ public Chromatogram1DViewPanel(InstanceContent topComponentInstanceContent, Lookup tcLookup, ADataset1D<IChromatogram1D, IScan> ds) { initComponents(); this.content = topComponentInstanceContent; this.lookup = tcLookup; chart = new JFreeChart(new XYPlot()); ContextAwareChartPanel chartPanel = new ContextAwareChartPanel(chart, true, true, true, true, true); Cursor crosshairCursor = new Cursor(Cursor.CROSSHAIR_CURSOR); chartPanel.setCursor(crosshairCursor); chartPanel.setInitialDelay(100); chartPanel.setDismissDelay(30000); chartPanel.setReshowDelay(0); chartPanel.setFocusable(true); chartPanel.setMouseWheelEnabled(true); chartPanel.setPopupMenuActionProvider(new ActionProvider()); addKeyListener(this); this.chartPanel = chartPanel; add(chartPanel, BorderLayout.CENTER); content.add(chartPanel); }
From source file:net.sf.maltcms.chromaui.chromatogram2Dviewer.ui.panel.Chromatogram2DViewerPanel.java
/** * Creates new form Chromatogram2DViewerPanel *//*www . j a v a2s.c o m*/ public Chromatogram2DViewerPanel(InstanceContent topComponentInstanceContent, Lookup tcLookup, ADataset2D<IChromatogram2D, IScan2D> ds, PaintScale ps) { initComponents(); this.content = topComponentInstanceContent; this.lookup = tcLookup; chart = new JFreeChart(new XYPlot()); chartPanel = new ContextAwareChartPanel(chart, true, true, true, true, true); Cursor crosshairCursor = new Cursor(Cursor.CROSSHAIR_CURSOR); chartPanel.setCursor(crosshairCursor); // chart.addProgressListener(cdxpanel); chartPanel.setInitialDelay(100); chartPanel.setDismissDelay(30000); chartPanel.setReshowDelay(0); chartPanel.setFocusable(true); jPanel2.add(chartPanel, BorderLayout.CENTER); content.add(chartPanel); addKeyListener(this); setPaintScale(ps); }