List of usage examples for javax.swing JDialog setContentPane
@BeanProperty(bound = false, hidden = true, description = "The client area of the dialog where child components are normally inserted.") public void setContentPane(Container contentPane)
From source file:org.geworkbench.engine.ccm.ComponentConfigurationManagerWindow.java
/** * Display a dialog box with a components license in it. * //from ww w . j av a 2 s. c om * @param ActionEvent * @return void */ private void viewLicense_actionPerformed(ActionEvent e) { int[] selectedRow = table.getSelectedRows(); String license = "Select a component in order to view its license."; String componentName = null; if (selectedRow != null && selectedRow.length > 0 && selectedRow[0] >= 0) { int modelRow = table.convertRowIndexToModel(selectedRow[0]); license = (String) ccmTableModel.getModelValueAt(modelRow, CCMTableModel.LICENSE_INDEX); componentName = (String) ccmTableModel.getModelValueAt(modelRow, CCMTableModel.NAME_INDEX); } JDialog licenseDialog = new JDialog(); final JEditorPane jEditorPane = new JEditorPane("text/html", ""); jEditorPane.getDocument().putProperty("IgnoreCharsetDirective", Boolean.TRUE); jEditorPane.setText(license); if (jEditorPane.getCaretPosition() > 1) { jEditorPane.setCaretPosition(1); } JScrollPane scrollPane = new JScrollPane(jEditorPane); licenseDialog.setTitle(componentName + " License"); licenseDialog.setContentPane(scrollPane); licenseDialog.setSize(400, 300); licenseDialog.setLocationRelativeTo(frame); licenseDialog.setVisible(true); }
From source file:org.geworkbench.engine.ccm.ComponentConfigurationManagerWindow2.java
/** * Display a dialog box with a components license in it. * //from w w w.j a v a 2 s. c o m * @param ActionEvent * @return void */ private void viewLicense_actionPerformed(ActionEvent e) { int[] selectedRow = table.getSelectedRows(); String license = "Select a component in order to view its license."; String componentName = null; if (selectedRow != null && selectedRow.length > 0 && selectedRow[0] >= 0) { int modelRow = table.convertRowIndexToModel(selectedRow[0]); license = (String) ccmTableModel.getModelValueAt(modelRow, CCMTableModel2.LICENSE_INDEX); componentName = (String) ccmTableModel.getModelValueAt(modelRow, CCMTableModel2.NAME_INDEX); } JDialog licenseDialog = new JDialog(); final JEditorPane jEditorPane = new JEditorPane("text/html", ""); jEditorPane.getDocument().putProperty("IgnoreCharsetDirective", Boolean.TRUE); jEditorPane.setText(license); if (jEditorPane.getCaretPosition() > 1) { jEditorPane.setCaretPosition(1); } JScrollPane scrollPane = new JScrollPane(jEditorPane); licenseDialog.setTitle(componentName + " License"); licenseDialog.setContentPane(scrollPane); licenseDialog.setSize(400, 300); licenseDialog.setLocationRelativeTo(frame); licenseDialog.setVisible(true); }
From source file:org.myrobotlab.service.MarySpeech.java
private void showProgressPanel(List<ComponentDescription> comps, boolean install) { final ProgressPanel pp = new ProgressPanel(comps, install); final JOptionPane optionPane = new JOptionPane(pp, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new String[] { "Abort" }, "Abort"); // optionPane.setPreferredSize(new Dimension(640,480)); final JDialog dialog = new JDialog((Frame) null, "Progress", false); dialog.setContentPane(optionPane); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (dialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) { pp.requestExit();/*from w w w. j a v a2s . c o m*/ dialog.setVisible(false); } } }); dialog.pack(); dialog.setVisible(true); new Thread(pp).start(); }
From source file:savant.view.swing.BookmarkSheet.java
private void loadBookmarks(JTable table) { final BookmarksTableModel btm = (BookmarksTableModel) table.getModel(); List<Bookmark> bookmarks = btm.getData(); if (bookmarks.size() > 0) { String message = "Clear existing bookmarks?"; String title = "Clear Bookmarks"; // display the JOptionPane showConfirmDialog int reply = JOptionPane.showConfirmDialog(null, message, title, JOptionPane.YES_NO_OPTION); if (reply == JOptionPane.YES_OPTION) { btm.clearData();//from w w w. j a v a2 s . c o m BookmarkController.getInstance().clearBookmarks(); } } final File selectedFile = DialogUtils.chooseFileForOpen("Load Bookmarks", null, null); // set the genome if (selectedFile != null) { int result = JOptionPane.showOptionDialog(null, "Would you like to add padding to each bookmark range?", "Add a margin?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); final boolean addMargin = (result == JOptionPane.YES_OPTION); Window w = SwingUtilities.getWindowAncestor(BookmarkSheet.this); JOptionPane optionPane = new JOptionPane( "<html>Loading bookmarks from file.<br>This may take a moment.</html>", JOptionPane.INFORMATION_MESSAGE, JOptionPane.CANCEL_OPTION); final JDialog dialog = new JDialog(w, "Loading Bookmarks", Dialog.ModalityType.MODELESS); dialog.setContentPane(optionPane); dialog.pack(); dialog.setLocationRelativeTo(w); dialog.setVisible(true); new Thread("BookmarkSheet.loadBookmarks") { @Override public void run() { try { BookmarkController.getInstance().addBookmarksFromFile(selectedFile, addMargin); btm.fireTableDataChanged(); } catch (Exception ex) { DialogUtils.displayError("Error", "Unable to load bookmarks: " + ex.getMessage()); } finally { dialog.setVisible(false); dialog.dispose(); } } }.start(); } }
From source file:tvbrowser.ui.mainframe.MainFrame.java
private void quit(boolean log, boolean export) { mTimer.stop(); // disable the update timer to avoid new update events if (log && downloadingThread != null && downloadingThread.isAlive()) { final JDialog info = new JDialog(UiUtilities.getLastModalChildOf(this)); info.setModal(true);//w w w . j av a 2 s.c o m info.setUndecorated(true); info.toFront(); JPanel main = new JPanel(new FormLayout("5dlu,pref,5dlu", "5dlu,pref,5dlu")); main.setBorder(BorderFactory.createLineBorder(Color.black)); main.add( new JLabel(mLocalizer.msg("downloadinfo", "A data update is running. TV-Browser will be closed when the update is done.")), new CellConstraints().xy(2, 2)); info.setContentPane(main); info.pack(); info.setLocationRelativeTo(this); SwingUtilities.invokeLater(new Runnable() { public void run() { if (downloadingThread != null && downloadingThread.isAlive()) { try { downloadingThread.join(); } catch (InterruptedException e) { e.printStackTrace(); } } info.setVisible(false); info.dispose(); } }); info.setVisible(true); } if (log && this.isUndecorated()) { switchFullscreenMode(); } if (mShuttingDown) { return; } mShuttingDown = true; if (log) { FavoritesPlugin.getInstance().handleTvBrowserIsShuttingDown(); } if (log) { mLog.info("Finishing plugins"); } PluginProxyManager.getInstance().shutdownAllPlugins(log); if (log) { mLog.info("Storing dataservice settings"); } TvDataServiceProxyManager.getInstance().shutDown(); FavoritesPlugin.getInstance().store(); ReminderPlugin.getInstance().store(); TVBrowser.shutdown(log); if (log) { mLog.info("Closing TV data base"); } try { TvDataBase.getInstance().close(); } catch (Exception exc) { if (log) { mLog.log(Level.WARNING, "Closing database failed", exc); } } if (export) { Settings.propTVDataDirectory.resetToDefault(); Settings.copyToSystem(); } if (log) { mLog.info("Quitting"); System.exit(0); } }