use of javax.swing.JDialog in project jabref by JabRef.
the class GroupAddRemoveDialog method action.
@Override
public void action() throws Exception {
Optional<GroupTreeNode> groups = panel.getBibDatabaseContext().getMetaData().getGroups();
if (!groups.isPresent()) {
return;
}
selection = panel.getSelectedEntries();
final JDialog diag = new JDialog(panel.frame(), (add ? (move ? Localization.lang("Move to group") : Localization.lang("Add to group")) : Localization.lang("Remove from group")), true);
JButton ok = new JButton(Localization.lang("OK"));
JButton cancel = new JButton(Localization.lang("Cancel"));
tree = new JTree(new GroupTreeNodeViewModel(groups.get()));
tree.setCellRenderer(new AddRemoveGroupTreeCellRenderer());
tree.setVisibleRowCount(22);
// tree.setPreferredSize(new Dimension(200, tree.getPreferredSize().height));
// The scrollbar appears when the preferred size of a component is greater than the size of the viewport. If one hard coded the preferred size, it will never change according to the expansion/collapse. Thus the scrollbar cannot appear accordingly.
//tree.setSelectionModel(new VetoableTreeSelectionModel());
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.addTreeSelectionListener(e -> {
GroupTreeNodeViewModel node = (GroupTreeNodeViewModel) e.getNewLeadSelectionPath().getLastPathComponent();
ok.setEnabled(checkGroupEnable(node));
});
//STA add expand and collapse all buttons
JButton jbExpandAll = new JButton("Expand All");
jbExpandAll.addActionListener(e -> expandAll(tree, true));
JButton jbCollapseAll = new JButton("Collapse All");
jbCollapseAll.addActionListener(e -> expandAll(tree, false));
//END add expand and collapse all buttons
ButtonBarBuilder bb = new ButtonBarBuilder();
bb.addGlue();
bb.addButton(ok);
bb.addButton(cancel);
bb.addButton(jbExpandAll);
bb.addButton(jbCollapseAll);
bb.addGlue();
bb.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
ok.addActionListener(actionEvent -> {
if (doAddOrRemove()) {
diag.dispose();
}
});
cancel.addActionListener(actionEvent -> diag.dispose());
ok.setEnabled(false);
JScrollPane sp = new JScrollPane(tree);
// Key bindings:
ActionMap am = sp.getActionMap();
InputMap im = sp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
am.put("close", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
diag.dispose();
}
});
diag.getContentPane().add(sp, BorderLayout.CENTER);
diag.getContentPane().add(bb.getPanel(), BorderLayout.SOUTH);
diag.pack();
diag.setLocationRelativeTo(panel.frame());
diag.setVisible(true);
}
use of javax.swing.JDialog in project jabref by JabRef.
the class OpenOfficePanel method showManualConnectionDialog.
private void showManualConnectionDialog() {
dialogOkPressed = false;
final JDialog cDiag = new JDialog(frame, Localization.lang("Set connection parameters"), true);
final NativeDesktop nativeDesktop = JabRefDesktop.getNativeDesktop();
final DialogService dirDialog = new FXDialogService();
DirectoryDialogConfiguration dirDialogConfiguration = new DirectoryDialogConfiguration.Builder().withInitialDirectory(nativeDesktop.getApplicationDirectory()).build();
FileDialogConfiguration fileDialogConfiguration = new FileDialogConfiguration.Builder().withInitialDirectory(nativeDesktop.getApplicationDirectory()).build();
DialogService fileDialog = new FXDialogService();
// Path fields
final JTextField ooPath = new JTextField(30);
JButton browseOOPath = new JButton(Localization.lang("Browse"));
ooPath.setText(preferences.getInstallationPath());
browseOOPath.addActionListener(e -> DefaultTaskExecutor.runInJavaFXThread(() -> dirDialog.showDirectorySelectionDialog(dirDialogConfiguration)).ifPresent(f -> ooPath.setText(f.toAbsolutePath().toString())));
final JTextField ooExec = new JTextField(30);
JButton browseOOExec = new JButton(Localization.lang("Browse"));
ooExec.setText(preferences.getExecutablePath());
browseOOExec.addActionListener(e -> DefaultTaskExecutor.runInJavaFXThread(() -> fileDialog.showFileOpenDialog(fileDialogConfiguration)).ifPresent(f -> ooExec.setText(f.toAbsolutePath().toString())));
final JTextField ooJars = new JTextField(30);
ooJars.setText(preferences.getJarsPath());
JButton browseOOJars = new JButton(Localization.lang("Browse"));
browseOOJars.addActionListener(e -> DefaultTaskExecutor.runInJavaFXThread(() -> dirDialog.showDirectorySelectionDialog(dirDialogConfiguration)).ifPresent(f -> ooJars.setText(f.toAbsolutePath().toString())));
FormBuilder builder = FormBuilder.create().layout(new FormLayout("left:pref, 4dlu, fill:pref:grow, 4dlu, fill:pref", "pref"));
if (OS.WINDOWS || OS.OS_X) {
builder.add(Localization.lang("Path to OpenOffice/LibreOffice directory")).xy(1, 1);
builder.add(ooPath).xy(3, 1);
builder.add(browseOOPath).xy(5, 1);
} else {
builder.add(Localization.lang("Path to OpenOffice/LibreOffice executable")).xy(1, 1);
builder.add(ooExec).xy(3, 1);
builder.add(browseOOExec).xy(5, 1);
builder.appendRows("4dlu, pref");
builder.add(Localization.lang("Path to OpenOffice/LibreOffice library dir")).xy(1, 3);
builder.add(ooJars).xy(3, 3);
builder.add(browseOOJars).xy(5, 3);
}
builder.padding("5dlu, 5dlu, 5dlu, 5dlu");
cDiag.getContentPane().add(builder.getPanel(), BorderLayout.CENTER);
// Buttons
JButton ok = new JButton(Localization.lang("OK"));
JButton cancel = new JButton(Localization.lang("Cancel"));
ok.addActionListener(e -> {
if (OS.WINDOWS || OS.OS_X) {
preferences.updateConnectionParams(ooPath.getText(), ooPath.getText(), ooPath.getText());
} else {
preferences.updateConnectionParams(ooPath.getText(), ooExec.getText(), ooJars.getText());
}
dialogOkPressed = true;
cDiag.dispose();
});
cancel.addActionListener(e -> cDiag.dispose());
ButtonBarBuilder bb = new ButtonBarBuilder();
bb.addGlue();
bb.addRelatedGap();
bb.addButton(ok);
bb.addButton(cancel);
bb.addGlue();
bb.padding("5dlu, 5dlu, 5dlu, 5dlu");
cDiag.getContentPane().add(bb.getPanel(), BorderLayout.SOUTH);
// Finish and show dirDialog
cDiag.pack();
cDiag.setLocationRelativeTo(frame);
cDiag.setVisible(true);
}
use of javax.swing.JDialog in project JMRI by JMRI.
the class LEConnectivityTest method testShowAndClose.
@SuppressWarnings("unchecked")
public void testShowAndClose() throws Exception {
if (GraphicsEnvironment.isHeadless()) {
// Can't Assume in TestCase
return;
}
jmri.configurexml.ConfigXmlManager cm = new jmri.configurexml.ConfigXmlManager() {
};
// load and display test panel file
java.io.File f = new java.io.File("java/test/jmri/jmrit/display/layoutEditor/valid/LEConnectTest.xml");
cm.load(f);
// time for internal listeners to calm down
sleep(100);
// Find new window by name (should be more distinctive, comes from sample file)
LayoutEditor le = (LayoutEditor) jmri.util.JmriJFrame.getFrame("Connectivity Test");
Assert.assertNotNull(le);
// Panel is up, continue set up for tests.
ConnectivityUtil cu = new ConnectivityUtil(le);
Assert.assertNotNull(cu);
BlockManager bm = jmri.InstanceManager.getDefault(jmri.BlockManager.class);
Assert.assertNotNull(bm);
// Test right-handed crossover connectivity turnout settings
Block cBlock = bm.getBlock("4");
Block pBlock = bm.getBlock("6");
Block nBlock = bm.getBlock("5");
cu.getTurnoutList(cBlock, pBlock, nBlock);
ArrayList<Integer> tsList = cu.getTurnoutSettingList();
int setting = tsList.get(0).intValue();
Assert.assertEquals("6_4_5Connect", setting, Turnout.CLOSED);
pBlock = bm.getBlock("5");
nBlock = bm.getBlock("6");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("5_4_6Connect", setting, Turnout.CLOSED);
pBlock = bm.getBlock("5");
nBlock = bm.getBlock("2");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("5_4_2Connect", setting, Turnout.THROWN);
cBlock = bm.getBlock("2");
pBlock = bm.getBlock("1");
nBlock = bm.getBlock("3");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("1_2_3Connect", setting, Turnout.CLOSED);
pBlock = bm.getBlock("3");
nBlock = bm.getBlock("1");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("3_2_1Connect", setting, Turnout.CLOSED);
pBlock = bm.getBlock("1");
nBlock = bm.getBlock("4");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("1_2_4Connect", setting, Turnout.THROWN);
// Test left-handed crossover connectivity turnout settings
cBlock = bm.getBlock("14");
pBlock = bm.getBlock("13");
nBlock = bm.getBlock("17");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("13_14_17Connect", setting, Turnout.CLOSED);
pBlock = bm.getBlock("17");
nBlock = bm.getBlock("13");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("17_14_13Connect", setting, Turnout.CLOSED);
pBlock = bm.getBlock("17");
nBlock = bm.getBlock("12");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("17_14_12Connect", setting, Turnout.THROWN);
cBlock = bm.getBlock("12");
pBlock = bm.getBlock("11");
nBlock = bm.getBlock("15");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("11_12_15Connect", setting, Turnout.CLOSED);
pBlock = bm.getBlock("15");
nBlock = bm.getBlock("11");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("15_12_11Connect", setting, Turnout.CLOSED);
pBlock = bm.getBlock("15");
nBlock = bm.getBlock("14");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("15_12_14Connect", setting, Turnout.THROWN);
// Test double crossover connectivity turnout settings
cBlock = bm.getBlock("21");
pBlock = bm.getBlock("20");
nBlock = bm.getBlock("22");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("20_21_22Connect", setting, Turnout.CLOSED);
pBlock = bm.getBlock("22");
nBlock = bm.getBlock("20");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("22_21_20Connect", setting, Turnout.CLOSED);
pBlock = bm.getBlock("20");
nBlock = bm.getBlock("26");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("20_21_26Connect", setting, Turnout.THROWN);
cBlock = bm.getBlock("22");
pBlock = bm.getBlock("23");
nBlock = bm.getBlock("21");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("23_22_21Connect", setting, Turnout.CLOSED);
pBlock = bm.getBlock("21");
nBlock = bm.getBlock("23");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("21_22_23Connect", setting, Turnout.CLOSED);
pBlock = bm.getBlock("23");
nBlock = bm.getBlock("25");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("23_22_25Connect", setting, Turnout.THROWN);
cBlock = bm.getBlock("26");
pBlock = bm.getBlock("27");
nBlock = bm.getBlock("25");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("27_26_25Connect", setting, Turnout.CLOSED);
pBlock = bm.getBlock("25");
nBlock = bm.getBlock("27");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("25_26_27Connect", setting, Turnout.CLOSED);
pBlock = bm.getBlock("27");
nBlock = bm.getBlock("21");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("27_26_21Connect", setting, Turnout.THROWN);
cBlock = bm.getBlock("25");
pBlock = bm.getBlock("24");
nBlock = bm.getBlock("26");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("24_25_26Connect", setting, Turnout.CLOSED);
pBlock = bm.getBlock("26");
nBlock = bm.getBlock("24");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("26_25_24Connect", setting, Turnout.CLOSED);
pBlock = bm.getBlock("24");
nBlock = bm.getBlock("22");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("24_25_22Connect", setting, Turnout.THROWN);
// Test right handed turnout (with "wings" in same block) connectivity turnout settings
cBlock = bm.getBlock("62");
pBlock = bm.getBlock("64");
nBlock = bm.getBlock("61");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("64_62_61Connect", setting, Turnout.THROWN);
pBlock = bm.getBlock("61");
nBlock = bm.getBlock("64");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("61_62_64Connect", setting, Turnout.THROWN);
pBlock = bm.getBlock("63");
nBlock = bm.getBlock("61");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("63_62_61Connect", setting, Turnout.CLOSED);
pBlock = bm.getBlock("61");
nBlock = bm.getBlock("63");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("61_62_63Connect", setting, Turnout.CLOSED);
// Test extended track following connectivity turnout settings
// Each path must go through two turnouts, whose settings are tested in order
cBlock = bm.getBlock("32");
pBlock = bm.getBlock("31");
nBlock = bm.getBlock("33");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("31_32_33ConnectA", setting, Turnout.CLOSED);
setting = tsList.get(1).intValue();
Assert.assertEquals("31_32_33ConnectB", setting, Turnout.THROWN);
pBlock = bm.getBlock("33");
nBlock = bm.getBlock("31");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("33_32_31ConnectA", setting, Turnout.THROWN);
setting = tsList.get(1).intValue();
Assert.assertEquals("33_32_31ConnectB", setting, Turnout.CLOSED);
pBlock = bm.getBlock("31");
nBlock = bm.getBlock("34");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("31_32_34ConnectA", setting, Turnout.CLOSED);
setting = tsList.get(1).intValue();
Assert.assertEquals("31_32_34ConnectB", setting, Turnout.CLOSED);
pBlock = bm.getBlock("34");
nBlock = bm.getBlock("31");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("34_32_31ConnectA", setting, Turnout.CLOSED);
setting = tsList.get(1).intValue();
Assert.assertEquals("34_32_31ConnectB", setting, Turnout.CLOSED);
pBlock = bm.getBlock("31");
nBlock = bm.getBlock("35");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("31_32_35ConnectA", setting, Turnout.THROWN);
setting = tsList.get(1).intValue();
Assert.assertEquals("31_32_35ConnectB", setting, Turnout.CLOSED);
pBlock = bm.getBlock("35");
nBlock = bm.getBlock("31");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("35_32_31ConnectA", setting, Turnout.CLOSED);
setting = tsList.get(1).intValue();
Assert.assertEquals("35_32_31ConnectB", setting, Turnout.THROWN);
pBlock = bm.getBlock("31");
nBlock = bm.getBlock("36");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("31_32_36ConnectA", setting, Turnout.THROWN);
setting = tsList.get(1).intValue();
Assert.assertEquals("31_32_36ConnectB", setting, Turnout.THROWN);
pBlock = bm.getBlock("36");
nBlock = bm.getBlock("31");
cu.getTurnoutList(cBlock, pBlock, nBlock);
tsList = cu.getTurnoutSettingList();
setting = tsList.get(0).intValue();
Assert.assertEquals("36_32_31ConnectA", setting, Turnout.THROWN);
setting = tsList.get(1).intValue();
Assert.assertEquals("36_32_31ConnectB", setting, Turnout.THROWN);
// Ask to close window
TestHelper.disposeWindow(le, this);
// Dialog has popped up, so handle that. First, locate it.
List<JDialog> dialogList = new DialogFinder(null).findAll(le);
JDialog d = dialogList.get(0);
// Find the button that deletes the panel
AbstractButtonFinder finder = new AbstractButtonFinder("Delete Panel");
JButton button = (JButton) finder.find(d, 0);
Assert.assertNotNull(button);
// Click button to delete panel and close window
getHelper().enterClickAndLeave(new MouseEventData(this, button));
// another dialog has popped up, so handle that by finding the "Yes - Delete" button.
dialogList = new DialogFinder(null).findAll(le);
d = dialogList.get(0);
finder = new AbstractButtonFinder("Yes - Delete");
button = (JButton) finder.find(d, 0);
Assert.assertNotNull(button);
// Click to say yes, I really mean it.
getHelper().enterClickAndLeave(new MouseEventData(this, button));
le.dispose();
}
use of javax.swing.JDialog in project jabref by JabRef.
the class ExternalFileTypeEntryEditor method init.
private void init(ExternalFileType inEntry) {
entry = inEntry;
icon.setText(null);
ButtonGroup bg = new ButtonGroup();
bg.add(useDefault);
bg.add(other);
FormBuilder builder = FormBuilder.create();
builder.layout(new FormLayout("left:pref, 4dlu, fill:150dlu, 4dlu, fill:pref", "p, 2dlu, p, 2dlu, p, 2dlu, p, 2dlu, p, 2dlu, p"));
builder.add(Localization.lang("Icon")).xy(1, 1);
builder.add(icon).xy(3, 1);
builder.add(Localization.lang("Name")).xy(1, 3);
builder.add(name).xy(3, 3);
builder.add(Localization.lang("Extension")).xy(1, 5);
builder.add(extension).xy(3, 5);
builder.add(Localization.lang("MIME type")).xy(1, 7);
builder.add(mimeType).xy(3, 7);
builder.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
builder.add(Localization.lang("Application")).xy(1, 9);
JButton browseBut = new JButton(Localization.lang("Browse"));
if (OS.WINDOWS) {
builder.add(useDefault).xy(3, 9);
builder.appendRows("2dlu, p");
JPanel p1 = new JPanel();
builder.add(p1).xy(1, 11);
JPanel p2 = new JPanel();
application.setPreferredSize(new Dimension(300, application.getPreferredSize().height));
BorderLayout bl = new BorderLayout();
bl.setHgap(4);
p2.setLayout(bl);
p2.add(other, BorderLayout.WEST);
p2.add(application, BorderLayout.CENTER);
builder.add(p2).xy(3, 11);
builder.add(browseBut).xy(5, 11);
} else {
builder.add(application).xy(3, 9);
builder.add(browseBut).xy(5, 9);
}
ButtonBarBuilder bb = new ButtonBarBuilder();
bb.addGlue();
bb.addButton(ok);
bb.addButton(cancel);
bb.addGlue();
ok.addActionListener(e -> {
okPressed = true;
storeSettings(ExternalFileTypeEntryEditor.this.entry);
diag.dispose();
});
cancel.addActionListener(e -> diag.dispose());
if (OS.WINDOWS) {
application.getDocument().addDocumentListener(new DocumentListener() {
private void handle() {
if (application.getText().isEmpty()) {
useDefault.setSelected(true);
} else {
other.setSelected(true);
}
}
@Override
public void insertUpdate(DocumentEvent documentEvent) {
handle();
}
@Override
public void removeUpdate(DocumentEvent documentEvent) {
handle();
}
@Override
public void changedUpdate(DocumentEvent documentEvent) {
handle();
}
});
}
String title = editFileTitle;
if (entry.getName().isEmpty()) {
title = newFileTitle;
}
if (dParent == null) {
diag = new JDialog(fParent, title, true);
} else {
diag = new JDialog(dParent, title, true);
}
diag.getContentPane().add(builder.getPanel(), BorderLayout.CENTER);
diag.getContentPane().add(bb.getPanel(), BorderLayout.SOUTH);
diag.pack();
browseBut.addActionListener(browsePressed);
if (dParent == null) {
diag.setLocationRelativeTo(fParent);
} else {
diag.setLocationRelativeTo(dParent);
}
setValues(entry);
}
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;
}
Aggregations