List of usage examples for javax.swing AbstractButton setToolTipText
@BeanProperty(bound = false, preferred = true, description = "The text to display in a tool tip.") public void setToolTipText(String text)
From source file:org.esa.snap.rcp.statistics.ChartPagePanel.java
private JPanel createTopPanel() { refreshButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/ViewRefresh22.png"), false); refreshButton.setToolTipText("Refresh View"); refreshButton.setName("refreshButton"); refreshButton.addActionListener(e -> { updateChartData();/*from ww w .ja v a 2s. co m*/ refreshButton.setEnabled(false); }); AbstractButton switchToTableButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/Table24.png"), false); switchToTableButton.setToolTipText("Switch to Table View"); switchToTableButton.setName("switchToTableButton"); switchToTableButton.setEnabled(hasAlternativeView()); switchToTableButton.addActionListener(e -> showAlternativeView()); final TableLayout tableLayout = new TableLayout(6); tableLayout.setColumnFill(2, TableLayout.Fill.HORIZONTAL); tableLayout.setColumnWeightX(2, 1.0); tableLayout.setRowPadding(0, new Insets(0, 4, 0, 0)); JPanel buttonPanel = new JPanel(tableLayout); buttonPanel.add(refreshButton); tableLayout.setRowPadding(0, new Insets(0, 0, 0, 0)); buttonPanel.add(switchToTableButton); buttonPanel.add(new JPanel()); return buttonPanel; }
From source file:com.projity.menu.MenuManager.java
public void setText(String id, String text) { Collection buttons = toolBarFactory.getButtonsFromId(id); if (buttons != null) { Iterator i = buttons.iterator(); while (i.hasNext()) { AbstractButton button = (AbstractButton) i.next(); if (button != null) button.setToolTipText(text); }//from w ww . j av a2 s. c om } JMenuItem menuItem = menuFactory.getMenuItemFromId(id); if (menuItem != null) menuItem.setText(text); }
From source file:org.esa.beam.timeseries.ui.graph.TimeSeriesGraphForm.java
private JPanel createButtonPanel(final String helpID) { showTimeSeriesForSelectedPinsButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/SelectedPinSpectra24.gif"), true); showTimeSeriesForSelectedPinsButton.addActionListener(new ActionListener() { @Override//from www . j a va2 s . co m public void actionPerformed(ActionEvent e) { if (graphModel.isShowingAllPins()) { showTimeSeriesForAllPinsButton.setSelected(false); graphModel.setIsShowingAllPins(false); } graphModel.setIsShowingSelectedPins(showTimeSeriesForSelectedPinsButton.isSelected()); } }); showTimeSeriesForSelectedPinsButton.setName("showTimeSeriesForSelectedPinsButton"); showTimeSeriesForSelectedPinsButton.setToolTipText("Show time series for selected pin"); ////////////////////////////////////////// showTimeSeriesForAllPinsButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/PinSpectra24.gif"), true); showTimeSeriesForAllPinsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (graphModel.isShowingSelectedPins()) { showTimeSeriesForSelectedPinsButton.setSelected(false); graphModel.setIsShowingSelectedPins(false); } graphModel.setIsShowingAllPins(showTimeSeriesForAllPinsButton.isSelected()); } }); showTimeSeriesForAllPinsButton.setName("showTimeSeriesForAllPinsButton"); showTimeSeriesForAllPinsButton.setToolTipText("Show time series for all pins"); ////////////////////////////////////////// showCursorTimeSeriesButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/CursorSpectrum24.gif"), true); showCursorTimeSeriesButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { graphModel.setIsShowingCursorTimeSeries(showCursorTimeSeriesButton.isSelected()); } }); showCursorTimeSeriesButton.setToolTipText("Show time series for cursor"); showCursorTimeSeriesButton.setSelected(true); ////////////////////////////////////////// exportTimeSeriesButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Export24.gif"), false); exportTimeSeriesButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final VisatApp app = VisatApp.getApp(); final ProductSceneView view = app.getSelectedProductSceneView(); JOptionPane.showMessageDialog(view, "Not available in the current version.", "Export data", JOptionPane.INFORMATION_MESSAGE); //@todo se remove message dialog and fix export that only the visible graph data will be exported // if (view != null // && view.getProduct() != null // && view.getProduct().getProductType().equals(AbstractTimeSeries.TIME_SERIES_PRODUCT_TYPE) // && TimeSeriesMapper.getInstance().getTimeSeries(view.getProduct()) != null) { // // AbstractTimeSeries timeSeries = TimeSeriesMapper.getInstance().getTimeSeries(view.getProduct()); // ExportTimeBasedText.export(mainPanel, timeSeries, helpID); // } } }); exportTimeSeriesButton.setToolTipText("Export raster data time series of all pins"); exportTimeSeriesButton.setName("exportTimeSeriesButton"); final ProductSceneView sceneView = VisatApp.getApp().getSelectedProductSceneView(); if (sceneView != null) { exportTimeSeriesButton.setEnabled(sceneView.getProduct().getPinGroup().getNodeCount() > 0); } else { exportTimeSeriesButton.setEnabled(false); } AbstractButton helpButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Help22.png"), false); helpButton.setToolTipText("Help"); final TableLayout tableLayout = new TableLayout(1); tableLayout.setTablePadding(4, 4); tableLayout.setTableAnchor(TableLayout.Anchor.NORTHWEST); tableLayout.setTableFill(TableLayout.Fill.HORIZONTAL); tableLayout.setTableWeightX(1.0); tableLayout.setTableWeightY(0.0); JPanel buttonPanel = new JPanel(tableLayout); buttonPanel.add(showTimeSeriesForSelectedPinsButton); buttonPanel.add(showTimeSeriesForAllPinsButton); buttonPanel.add(showCursorTimeSeriesButton); buttonPanel.add(exportTimeSeriesButton); buttonPanel.add(tableLayout.createVerticalSpacer()); buttonPanel.add(helpButton); if (helpID != null) { HelpSys.enableHelpOnButton(helpButton, helpID); HelpSys.enableHelpKey(buttonPanel, helpID); } return buttonPanel; }
From source file:org.esa.snap.rcp.statistics.ChartPagePanel.java
private JPanel createChartBottomPanel(final ChartPanel chartPanel) { final AbstractButton zoomAllButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/view-fullscreen.png"), false); zoomAllButton.setToolTipText("Zoom all."); zoomAllButton.setName("zoomAllButton."); zoomAllButton.addActionListener(e -> { chartPanel.restoreAutoBounds();//from www . ja v a 2s . c o m chartPanel.repaint(); }); final AbstractButton propertiesButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/Edit24.gif"), false); propertiesButton.setToolTipText("Edit properties."); propertiesButton.setName("propertiesButton."); propertiesButton.addActionListener(e -> chartPanel.doEditChartProperties()); final AbstractButton saveButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/Export24.gif"), false); saveButton.setToolTipText("Save chart as image."); saveButton.setName("saveButton."); saveButton.addActionListener(e -> { try { chartPanel.doSaveAs(); } catch (IOException e1) { JOptionPane.showMessageDialog(chartPanel, "Could not save chart:\n" + e1.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } }); final AbstractButton printButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/Print24.gif"), false); printButton.setToolTipText("Print chart."); printButton.setName("printButton."); printButton.addActionListener(e -> chartPanel.createChartPrintJob()); final TableLayout tableLayout = new TableLayout(6); tableLayout.setColumnFill(4, TableLayout.Fill.HORIZONTAL); tableLayout.setColumnWeightX(4, 1.0); JPanel buttonPanel = new JPanel(tableLayout); tableLayout.setRowPadding(0, new Insets(0, 4, 0, 0)); buttonPanel.add(zoomAllButton); tableLayout.setRowPadding(0, new Insets(0, 0, 0, 0)); buttonPanel.add(propertiesButton); buttonPanel.add(saveButton); buttonPanel.add(printButton); buttonPanel.add(new JPanel()); buttonPanel.add(getHelpButton()); return buttonPanel; }
From source file:org.esa.snap.timeseries.ui.graph.TimeSeriesGraphForm.java
private JPanel createButtonPanel(final String helpID) { showTimeSeriesForSelectedPinsButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/SelectedPinSpectra24.gif"), true); showTimeSeriesForSelectedPinsButton.addActionListener(e -> { if (graphModel.isShowingAllPins()) { showTimeSeriesForAllPinsButton.setSelected(false); graphModel.setIsShowingAllPins(false); }// w w w . ja v a 2s . c om graphModel.setIsShowingSelectedPins(showTimeSeriesForSelectedPinsButton.isSelected()); }); showTimeSeriesForSelectedPinsButton.setName("showTimeSeriesForSelectedPinsButton"); showTimeSeriesForSelectedPinsButton.setToolTipText("Show time series for selected pin"); ////////////////////////////////////////// showTimeSeriesForAllPinsButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/PinSpectra24.gif"), true); showTimeSeriesForAllPinsButton.addActionListener(e -> { if (graphModel.isShowingSelectedPins()) { showTimeSeriesForSelectedPinsButton.setSelected(false); graphModel.setIsShowingSelectedPins(false); } graphModel.setIsShowingAllPins(showTimeSeriesForAllPinsButton.isSelected()); }); showTimeSeriesForAllPinsButton.setName("showTimeSeriesForAllPinsButton"); showTimeSeriesForAllPinsButton.setToolTipText("Show time series for all pins"); ////////////////////////////////////////// showCursorTimeSeriesButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/CursorSpectrum24.gif"), true); showCursorTimeSeriesButton.addActionListener( e -> graphModel.setIsShowingCursorTimeSeries(showCursorTimeSeriesButton.isSelected())); showCursorTimeSeriesButton.setToolTipText("Show time series for cursor"); showCursorTimeSeriesButton.setSelected(true); ////////////////////////////////////////// exportTimeSeriesButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Export24.gif"), false); exportTimeSeriesButton.addActionListener(e -> { final ProductSceneView view = SnapApp.getDefault().getSelectedProductSceneView(); JOptionPane.showMessageDialog(view, "Not available in the current version.", "Export data", JOptionPane.INFORMATION_MESSAGE); //@todo se remove message dialog and fix export that only the visible graph data will be exported // if (view != null // && view.getProduct() != null // && view.getProduct().getProductType().equals(AbstractTimeSeries.TIME_SERIES_PRODUCT_TYPE) // && TimeSeriesMapper.getInstance().getTimeSeries(view.getProduct()) != null) { // // AbstractTimeSeries timeSeries = TimeSeriesMapper.getInstance().getTimeSeries(view.getProduct()); // ExportTimeBasedText.export(mainPanel, timeSeries, helpID); // } }); exportTimeSeriesButton.setToolTipText("Export raster data time series of all pins"); exportTimeSeriesButton.setName("exportTimeSeriesButton"); final ProductSceneView sceneView = SnapApp.getDefault().getSelectedProductSceneView(); if (sceneView != null) { exportTimeSeriesButton.setEnabled(sceneView.getProduct().getPinGroup().getNodeCount() > 0); } else { exportTimeSeriesButton.setEnabled(false); } AbstractButton helpButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Help22.png"), false); helpButton.addActionListener(e -> new HelpCtx(helpID).display()); helpButton.setToolTipText("Help"); final TableLayout tableLayout = new TableLayout(1); tableLayout.setTablePadding(4, 4); tableLayout.setTableAnchor(TableLayout.Anchor.NORTHWEST); tableLayout.setTableFill(TableLayout.Fill.HORIZONTAL); tableLayout.setTableWeightX(1.0); tableLayout.setTableWeightY(0.0); JPanel buttonPanel = new JPanel(tableLayout); buttonPanel.add(showTimeSeriesForSelectedPinsButton); buttonPanel.add(showTimeSeriesForAllPinsButton); buttonPanel.add(showCursorTimeSeriesButton); buttonPanel.add(exportTimeSeriesButton); buttonPanel.add(tableLayout.createVerticalSpacer()); buttonPanel.add(helpButton); return buttonPanel; }
From source file:org.esa.beam.visat.toolviews.stat.ChartPagePanel.java
private JPanel createChartBottomPanel(final ChartPanel chartPanel) { final AbstractButton zoomAllButton = ToolButtonFactory.createButton( UIUtils.loadImageIcon("/com/bc/ceres/swing/actions/icons_22x22/view-fullscreen.png"), false); zoomAllButton.setToolTipText("Zoom all."); zoomAllButton.setName("zoomAllButton."); zoomAllButton.addActionListener(new ActionListener() { @Override/*from www. j a v a 2 s. c o m*/ public void actionPerformed(ActionEvent e) { chartPanel.restoreAutoBounds(); chartPanel.repaint(); } }); final AbstractButton propertiesButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/Edit24.gif"), false); propertiesButton.setToolTipText("Edit properties."); propertiesButton.setName("propertiesButton."); propertiesButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { chartPanel.doEditChartProperties(); } }); final AbstractButton saveButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/Export24.gif"), false); saveButton.setToolTipText("Save chart as image."); saveButton.setName("saveButton."); saveButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { chartPanel.doSaveAs(); } catch (IOException e1) { JOptionPane.showMessageDialog(chartPanel, "Could not save chart:\n" + e1.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } }); final AbstractButton printButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/Print24.gif"), false); printButton.setToolTipText("Print chart."); printButton.setName("printButton."); printButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { chartPanel.createChartPrintJob(); } }); final TableLayout tableLayout = new TableLayout(6); tableLayout.setColumnFill(4, TableLayout.Fill.HORIZONTAL); tableLayout.setColumnWeightX(4, 1.0); JPanel buttonPanel = new JPanel(tableLayout); tableLayout.setRowPadding(0, new Insets(0, 4, 0, 0)); buttonPanel.add(zoomAllButton); tableLayout.setRowPadding(0, new Insets(0, 0, 0, 0)); buttonPanel.add(propertiesButton); buttonPanel.add(saveButton); buttonPanel.add(printButton); buttonPanel.add(new JPanel()); buttonPanel.add(getHelpButton()); return buttonPanel; }
From source file:de.unibayreuth.bayeos.goat.panels.timeseries.JPanelChart.java
protected void prepareButton(AbstractButton button, String actionKey, String iconResource, String toolTipText) { button.setActionCommand(actionKey);/*from w w w.j a v a 2s .c o m*/ button.setToolTipText(toolTipText); button.addActionListener(this); try { button.setIcon(ImageFactory.getIcon(iconResource)); } catch (ImageFactoryException i) { MsgBox.error(i.getMessage()); } }
From source file:org.eumetsat.metop.visat.IasiInfoView.java
@Override protected JComponent createControl() { JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.add("Sounder Info", createInfoComponent()); tabbedPane.add("Sounder Spectrum", createSpectrumChartComponent()); tabbedPane.add("Radiance Analysis", createRadianceAnalysisComponent()); tabbedPane.add("Sounder Layer", createSounderLayerComponent()); if (getDescriptor().getHelpId() != null) { HelpSys.enableHelpKey(tabbedPane, getDescriptor().getHelpId()); }//w ww . j av a 2 s .c o m InternalFrameListener internalFrameListener = new InternalFrameAdapter() { @Override public void internalFrameActivated(InternalFrameEvent e) { final Container contentPane = e.getInternalFrame().getContentPane(); if (contentPane instanceof ProductSceneView) { final ProductSceneView view = (ProductSceneView) contentPane; final IasiLayer layer = getIasiLayer(); if (layer != null) { modelChanged(layer); } else { final LayerListener layerListener = new AbstractLayerListener() { @Override public void handleLayersAdded(Layer parentLayer, Layer[] childLayers) { final IasiLayer layer = getIasiLayer(); if (layer != null) { modelChanged(layer); view.getRootLayer().removeListener(this); } } }; view.getRootLayer().addListener(layerListener); } } } @Override public void internalFrameDeactivated(InternalFrameEvent e) { if (currentOverlay != null) { currentOverlay.removeListener(overlayListener); } updateUI(null); editor.setModel(null); } }; VisatApp.getApp().addInternalFrameListener(internalFrameListener); if (MetopSounderVPI.isValidAvhrrProductSceneViewSelected()) { final IasiLayer layer = getIasiLayer(); if (layer != null) { modelChanged(layer); } } final AbstractButton helpButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Help24.gif"), false); helpButton.setToolTipText("Help."); /*I18N*/ helpButton.setName("helpButton"); if (getDescriptor().getHelpId() != null) { HelpSys.enableHelpOnButton(helpButton, getDescriptor().getHelpId()); HelpSys.enableHelpKey(tabbedPane, getDescriptor().getHelpId()); } final JPanel containerPanel = new JPanel(new BorderLayout()); containerPanel.add(tabbedPane, BorderLayout.CENTER); final JPanel buttonPanel = new JPanel(new BorderLayout()); buttonPanel.add(helpButton, BorderLayout.EAST); containerPanel.add(buttonPanel, BorderLayout.SOUTH); return containerPanel; }
From source file:org.eumetsat.metop.visat.SounderInfoView.java
@Override protected JComponent createControl() { overlayListener = new SounderOverlayListener() { @Override/* w w w . j av a 2 s .c o m*/ public void selectionChanged(SounderOverlay overlay) { updateUI(overlay); } @Override public void dataChanged(SounderOverlay overlay) { updateUI(overlay); } }; internalFrameListener = new InternalFrameAdapter() { @Override public void internalFrameActivated(final InternalFrameEvent e) { final Container contentPane = e.getInternalFrame().getContentPane(); if (contentPane instanceof ProductSceneView) { final ProductSceneView view = (ProductSceneView) contentPane; final SounderLayer layer = getSounderLayer(view); if (layer != null) { layerChanged(layer); } else { final LayerListener layerListener = new AbstractLayerListener() { @Override public void handleLayersAdded(Layer parentLayer, Layer[] childLayers) { final SounderLayer layer = getSounderLayer(view); if (layer != null) { layerChanged(layer); view.getRootLayer().removeListener(this); } } }; view.getRootLayer().addListener(layerListener); } } } @Override public void internalFrameDeactivated(final InternalFrameEvent e) { final Container contentPane = e.getInternalFrame().getContentPane(); if (contentPane instanceof ProductSceneView) { final ProductSceneView view = (ProductSceneView) contentPane; final SounderLayer layer = getSounderLayer(view); if (layer != null) { layer.getOverlay().removeListener(overlayListener); } } } @Override public void internalFrameClosed(InternalFrameEvent e) { if (getSounderLayer() == null) { clearUI(); editor.setModel(null); } } }; VisatApp.getApp().addInternalFrameListener(internalFrameListener); final JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.add("Sounder Info", createInfoComponent()); tabbedPane.add("Sounder Spectrum", createSpectrumChartComponent()); tabbedPane.add("Sounder Layer", createSounderLayerComponent()); final SounderLayer layer = getSounderLayer(); if (layer != null) { layerChanged(layer); } final AbstractButton helpButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Help24.gif"), false); helpButton.setToolTipText("Help."); /*I18N*/ helpButton.setName("helpButton"); if (getDescriptor().getHelpId() != null) { HelpSys.enableHelpOnButton(helpButton, getDescriptor().getHelpId()); HelpSys.enableHelpKey(tabbedPane, getDescriptor().getHelpId()); } final JPanel containerPanel = new JPanel(new BorderLayout()); containerPanel.add(tabbedPane, BorderLayout.CENTER); final JPanel buttonPanel = new JPanel(new BorderLayout()); buttonPanel.add(helpButton, BorderLayout.EAST); containerPanel.add(buttonPanel, BorderLayout.SOUTH); return containerPanel; }
From source file:apidemo.PanScrollZoomDemo.java
/** * Prepares a button./*from w w w .ja v a 2 s .co m*/ * * @param button the button. * @param actionKey the action key. * @param buttonLabelText the button label. * @param toolTipText the tooltip text. */ private void prepareButton(final AbstractButton button, final String actionKey, final String buttonLabelText, final String toolTipText) { // todo // as this action is empty and the button text is // redefined later, it can be safely removed ... // Action action = new AbstractAction(actionKey) { // public void actionPerformed(ActionEvent evt) { // // ignored // } // }; // button.addActionListener(action); button.setActionCommand(actionKey); button.setText(buttonLabelText); button.setToolTipText(toolTipText); button.addActionListener(this); }