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;
}
use of javax.swing.JDialog in project sling by apache.
the class RequestListSelectionListener method valueChanged.
public void valueChanged(ListSelectionEvent e) {
if (!e.getValueIsAdjusting()) {
ListSelectionModel lsm = (ListSelectionModel) e.getSource();
int idx = lsm.getMinSelectionIndex();
if (idx >= 0) {
try {
idx = table.getRowSorter().convertRowIndexToModel(idx);
TableModel tm = ((RequestTrackerFile) table.getModel()).getData(idx);
if (dataField == null) {
dataField = new JTable();
dataField.setAutoCreateRowSorter(true);
dataField.setGridColor(Color.GRAY);
dataField.setShowGrid(true);
dataField.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
dataField.setRowSelectionAllowed(true);
dataField.setTableHeader(new JTableHeader(dataField.getColumnModel()));
dataField.setFont(new Font("Monospaced", dataField.getFont().getStyle(), dataField.getFont().getSize()));
dataField.setShowHorizontalLines(false);
// dataField.setIntercellSpacing(new Dimension(3, 5));
JDialog d = new JDialog(this.parent);
d.add(new JScrollPane(dataField));
d.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
dataField = null;
}
});
// setup location and size and ensure updating preferences
Util.setupComponentLocationSize(d, REQUEST_X, REQUEST_Y, REQUEST_WIDTH, REQUEST_HEIGHT, (int) screenSize.getWidth() / 4, (int) screenSize.getHeight() / 4, (int) screenSize.getWidth() / 2, (int) screenSize.getHeight() / 2);
d.setVisible(true);
}
dataField.setModel(tm);
Util.setupColumnWidths(dataField.getColumnModel(), REQUEST_COLS);
} catch (IOException e1) {
// ignore
}
}
}
}
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 JMRI by JMRI.
the class PositionablePoint method setLink.
void setLink() {
if (getConnect1() == null || getConnect1().getLayoutBlock() == null) {
log.error("Can not set link until we have a connecting track with a block assigned");
return;
}
editLink = new JDialog();
editLink.setTitle("EDIT LINK from " + getConnect1().getLayoutBlock().getDisplayName());
JPanel container = new JPanel();
container.setLayout(new BorderLayout());
JButton done = new JButton(Bundle.getMessage("ButtonDone"));
done.addActionListener((ActionEvent a) -> {
updateLink();
});
// make this button the default button (return or enter activates)
// Note: We have to invoke this later because we don't currently have a root pane
SwingUtilities.invokeLater(() -> {
JRootPane rootPane = SwingUtilities.getRootPane(done);
rootPane.setDefaultButton(done);
});
container.add(getLinkPanel(), BorderLayout.NORTH);
container.add(done, BorderLayout.SOUTH);
container.revalidate();
editLink.add(container);
editLink.pack();
editLink.setModal(false);
editLink.setVisible(true);
}
Aggregations