List of usage examples for javax.swing JButton setToolTipText
@BeanProperty(bound = false, preferred = true, description = "The text to display in a tool tip.") public void setToolTipText(String text)
From source file:edu.scripps.fl.pubchem.xmltool.gui.GUIComponent.java
public JButton createJButton(String text, String toolTip, String type) { JButton jbn = null; if (type.equals("icon")) { jbn = new JButton(createGeneralIcon(text)); } else if (type.equals("text")) { Font jbnFont = new Font(Font.SANS_SERIF, Font.BOLD, 10); jbn = new JButton(text); jbn.setFont(jbnFont);/*from w ww .j a v a 2 s . c o m*/ } jbn.setOpaque(true); jbn.setToolTipText(toolTip); return jbn; }
From source file:net.sf.jabref.external.ExternalFilePanel.java
public ExternalFilePanel(final JabRefFrame frame, final MetaData metaData, final EntryEditor entryEditor, final String fieldName, final OpenFileFilter off, final FieldEditor editor) { this.frame = frame; this.metaData = metaData; this.off = off; this.entryEditor = entryEditor; setLayout(new GridLayout(2, 2)); JButton browseBut = new JButton(Localization.lang("Browse")); JButton download = new JButton(Localization.lang("Download")); JButton auto = new JButton(Localization.lang("Auto")); JButton xmp = new JButton(Localization.lang("Write XMP")); xmp.setToolTipText(Localization.lang("Write BibtexEntry as XMP-metadata to PDF.")); browseBut.addActionListener(new ActionListener() { @Override/*ww w . jav a2 s .co m*/ public void actionPerformed(ActionEvent e) { browseFile(fieldName, editor); // editor.setText(chosenValue); entryEditor.storeFieldAction.actionPerformed(new ActionEvent(editor, 0, "")); } }); download.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { downLoadFile(fieldName, editor, frame); } }); auto.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JabRefExecutorService.INSTANCE.execute(autoSetFile(fieldName, editor)); } }); xmp.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { pushXMP(fieldName, editor); } }); add(browseBut); add(download); add(auto); add(xmp); // Add drag and drop support to the field if (editor != null) { ((JComponent) editor).setDropTarget(new DropTarget((Component) editor, DnDConstants.ACTION_NONE, new UrlDragDrop(entryEditor, frame, editor))); } }
From source file:src.gui.LifelinePanel.java
public void buildBottonToolBar() { buttonPanel = new JPanel(new BorderLayout()); buttonPanel.setBackground(Color.WHITE); //JLabel test = new JLabel("<html><a href=\"http://www.google.com\">delete</a></html>"); JPanel leftpanel = new JPanel(new BorderLayout()); leftpanel.setBackground(Color.WHITE); JButton button = new JButton(editLifeLine); button.setToolTipText("Edit lifeline"); button.setBackground(Color.WHITE); button.setBorderPainted(false);/*from w ww. ja va 2s . c o m*/ leftpanel.add(button, BorderLayout.WEST); button.setRolloverEnabled(true); button = new JButton(deleteLifeLine); button.setToolTipText("Delete lifeline"); button.setBackground(Color.WHITE); button.setBorderPainted(false); leftpanel.add(button, BorderLayout.EAST); button.setRolloverEnabled(true); //JLabel editlabel = new JLabel("<html><b><u>edit</u></b> </html>"); //leftpanel.add(editlabel, BorderLayout.WEST); //JLabel deletelabel = new JLabel("<html><b><u>delete</u></b></html>"); //leftpanel.add(deletelabel, BorderLayout.EAST); buttonPanel.add(leftpanel, BorderLayout.EAST); this.add(buttonPanel, BorderLayout.SOUTH); }
From source file:cool.pandora.modeller.ui.jpanel.base.NewBagInPlaceFrame.java
/** * layoutSelectDataContent./* ww w. j a v a 2 s . c o m*/ * * @param contentPanel JPanel * @param row int */ private void layoutSelectDataContent(final JPanel contentPanel, final int row) { final JLabel location = new JLabel("Select Data:"); final JButton saveAsButton = new JButton(bagView.getPropertyMessage("bag.button.browse")); saveAsButton.addActionListener(new BrowseFileHandler()); saveAsButton.setEnabled(true); saveAsButton.setToolTipText(bagView.getPropertyMessage("bag.button.browse.help")); String fileName = ""; if (bag != null) { fileName = bag.getName(); } bagNameField = new JTextField(fileName); bagNameField.setCaretPosition(fileName.length()); bagNameField.setEditable(false); bagNameField.setEnabled(false); GridBagConstraints glbc = new GridBagConstraints(); glbc = LayoutUtil.buildGridBagConstraints(0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); contentPanel.add(location, glbc); glbc = LayoutUtil.buildGridBagConstraints(2, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.EAST); contentPanel.add(saveAsButton, glbc); glbc = LayoutUtil.buildGridBagConstraints(1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); glbc.ipadx = 0; contentPanel.add(bagNameField, glbc); }
From source file:org.drugis.addis.gui.builder.NetworkMetaAnalysisView.java
private JComponent buildNodeSplitControls() { final FormLayout layout = new FormLayout("fill:0:grow, 3dlu, pref", "p"); final CellConstraints cc = new CellConstraints(); final PanelBuilder panelBuilder = new PanelBuilder(layout); final JButton resetAll = new JButton( MainWindow.IMAGELOADER.getIcon(org.drugis.mtc.gui.FileNames.ICON_REDO)); resetAll.setToolTipText("Reset all simulations"); resetAll.addActionListener(new ActionListener() { @Override/*from w ww .j a v a2 s. c o m*/ public void actionPerformed(final ActionEvent e) { d_pm.getBean().resetNodeSplitModels(); if (d_mainWindow instanceof AddisWindow) { d_mainWindow.reloadRightPanel(NODE_SPLIT_TAB_TITLE); } } }); final JButton runAll = new JButton(MainWindow.IMAGELOADER.getIcon(org.drugis.mtc.gui.FileNames.ICON_RUN)); runAll.setText("Run all node-split models"); runAll.setToolTipText("Run all simulations"); final List<Task> tasks = new ArrayList<Task>(); for (final BasicParameter p : d_pm.getSplitParameters()) { final NodeSplitWrapper<TreatmentDefinition> wrapper = d_pm.getNodeSplitModel(p); if (!wrapper.isSaved()) { tasks.add(wrapper.getModel().getActivityTask()); } } runAll.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { ThreadHandler.getInstance().scheduleTasks(tasks); } }); panelBuilder.add(resetAll, cc.xy(3, 1)); panelBuilder.add(runAll, cc.xy(1, 1)); return panelBuilder.getPanel(); }
From source file:net.sf.xmm.moviemanager.gui.DialogIMDbMultiAdd.java
JButton createChooseBetweenImdbAndLocalDatabaseButton() { /*This button choses between IMDB and local movie database*/ final JButton chooseBetweenImdbAndLocalDatabase = new JButton( Localizer.get("DialogIMDbMultiAdd.button.add-to-existing-movie.text")); //$NON-NLS-1$ chooseBetweenImdbAndLocalDatabase .setToolTipText(Localizer.get("DialogIMDbMultiAdd.button.add-to-existing-movie.tooltip")); //$NON-NLS-1$ chooseBetweenImdbAndLocalDatabase.setActionCommand("GetIMDBInfo - chooseBetweenImdbAndLocalDatabase"); //$NON-NLS-1$ chooseBetweenImdbAndLocalDatabase.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { log.debug("ActionPerformed: " + event.getActionCommand()); //$NON-NLS-1$ if (addInfoToExistingMovie) { getPanelMoviesList().setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), Localizer.get("DialogIMDB.panel-movie-list.title")), //$NON-NLS-1$ BorderFactory.createEmptyBorder(5, 5, 5, 5))); chooseBetweenImdbAndLocalDatabase .setText(Localizer.get("DialogIMDbMultiAdd.button.add-to-existing-movie.text")); //$NON-NLS-1$ chooseBetweenImdbAndLocalDatabase.setToolTipText( Localizer.get("DialogIMDbMultiAdd.button.add-to-existing-movie.tooltip")); //$NON-NLS-1$ addInfoToExistingMovie = false; executeSearchMultipleMovies(); }//from w ww .j a v a2 s .c om else { executeEditExistingMovie(""); //$NON-NLS-1$ chooseBetweenImdbAndLocalDatabase .setText(Localizer.get("DialogIMDbMultiAdd.button.search-on-IMDb.text")); //$NON-NLS-1$ chooseBetweenImdbAndLocalDatabase .setToolTipText(Localizer.get("DialogIMDbMultiAdd.button.search-on-IMDb.tooltip")); //$NON-NLS-1$ addInfoToExistingMovie = true; getPanelMoviesList().setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), Localizer.get("DialogIMDB.panel-your-movie-list.title")), //$NON-NLS-1$ BorderFactory.createEmptyBorder(5, 5, 5, 5))); } } }); return chooseBetweenImdbAndLocalDatabase; }
From source file:me.philnate.textmanager.windows.MainWindow.java
/** * Initialize the contents of the frame. *//* w w w . j av a2 s . c o m*/ private void initialize() { changeListener = new ChangeListener(); frame = new JFrame(); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { Starter.shutdown(); } }); frame.setBounds(100, 100, 1197, 500); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(new MigLayout("", "[grow]", "[][grow][::16px]")); customers = new CustomerComboBox(); customers.addItemListener(changeListener); frame.getContentPane().add(customers, "flowx,cell 0 0,growx"); jScrollPane = new JScrollPane(); billLines = new BillingItemTable(frame, true); jScrollPane.setViewportView(billLines); frame.getContentPane().add(jScrollPane, "cell 0 1,grow"); // for each file added through drag&drop create a new lineItem new FileDrop(jScrollPane, new FileDrop.Listener() { @Override public void filesDropped(File[] files) { for (File file : files) { addNewBillingItem(Document.loadAndSave(file)); } } }); monthChooser = new JMonthChooser(); monthChooser.addPropertyChangeListener(changeListener); frame.getContentPane().add(monthChooser, "cell 0 0"); yearChooser = new JYearChooser(); yearChooser.addPropertyChangeListener(changeListener); frame.getContentPane().add(yearChooser, "cell 0 0"); JButton btnAddLine = new JButton(); btnAddLine.setIcon(ImageRegistry.getImage("load.gif")); btnAddLine.setToolTipText(getCaption("mw.tooltip.add")); btnAddLine.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { addNewBillingItem(); } }); frame.getContentPane().add(btnAddLine, "cell 0 0"); JButton btnMassAdd = new JButton(); btnMassAdd.setIcon(ImageRegistry.getImage("load_all.gif")); btnMassAdd.setToolTipText(getCaption("mw.tooltip.massAdd")); btnMassAdd.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { JFileChooser file = new DocXFileChooser(); switch (file.showOpenDialog(frame)) { case JFileChooser.APPROVE_OPTION: File[] files = file.getSelectedFiles(); if (null != files) { for (File fl : files) { addNewBillingItem(Document.loadAndSave(fl)); } } break; default: return; } } }); frame.getContentPane().add(btnMassAdd, "cell 0 0"); billNo = new JTextField(); // enable/disable build button based upon text in billNo billNo.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent arg0) { setButtonStates(); } @Override public void insertUpdate(DocumentEvent arg0) { setButtonStates(); } @Override public void changedUpdate(DocumentEvent arg0) { setButtonStates(); } private void setButtonStates() { boolean notBlank = StringUtils.isNotBlank(billNo.getText()); build.setEnabled(notBlank); view.setEnabled(pdf.find(billNo.getText() + ".pdf").size() == 1); } }); frame.getContentPane().add(billNo, "cell 0 0"); billNo.setColumns(10); build = new JButton(); build.setEnabled(false);// disable build Button until there's some // billNo entered build.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { if (runningThread == null) { try { // check that billNo isn't empty or already used within // another Bill if (billNo.getText().trim().equals("")) { JOptionPane.showMessageDialog(frame, getCaption("mw.dialog.error.billNoBlank.msg"), getCaption("mw.dialog.error.billNoBlank.title"), JOptionPane.ERROR_MESSAGE); return; } try { bill.setBillNo(billNo.getText()).save(); } catch (DuplicateKey e) { // unset the internal value as this is already used bill.setBillNo(""); JOptionPane.showMessageDialog(frame, format(getCaption("mw.error.billNoUsed.msg"), billNo.getText()), getCaption("mw.dialog.error.billNoBlank.title"), JOptionPane.ERROR_MESSAGE); return; } PDFCreator pdf = new PDFCreator(bill); pdf.addListener(new ThreadCompleteListener() { @Override public void threadCompleted(NotifyingThread notifyingThread) { build.setToolTipText(getCaption("mw.tooltip.build")); build.setIcon(ImageRegistry.getImage("build.png")); runningThread = null; view.setEnabled(DB.pdf.find(billNo.getText() + ".pdf").size() == 1); } }); runningThread = new Thread(pdf); runningThread.start(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } build.setToolTipText(getCaption("mw.tooltip.build.cancel")); build.setIcon(ImageRegistry.getImage("cancel.gif")); } else { runningThread.interrupt(); runningThread = null; build.setToolTipText(getCaption("mw.tooltip.build")); build.setIcon(ImageRegistry.getImage("build.png")); } } }); build.setToolTipText(getCaption("mw.tooltip.build")); build.setIcon(ImageRegistry.getImage("build.png")); frame.getContentPane().add(build, "cell 0 0"); view = new JButton(); view.setToolTipText(getCaption("mw.tooltip.view")); view.setIcon(ImageRegistry.getImage("view.gif")); view.setEnabled(false); view.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { File file = new File(System.getProperty("user.dir"), format("template/%s.tmp.pdf", billNo.getText())); try { pdf.findOne(billNo.getText() + ".pdf").writeTo(file); new ProcessBuilder(Setting.find("pdfViewer").getValue(), file.getAbsolutePath()).start() .waitFor(); file.delete(); } catch (IOException | InterruptedException e1) { // TODO Auto-generated catch block LOG.warn("Error while building PDF", e1); } } }); frame.getContentPane().add(view, "cell 0 0"); statusBar = new JPanel(); statusBar.setBorder(new BevelBorder(BevelBorder.LOWERED)); statusBar.setLayout(new BoxLayout(statusBar, BoxLayout.X_AXIS)); GitRepositoryState state = DB.state; JLabel statusLabel = new JLabel(String.format("textManager Version v%s build %s", state.getCommitIdDescribe(), state.getBuildTime())); statusLabel.setHorizontalAlignment(SwingConstants.LEFT); statusBar.add(statusLabel); frame.add(statusBar, "cell 0 2,growx"); JMenuBar menuBar = new JMenuBar(); frame.setJMenuBar(menuBar); JMenu menu = new JMenu(getCaption("mw.menu.edit")); JMenuItem itemCust = new JMenuItem(getCaption("mw.menu.edit.customer")); itemCust.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { new CustomerWindow(customers); } }); menu.add(itemCust); JMenuItem itemSetting = new JMenuItem(getCaption("mw.menu.edit.settings")); itemSetting.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { new SettingWindow(); } }); menu.add(itemSetting); JMenuItem itemImport = new JMenuItem(getCaption("mw.menu.edit.import")); itemImport.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { new ImportWindow(new ImportListener() { @Override public void entriesImported(List<BillingItem> items) { for (BillingItem item : items) { item.setCustomerId(customers.getSelectedCustomer().getId()) .setMonth(monthChooser.getMonth()).setYear(yearChooser.getYear()); item.save(); billLines.addRow(item); } } }, frame); } }); menu.add(itemImport); menuBar.add(menu); customers.loadCustomer(); fillTableModel(); }
From source file:com.googlecode.bpmn_simulator.gui.BPMNSimulatorFrame.java
private JToolBar createDefinitionToolbar() { final JButton openButton = new JButton(Theme.ICON_OPEN); openButton.setToolTipText(Messages.getString("Toolbar.open")); //$NON-NLS-1$ openButton.addActionListener(new ActionListener() { @Override//from w w w . j a v a2s . c om public void actionPerformed(final ActionEvent event) { openFile(); } }); definitionToolbar.add(openButton); final JPopupMenu importMenu = new JPopupMenu(Messages.getString("Toolbar.import")); //$NON-NLS-1$ final JMenuItem importBonitaItem = new JMenuItem("Bonita"); importBonitaItem.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent event) { importBonita(); } }); importMenu.add(importBonitaItem); final JButton importButton = new JButton(Theme.ICON_IMPORT); importButton.setToolTipText(Messages.getString("Toolbar.import")); //$NON-NLS-1$ importButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent event) { importMenu.show(importButton, 0, importButton.getHeight()); } }); definitionToolbar.add(importButton); return definitionToolbar; }
From source file:com.microsoft.azure.hdinsight.spark.ui.SparkSubmissionContentPanel.java
private void addAdvancedConfigLineItem() { JButton advancedConfigButton = new JButton("Advanced configuration"); advancedConfigButton .setToolTipText("Specify advanced configuration, for example, enabling Spark remote debug"); add(advancedConfigButton, new GridBagConstraints(0, ++displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE, new Insets(margin, margin, 0, 0), 0, 0)); advancedConfigButton.addActionListener(new ActionListener() { @Override//w w w .j a va 2s .c o m public void actionPerformed(ActionEvent e) { advancedConfigDialog = new SparkSubmissionAdvancedConfigDialog(submitModel.getAdvancedConfigModel(), new CallBack() { @Override public void run() { if (null != advancedConfigDialog) { submitModel .setAdvancedConfigModel(advancedConfigDialog.getAdvancedConfigModel()); } } }); advancedConfigDialog.setModal(true); advancedConfigDialog.setVisible(true); } }); }