List of usage examples for java.awt Cursor getPredefinedCursor
public static Cursor getPredefinedCursor(int type)
From source file:com.willwinder.ugs.nbp.core.services.SettingsChangedNotificationService.java
private JComponent createRestartNotificationDetails() { JPanel panel = new JPanel(new BorderLayout(10, 10)); panel.setOpaque(false);//from www. jav a 2 s .com JLabel label = new JLabel(Localization.getString("platform.window.restart.changed.settings")); //NOI18N label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); panel.add(label, BorderLayout.CENTER); label.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (null != restartNotification) { restartNotification.clear(); restartNotification = null; } LifecycleManager.getDefault().markForRestart(); LifecycleManager.getDefault().exit(); } }); return panel; }
From source file:io.github.jeddict.db.modeler.widget.TableWidget.java
public TableWidget(DBModelerScene scene, NodeWidgetInfo node) { super(scene, node); this.setName(((DBTable) node.getBaseElementSpec()).getName()); this.setImage(this.getNodeWidgetInfo().getModelerDocument().getImage()); this.getImageWidget().setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); this.getImageWidget().getActions().addAction(new TableAction()); getNodeNameWidget().getActions().removeAction(editAction); }
From source file:biz.wolschon.finance.jgnucash.actions.SaveAsFilePluginMenuAction.java
@Override public void actionPerformed(final ActionEvent e) { try {//from w w w .j a v a2 s . c o m // Activate plug-in that declares extension. myJGnucashEditor.getPluginManager().activatePlugin(ext.getDeclaringPluginDescriptor().getId()); // Get plug-in class loader. ClassLoader classLoader = myJGnucashEditor.getPluginManager() .getPluginClassLoader(ext.getDeclaringPluginDescriptor()); // Load Tool class. Class toolCls = classLoader.loadClass(ext.getParameter("class").valueAsString()); // Create Tool instance. Object o = toolCls.newInstance(); if (!(o instanceof DataSourcePlugin)) { LOGGER.error("Plugin '" + pluginName + "' does not implement DataSourcePlugin-interface."); JOptionPane.showMessageDialog(myJGnucashEditor, "Error", "Plugin '" + pluginName + "' does not implement DataSourcePlugin-interface.", JOptionPane.ERROR_MESSAGE); return; } DataSourcePlugin importer = (DataSourcePlugin) o; try { myJGnucashEditor.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); //workaround because of a deadlock in log4j-consoleAppender in the JPf-classloader Logger.getLogger("org.java.plugin.standard.StandardPluginClassLoader").removeAllAppenders(); Logger.getLogger("org.java.plugin.standard.StandardPluginClassLoader").setLevel(Level.FATAL); importer.writeTo(myJGnucashEditor.getWritableModel()); } catch (Exception e1) { LOGGER.error("Write via Plugin '" + pluginName + "' failed.", e1); JOptionPane .showMessageDialog( myJGnucashEditor, "Error", "Write via Plugin '" + pluginName + "' failed.\n" + "[" + e1.getClass().getName() + "]: " + e1.getMessage(), JOptionPane.ERROR_MESSAGE); } finally { myJGnucashEditor.setCursor(Cursor.getDefaultCursor()); } } catch (Exception e1) { LOGGER.error("Could not activate requested Writer-plugin '" + pluginName + "'.", e1); JOptionPane .showMessageDialog( myJGnucashEditor, "Error", "Could not activate requested Writer-plugin '" + pluginName + "'.\n" + "[" + e1.getClass().getName() + "]: " + e1.getMessage(), JOptionPane.ERROR_MESSAGE); } }
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);/* w w w . j a va2 s.c om*/ 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:org.ut.biolab.medsavant.client.view.util.PeekingPanel.java
public PeekingPanel(String label, String borderLayoutPosition, JComponent panel, boolean isExpanded, int size) { final boolean isVertical = borderLayoutPosition.equals(BorderLayout.EAST) || borderLayoutPosition.equals(BorderLayout.WEST); this.setAnimated(false); if (borderLayoutPosition.equals(BorderLayout.NORTH)) { dockedSide = DockedSide.NORTH;/* w ww. j a va2 s . c o m*/ this.setDirection(JXCollapsiblePane.Direction.UP); } else if (borderLayoutPosition.equals(BorderLayout.SOUTH)) { dockedSide = DockedSide.SOUTH; this.setDirection(JXCollapsiblePane.Direction.DOWN); } else if (borderLayoutPosition.equals(BorderLayout.EAST)) { dockedSide = DockedSide.EAST; this.setDirection(JXCollapsiblePane.Direction.RIGHT); } else { dockedSide = DockedSide.WEST; this.setDirection(JXCollapsiblePane.Direction.LEFT); } this.setLayout(new BorderLayout()); this.panel = panel; if (isVertical) { panel.setPreferredSize(new Dimension(size, 999)); } else { panel.setPreferredSize(new Dimension(999, size)); } titlePanel = new JPanel(); titlePanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); titlePanel.setBorder(ViewUtil.getTinyBorder()); if (isVertical) { titlePanel.setLayout(new BoxLayout(titlePanel, BoxLayout.Y_AXIS)); } else { titlePanel.setLayout(new BoxLayout(titlePanel, BoxLayout.X_AXIS)); } titlePanel.add(Box.createHorizontalGlue()); this.titleString = label.toUpperCase(); title = new JLabel(" ");//titleString); title.setForeground(Color.darkGray); if (borderLayoutPosition.equals(BorderLayout.EAST)) { title.setUI(new VerticalLabelUI(true)); } else if (borderLayoutPosition.equals(BorderLayout.WEST)) { title.setUI(new VerticalLabelUI(false)); } titlePanel.add(title); if (!isVertical) { titlePanel.add(Box.createHorizontalGlue()); } titlePanel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { toggleExpanded(); } }); this.add(titlePanel, borderLayoutPosition); this.add(panel, BorderLayout.CENTER); setExpanded(isExpanded); }
From source file:biz.wolschon.finance.jgnucash.actions.OpenFilePluginMenuAction.java
@Override public void actionPerformed(final ActionEvent e) { try {// w w w .j a v a 2s .c o m // Activate plug-in that declares extension. myJGnucashEditor.getPluginManager().activatePlugin(ext.getDeclaringPluginDescriptor().getId()); // Get plug-in class loader. ClassLoader classLoader = myJGnucashEditor.getPluginManager() .getPluginClassLoader(ext.getDeclaringPluginDescriptor()); // Load Tool class. Class toolCls = classLoader.loadClass(ext.getParameter("class").valueAsString()); // Create Tool instance. Object o = toolCls.newInstance(); if (!(o instanceof DataSourcePlugin)) { LOGGER.error("Plugin '" + pluginName + "' does not implement DataSourcePlugin-interface."); JOptionPane.showMessageDialog(myJGnucashEditor, "Error", "Plugin '" + pluginName + "' does not implement DataSourcePlugin-interface.", JOptionPane.ERROR_MESSAGE); return; } DataSourcePlugin importer = (DataSourcePlugin) o; try { myJGnucashEditor.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); //workaround because of a deadlock in log4j-consoleAppender in the JPf-classloader Logger.getLogger("org.java.plugin.standard.StandardPluginClassLoader").removeAllAppenders(); Logger.getLogger("org.java.plugin.standard.StandardPluginClassLoader").setLevel(Level.FATAL); GnucashWritableFile loadedFile = importer.loadFile(); if (loadedFile != null) { myJGnucashEditor.setWritableModel(loadedFile); } } catch (Exception e1) { LOGGER.error("Load via Plugin '" + pluginName + "' failed.", e1); JOptionPane .showMessageDialog( myJGnucashEditor, "Error", "Load via Plugin '" + pluginName + "' failed.\n" + "[" + e1.getClass().getName() + "]: " + e1.getMessage(), JOptionPane.ERROR_MESSAGE); } finally { myJGnucashEditor.setCursor(Cursor.getDefaultCursor()); } } catch (Exception e1) { LOGGER.error("Could not activate requested Loader-plugin '" + pluginName + "'.", e1); JOptionPane .showMessageDialog( myJGnucashEditor, "Error", "Could not activate requested Loader-plugin '" + pluginName + "'.\n" + "[" + e1.getClass().getName() + "]: " + e1.getMessage(), JOptionPane.ERROR_MESSAGE); } }
From source file:net.panthema.BispanningGame.MyEditingGraphMousePlugin.java
/** * create instance and prepare shapes for visual effects * // w ww . j av a 2 s.com * @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:gmgen.util.MiscUtilities.java
/** * Set the cursor for the specified component to the wait cursor * *@param component The component to set the cursor for *@return The currently set cursor *//*from w w w. j a va 2 s.c o m*/ public static Cursor setBusyCursor(java.awt.Component component) { Cursor old = component.getCursor(); component.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); return old; }
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 v a 2 s . c o 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:biz.wolschon.finance.jgnucash.actions.ToolPluginMenuAction.java
@Override public void actionPerformed(final ActionEvent e) { try {//from w w w. ja va 2 s .c om GnucashWritableFile wModel = myJGnucashEditor.getWritableModel(); if (wModel == null) { JOptionPane.showMessageDialog(myJGnucashEditor, "No open file.", "Please open a gnucash-file first!", JOptionPane.WARNING_MESSAGE); return; } // Activate plug-in that declares extension. myJGnucashEditor.getPluginManager().activatePlugin(ext.getDeclaringPluginDescriptor().getId()); // Get plug-in class loader. ClassLoader classLoader = myJGnucashEditor.getPluginManager() .getPluginClassLoader(ext.getDeclaringPluginDescriptor()); // Load Tool class. Class toolCls = classLoader.loadClass(ext.getParameter("class").valueAsString()); // Create Tool instance. Object o = toolCls.newInstance(); if (!(o instanceof ToolPlugin)) { LOGGER.error("Plugin '" + pluginName + "' does not implement ToolPlugin-interface."); JOptionPane.showMessageDialog(myJGnucashEditor, "Error", "Plugin '" + pluginName + "' does not implement ToolPlugin-interface.", JOptionPane.ERROR_MESSAGE); return; } ToolPlugin importer = (ToolPlugin) o; try { myJGnucashEditor.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); GnucashWritableAccount selectedAccount = (GnucashWritableAccount) myJGnucashEditor .getSelectedAccount(); String message = importer.runTool(wModel, selectedAccount); if (message != null && message.length() > 0) { JOptionPane.showMessageDialog(myJGnucashEditor, "Tool OK", "The tool-use was a success:\n" + message, JOptionPane.INFORMATION_MESSAGE); } } catch (Exception e1) { LOGGER.error("Tool-use via Plugin '" + pluginName + "' failed.", e1); JOptionPane .showMessageDialog( myJGnucashEditor, "Error", "Tool-use via Plugin '" + pluginName + "' failed.\n" + "[" + e1.getClass().getName() + "]: " + e1.getMessage(), JOptionPane.ERROR_MESSAGE); } finally { myJGnucashEditor.setCursor(Cursor.getDefaultCursor()); } } catch (Exception e1) { LOGGER.error("Could not activate requested Tool-plugin '" + pluginName + "'.", e1); JOptionPane .showMessageDialog( myJGnucashEditor, "Error", "Could not activate requested Tool-plugin '" + pluginName + "'.\n" + "[" + e1.getClass().getName() + "]: " + e1.getMessage(), JOptionPane.ERROR_MESSAGE); } }