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;
}
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);
}
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);
}
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();
}
}
}
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;
}
Aggregations