本文整理汇总了Java中com.jgoodies.forms.builder.DefaultFormBuilder.add方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultFormBuilder.add方法的具体用法?Java DefaultFormBuilder.add怎么用?Java DefaultFormBuilder.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jgoodies.forms.builder.DefaultFormBuilder
的用法示例。
在下文中一共展示了DefaultFormBuilder.add方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPanel
import com.jgoodies.forms.builder.DefaultFormBuilder; //导入方法依赖的package包/类
/**
* Creates the panel layout. Requires that the GUI components have already
* been created. Does not fill in any values into the components. See
* {@link #switchToDsType()} for that.
*/
private JPanel createPanel() {
FormLayout layout = new FormLayout("fill:max(60dlu;pref), 6dlu, pref:grow", "pref, 6dlu, pref:grow, 3dlu, pref"); //$NON-NLS-1$ //$NON-NLS-2$
DefaultFormBuilder fb = new DefaultFormBuilder(layout);
fb.setDefaultDialogBorder();
JComponent addRemoveBar = new JPanel(new FlowLayout(FlowLayout.LEFT));
addRemoveBar.add(addDsTypeButton);
addRemoveBar.add(removeDsTypeButton);
JScrollPane dsTypePane = new JScrollPane(dsTypeList);
//Setting the preferred size to 0 so the add/remove bar and the default size
//set the width of the column and not the max type name width.
dsTypePane.setPreferredSize(new Dimension(0, 0));
fb.add(dsTypePane, "1, 1, 1, 3"); //$NON-NLS-1$
fb.add(addRemoveBar, "1, 5"); //$NON-NLS-1$
fb.add(dsTypePanel.getPanel(), "3, 1"); //$NON-NLS-1$
return fb.getPanel();
}
示例2: initializeCoverPanel
import com.jgoodies.forms.builder.DefaultFormBuilder; //导入方法依赖的package包/类
private void initializeCoverPanel()
{
FormLayout layout = new FormLayout("left:max(40dlu;pref), 3dlu, pref:grow", "");
DefaultFormBuilder builder = new DefaultFormBuilder(layout);
coverPanel = builder.getPanel();
this.builder.appendRow(builder.getLineGapSpec());
this.builder.nextLine();
this.builder.appendRow("fill:pref:grow");
this.builder.append(coverPanel, 6);
coverSenderTextField = new JTextField(DEFAULT_COLUMNS);
coverSenderTextField.setText(Settings.FULLNAME.getValue());
coverSenderLabel = builder.append("", coverSenderTextField);
builder.nextLine();
coverRecepientTextField = new JTextField(DEFAULT_COLUMNS);
coverRecepientLabel = builder.append("", coverRecepientTextField);
builder.nextLine();
coverSubjectTextField = new JTextField(DEFAULT_COLUMNS);
coverSubjectLabel = builder.append("", coverSubjectTextField);
builder.nextLine();
coverCommentTextArea= new JTextArea(3, DEFAULT_COLUMNS);
coverCommentLabel = builder.append("");
builder.appendRow("fill:pref:grow"); // second row for text area
CellConstraints cc = new CellConstraints();
coverCommentScrollPane = new JScrollPane(coverCommentTextArea);
builder.add(coverCommentScrollPane,
cc.xywh(builder.getColumn(), builder.getRow(), 1, 2));
builder.nextLine(2);
}
示例3: FontSelector
import com.jgoodies.forms.builder.DefaultFormBuilder; //导入方法依赖的package包/类
public FontSelector(Font font, String[] fontList, SPFontLoader fontLoader) {
this.fontLoader = fontLoader;
if (font == null) {
if (fontList == null
|| fontList.length == 0)
{
throw new IllegalArgumentException("The fontList parameter requires at least one valid font.");
}
font = Font.decode(fontList[0]);
if (font == null) {
throw new IllegalArgumentException("The fontList[0] element cannot be loaded.");
}
}
logger.debug("Creating new font selector with given font: " + font);
this.originalFont = font;
SelectionHandler selectionHandler = new SelectionHandler();
fontNameList = new JList(fontList);
fontNameList.addListSelectionListener(selectionHandler);
fontSizeSpinner = new JSpinner(new SpinnerNumberModel(font.getSize(), 1, 200, 1));
fontSizeSpinner.addChangeListener(selectionHandler);
fontSizeList = new JList(FONT_SIZES);
fontSizeList.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
if (fontSizeList.getSelectedValue() != null) {
fontSizeSpinner.setValue((Integer) fontSizeList.getSelectedValue());
}
}
});
styleChoice = new JList(FontStyle.values());
styleChoice.setSelectedValue(FontStyle.forCode(font.getStyle()), true);
styleChoice.addListSelectionListener(selectionHandler);
FormLayout layout = new FormLayout(
"pref:grow, 4dlu, pref, 4dlu, pref",
"pref, 4dlu, pref, 4dlu, fill:pref:grow");
layout.setHonorsVisibility(true);
DefaultFormBuilder builder = new DefaultFormBuilder(layout);
CellConstraints cc = new CellConstraints();
builder.add(new JScrollPane(fontNameList), cc.xywh(1, 1, 1, 3));
builder.add(fontSizeSpinner, cc.xywh(3, 1, 1, 1));
builder.add(new JScrollPane(fontSizeList), cc.xywh(3, 3, 1, 1));
builder.add(new JScrollPane(styleChoice), cc.xywh(5, 1, 1, 3));
previewArea.setBackground(Color.WHITE);
previewArea.setPreferredSize(new Dimension(300, 100));
builder.add(previewArea, cc.xywh(1, 5, 5, 1));
// Set defaults after creating layout so the "scroll to visible" works
fontSizeList.setSelectedValue(Integer.valueOf(font.getSize()), true);
fontNameList.setSelectedValue(font.getFamily(), true);
logger.debug("Set family list to \"" + font.getFamily() +
"\" and size to " + Integer.valueOf(font.getSize()));
panel = builder.getPanel();
previewFont(); // ensure view is up to date!
}
示例4: ServerProjectsManagerPanel
import com.jgoodies.forms.builder.DefaultFormBuilder; //导入方法依赖的package包/类
/**
* This constructor creates a dialog for modifying and loading a project
* from a single server designated by the given serverInfo parameter.
*
* @param serverInfo
* Projects will be retrieved from this server based on the
* information and displayed. The dialog will allow editing the
* security as well as creating and deleting projects on this
* server.
* @param dialogOwner
* The dialog to parent new dialogs to.
* @param upf
* A user prompter factory for displaying error and warning
* messages to users.
* @param closeAction
* An action that will close the dialog or frame that this dialog
* is contained in.
* @param defaultFileDirectory
* A default file directory to start looking for files in if the
* user wants to upload a project. If null this will default to
* the user's home directory.
* @param cookieStore
* A cookie store for HTTP requests. Used by the
* {@link ClientSideSessionUtils}.
*/
public ServerProjectsManagerPanel(
SPServerInfo serverInfo,
Component dialogOwner,
UserPrompterFactory upf,
Action closeAction,
File defaultFileDirectory,
CookieStore cookieStore) {
this.serverInfo = serverInfo;
this.dialogOwner = dialogOwner;
this.upf = upf;
this.closeAction = closeAction;
this.defaultFileDirectory = defaultFileDirectory;
this.cookieStore = cookieStore;
cookieStore.clear();
DefaultFormBuilder builder = new DefaultFormBuilder(new FormLayout(
"pref:grow, 5dlu, pref",
"pref, pref, pref"));
servers = null;
projects = new JList(new DefaultListModel());
projects.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
refreshPanel();
if (e.getClickCount() == 2 && SwingUtilities.isLeftMouseButton(e)) {
getOpenAction().actionPerformed(null);
}
}
});
JScrollPane projectsPane = new JScrollPane(projects);
projectsPane.setPreferredSize(new Dimension(250, 300));
CellConstraints cc = new CellConstraints();
builder.add(new JLabel(serverInfo.getName() + "'s projects:"), cc.xyw(1, 1, 2));
builder.nextLine();
builder.add(projectsPane, cc.xywh(1, 2, 1, 2));
DefaultFormBuilder buttonBarBuilder = new DefaultFormBuilder(new FormLayout("pref"));
buttonBarBuilder.append(new JButton(refreshAction));
buttonBarBuilder.append(securityButton);
buttonBarBuilder.append(new JButton(newAction));
buttonBarBuilder.append(openButton);
buttonBarBuilder.append(new JButton(deleteAction));
buttonBarBuilder.append(new JButton(closeAction));
builder.add(buttonBarBuilder.getPanel(), cc.xy(3, 2));
builder.setDefaultDialogBorder();
panel = builder.getPanel();
}
示例5: SPServerInfoManagerPanel
import com.jgoodies.forms.builder.DefaultFormBuilder; //导入方法依赖的package包/类
/**
* Creates a panel that displays the currently configured server
* connections. New connections can be added from this panel and existing
* connections can be modified or removed.
*
* @param manager
* An {@link SPServerInfoManager} instance that contains server connection information.
* @param dialogOwner
* A component that will be used as the dialog owner for other
* panels.
* @param closeAction
* An action that will properly close the object displaying the
* panel.
* @param boxLabel
* Label of the server information box
* @param addOrEditDialogLable
* Label of the Add/Edit panel
*/
public SPServerInfoManagerPanel(SPServerInfoManager manager,
Component dialogOwner, Action closeAction, String boxLabel, String addOrEditDialogLable, Action ... extraButtons) {
this.manager = manager;
this.dialogOwner = dialogOwner;
this.boxLable = boxLabel;
this.addOrEditDialogLabel = addOrEditDialogLable;
DefaultFormBuilder builder = new DefaultFormBuilder(new FormLayout(
"pref:grow, 5dlu, pref", "pref, pref, pref"));
serverInfos = new JList(new DefaultListModel());
serverInfos.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2
&& SwingUtilities.isLeftMouseButton(e)
&& connectButton.getAction() != null) {
connectButton.getAction().actionPerformed(null);
}
}
});
JScrollPane scrollPane = new JScrollPane(serverInfos);
scrollPane.setPreferredSize(new Dimension(400, 300));
this.connectButton = new JButton();
// Build the GUI
refreshInfoList();
CellConstraints cc = new CellConstraints();
builder.add(new JLabel(boxLable), cc
.xyw(1, 1, 3));
builder.nextLine();
builder.add(scrollPane, cc.xywh(1, 2, 1, 2));
DefaultFormBuilder buttonBarBuilder = new DefaultFormBuilder(
new FormLayout("pref"));
buttonBarBuilder.append(new JButton(addAction));
buttonBarBuilder.append(new JButton(editAction));
buttonBarBuilder.append(connectButton);
for (Action a : extraButtons) {
buttonBarBuilder.append(new JButton(a));
}
buttonBarBuilder.append(new JButton(removeAction));
buttonBarBuilder.append(new JButton(closeAction));
builder.add(buttonBarBuilder.getPanel(), cc.xy(3, 2));
builder.setDefaultDialogBorder();
panel = builder.getPanel();
}
示例6: buildUI
import com.jgoodies.forms.builder.DefaultFormBuilder; //导入方法依赖的package包/类
@Override
protected JPanel buildUI() {
if (addressDataRequired != null) {
addressDataRequired
.removeMouseListener(HyperlinkTextSelectedListener);
}
if (HyperlinkTextSelectedListener == null) {
HyperlinkTextSelectedListener = new MouseAdapter() {
public void mouseEntered(MouseEvent e) {
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
public void mousePressed(MouseEvent e) {
try {
BrowserUtil.launch(addressDataURL);
} catch (IOException e1) {
SPSUtils.showExceptionDialogNoReport(
AddressCorrectionMungeComponent.this,
"Invalid URL", e1);
}
}
public void mouseExited(MouseEvent e) {
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
};
}
DefaultFormBuilder builder = new DefaultFormBuilder(new FormLayout(
"center:pref:grow", "fill:pref, pref"));
addressDataURL = "http://www.sqlpower.ca/page/dqguru_address_data";
addressDataRequired = new JLabel(
"<html> <p align =\"center\">You cannot continue without having a valid address database to compare against!<br> Please set the path to your address database in the User Preferences... <br> To purchase one, click on the following link:<br> <a href=\""
+ addressDataURL
+ "\">http://www.sqlpower.ca/page/dqguru_address_data</a><html>");
addressDataRequired.addMouseListener(HyperlinkTextSelectedListener);
builder.add(addressDataRequired);
builder.nextLine();
addressDataRequired.setVisible(false);
if (!((AddressCorrectionMungeStep) getStep()).doesDatabaseExist()) {
addressDataRequired.setVisible(true);
}
showAllButton = new JButton(new HideShowAllLabelsAction("Show All",
true, true, true));
hideAllButton = new JButton(new HideShowAllLabelsAction("Hide All",
true, true, false));
JPanel content = new JPanel(new FlowLayout());
content.add(showAllButton);
content.add(hideAllButton);
builder.append(content);
setOutputShowNames(true);
setInputShowNames(true);
return builder.getPanel();
}