本文整理汇总了Java中javax.swing.JTextField.getPreferredSize方法的典型用法代码示例。如果您正苦于以下问题:Java JTextField.getPreferredSize方法的具体用法?Java JTextField.getPreferredSize怎么用?Java JTextField.getPreferredSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTextField
的用法示例。
在下文中一共展示了JTextField.getPreferredSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import javax.swing.JTextField; //导入方法依赖的package包/类
private void setup()
{
JLabel cssLabel = new JLabel(getString("page.additionalcssclass.label"));
additionalCssClass = new JTextField();
JLabel cssHelp = new JLabel(getString("page.additionalcssclass.help"));
final int height1 = additionalCssClass.getPreferredSize().height;
final int width1 = cssLabel.getPreferredSize().width;
final int height2 = cssHelp.getPreferredSize().height;
final int[] rows = {height1, height2};
final int[] cols = {width1, TableLayout.FILL,};
JPanel all = new JPanel(new TableLayout(rows, cols, 5, 5));
cssHelp.setFont(all.getFont());
all.add(cssLabel, new Rectangle(0, 0, 1, 1));
all.add(additionalCssClass, new Rectangle(1, 0, 1, 1));
all.add(cssHelp, new Rectangle(0, 1, 2, 1));
addSection(all);
}
示例2: fixPrefSize
import javax.swing.JTextField; //导入方法依赖的package包/类
private static void fixPrefSize(JTextField textField) {
// The preferred size of JTextField on (Classic) Windows look and feel
// is one pixel shorter. The following code is a workaround.
textField.setPreferredSize(null);
Dimension dim = textField.getPreferredSize();
Dimension fixedDim = new Dimension(dim.width+1, dim.height);
textField.setPreferredSize(fixedDim);
}
示例3: setupOverall
import javax.swing.JTextField; //导入方法依赖的package包/类
private void setupOverall()
{
setupCredentials();
JLabel hostLabel = new JLabel("Proxy Host:");
JLabel portLabel = new JLabel("Proxy Port:");
hostField = new JTextField();
hostField.addKeyListener(this);
portModel = new SpinnerNumberModel(PROXY_DEFAULT, PROXY_MIN, PROXY_MAX, PROXY_STEP);
JSpinner portSpinner = new JSpinner(portModel);
final int width1 = hostLabel.getPreferredSize().width;
final int width2 = portSpinner.getPreferredSize().width;
final int height1 = hostField.getPreferredSize().height;
final int height2 = credentials.getPreferredSize().height;
final int[] rows = {height1, height1, height2,};
final int[] cols = {width1, width2, TableLayout.FILL,};
overall = new JGroup("Enable Proxy", false);
overall.addActionListener(this);
overall.setInnerLayout(new TableLayout(rows, cols));
overall.addInner(hostLabel, new Rectangle(0, 0, 1, 1));
overall.addInner(hostField, new Rectangle(1, 0, 2, 1));
overall.addInner(portLabel, new Rectangle(0, 1, 1, 1));
overall.addInner(portSpinner, new Rectangle(1, 1, 1, 1));
overall.addInner(credentials, new Rectangle(0, 2, 3, 1));
overall.setSelected(false);
}
示例4: setupCredentials
import javax.swing.JTextField; //导入方法依赖的package包/类
private void setupCredentials()
{
JLabel usernameLabel = new JLabel("Username:");
JLabel passwordLabel = new JLabel("Password:");
usernameField = new JTextField();
passwordField = new JPasswordField();
usernameField.addKeyListener(this);
passwordField.addKeyListener(this);
final int width1 = usernameLabel.getPreferredSize().width;
final int width2 = passwordLabel.getPreferredSize().width;
final int width3 = Math.max(width1, width2);
final int height1 = usernameField.getPreferredSize().height;
final int[] rows = {height1, height1};
final int[] cols = {width3, TableLayout.FILL};
credentials = new JGroup("Server requires authentication", false);
credentials.addActionListener(this);
credentials.setInnerLayout(new TableLayout(rows, cols));
credentials.addInner(usernameLabel, new Rectangle(0, 0, 1, 1));
credentials.addInner(passwordLabel, new Rectangle(0, 1, 1, 1));
credentials.addInner(usernameField, new Rectangle(1, 0, 1, 1));
credentials.addInner(passwordField, new Rectangle(1, 1, 1, 1));
credentials.setSelected(false);
}
示例5: setupGUI
import javax.swing.JTextField; //导入方法依赖的package包/类
protected void setupGUI(FilterModel<T> filterModel, String leftTitle, String rightTitle)
{
filter = filterModel;
query = new JTextField();
search = new JButton("Search"); //$NON-NLS-1$
query.addActionListener(this);
search.addActionListener(this);
if( leftTitle == null || rightTitle == null )
{
shuffle = new JShuffleBox<T>();
}
else
{
shuffle = new JShuffleBox<T>(leftTitle, rightTitle);
}
shuffle.setAllowDuplicates(true);
final int height = query.getPreferredSize().height;
final int width1 = 200;
final int width2 = search.getPreferredSize().width;
final int[] rows = new int[]{height, TableLayout.FILL};
final int[] columns = new int[]{TableLayout.FILL, width1, width2, TableLayout.FILL};
setLayout(new TableLayout(rows, columns, 5, 5));
add(query, new Rectangle(1, 0, 1, 1));
add(search, new Rectangle(2, 0, 1, 1));
add(shuffle, new Rectangle(0, 1, 4, 1));
rightHasPriority = true;
}
示例6: generateControl
import javax.swing.JTextField; //导入方法依赖的package包/类
@Override
public JComponent generateControl()
{
localhost = new JRadioButton("This machine", true);
remotehost = new JRadioButton("A different server");
field = new JTextField();
ButtonGroup group = new ButtonGroup();
group.add(localhost);
group.add(remotehost);
ActionListener buttonListener = new ActionListener()
{
/*
* (non-Javadoc)
* @see
* java.awt.event.ActionListener#actionPerformed(java.awt.event.
* ActionEvent)
*/
@Override
public void actionPerformed(ActionEvent e)
{
update();
}
};
localhost.addActionListener(buttonListener);
remotehost.addActionListener(buttonListener);
final int height1 = field.getPreferredSize().height;
final int width1 = remotehost.getPreferredSize().width;
final int[] rows = {height1, height1,};
final int[] cols = {width1, TableLayout.FILL};
JPanel all = new JPanel(new TableLayout(rows, cols));
all.add(localhost, new Rectangle(0, 0, 2, 1));
all.add(remotehost, new Rectangle(0, 1, 1, 1));
all.add(field, new Rectangle(1, 1, 1, 1));
if( items.size() >= 1 )
{
String host = ((Item) items.get(0)).getValue();
if( host.length() == 0 || isLocalhost(host) )
{
localhost.setSelected(true);
}
else
{
remotehost.setSelected(true);
field.setText(host);
}
}
update();
return all;
}
示例7: setup
import javax.swing.JTextField; //导入方法依赖的package包/类
private void setup()
{
JLabel heading = new JLabel("<html><h2>Save Settings");
JLabel help1 = new JLabel("<html><b>Save items to folder:");
JLabel help2 = new JLabel("<html><b>Save items:");
errorLabel = new JLabel();
errorIcon = Icons.getErrorIcon();
folderField = new JTextField();
xsltField = new JTextField();
folderField.setEditable(false);
xsltField.setEditable(false);
folderBrowse = new JButton("Browse");
xsltBrowse = new JButton("Upload");
xsltBrowse.setEnabled(false);
asNativeXML = new JRadioButton("XML and attachments", true);
asIMSPackage = new JRadioButton("IMS packages only");
usingXSLT = new JRadioButton("Other format using an XSLT");
ButtonGroup saveAsGroup = new ButtonGroup();
saveAsGroup.add(asNativeXML);
saveAsGroup.add(asIMSPackage);
saveAsGroup.add(usingXSLT);
folderBrowse.addActionListener(this);
xsltBrowse.addActionListener(this);
asNativeXML.addActionListener(this);
asIMSPackage.addActionListener(this);
usingXSLT.addActionListener(this);
final int height1 = heading.getPreferredSize().height;
final int height2 = help1.getPreferredSize().height;
final int height3 = folderField.getPreferredSize().height;
final int height4 = 5;
final int width1 = 10;
final int width2 = folderBrowse.getPreferredSize().width;
final int[] rows = {height1, height2, height3, height4, height2, height2, height2, height2, height3, height3,
TableLayout.FILL};
final int[] cols = {width1, width1, TableLayout.FILL, width2};
setLayout(new TableLayout(rows, cols, 5, 5));
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
add(heading, new Rectangle(0, 0, 4, 1));
add(help1, new Rectangle(0, 1, 4, 1));
add(folderField, new Rectangle(2, 2, 1, 1));
add(folderBrowse, new Rectangle(3, 2, 1, 1));
add(help2, new Rectangle(0, 4, 4, 1));
add(asNativeXML, new Rectangle(1, 5, 3, 1));
add(asIMSPackage, new Rectangle(1, 6, 3, 1));
add(usingXSLT, new Rectangle(1, 7, 2, 1));
add(xsltField, new Rectangle(2, 8, 1, 1));
add(xsltBrowse, new Rectangle(3, 8, 1, 1));
add(errorLabel, new Rectangle(0, 9, 4, 1));
}
示例8: ServerPage
import javax.swing.JTextField; //导入方法依赖的package包/类
public ServerPage(SharedData data)
{
super(data);
errorLabel = new JLabel();
errorIcon = Icons.getErrorIcon();
JLabel heading = new JLabel("<html><h2>Server Connection");
JLabel help = new JLabel("<html><b>Please enter the server details:");
JLabel serverLabel = new JLabel("Server URL");
JLabel usernameLabel = new JLabel("Username");
JLabel passwordLabel = new JLabel("Password");
server = new JTextField("http://");
username = new JTextField();
password = new JPasswordField();
final int width = serverLabel.getPreferredSize().width;
final int height1 = heading.getPreferredSize().height;
final int height2 = help.getPreferredSize().height;
final int height3 = server.getPreferredSize().height;
final int[] rows = new int[]{height1, height2, height3, height3, height3, height3, height3, TableLayout.FILL};
final int[] cols = new int[]{width, TableLayout.FILL};
setLayout(new TableLayout(rows, cols, 5, 5));
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
add(heading, new Rectangle(0, 0, 2, 1));
add(help, new Rectangle(0, 1, 2, 1));
add(serverLabel, new Rectangle(0, 2, 1, 1));
add(server, new Rectangle(1, 2, 1, 1));
add(usernameLabel, new Rectangle(0, 3, 1, 1));
add(username, new Rectangle(1, 3, 1, 1));
add(passwordLabel, new Rectangle(0, 4, 1, 1));
add(password, new Rectangle(1, 4, 1, 1));
add(errorLabel, new Rectangle(0, 6, 2, 2));
}
示例9: ProxyPage
import javax.swing.JTextField; //导入方法依赖的package包/类
public ProxyPage(SharedData data)
{
super(data);
JLabel heading = new JLabel("<html><h2>Proxy Settings");
JLabel help = new JLabel("<html><b>Please enter the proxy server details (if any):");
JLabel hostLabel = new JLabel("Host");
JLabel portLabel = new JLabel("Port");
JLabel usernameLabel = new JLabel("Username");
JLabel passwordLabel = new JLabel("Password");
host = new JTextField();
port = new JTextField();
username = new JTextField();
password = new JPasswordField();
final int width = Math.max(usernameLabel.getPreferredSize().width, passwordLabel.getPreferredSize().width);
final int height1 = heading.getPreferredSize().height;
final int height2 = help.getPreferredSize().height;
final int height3 = host.getPreferredSize().height;
final int[] rows = new int[]{height1, height2, height3, height3, height3, height3, TableLayout.FILL};
final int[] cols = new int[]{width, TableLayout.FILL};
setLayout(new TableLayout(rows, cols, 5, 5));
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
add(heading, new Rectangle(0, 0, 2, 1));
add(help, new Rectangle(0, 1, 2, 1));
add(hostLabel, new Rectangle(0, 2, 1, 1));
add(host, new Rectangle(1, 2, 1, 1));
add(portLabel, new Rectangle(0, 3, 1, 1));
add(port, new Rectangle(1, 3, 1, 1));
add(usernameLabel, new Rectangle(0, 4, 1, 1));
add(username, new Rectangle(1, 4, 1, 1));
add(passwordLabel, new Rectangle(0, 5, 1, 1));
add(password, new Rectangle(1, 5, 1, 1));
}
示例10: setup
import javax.swing.JTextField; //导入方法依赖的package包/类
private void setup()
{
JLabel heading = new JLabel("<html><h2>Item Selection");
JLabel typeLabel = new JLabel("Type");
JLabel dirLabel = new JLabel("Source");
JLabel xsltLabel = new JLabel("XSLT");
JLabel requiredLabel = new JLabel("<html><b>Required:");
JLabel optionalLabel = new JLabel("<html><b>Optional:");
xsltTextField = new JTextField();
dirTextField = new JTextField();
xsltButton = new JButton("...");
dirButton = new JButton("...");
xsltTextField.setEditable(false);
dirTextField.setEditable(true);
xsltButton.addActionListener(this);
dirButton.addActionListener(this);
typeComboBox = new JComboBox();
typeComboBox.setEnabled(false);
dirChooser = new JFileChooser();
dirChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
xsltChooser = new JFileChooser();
xsltChooser.setFileFilter(new XSLTFileFilter());
final int height1 = typeComboBox.getPreferredSize().height;
final int height2 = xsltTextField.getPreferredSize().height;
final int height3 = optionalLabel.getPreferredSize().height;
final int height4 = heading.getPreferredSize().height;
final int width2 = xsltButton.getPreferredSize().width;
final int width3 = dirLabel.getPreferredSize().width + 5;
final int[] rows = new int[]{height4, height3, height1, height2, height3, height2};
final int[] cols = new int[]{width3, TableLayout.FILL, width2};
setLayout(new TableLayout(rows, cols, 5, 0));
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
add(heading, new Rectangle(0, 0, 2, 1));
add(requiredLabel, new Rectangle(0, 1, 3, 1));
add(typeLabel, new Rectangle(0, 2, 1, 1));
add(typeComboBox, new Rectangle(1, 2, 2, 1));
add(dirLabel, new Rectangle(0, 3, 1, 1));
add(dirTextField, new Rectangle(1, 3, 1, 1));
add(dirButton, new Rectangle(2, 3, 1, 1));
add(optionalLabel, new Rectangle(0, 4, 3, 1));
add(xsltLabel, new Rectangle(0, 5, 1, 1));
add(xsltTextField, new Rectangle(1, 5, 1, 1));
add(xsltButton, new Rectangle(2, 5, 1, 1));
}
示例11: setup
import javax.swing.JTextField; //导入方法依赖的package包/类
private void setup()
{
JLabel profileLabel = new JLabel("Profile Name:");
JLabel serverLabel = new JLabel("Server URL:");
JLabel usernameLabel = new JLabel("Username:");
JLabel passwordLabel = new JLabel("Password:");
profileField = new JTextField();
serverField = new JTextField();
usernameField = new JTextField();
passwordField = new JPasswordField();
profileField.addKeyListener(this);
serverField.addKeyListener(this);
ok = new JButton("Save");
cancel = new JButton("Cancel");
ok.addActionListener(this);
cancel.addActionListener(this);
ok.setEnabled(false);
final int width1 = profileLabel.getPreferredSize().width;
final int width2 = cancel.getPreferredSize().width;
final int height1 = profileField.getPreferredSize().height;
final int height2 = cancel.getPreferredSize().height;
final int[] rows = {height1, height1, height1, height1, TableLayout.FILL, height2,};
final int[] cols = {width1, TableLayout.FILL, width2, width2,};
JPanel all = new JPanel(new TableLayout(rows, cols, 5, 5));
all.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
all.add(profileLabel, new Rectangle(0, 0, 1, 1));
all.add(profileField, new Rectangle(1, 0, 3, 1));
all.add(serverLabel, new Rectangle(0, 1, 1, 1));
all.add(serverField, new Rectangle(1, 1, 3, 1));
all.add(usernameLabel, new Rectangle(0, 2, 1, 1));
all.add(usernameField, new Rectangle(1, 2, 3, 1));
all.add(passwordLabel, new Rectangle(0, 3, 1, 1));
all.add(passwordField, new Rectangle(1, 3, 3, 1));
all.add(ok, new Rectangle(2, 5, 1, 1));
all.add(cancel, new Rectangle(3, 5, 1, 1));
setModal(true);
setTitle("Profile Editor");
getContentPane().add(all);
getRootPane().setDefaultButton(ok);
pack();
ComponentHelper.ensureMinimumSize(this, 500, 0);
ComponentHelper.centreOnScreen(this);
}
示例12: setupGui
import javax.swing.JTextField; //导入方法依赖的package包/类
protected void setupGui()
{
final JLabel httpHeaderNameLabel = new JLabel(getString("httpheadername")); //$NON-NLS-1$
final JLabel environmentVarNameLabel = new JLabel(getString("environmentvarname")); //$NON-NLS-1$
final JLabel preamble = new JLabel(getString("shib.preamble")); //$NON-NLS-1$
final JLabel logoutUrlLabel = new JLabel(getString("logouturl")); //$NON-NLS-1$
httpHeaderName = new JTextField(20);
environmentVarName = new JTextField(20);
logoutUrl = new JTextField(20);
final int height1 = logoutUrl.getPreferredSize().height;
final TableLayout innerLayout = new TableLayout(new int[]{height1, height1},
new int[]{
Math.max(environmentVarNameLabel.getPreferredSize().width,
httpHeaderNameLabel.getPreferredSize().width), TableLayout.FILL}, 5, 5);
final Rectangle radioPos = new Rectangle(0, 0, 2, 1);
useRemoteUser = new JRadioGroup(getString("useremoteuser"), innerLayout, radioPos); //$NON-NLS-1$
buttonGroup.add(useRemoteUser.getButton());
useHTTPHeader = new JRadioGroup(getString("usehttpheader"), innerLayout, radioPos); //$NON-NLS-1$
buttonGroup.add(useHTTPHeader.getButton());
useEnvironmentVariable = new JRadioGroup(getString("useenvironmentvar"), innerLayout, radioPos); //$NON-NLS-1$
buttonGroup.add(useEnvironmentVariable.getButton());
final int width1 = logoutUrlLabel.getPreferredSize().width;
final int width2 = logoutUrl.getPreferredSize().width;
final int[] rows = {preamble.getPreferredSize().height * 2, height1, height1, height1, height1, height1,
height1, height1, height1, height1, height1, TableLayout.PREFERRED};
final int[] columns = {width1, width2, TableLayout.FILL};
setLayout(new TableLayout(rows, columns, 5, 5));
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
int row = 0;
add(preamble, new Rectangle(0, row, 3, 1));
// Advance the value of row as we refer to it ...
++row;
add(useRemoteUser, new Rectangle(0, row, 3, 1));
useHTTPHeader.add(httpHeaderNameLabel, new Rectangle(0, 1, 1, 1));
useHTTPHeader.add(httpHeaderName, new Rectangle(1, 1, 1, 1));
row += 2;
add(useHTTPHeader, new Rectangle(0, row, 3, 2));
useEnvironmentVariable.add(environmentVarNameLabel, new Rectangle(0, 1, 1, 1));
useEnvironmentVariable.add(environmentVarName, new Rectangle(1, 1, 1, 1));
row += 3;
add(useEnvironmentVariable, new Rectangle(0, row, 3, 2));
row += 3;
add(logoutUrlLabel, new Rectangle(0, row, 1, 1));
// .. except this time
add(logoutUrl, new Rectangle(1, row, 2, 1));
useRemoteUser.setEnabled(false);
useHTTPHeader.setEnabled(false);
useEnvironmentVariable.setEnabled(false);
validate();
}
示例13: setupGui
import javax.swing.JTextField; //导入方法依赖的package包/类
private void setupGui()
{
JLabel identifierLabel = new JLabel(
CurrentLocale.get("com.tle.admin.usermanagement.internal.userdetailspanel.identifier")); //$NON-NLS-1$
JLabel usernameLabel = new JLabel(
CurrentLocale.get("com.tle.admin.usermanagement.internal.userdetailspanel.username")); //$NON-NLS-1$
JLabel firstNameLabel = new JLabel(
CurrentLocale.get("com.tle.admin.usermanagement.internal.userdetailspanel.first")); //$NON-NLS-1$
JLabel lastNameLabel = new JLabel(
CurrentLocale.get("com.tle.admin.usermanagement.internal.userdetailspanel.last")); //$NON-NLS-1$
JLabel emailAddressLabel = new JLabel(
CurrentLocale.get("com.tle.admin.usermanagement.internal.userdetailspanel.email")); //$NON-NLS-1$
JLabel newPasswordLabel = new JLabel(
CurrentLocale.get("com.tle.admin.usermanagement.internal.userdetailspanel.newpswd")); //$NON-NLS-1$
JLabel passwordConfirmLabel = new JLabel(
CurrentLocale.get("com.tle.admin.usermanagement.internal.userdetailspanel.confirmpswd")); //$NON-NLS-1$
identifier = new JTextField();
identifier.setEditable(false);
username = new JTextField();
firstName = new JTextField();
lastName = new JTextField();
emailAddress = new JTextField();
newPassword = new JPasswordField();
passwordConfirm = new JPasswordField();
labels.put("username", usernameLabel);
labels.put("firstName", firstNameLabel);
labels.put("lastName", lastNameLabel);
labels.put("emailAddress", emailAddressLabel);
labels.put("email", emailAddressLabel);
labels.put("password", newPasswordLabel);
JButton save = new JButton(saveAction);
final int height1 = username.getPreferredSize().height;
final int height2 = save.getPreferredSize().height;
final int width1 = passwordConfirmLabel.getPreferredSize().width + 10;
final int width2 = save.getPreferredSize().width;
final int[] rows = {height1, height1, height1, height1, height1, height1, height1, height1, TableLayout.FILL,
height2,};
final int[] cols = {width1, TableLayout.FILL, width2,};
setLayout(new TableLayout(rows, cols));
add(identifierLabel, new Rectangle(0, 0, 1, 1));
add(identifier, new Rectangle(1, 0, 2, 1));
add(usernameLabel, new Rectangle(0, 1, 1, 1));
add(username, new Rectangle(1, 1, 2, 1));
add(firstNameLabel, new Rectangle(0, 2, 1, 1));
add(firstName, new Rectangle(1, 2, 2, 1));
add(lastNameLabel, new Rectangle(0, 3, 1, 1));
add(lastName, new Rectangle(1, 3, 2, 1));
add(emailAddressLabel, new Rectangle(0, 4, 1, 1));
add(emailAddress, new Rectangle(1, 4, 2, 1));
add(newPasswordLabel, new Rectangle(0, 6, 1, 1));
add(newPassword, new Rectangle(1, 6, 2, 1));
add(passwordConfirmLabel, new Rectangle(0, 7, 1, 1));
add(passwordConfirm, new Rectangle(1, 7, 2, 1));
add(save, new Rectangle(2, 9, 1, 1));
changeDetector = new ChangeDetector();
changeDetector.watch(username);
changeDetector.watch(firstName);
changeDetector.watch(lastName);
changeDetector.watch(emailAddress);
changeDetector.watch(newPassword);
changeDetector.watch(passwordConfirm);
}
示例14: setupGUI
import javax.swing.JTextField; //导入方法依赖的package包/类
@SuppressWarnings("nls")
private void setupGUI()
{
JPanel all = new JPanel();
allowNonSequential = new JCheckBox(
getString("wizard.editor.allowNonSequential.label"));
showPageTitlesNextPrev = new JCheckBox(
getString("wizard.editor.showPageTitlesNextPrev.label"));
JLabel cssLabel = new JLabel(
getString("wizard.editor.additionalCssClass.label"));
additionalCssClass = new JTextField();
JLabel cssHelp = new JLabel(
getString("wizard.editor.additionalCssClass.help"));
cssHelp.setFont(all.getFont());
accessibilityHelpTitle = new JLabel(
getString("wizard.editor.accesshelp.title"));
accessibilityHelp = new JTextArea(
getString("wizard.editor.accesshelp.text"));
accessibilityHelp.setEditable(false);
accessibilityHelp.setBackground(all.getBackground());
accessibilityHelp.setFont(all.getFont());
JSeparator separator1 = new JSeparator();
JSeparator separator2 = new JSeparator();
int sh = separator1.getPreferredSize().height;
final int columns[] = {cssLabel.getPreferredSize().width, TableLayout.FILL};
final int rows[] = {allowNonSequential.getPreferredSize().height,
showPageTitlesNextPrev.getPreferredSize().height, sh, additionalCssClass.getPreferredSize().height,
cssHelp.getPreferredSize().height, sh, accessibilityHelpTitle.getPreferredSize().height,
accessibilityHelp.getPreferredSize().height};
all.setLayout(new TableLayout(rows, columns, 5, 5));
all.add(allowNonSequential, new Rectangle(0, 0, 2, 1));
all.add(showPageTitlesNextPrev, new Rectangle(0, 1, 2, 1));
all.add(separator1, new Rectangle(0, 2, 2, 1));
all.add(cssLabel, new Rectangle(0, 3, 1, 1));
all.add(additionalCssClass, new Rectangle(1, 3, 1, 1));
all.add(cssHelp, new Rectangle(0, 4, 2, 1));
all.add(separator2, new Rectangle(0, 5, 2, 1));
all.add(accessibilityHelpTitle, new Rectangle(0, 6, 2, 1));
all.add(accessibilityHelp, new Rectangle(0, 7, 2, 1));
addSection(all);
}
示例15: setup
import javax.swing.JTextField; //导入方法依赖的package包/类
private void setup(String server)
{
okPressed = false;
JLabel usernameLabel = new JLabel("Username");
JLabel passwordLabel = new JLabel("Password");
ok = new JButton("OK");
cancel = new JButton("Cancel");
username = new JTextField();
password = new JPasswordField();
ok.addActionListener(this);
cancel.addActionListener(this);
final int height1 = username.getPreferredSize().height;
final int height2 = ok.getPreferredSize().height;
final int width1 = Math.max(usernameLabel.getPreferredSize().width, passwordLabel.getPreferredSize().width);
final int width2 = cancel.getPreferredSize().width;
final int[] rows = {height1, height1, TableLayout.FILL, height2,};
final int[] cols = {width1, TableLayout.FILL, width2, width2,};
JPanel all = new JPanel(new TableLayout(rows, cols, 5, 5));
all.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
all.add(usernameLabel, new Rectangle(0, 0, 1, 1));
all.add(username, new Rectangle(1, 0, 3, 1));
all.add(passwordLabel, new Rectangle(0, 1, 1, 1));
all.add(password, new Rectangle(1, 1, 3, 1));
all.add(ok, new Rectangle(2, 3, 1, 1));
all.add(cancel, new Rectangle(3, 3, 1, 1));
getContentPane().add(all);
ok.requestFocus();
setSize(310, 150);
setTitle("Login to " + server);
getRootPane().setDefaultButton(ok);
ComponentHelper.centreOnScreen(this);
}