本文整理汇总了Java中com.jgoodies.forms.builder.FormBuilder类的典型用法代码示例。如果您正苦于以下问题:Java FormBuilder类的具体用法?Java FormBuilder怎么用?Java FormBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FormBuilder类属于com.jgoodies.forms.builder包,在下文中一共展示了FormBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: build
import com.jgoodies.forms.builder.FormBuilder; //导入依赖的package包/类
public JComponent build() {
String colSpec = FormLayoutUtil.getColSpec(MAIN_COL_SPEC, orientation);
FormLayout mainlayout = new FormLayout(colSpec, MAIN_ROW_SPEC);
FormBuilder builder = FormBuilder.create().layout(mainlayout).border(Paddings.DLU4).opaque(true);
CellConstraints cc = new CellConstraints();
if (!configuration.isHideAdvancedOptions()) {
builder.add(buildRightTabbedPanel()).at(FormLayoutUtil.flip(cc.xyw(4, 1, 3), colSpec, orientation));
builder.add(buildLeft()).at(FormLayoutUtil.flip(cc.xy(2, 1), colSpec, orientation));
} else {
builder.add(buildRightTabbedPanel()).at(FormLayoutUtil.flip(cc.xyw(2, 1, 5), colSpec, orientation));
builder.add(buildLeft()).at(FormLayoutUtil.flip(cc.xy(2, 1), colSpec, orientation));
}
JPanel panel = builder.getPanel();
// Apply the orientation to the panel and all components in it
panel.applyComponentOrientation(orientation);
return panel;
}
示例2: getConfigurationPanel
import com.jgoodies.forms.builder.FormBuilder; //导入依赖的package包/类
@Override
public JComponent getConfigurationPanel() {
FormLayout layout = new FormLayout(
"left:pref, 0:grow",
"p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, 0:grow"
);
FormBuilder builder = FormBuilder.create().layout(layout).border(Paddings.EMPTY).opaque(false);
CellConstraints cc = new CellConstraints();
noresample = new JCheckBox(Messages.getString("TrTab2.22"), configuration.isAudioResample());
noresample.setContentAreaFilled(false);
noresample.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
configuration.setAudioResample(e.getStateChange() == ItemEvent.SELECTED);
}
});
builder.add(GuiUtil.getPreferredSizeComponent(noresample)).at(cc.xy(2, 3));
return builder.getPanel();
}
示例3: initSettingsPanel
import com.jgoodies.forms.builder.FormBuilder; //导入依赖的package包/类
/**
* Create a FormBuilder, fill it with a textbox for the path and store the JPanel in settings
*/
protected void initSettingsPanel() {
builder = FormBuilder.create();
builder.layout(new FormLayout("left:pref, 4dlu, fill:pref:grow, 4dlu, fill:pref", "p"));
StringBuilder label = new StringBuilder(Localization.lang("Path to %0", getApplicationName()));
// In case the application name and the actual command is not the same, add the command in brackets
if (getCommandName() == null) {
label.append(':');
} else {
label.append(" (").append(getCommandName()).append("):");
}
builder.add(label.toString()).xy(1, 1);
builder.add(path).xy(3, 1);
JButton browse = new JButton(Localization.lang("Browse"));
FileDialogConfiguration fileDialogConfiguration = new FileDialogConfiguration.Builder()
.withInitialDirectory(Globals.prefs.get(JabRefPreferences.WORKING_DIRECTORY)).build();
DialogService ds = new FXDialogService();
browse.addActionListener(
e -> DefaultTaskExecutor.runInJavaFXThread(() -> ds.showFileOpenDialog(fileDialogConfiguration))
.ifPresent(f -> path.setText(f.toAbsolutePath().toString())));
builder.add(browse).xy(5, 1);
settings = builder.build();
}
示例4: DroppedFileHandler
import com.jgoodies.forms.builder.FormBuilder; //导入依赖的package包/类
public DroppedFileHandler(JabRefFrame frame, BasePanel panel) {
this.frame = frame;
this.panel = panel;
ButtonGroup grp = new ButtonGroup();
grp.add(linkInPlace);
grp.add(copyRadioButton);
grp.add(moveRadioButton);
FormLayout layout = new FormLayout("left:15dlu,pref,pref,pref", "bottom:14pt,pref,pref,pref,pref");
layout.setRowGroups(new int[][] {{1, 2, 3, 4, 5}});
FormBuilder builder = FormBuilder.create().layout(layout);
builder.add(linkInPlace).xyw(1, 1, 4);
builder.add(destDirLabel).xyw(1, 2, 4);
builder.add(copyRadioButton).xyw(2, 3, 3);
builder.add(moveRadioButton).xyw(2, 4, 3);
builder.add(renameCheckBox).xyw(2, 5, 1);
builder.add(renameToTextBox).xyw(4, 5, 1);
optionsPanel.add(builder.getPanel());
}
示例5: rejectFocusTraversalTypeNull
import com.jgoodies.forms.builder.FormBuilder; //导入依赖的package包/类
@Test(expected=NullPointerException.class)
public void rejectFocusTraversalTypeNull() {
FormBuilder.create()
.columns("pref")
.rows("pref")
.focusTraversalType(null)
.build();
}
示例6: acceptFocusTraversalTypes
import com.jgoodies.forms.builder.FormBuilder; //导入依赖的package包/类
@Test
public void acceptFocusTraversalTypes() {
FormBuilder.create()
.columns("pref")
.rows("pref")
.focusTraversalType(FocusTraversalType.LAYOUT)
.build();
FormBuilder.create()
.columns("pref")
.rows("pref")
.focusTraversalType(FocusTraversalType.CONTAINER_ORDER)
.build();
}
示例7: customFocusTraversalPolicy
import com.jgoodies.forms.builder.FormBuilder; //导入依赖的package包/类
@Test
public void customFocusTraversalPolicy() {
FormBuilder.create()
.columns("pref")
.rows("pref")
.focusTraversalPolicy(new ContainerOrderFocusTraversalPolicy())
.build();
}
示例8: rejectSettingFocusTraversalPolicyTwice
import com.jgoodies.forms.builder.FormBuilder; //导入依赖的package包/类
@Test(expected=IllegalStateException.class)
public void rejectSettingFocusTraversalPolicyTwice() {
FormBuilder.create()
.columns("pref")
.rows("pref")
.focusTraversalPolicy(new ContainerOrderFocusTraversalPolicy())
.focusTraversalPolicy(new LayoutFocusTraversalPolicy())
.build();
}
示例9: chooseAmongInstallations
import com.jgoodies.forms.builder.FormBuilder; //导入依赖的package包/类
private Optional<Path> chooseAmongInstallations(List<Path> installDirs) {
if (installDirs.isEmpty()) {
return Optional.empty();
}
if (installDirs.size() == 1) {
return Optional.of(installDirs.get(0).toAbsolutePath());
}
// Otherwise more than one installation was found, select among them
DefaultListModel<File> mod = new DefaultListModel<>();
for (Path tmpfile : installDirs) {
mod.addElement(tmpfile.toFile());
}
JList<File> fileList = new JList<>(mod);
fileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
fileList.setSelectedIndex(0);
FormBuilder builder = FormBuilder.create().layout(new FormLayout("pref:grow", "pref, 2dlu, pref, 4dlu, pref"));
builder.add(Localization.lang("Found more than one OpenOffice/LibreOffice executable.")).xy(1, 1);
builder.add(Localization.lang("Please choose which one to connect to:")).xy(1, 3);
builder.add(fileList).xy(1, 5);
int answer = JOptionPane.showConfirmDialog(null, builder.getPanel(),
Localization.lang("Choose OpenOffice/LibreOffice executable"), JOptionPane.OK_CANCEL_OPTION);
if (answer == JOptionPane.CANCEL_OPTION) {
return Optional.empty();
} else {
return Optional.of(fileList.getSelectedValue().toPath());
}
}
示例10: init
import com.jgoodies.forms.builder.FormBuilder; //导入依赖的package包/类
private void init() {
List<String> fieldNames = InternalBibtexFields.getAllPublicFieldNames();
fieldNames.add(BibEntry.KEY_FIELD);
Collections.sort(fieldNames);
String[] allPlusKey = fieldNames.toArray(new String[fieldNames.size()]);
savePriSort = new JComboBox<>(allPlusKey);
savePriSort.setEditable(true);
saveSecSort = new JComboBox<>(allPlusKey);
saveSecSort.setEditable(true);
saveTerSort = new JComboBox<>(allPlusKey);
saveTerSort.setEditable(true);
savePriDesc = new JCheckBox(Localization.lang("Descending"));
saveSecDesc = new JCheckBox(Localization.lang("Descending"));
saveTerDesc = new JCheckBox(Localization.lang("Descending"));
FormLayout layout = new FormLayout("right:pref, 8dlu, fill:pref, 4dlu, fill:60dlu, 4dlu, left:pref",
"pref, 2dlu, pref, 2dlu, pref");
FormBuilder builder = FormBuilder.create().layout(layout);
builder.add(Localization.lang("Primary sort criterion")).xy(1, 1);
builder.add(savePriSort).xy(3, 1);
builder.add(savePriDesc).xy(5, 1);
builder.add(Localization.lang("Secondary sort criterion")).xy(1, 3);
builder.add(saveSecSort).xy(3, 3);
builder.add(saveSecDesc).xy(5, 3);
builder.add(Localization.lang("Tertiary sort criterion")).xy(1, 5);
builder.add(saveTerSort).xy(3, 5);
builder.add(saveTerDesc).xy(5, 5);
panel = builder.build();
}
示例11: setupGui
import com.jgoodies.forms.builder.FormBuilder; //导入依赖的package包/类
private void setupGui() {
JPanel chooseStyle = FormBuilder.create()
.columns("0:grow, $lcgap, pref, $lcgap, 0:grow")
.rows("pref, $lg, fill:pref:grow, $lg, pref:grow, $lg, pref:grow, $lg, pref:grow")
.padding(Paddings.DIALOG)
.addSeparator(Localization.lang("Current Preview")).xyw(1, 1, 5)
.add(available).xywh(1, 3, 1, 7)
.add(chosen).xywh(5, 3, 1, 7)
.add(btnRight).xy(3, 3, "fill, bottom")
.add(btnLeft).xy(3, 5, "fill, top")
.add(btnUp).xy(3, 7, "fill, bottom")
.add(btnDown).xy(3, 9, "fill, top")
.build();
JPanel preview = FormBuilder.create()
.columns("pref:grow, $lcgap, pref, $lcgap, pref")
.rows("pref, $lg, fill:pref:grow")
.padding(Paddings.DIALOG)
.addSeparator(Localization.lang("Preview")).xy(1, 1)
.add(btnTest).xy(3, 1)
.add(btnDefault).xy(5, 1)
.add(scrollPane).xyw(1, 3, 5)
.build();
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
add(chooseStyle, BorderLayout.CENTER);
add(preview, BorderLayout.PAGE_END);
}
示例12: SingleCitationDialog
import com.jgoodies.forms.builder.FormBuilder; //导入依赖的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);
}
示例13: init
import com.jgoodies.forms.builder.FormBuilder; //导入依赖的package包/类
private void init() {
cleanUpDOI = new JCheckBox(
Localization.lang("Move DOIs from note and URL field to DOI field and remove http prefix"));
cleanUpISSN = new JCheckBox(Localization.lang("Reformat ISSN"));
Optional<Path> firstExistingDir = databaseContext
.getFirstExistingFileDir(JabRefPreferences.getInstance().getFileDirectoryPreferences());
if (firstExistingDir.isPresent()) {
cleanUpMovePDF = new JCheckBox(Localization.lang("Move linked files to default file directory %0",
firstExistingDir.get().toString()));
} else {
cleanUpMovePDF = new JCheckBox(Localization.lang("Move linked files to default file directory %0", "..."));
cleanUpMovePDF.setEnabled(false);
// Since the directory does not exist, we cannot move it to there. So, this option is not checked - regardless of the presets stored in the preferences.
cleanUpMovePDF.setSelected(false);
}
cleanUpMakePathsRelative = new JCheckBox(
Localization.lang("Make paths of linked files relative (if possible)"));
cleanUpRenamePDF = new JCheckBox(Localization.lang("Rename PDFs to given filename format pattern"));
cleanUpRenamePDF.addChangeListener(
event -> cleanUpRenamePDFonlyRelativePaths.setEnabled(cleanUpRenamePDF.isSelected()));
cleanUpRenamePDFonlyRelativePaths = new JCheckBox(Localization.lang("Rename only PDFs having a relative path"));
cleanUpUpgradeExternalLinks = new JCheckBox(
Localization.lang("Upgrade external PDF/PS links to use the '%0' field.", FieldName.FILE));
cleanUpBiblatex = new JCheckBox(Localization.lang(
"Convert to biblatex format (for example, move the value of the 'journal' field to 'journaltitle')"));
cleanUpBibtex = new JCheckBox(Localization.lang(
"Convert to BibTeX format (for example, move the value of the 'journaltitle' field to 'journal')"));
ButtonGroup biblatexConversion = new ButtonGroup(); // Only make "to Biblatex" or "to BibTeX" selectable
biblatexConversion.add(cleanUpBiblatex);
biblatexConversion.add(cleanUpBibtex);
cleanUpFormatters = new FieldFormatterCleanupsPanel(Localization.lang("Run field formatter:"),
Cleanups.DEFAULT_SAVE_ACTIONS);
updateDisplay(cleanupPreset);
FormLayout layout = new FormLayout("left:15dlu, fill:pref:grow",
"pref, pref, pref, pref, pref, fill:pref:grow, pref,pref, pref, pref,190dlu, fill:pref:grow,");
FormBuilder builder = FormBuilder.create().layout(layout);
builder.add(cleanUpDOI).xyw(1, 1, 2);
builder.add(cleanUpUpgradeExternalLinks).xyw(1, 2, 2);
builder.add(cleanUpMovePDF).xyw(1, 3, 2);
builder.add(cleanUpMakePathsRelative).xyw(1, 4, 2);
builder.add(cleanUpRenamePDF).xyw(1, 5, 2);
String currentPattern = Localization.lang("Filename format pattern").concat(": ");
currentPattern = currentPattern.concat(Globals.prefs.get(JabRefPreferences.IMPORT_FILENAMEPATTERN));
builder.add(new JLabel(currentPattern)).xy(2, 6);
builder.add(cleanUpRenamePDFonlyRelativePaths).xy(2, 7);
builder.add(cleanUpBibtex).xyw(1, 8, 2);
builder.add(cleanUpBiblatex).xyw(1, 9, 2);
builder.add(cleanUpISSN).xyw(1, 10, 2);
builder.add(cleanUpFormatters).xyw(1, 11, 2);
panel = builder.build();
scrollPane = new JScrollPane(panel);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
scrollPane.setVisible(true);
scrollPane.setBorder(null);
}
示例14: getSelectorPanel
import com.jgoodies.forms.builder.FormBuilder; //导入依赖的package包/类
/**
* This panel contains the two comboboxes and the Add button
* @return Returns the created JPanel
*/
private JPanel getSelectorPanel() {
FormBuilder builder = FormBuilder.create()
.layout(new FormLayout("left:pref:grow, 4dlu, left:pref:grow, 4dlu, fill:pref:grow, 4dlu, right:pref",
"fill:pref:grow, 2dlu, pref, 2dlu"));
List<String> fieldNames = InternalBibtexFields.getAllPublicAndInternalFieldNames();
fieldNames.add(BibEntry.KEY_FIELD);
Collections.sort(fieldNames);
String[] allPlusKey = fieldNames.toArray(new String[fieldNames.size()]);
selectFieldCombobox = new JComboBox<>(allPlusKey);
selectFieldCombobox.setEditable(true);
builder.add(selectFieldCombobox).xy(1, 1);
List<String> formatterNames = Cleanups.getAvailableFormatters().stream()
.map(Formatter::getName).collect(Collectors.toList());
List<String> formatterDescriptions = Cleanups.getAvailableFormatters().stream()
.map(Formatter::getDescription).collect(Collectors.toList());
formattersCombobox = new JComboBox<>(formatterNames.toArray());
formattersCombobox.setRenderer(new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected,
boolean cellHasFocus) {
if ((-1 < index) && (index < formatterDescriptions.size()) && (value != null)) {
setToolTipText(formatterDescriptions.get(index));
}
return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
}
});
formattersCombobox.addItemListener(e -> updateDescription());
builder.add(formattersCombobox).xy(3, 1);
addButton = new JButton(Localization.lang("Add"));
addButton.addActionListener(e -> {
FieldFormatterCleanup newAction = getFieldFormatterCleanup();
if (newAction == null) {
return;
}
((CleanupActionsListModel) actionsList.getModel()).addCleanupAction(newAction);
});
builder.add(addButton).xy(5, 1);
return builder.getPanel();
}
示例15: ColorSetupPanel
import com.jgoodies.forms.builder.FormBuilder; //导入依赖的package包/类
public ColorSetupPanel(JCheckBox colorCodes, JCheckBox resolvedColorCodes, JCheckBox showGrid) {
FormLayout layout = new FormLayout(
"30dlu, 4dlu, fill:pref, 4dlu, fill:pref, 8dlu, 30dlu, 4dlu, fill:pref, 4dlu, fill:pref",
"pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref");
FormBuilder builder = FormBuilder.create().layout(layout);
buttons.add(new ColorButton(JabRefPreferences.TABLE_TEXT, Localization.lang("Table text color")));
buttons.add(new ColorButton(JabRefPreferences.MARKED_ENTRY_BACKGROUND0,
Localization.lang("Marking color %0", "1")));
buttons.add(new ColorButton(JabRefPreferences.TABLE_BACKGROUND, Localization.lang("Table background color")));
buttons.add(new ColorButton(JabRefPreferences.MARKED_ENTRY_BACKGROUND1,
Localization.lang("Marking color %0", "2")));
buttons.add(new ColorButton(JabRefPreferences.TABLE_REQ_FIELD_BACKGROUND,
Localization.lang("Background color for required fields"), colorCodes));
buttons.add(new ColorButton(JabRefPreferences.MARKED_ENTRY_BACKGROUND2,
Localization.lang("Marking color %0", "3")));
buttons.add(new ColorButton(JabRefPreferences.TABLE_OPT_FIELD_BACKGROUND,
Localization.lang("Background color for optional fields"), colorCodes));
buttons.add(new ColorButton(JabRefPreferences.MARKED_ENTRY_BACKGROUND3,
Localization.lang("Marking color %0", "4")));
buttons.add(new ColorButton(JabRefPreferences.INCOMPLETE_ENTRY_BACKGROUND,
Localization.lang("Color for marking incomplete entries")));
buttons.add(new ColorButton(JabRefPreferences.MARKED_ENTRY_BACKGROUND4,
Localization.lang("Marking color %0", "5")));
buttons.add(new ColorButton(JabRefPreferences.GRID_COLOR, Localization.lang("Table grid color"), showGrid));
buttons.add(
new ColorButton(JabRefPreferences.MARKED_ENTRY_BACKGROUND5, Localization.lang("Import marking color")));
buttons.add(new ColorButton(JabRefPreferences.FIELD_EDITOR_TEXT_COLOR,
Localization.lang("Entry editor font color")));
buttons.add(new ColorButton(JabRefPreferences.VALID_FIELD_BACKGROUND_COLOR,
Localization.lang("Entry editor background color")));
buttons.add(new ColorButton(JabRefPreferences.ACTIVE_FIELD_EDITOR_BACKGROUND_COLOR,
Localization.lang("Entry editor active background color")));
buttons.add(new ColorButton(JabRefPreferences.INVALID_FIELD_BACKGROUND_COLOR,
Localization.lang("Entry editor invalid field color")));
buttons.add(new ColorButton(JabRefPreferences.TABLE_RESOLVED_FIELD_BACKGROUND,
Localization.lang("Background color for resolved fields"), resolvedColorCodes));
buttons.add(new ColorButton(JabRefPreferences.ICON_ENABLED_COLOR, Localization.lang("Color for enabled icons")));
buttons.add(new ColorButton(JabRefPreferences.ICON_DISABLED_COLOR, Localization.lang("Color for disabled icons")));
int rowcnt = 0;
int col = 0;
int row;
for (ColorButton but : buttons) {
row = (2 * (rowcnt / 2)) + 1; // == 2*floor(rowcnt/2) + 1
builder.add((JButton)but).xy((6 * col) + 1, row);
builder.add(but.getDefaultButton()).xy((6 * col) + 3, row);
builder.add(but.getName()).xy((6 * col) + 5, row);
but.addActionListener(new ColorButtonListener(but));
col = 1 - col; // Change 0 -> 1 -> 0 ...
rowcnt++;
}
setLayout(new BorderLayout());
add(builder.getPanel(), BorderLayout.CENTER);
setValues();
}