本文整理汇总了Java中com.jgoodies.forms.builder.ButtonBarBuilder.addButton方法的典型用法代码示例。如果您正苦于以下问题:Java ButtonBarBuilder.addButton方法的具体用法?Java ButtonBarBuilder.addButton怎么用?Java ButtonBarBuilder.addButton使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jgoodies.forms.builder.ButtonBarBuilder
的用法示例。
在下文中一共展示了ButtonBarBuilder.addButton方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: displayTerms
import com.jgoodies.forms.builder.ButtonBarBuilder; //导入方法依赖的package包/类
private void displayTerms(ProtectedTermsList list) {
// Make a dialog box to display the contents:
final JDialog dd = new JDialog(diag, list.getDescription() + " - " + list.getLocation(), true);
JTextArea ta = new JTextArea(list.getTermListing());
ta.setEditable(false);
JScrollPane sp = new JScrollPane(ta);
sp.setPreferredSize(new Dimension(700, 500));
dd.getContentPane().add(sp, BorderLayout.CENTER);
JButton okButton = new JButton(Localization.lang("OK"));
ButtonBarBuilder bb = new ButtonBarBuilder();
bb.addGlue();
bb.addButton(okButton);
bb.addGlue();
bb.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
dd.getContentPane().add(bb.getPanel(), BorderLayout.SOUTH);
okButton.addActionListener(actionEvent -> dd.dispose());
dd.pack();
dd.setLocationRelativeTo(diag);
dd.setVisible(true);
}
示例2: displayStyle
import com.jgoodies.forms.builder.ButtonBarBuilder; //导入方法依赖的package包/类
private void displayStyle(OOBibStyle style) {
// Make a dialog box to display the contents:
final JDialog dd = new JDialog(diag, style.getName(), true);
JTextArea ta = new JTextArea(style.getLocalCopy());
ta.setEditable(false);
JScrollPane sp = new JScrollPane(ta);
sp.setPreferredSize(new Dimension(700, 500));
dd.getContentPane().add(sp, BorderLayout.CENTER);
JButton okButton = new JButton(Localization.lang("OK"));
ButtonBarBuilder bb = new ButtonBarBuilder();
bb.addGlue();
bb.addButton(okButton);
bb.addGlue();
bb.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
dd.getContentPane().add(bb.getPanel(), BorderLayout.SOUTH);
okButton.addActionListener(actionEvent -> dd.dispose());
dd.pack();
dd.setLocationRelativeTo(diag);
dd.setVisible(true);
}
示例3: init
import com.jgoodies.forms.builder.ButtonBarBuilder; //导入方法依赖的package包/类
/**
* Sets up the dialog
*/
private void init() {
mergeEntries = new MergeEntries(this.originalEntry, this.fetchedEntry, Localization.lang("Original entry"),
Localization.lang("Entry from %0", type), panel.getBibDatabaseContext().getMode());
// Create undo-compound
ce = new NamedCompound(Localization.lang("Merge entry with %0 information", type));
FormLayout layout = new FormLayout("fill:700px:grow", "fill:400px:grow, 4px, p, 5px, p");
this.setLayout(layout);
this.add(mergeEntries.getMergeEntryPanel(), cc.xy(1, 1));
this.add(new JSeparator(), cc.xy(1, 3));
// Create buttons
ButtonBarBuilder bb = new ButtonBarBuilder();
bb.addGlue();
JButton cancel = new JButton(new CancelAction());
JButton replaceEntry = new JButton(new ReplaceAction());
bb.addButton(replaceEntry, cancel);
this.add(bb.getPanel(), cc.xy(1, 5));
// Add some margin around the layout
layout.appendRow(RowSpec.decode(MARGIN));
layout.appendColumn(ColumnSpec.decode(MARGIN));
layout.insertRow(1, RowSpec.decode(MARGIN));
layout.insertColumn(1, ColumnSpec.decode(MARGIN));
WindowLocation pw = new WindowLocation(this, JabRefPreferences.MERGEENTRIES_POS_X,
JabRefPreferences.MERGEENTRIES_POS_Y, JabRefPreferences.MERGEENTRIES_SIZE_X,
JabRefPreferences.MERGEENTRIES_SIZE_Y);
pw.displayWindowAtStoredLocation();
}
示例4: WaitForSaveOperation
import com.jgoodies.forms.builder.ButtonBarBuilder; //导入方法依赖的package包/类
public WaitForSaveOperation(JabRefFrame frame) {
this.frame = frame;
JButton cancel = new JButton(Localization.lang("Cancel"));
JProgressBar prog = new JProgressBar(0);
prog.setIndeterminate(true);
prog.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
diag = new JDialog(frame, Localization.lang("Please wait..."), true);
ButtonBarBuilder bb = new ButtonBarBuilder();
bb.addGlue();
bb.addButton(cancel);
bb.addGlue();
cancel.addActionListener(e -> {
canceled = true;
t.stop();
diag.dispose();
});
JLabel message = new JLabel(Localization.lang("Waiting for save operation to finish") + "...");
message.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
diag.getContentPane().add(message, BorderLayout.NORTH);
diag.getContentPane().add(bb.getPanel(), BorderLayout.SOUTH);
diag.getContentPane().add(prog, BorderLayout.CENTER);
diag.pack();
}
示例5: initButtonPanel
import com.jgoodies.forms.builder.ButtonBarBuilder; //导入方法依赖的package包/类
private void initButtonPanel() {
okButton.addActionListener(event -> {
okPressed = true;
dispose();
});
cancelButton.addActionListener(event -> dispose());
ButtonBarBuilder bb = new ButtonBarBuilder(buttons);
buttons.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
bb.addGlue();
bb.addButton(okButton);
bb.addButton(parseWithFreeCiteButton);
bb.addButton(cancelButton);
bb.addGlue();
}
示例6: createCancelButtonBarPanel
import com.jgoodies.forms.builder.ButtonBarBuilder; //导入方法依赖的package包/类
private JPanel createCancelButtonBarPanel() {
JButton cancel = new JButton(Localization.lang("Cancel"));
cancel.addActionListener(this);
// Make ESC close dialog, equivalent to clicking Cancel.
cancel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
cancel.getActionMap().put("close", cancelAction);
JPanel buttons = new JPanel();
ButtonBarBuilder bb = new ButtonBarBuilder(buttons);
bb.addGlue();
bb.addButton(cancel);
bb.addGlue();
return buttons;
}
示例7: MainDialog
import com.jgoodies.forms.builder.ButtonBarBuilder; //导入方法依赖的package包/类
public MainDialog(final Gui gui, final SecureStore store) {
this.setTitle("Portalsammler");
this.setSize(800, 600);
this.gui = gui;
this.table = new DocumentTable(gui, store);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.filterField = new JTextField();
this.filterField.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
MainDialog.this.filter();
}
});
final PanelBuilder fpb = new PanelBuilder(new FormLayout(
"right:pref, 4dlu, fill:pref:grow", "p"));
fpb.addLabel("&Filter", CC.xy(1, 1));
fpb.add(this.filterField, CC.xy(3, 1));
final ButtonBarBuilder bbb = new ButtonBarBuilder();
this.pollButton = this.createPollButton();
bbb.addButton(this.pollButton, this.createConfigButton());
final PanelBuilder builder = new PanelBuilder(new FormLayout(
"4dlu, fill:pref:grow, 4dlu",
"4dlu, p, 4dlu, fill:50dlu:grow, 4dlu, p, 4dlu"));
builder.add(fpb.getPanel(), CC.xy(2, 2));
builder.add(this.table.createWrappedPanel(), CC.xy(2, 4));
builder.add(bbb.getPanel(), CC.xy(2, 6));
this.setContentPane(builder.getPanel());
this.setLocationRelativeTo(this.getOwner());
}
示例8: init
import com.jgoodies.forms.builder.ButtonBarBuilder; //导入方法依赖的package包/类
/**
* Sets up the dialog
*
* @param selected Selected BibtexEntries
*/
private void init(List<BibEntry> selected) {
// Check if there are two entries selected
if (selected.size() != 2) { // None selected. Inform the user to select entries first.
JOptionPane.showMessageDialog(panel.frame(),
Localization.lang("You have to choose exactly two entries to merge."),
MERGE_ENTRIES, JOptionPane.INFORMATION_MESSAGE);
this.dispose();
return;
}
// Store the two entries
BibEntry one = selected.get(0);
BibEntry two = selected.get(1);
MergeEntries mergeEntries = new MergeEntries(one, two, panel.getBibDatabaseContext().getMode());
// Create undo-compound
NamedCompound ce = new NamedCompound(MERGE_ENTRIES);
FormLayout layout = new FormLayout("fill:700px:grow", "fill:400px:grow, 4px, p, 5px, p");
this.setLayout(layout);
this.add(mergeEntries.getMergeEntryPanel(), cc.xy(1, 1));
this.add(new JSeparator(), cc.xy(1, 3));
// Create buttons
ButtonBarBuilder bb = new ButtonBarBuilder();
bb.addGlue();
JButton cancel = new JButton(Localization.lang("Cancel"));
cancel.setActionCommand("cancel");
cancel.addActionListener(e -> {
panel.output(Localization.lang("Canceled merging entries"));
dispose();
});
JButton replaceentries = new JButton(MERGE_ENTRIES);
replaceentries.setActionCommand("replace");
replaceentries.addActionListener(e -> {
// Create a new entry and add it to the undo stack
// Remove the other two entries and add them to the undo stack (which is not working...)
BibEntry mergedEntry = mergeEntries.getMergeEntry();
panel.insertEntry(mergedEntry);
ce.addEdit(new UndoableInsertEntry(panel.getDatabase(), mergedEntry, panel));
ce.addEdit(new UndoableRemoveEntry(panel.getDatabase(), one, panel));
panel.getDatabase().removeEntry(one);
ce.addEdit(new UndoableRemoveEntry(panel.getDatabase(), two, panel));
panel.getDatabase().removeEntry(two);
ce.end();
panel.getUndoManager().addEdit(ce);
panel.output(Localization.lang("Merged entries"));
dispose();
});
bb.addButton(new JButton[] {replaceentries, cancel});
this.add(bb.getPanel(), cc.xy(1, 5));
// Add some margin around the layout
layout.appendRow(RowSpec.decode(MARGIN));
layout.appendColumn(ColumnSpec.decode(MARGIN));
layout.insertRow(1, RowSpec.decode(MARGIN));
layout.insertColumn(1, ColumnSpec.decode(MARGIN));
WindowLocation pw = new WindowLocation(this, JabRefPreferences.MERGEENTRIES_POS_X,
JabRefPreferences.MERGEENTRIES_POS_Y, JabRefPreferences.MERGEENTRIES_SIZE_X,
JabRefPreferences.MERGEENTRIES_SIZE_Y);
pw.displayWindowAtStoredLocation();
// Show what we've got
setVisible(true);
}
示例9: CitationManager
import com.jgoodies.forms.builder.ButtonBarBuilder; //导入方法依赖的package包/类
public CitationManager(final JabRefFrame frame, OOBibBase ooBase)
throws NoSuchElementException, WrappedTargetException, UnknownPropertyException {
diag = new JDialog(frame, Localization.lang("Manage citations"), true);
this.ooBase = ooBase;
list = new BasicEventList<>();
XNameAccess nameAccess = ooBase.getReferenceMarks();
List<String> names = ooBase.getJabRefReferenceMarks(nameAccess);
for (String name : names) {
list.add(new CitationEntry(name,
"<html>..." + ooBase.getCitationContext(nameAccess, name, 30, 30, true) + "...</html>",
ooBase.getCustomProperty(name)));
}
tableModel = new DefaultEventTableModel<>(list, new CitationEntryFormat());
table = new JTable(tableModel);
diag.add(new JScrollPane(table), BorderLayout.CENTER);
ButtonBarBuilder bb = new ButtonBarBuilder();
bb.addGlue();
JButton ok = new JButton(Localization.lang("OK"));
bb.addButton(ok);
JButton cancel = new JButton(Localization.lang("Cancel"));
bb.addButton(cancel);
bb.addGlue();
bb.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
diag.add(bb.getPanel(), BorderLayout.SOUTH);
diag.pack();
diag.setSize(700, 400);
ok.addActionListener(e -> {
try {
storeSettings();
} catch (UnknownPropertyException | NotRemoveableException | PropertyExistException | IllegalTypeException |
IllegalArgumentException ex) {
LOGGER.warn("Problem modifying citation", ex);
JOptionPane.showMessageDialog(frame, Localization.lang("Problem modifying citation"));
}
diag.dispose();
});
Action cancelAction = new AbstractAction() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
diag.dispose();
}
};
cancel.addActionListener(cancelAction);
bb.getPanel().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put
(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
bb.getPanel().getActionMap().put("close", cancelAction);
table.getColumnModel().getColumn(0).setPreferredWidth(580);
table.getColumnModel().getColumn(1).setPreferredWidth(110);
table.setPreferredScrollableViewportSize(new Dimension(700, 500));
table.addMouseListener(new TableClickListener());
}
示例10: SingleCitationDialog
import com.jgoodies.forms.builder.ButtonBarBuilder; //导入方法依赖的package包/类
public SingleCitationDialog(CitationEntry citEntry) {
this.entry = citEntry;
pageInfo.setText(entry.getPageInfo().orElse(""));
singleCiteDialog = new JDialog(CitationManager.this.diag, Localization.lang("Citation"), true);
FormBuilder builder = FormBuilder.create()
.layout(new FormLayout("left:pref, 4dlu, fill:150dlu:grow", "pref, 4dlu, pref"));
builder.add(entry.getContext()).xyw(1, 1, 3);
builder.add(Localization.lang("Extra information (e.g. page number)")).xy(1, 3);
builder.add(pageInfo).xy(3, 3);
builder.padding("10dlu, 10dlu, 10dlu, 10dlu");
singleCiteDialog.getContentPane().add(builder.getPanel(), BorderLayout.CENTER);
ButtonBarBuilder bb = new ButtonBarBuilder();
bb.addGlue();
bb.addButton(okButton);
bb.addButton(cancelButton);
bb.addGlue();
bb.padding("5dlu, 5dlu, 5dlu, 5dlu");
singleCiteDialog.add(bb.getPanel(), BorderLayout.SOUTH);
okButton.addActionListener(e -> {
if (pageInfo.getText().trim().isEmpty()) {
entry.setPageInfo(null);
} else {
entry.setPageInfo(pageInfo.getText().trim());
}
tableModel.fireTableDataChanged();
singleCiteDialog.dispose();
});
Action cancelAction = new AbstractAction() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
singleCiteDialog.dispose();
}
};
cancelButton.addActionListener(cancelAction);
builder.getPanel().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put
(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
builder.getPanel().getActionMap().put("close", cancelAction);
}
示例11: SourceConfigDialog
import com.jgoodies.forms.builder.ButtonBarBuilder; //导入方法依赖的package包/类
public SourceConfigDialog(final Gui gui, final SecureStore store) {
this.setTitle("Quellen-Konfiguration");
this.setModal(true);
this.setMinimumSize(new Dimension(500, 350));
this.gui = gui;
this.store = store;
this.workingCopy = this.store.getSettings().deepClone();
this.idCombo = new JComboBox<String>();
this.idCombo.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
SourceConfigDialog.this.updateSettingPanel();
}
});
final PanelBuilder upb = new PanelBuilder(new FormLayout(
"fill:p:grow, 4dlu, p, 4dlu, p", "p"));
upb.add(this.idCombo, CC.xy(1, 1));
upb.add(this.createNewButton(), CC.xy(3, 1));
upb.add(this.createRemoveButton(), CC.xy(5, 1));
this.settingPanel = new JPanel();
final ButtonBarBuilder bbb = new ButtonBarBuilder();
bbb.addGlue();
bbb.addButton(this.createOkButton(), this.createCancelButton());
this.updateIdCombo();
final PanelBuilder builder = new PanelBuilder(new FormLayout(
"4dlu, fill:p:grow, 4dlu",
"4dlu, p, 4dlu, fill:p:grow, 4dlu, p, 4dlu"));
builder.add(upb.getPanel(), CC.xy(2, 2));
builder.add(this.settingPanel, CC.xy(2, 4));
builder.add(bbb.getPanel(), CC.xy(2, 6));
this.setContentPane(builder.getPanel());
this.pack();
this.setLocationRelativeTo(this.getOwner());
}