Java Code Examples for javax.swing.JDialog#add()
The following examples show how to use
javax.swing.JDialog#add() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HelpMenu.java From triplea with GNU General Public License v3.0 | 6 votes |
private static JDialog createInformationDialog(final JComponent component, final String title) { final JDialog dialog = new JDialog((JFrame) null, title); dialog.add(component, BorderLayout.CENTER); final JPanel buttons = new JPanel(); final JButton button = new JButton( SwingAction.of( "OK", event -> { dialog.setVisible(false); dialog.removeAll(); dialog.dispose(); })); buttons.add(button); dialog.getRootPane().setDefaultButton(button); dialog.add(buttons, BorderLayout.SOUTH); dialog.pack(); dialog.addWindowListener( new WindowAdapter() { @Override public void windowOpened(final WindowEvent e) { button.requestFocus(); } }); return dialog; }
Example 2
Source File: SimilarityMatrixExportDialog.java From wandora with GNU General Public License v3.0 | 5 votes |
public void open() { myDialog = new JDialog(Wandora.getWandora(), true); myDialog.add(this); myDialog.setSize(600,320); myDialog.setTitle("Similarity matrix export options"); UIBox.centerWindow(myDialog, Wandora.getWandora()); wasAccepted = false; myDialog.setVisible(true); }
Example 3
Source File: EditParamsDialogFactory.java From lucene-solr with Apache License 2.0 | 5 votes |
@Override public JDialog create(Window owner, String title, int width, int height) { dialog = new JDialog(owner, title, Dialog.ModalityType.APPLICATION_MODAL); dialog.add(content()); dialog.setSize(new Dimension(width, height)); dialog.setLocationRelativeTo(owner); dialog.getContentPane().setBackground(prefs.getColorTheme().getBackgroundColor()); return dialog; }
Example 4
Source File: DefaultAbout.java From opt4j with MIT License | 5 votes |
@Override public JDialog getDialog(ApplicationFrame frame) { JDialog dialog = new JDialog(frame, "About Configurator", true); dialog.setBackground(Color.WHITE); dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); dialog.setResizable(false); dialog.add(new JLabel("Void Frame")); dialog.pack(); dialog.setVisible(false); return dialog; }
Example 5
Source File: OptimizeIndexDialogFactory.java From lucene-solr with Apache License 2.0 | 5 votes |
@Override public JDialog create(Window owner, String title, int width, int height) { dialog = new JDialog(owner, title, Dialog.ModalityType.APPLICATION_MODAL); dialog.add(content()); dialog.setSize(new Dimension(width, height)); dialog.setLocationRelativeTo(owner); dialog.getContentPane().setBackground(prefs.getColorTheme().getBackgroundColor()); return dialog; }
Example 6
Source File: AboutView.java From pgptool with GNU General Public License v3.0 | 5 votes |
@Override protected JDialog initDialog(Window owner, Object constraints) { JDialog ret = new JDialog(owner, ModalityType.APPLICATION_MODAL); ret.setLayout(new BorderLayout()); ret.setResizable(false); ret.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); ret.setTitle(Messages.get("term.aboutApp")); ret.add(pnl, BorderLayout.CENTER); ret.pack(); return ret; }
Example 7
Source File: InflateReader.java From aion-germany with GNU General Public License v3.0 | 5 votes |
public void actionPerformed(ActionEvent e) { JDialog dlg = new JDialog(((Main) PacketSamurai.getUserInterface()).getMainFrame(), "Text"); dlg.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dlg.setSize(350, 400); dlg.setLocationRelativeTo(((Main) PacketSamurai.getUserInterface()).getMainFrame()); JEditorPane sourceDisplay = new JEditorPane(); sourceDisplay.setEditable(false); sourceDisplay.setContentType("text/plain"); sourceDisplay.setText(_xml); dlg.add(new JScrollPane(sourceDisplay)); dlg.setVisible(true); }
Example 8
Source File: FBGraphExtractorPanel.java From wandora with GNU General Public License v3.0 | 5 votes |
void open() { app = Wandora.getWandora(); window = new JDialog(app, AbstractFBGraphExtractor.NAME, true); window.add(this); window.setSize(DIMENSION); app.centerWindow(window); window.setVisible(true); }
Example 9
Source File: RTopicPanel.java From wandora with GNU General Public License v3.0 | 5 votes |
private void openOptionsDialog() { optionsDialog = new JDialog(Wandora.getWandora(), true); optionsDialog.setSize(500,270); optionsDialog.add(optionsPanel); optionsDialog.setTitle("R topic panel options"); Wandora.getWandora().centerWindow(optionsDialog); optionsDialog.setVisible(true); }
Example 10
Source File: SQLExtractorUI.java From wandora with GNU General Public License v3.0 | 5 votes |
public void open(Wandora w) { accepted = false; dialog = new JDialog(w, true); dialog.setSize(750,400); dialog.add(this); dialog.setTitle("SQL Extractor"); UIBox.centerWindow(dialog, w); dialog.setVisible(true); }
Example 11
Source File: ImageableAreaTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static void createAndShowTestDialog(String description, String failMessage, Runnable action) { final JDialog dialog = new JDialog(); dialog.setTitle("Test: " + (++testCount)); dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); JTextArea textArea = new JTextArea(description); textArea.setEditable(false); final JButton testButton = new JButton("Print Table"); final JButton passButton = new JButton("PASS"); passButton.setEnabled(false); passButton.addActionListener((e) -> { dialog.dispose(); }); final JButton failButton = new JButton("FAIL"); failButton.setEnabled(false); failButton.addActionListener((e) -> { throw new RuntimeException(failMessage); }); testButton.addActionListener((e) -> { testButton.setEnabled(false); action.run(); passButton.setEnabled(true); failButton.setEnabled(true); }); JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.add(textArea, BorderLayout.CENTER); JPanel buttonPanel = new JPanel(new FlowLayout()); buttonPanel.add(testButton); buttonPanel.add(passButton); buttonPanel.add(failButton); mainPanel.add(buttonPanel, BorderLayout.SOUTH); dialog.add(mainPanel); dialog.pack(); dialog.setVisible(true); }
Example 12
Source File: AboutDialogFactory.java From lucene-solr with Apache License 2.0 | 5 votes |
@Override public JDialog create(Window owner, String title, int width, int height) { dialog = new JDialog(owner, title, Dialog.ModalityType.APPLICATION_MODAL); dialog.add(content()); dialog.setSize(new Dimension(width, height)); dialog.setLocationRelativeTo(owner); dialog.getContentPane().setBackground(prefs.getColorTheme().getBackgroundColor()); return dialog; }
Example 13
Source File: SelectMicrosoftTranslationLanguagesPanel.java From wandora with GNU General Public License v3.0 | 5 votes |
public void openInDialog(Wandora wandora) { someLangs = filterLangs(wandora.getTopicMap(), langs); setLanguages(); accepted = false; dialog = new JDialog(wandora, true); dialog.setSize(500,470); dialog.setTitle("Select source and target languages"); wandora.centerWindow(dialog); dialog.add(this); dialog.setVisible(true); }
Example 14
Source File: ImageableAreaTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static void createAndShowTestDialog(String description, String failMessage, Runnable action) { final JDialog dialog = new JDialog(); dialog.setTitle("Test: " + (++testCount)); dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); JTextArea textArea = new JTextArea(description); textArea.setEditable(false); final JButton testButton = new JButton("Print Table"); final JButton passButton = new JButton("PASS"); passButton.setEnabled(false); passButton.addActionListener((e) -> { dialog.dispose(); }); final JButton failButton = new JButton("FAIL"); failButton.setEnabled(false); failButton.addActionListener((e) -> { throw new RuntimeException(failMessage); }); testButton.addActionListener((e) -> { testButton.setEnabled(false); action.run(); passButton.setEnabled(true); failButton.setEnabled(true); }); JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.add(textArea, BorderLayout.CENTER); JPanel buttonPanel = new JPanel(new FlowLayout()); buttonPanel.add(testButton); buttonPanel.add(passButton); buttonPanel.add(failButton); mainPanel.add(buttonPanel, BorderLayout.SOUTH); dialog.add(mainPanel); dialog.pack(); dialog.setVisible(true); }
Example 15
Source File: GeopaparazziViewer.java From hortonmachine with GNU General Public License v3.0 | 5 votes |
private void openImageInDialog( long imageId, String imageName, File dbFile, boolean doOriginalSize ) throws Exception { BufferedImage bufferedImage = readImageToBufferedImage(imageId, dbFile, doOriginalSize); if (bufferedImage != null) { JDialog f = new JDialog(); f.add(new JLabel(new ImageIcon(bufferedImage)), BorderLayout.CENTER); f.setTitle(imageName); f.pack(); f.setSize(bufferedImage.getWidth(), bufferedImage.getHeight()); f.setLocationRelativeTo(null); // Center on screen f.setVisible(true); f.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); } }
Example 16
Source File: SelectWatsonTranslationLanguagesPanel.java From wandora with GNU General Public License v3.0 | 5 votes |
public void openInDialog(Wandora wandora) { setLanguages(); accepted = false; dialog = new JDialog(wandora, true); dialog.setSize(500,350); dialog.setTitle("Select translation languages"); wandora.centerWindow(dialog); dialog.add(this); dialog.setVisible(true); }
Example 17
Source File: AddThemeEntry.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
private void customizeBorderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_customizeBorderActionPerformed BorderEditor editor = new BorderEditor(currentBorder, resources); JDialog dialog = new JDialog((JDialog)SwingUtilities.windowForComponent(this), "Border"); dialog.setLayout(new BorderLayout()); dialog.add(BorderLayout.CENTER, editor); dialog.pack(); dialog.setLocationRelativeTo(customizeBorder); dialog.setModal(true); dialog.setVisible(true); currentBorder = editor.getResult(); updateThemePreview(); }
Example 18
Source File: UITool.java From freeinternals with Apache License 2.0 | 5 votes |
/** * Show a popup window with given message. * * @param frame Parent window * @param panel Content in panel * @param title Popup window title */ public static void showPopup(final JFrame frame, final JPanel panel, final String title) { if (frame == null || panel == null) { return; } final JDialog popup = new JDialog(frame, title); popup.setSize( (int) Math.floor(frame.getWidth() * POPUP_RATIO), (int) Math.floor(frame.getHeight() * POPUP_RATIO)); popup.setLayout(new BorderLayout()); popup.add(panel, BorderLayout.CENTER); popup.setLocationRelativeTo(frame); popup.setVisible(true); }
Example 19
Source File: ServiceDlgSheetCollateTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private static void doTest(Runnable action) { String description = " A print dialog would appear.\n" + " Increase the no. of copies.\n" + " If COLLATE checkbox gets enabled, press FAIL else press PASS.\n" + " Press Cancel to close the dialog."; final JDialog dialog = new JDialog(); dialog.setTitle("printSelectionTest"); JTextArea textArea = new JTextArea(description); textArea.setEditable(false); final JButton testButton = new JButton("Start Test"); final JButton passButton = new JButton("PASS"); passButton.setEnabled(false); passButton.addActionListener((e) -> { dialog.dispose(); pass(); }); final JButton failButton = new JButton("FAIL"); failButton.setEnabled(false); failButton.addActionListener((e) -> { dialog.dispose(); fail(); }); testButton.addActionListener((e) -> { testButton.setEnabled(false); action.run(); passButton.setEnabled(true); failButton.setEnabled(true); }); JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.add(textArea, BorderLayout.CENTER); JPanel buttonPanel = new JPanel(new FlowLayout()); buttonPanel.add(testButton); buttonPanel.add(passButton); buttonPanel.add(failButton); mainPanel.add(buttonPanel, BorderLayout.SOUTH); dialog.add(mainPanel); dialog.pack(); dialog.setVisible(true); }
Example 20
Source File: DlgAttrsBug.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
private static void doTest(Runnable action) { String description = " Visual inspection of print dialog is required.\n" + " A print dialog will be shown.\n " + " Please verify Copies 5 is selected.\n" + " Also verify, Page Range is selected with " + " from page 3 and to Page 4.\n" + " If ok, press PASS else press FAIL"; final JDialog dialog = new JDialog(); dialog.setTitle("printSelectionTest"); JTextArea textArea = new JTextArea(description); textArea.setEditable(false); final JButton testButton = new JButton("Start Test"); final JButton passButton = new JButton("PASS"); passButton.setEnabled(false); passButton.addActionListener((e) -> { dialog.dispose(); pass(); }); final JButton failButton = new JButton("FAIL"); failButton.setEnabled(false); failButton.addActionListener((e) -> { dialog.dispose(); fail(); }); testButton.addActionListener((e) -> { testButton.setEnabled(false); action.run(); passButton.setEnabled(true); failButton.setEnabled(true); }); JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.add(textArea, BorderLayout.CENTER); JPanel buttonPanel = new JPanel(new FlowLayout()); buttonPanel.add(testButton); buttonPanel.add(passButton); buttonPanel.add(failButton); mainPanel.add(buttonPanel, BorderLayout.SOUTH); dialog.add(mainPanel); dialog.pack(); dialog.setVisible(true); }