Search in sources :

Example 56 with JDialog

use of javax.swing.JDialog in project jabref by JabRef.

the class DetectOpenOfficeInstallation method showProgressDialog.

public JDialog showProgressDialog(JDialog progressParent, String title, String message) {
    JProgressBar bar = new JProgressBar(SwingConstants.HORIZONTAL);
    final JDialog progressDialog = new JDialog(progressParent, title, false);
    bar.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    bar.setIndeterminate(true);
    progressDialog.add(new JLabel(message), BorderLayout.NORTH);
    progressDialog.add(bar, BorderLayout.CENTER);
    progressDialog.pack();
    progressDialog.setLocationRelativeTo(null);
    progressDialog.setVisible(true);
    return progressDialog;
}
Also used : JProgressBar(javax.swing.JProgressBar) JLabel(javax.swing.JLabel) JDialog(javax.swing.JDialog)

Example 57 with JDialog

use of javax.swing.JDialog in project jabref by JabRef.

the class ParameterizedDialogNewEntryTest method cancelAddingEntryPlainTextOfGivenType.

@Test
public void cancelAddingEntryPlainTextOfGivenType() {
    mainFrame.menuItemWithPath("File", "New " + databaseMode + " database").click();
    JTableFixture entryTable = mainFrame.table();
    entryTable.requireRowCount(0);
    mainFrame.menuItemWithPath("BibTeX", "New entry from plain text...").click();
    selectEntryType();
    GenericTypeMatcher<JDialog> matcher2 = plainTextMatcher();
    findDialog(matcher2).withTimeout(10_000).using(robot()).button(new GenericTypeMatcher<JButton>(JButton.class) {

        @Override
        protected boolean isMatching(@Nonnull JButton jButton) {
            return "Cancel".equals(jButton.getText());
        }
    }).click();
    entryTable.requireRowCount(0);
}
Also used : JTableFixture(org.assertj.swing.fixture.JTableFixture) Nonnull(org.assertj.swing.dependency.jsr305.Nonnull) JButton(javax.swing.JButton) GenericTypeMatcher(org.assertj.swing.core.GenericTypeMatcher) JDialog(javax.swing.JDialog) Test(org.junit.Test)

Example 58 with JDialog

use of javax.swing.JDialog in project jabref by JabRef.

the class IdFetcherDialogTest method insertEmptySearchID.

@Test
public void insertEmptySearchID() {
    mainFrame.menuItemWithPath("File", "New " + databaseMode + " database").click();
    JTableFixture entryTable = mainFrame.table();
    entryTable.requireRowCount(0);
    mainFrame.menuItemWithPath("BibTeX", "New entry...").click();
    GenericTypeMatcher<JDialog> matcher = new GenericTypeMatcher<JDialog>(JDialog.class) {

        @Override
        protected boolean isMatching(JDialog dialog) {
            return "Select entry type".equals(dialog.getTitle());
        }
    };
    findDialog(matcher).withTimeout(10_000).using(robot()).button(new GenericTypeMatcher<JButton>(JButton.class) {

        @Override
        protected boolean isMatching(@Nonnull JButton jButton) {
            return "Generate".equals(jButton.getText());
        }
    }).click();
    GenericTypeMatcher<JDialog> matcherEmptyDialog = new GenericTypeMatcher<JDialog>(JDialog.class) {

        @Override
        protected boolean isMatching(JDialog dialog) {
            return "Empty search ID".equals(dialog.getTitle());
        }
    };
    findDialog(matcherEmptyDialog).withTimeout(10_000).using(robot()).button(new GenericTypeMatcher<JButton>(JButton.class) {

        @Override
        protected boolean isMatching(@Nonnull JButton jButton) {
            return "OK".equals(jButton.getText());
        }
    }).click();
    entryTable.requireRowCount(0);
}
Also used : JTableFixture(org.assertj.swing.fixture.JTableFixture) Nonnull(org.assertj.swing.dependency.jsr305.Nonnull) JButton(javax.swing.JButton) GenericTypeMatcher(org.assertj.swing.core.GenericTypeMatcher) JDialog(javax.swing.JDialog) Test(org.junit.Test)

Example 59 with JDialog

use of javax.swing.JDialog in project tika by apache.

the class TikaGUI method hyperlinkUpdate.

public void hyperlinkUpdate(HyperlinkEvent e) {
    if (e.getEventType() == EventType.ACTIVATED) {
        try {
            URL url = e.getURL();
            try (InputStream stream = url.openStream()) {
                JEditorPane editor = new JEditorPane("text/plain", IOUtils.toString(stream, UTF_8));
                editor.setEditable(false);
                editor.setBackground(Color.WHITE);
                editor.setCaretPosition(0);
                editor.setPreferredSize(new Dimension(600, 400));
                String name = url.toString();
                name = name.substring(name.lastIndexOf('/') + 1);
                JDialog dialog = new JDialog(this, "Apache Tika: " + name);
                dialog.add(new JScrollPane(editor));
                dialog.pack();
                dialog.setVisible(true);
            }
        } catch (IOException exception) {
            exception.printStackTrace();
        }
    }
}
Also used : JScrollPane(javax.swing.JScrollPane) ProgressMonitorInputStream(javax.swing.ProgressMonitorInputStream) TikaInputStream(org.apache.tika.io.TikaInputStream) InputStream(java.io.InputStream) JEditorPane(javax.swing.JEditorPane) Dimension(java.awt.Dimension) IOException(java.io.IOException) URL(java.net.URL) JDialog(javax.swing.JDialog)

Example 60 with JDialog

use of javax.swing.JDialog in project sling by apache.

the class Util method showStartupDialog.

static JTextPane showStartupDialog(final String title, final Dimension screenSize) {
    JTextPane text = new JTextPane();
    text.setText("...");
    JDialog d = new JDialog((Window) null);
    d.setTitle(title);
    d.add(text);
    d.setSize((int) screenSize.getWidth() / 2, 30);
    d.setLocation((int) screenSize.getWidth() / 4, (int) screenSize.getHeight() / 2 - 15);
    d.setVisible(true);
    return text;
}
Also used : JTextPane(javax.swing.JTextPane) JDialog(javax.swing.JDialog)

Aggregations

JDialog (javax.swing.JDialog)141 JButton (javax.swing.JButton)65 JPanel (javax.swing.JPanel)50 ActionEvent (java.awt.event.ActionEvent)42 JLabel (javax.swing.JLabel)35 ActionListener (java.awt.event.ActionListener)30 BorderLayout (java.awt.BorderLayout)24 JScrollPane (javax.swing.JScrollPane)24 JFrame (javax.swing.JFrame)20 Dimension (java.awt.Dimension)18 BoxLayout (javax.swing.BoxLayout)18 JCheckBox (javax.swing.JCheckBox)15 FlowLayout (java.awt.FlowLayout)14 AbstractAction (javax.swing.AbstractAction)14 JOptionPane (javax.swing.JOptionPane)13 ButtonBarBuilder (com.jgoodies.forms.builder.ButtonBarBuilder)11 WindowEvent (java.awt.event.WindowEvent)11 IOException (java.io.IOException)10 JProgressBar (javax.swing.JProgressBar)10 WindowAdapter (java.awt.event.WindowAdapter)9