javax.swing.JTextField.setMaximumSize()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(211)

本文整理了Java中javax.swing.JTextField.setMaximumSize()方法的一些代码示例,展示了JTextField.setMaximumSize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextField.setMaximumSize()方法的具体详情如下:
包路径:javax.swing.JTextField
类名称:JTextField
方法名:setMaximumSize

JTextField.setMaximumSize介绍

暂无

代码示例

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

nameField = new JTextField(System.getProperty("user.name", "yourname"));
Dimension d = nameField.getPreferredSize();
nameField.setMaximumSize(new Dimension(120, d.height + 6));
p.add(nameField);
p.add(new JLabel("  Message:"));

代码示例来源:origin: magefree/mage

jScrollPaneTxt.setViewportView(txtConversation);
txtMessage.setMaximumSize(new java.awt.Dimension(5000, 70));
txtMessage.setMinimumSize(new java.awt.Dimension(6, 70));
txtMessage.setName(""); // NOI18N

代码示例来源:origin: magefree/mage

public void changeGUISize(Font font) {
  txtConversation.setFont(font);
  txtMessage.setFont(font);
  if (jScrollPaneTxt != null) {
    jScrollPaneTxt.setFont(font);
    jScrollPaneTxt.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
    jScrollPaneTxt.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
  }
  int height = 30;
  if (font.getSize() > 20) {
    height = 30 + Math.min(font.getSize() - 10, 30);
  }
  txtMessage.setMinimumSize(new Dimension(20, height));
  txtMessage.setMaximumSize(new Dimension(txtMessage.getWidth(), height));
  txtMessage.setPreferredSize(new Dimension(txtMessage.getWidth(), height));
  txtMessage.setSize(new Dimension(txtMessage.getWidth(), height));
  if (connectedChat != null) {
    connectedChat.changeGUISize(font);
  }
}

代码示例来源:origin: magefree/mage

txtName.setBorder(javax.swing.BorderFactory.createEtchedBorder());
txtName.setFocusable(false);
txtName.setMaximumSize(new java.awt.Dimension(50, 22));
txtName.setOpaque(false);
txtName.setRequestFocusEnabled(false);

代码示例来源:origin: ron190/jsql-injection

});
this.textKerberosKrb5Conf.setMaximumSize(new Dimension(400, 0));
this.textKerberosLoginConf.setMaximumSize(new Dimension(400, 0));
this.textDigestAuthenticationUsername.setMaximumSize(new Dimension(200, 0));
this.textDigestAuthenticationPassword.setMaximumSize(new Dimension(200, 0));
this.textProxyAddress.setMaximumSize(new Dimension(200, 0));
this.textProxyPort.setMaximumSize(new Dimension(200, 0));
this.textProxyAddressHttps.setMaximumSize(new Dimension(200, 0));
this.textProxyPortHttps.setMaximumSize(new Dimension(200, 0));

代码示例来源:origin: RaiMan/SikuliX2

status.setEditable(false);
status.setMinimumSize(new Dimension(tableW, 30));
status.setMaximumSize(new Dimension(tableW, 30));
status.setPreferredSize(new Dimension(tableW, 30));
panel.add(status);

代码示例来源:origin: stackoverflow.com

private JTextField createJTextField(String text, Dimension dimenstion) {
  JTextField textField = new JTextField(text);
  textField.setMaximumSize(dimenstion);
  return textField;
}

代码示例来源:origin: matsim-org/matsim

private static void addTextField(JPanel panel, String value) {
  JTextField text = new JTextField(value);
  text.setMaximumSize(new Dimension(300, 27));
  panel.add(text);
}

代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler

public void hideSearchLabel() {
    searchLabel.setVisible(false);
    findField.setMaximumSize(null);
    findField.setPreferredSize(new Dimension(100, 40));
    findField.setToolTipText("Search");
    box.setOpaque(false);
    box.setBackground(null);
  }
}

代码示例来源:origin: ome/bio-formats_plugins

public static JTextField makeTextField() {
 JTextField textField = new JTextField(48);
 int prefHeight = textField.getPreferredSize().height;
 textField.setMaximumSize(new Dimension(Integer.MAX_VALUE, prefHeight));
 textField.setEditable(false);
 return textField;
}

代码示例来源:origin: openmicroscopy/bioformats

public static JTextField makeTextField() {
 JTextField textField = new JTextField(48);
 int prefHeight = textField.getPreferredSize().height;
 textField.setMaximumSize(new Dimension(Integer.MAX_VALUE, prefHeight));
 textField.setEditable(false);
 return textField;
}

代码示例来源:origin: pl.touk/test-generator

private JTextField createTextField(String field)
  {
    JTextField jtext = new JTextField(field);
    jtext.setPreferredSize(new Dimension(200, 20));
    jtext.setMinimumSize(new Dimension(150, 20));
    jtext.setMaximumSize(new Dimension(500, 20));
//        jtext.setMaximumSize(new Dimension(340, 0));
    //jtext.setSize(200, 20);

    return jtext;
  }

代码示例来源:origin: stackoverflow.com

menuBar.add(Box.createHorizontalGlue());
JTextField textField = new JTextField(10);
textField.setMaximumSize( textField.getPreferredSize() );
menuBar.add(textField);

代码示例来源:origin: org.apache.jmeter/ApacheJMeter_tcp

private JPanel createSoLingerOption() {
  JLabel label = new JLabel(JMeterUtils.getResString("solinger")); //$NON-NLS-1$ 
  soLinger = new JTextField(5); // 5 columns size
  soLinger.setMaximumSize(new Dimension(soLinger.getPreferredSize()));
  label.setLabelFor(soLinger);
  JPanel soLingerPanel = new JPanel(new FlowLayout());
  soLingerPanel.add(label);
  soLingerPanel.add(soLinger);
  return soLingerPanel;
}

代码示例来源:origin: org.apache.jmeter/ApacheJMeter_tcp

private JPanel createEolBytePanel() {
  JLabel label = new JLabel(JMeterUtils.getResString("eolbyte")); //$NON-NLS-1$ 
  eolByte = new JTextField(3); // 3 columns size
  eolByte.setMaximumSize(new Dimension(eolByte.getPreferredSize()));
  label.setLabelFor(eolByte);
  JPanel eolBytePanel = new JPanel(new FlowLayout());
  eolBytePanel.add(label);
  eolBytePanel.add(eolByte);
  return eolBytePanel;
}

代码示例来源:origin: stackoverflow.com

public static void main(String [] args) {
  JFrame frame = new JFrame();
  JTextField small = new JTextField("small");
  JTextField big = new JTextField("big");
  big.setFont(big.getFont().deriveFont(Font.BOLD, 40));
  big.setPreferredSize(new Dimension(123, 20));
  big.setMaximumSize(new Dimension(123, 20));
  frame.setLayout(new FlowLayout());
  frame.add(small);
  frame.add(big);

  frame.setVisible(true);
}

代码示例来源:origin: biojava/biojava

private Box getDomainPanel(JTextField f){
  JLabel l01 = new JLabel("Input structures:");
  Box hBox = Box.createHorizontalBox();
  hBox.add(Box.createGlue());
  hBox.add(l01);
  f.setMaximumSize(new Dimension(Short.MAX_VALUE,30));
  f.setToolTipText("Provide structure identifiers space separated.");
  hBox.add(Box.createVerticalGlue());
  hBox.add(f, BorderLayout.CENTER);
  hBox.add(Box.createGlue());
  return hBox;
}

代码示例来源:origin: eu.mihosoft.vrl/vrl

public void setMaximumSizeAsSuper(Dimension d) {
    super.setMaximumSize(d);
    if (typeRepresentation != null &&
        typeRepresentation.getMainCanvas() != null) {
       revalidate();
//            typeRepresentation.getMainCanvas().revalidate();
    }
  }
//    @Override

代码示例来源:origin: matsim-org/matsim

private void addTextFieldButton(ActionPanel panel, String type) {
  JTextField text = new JTextField("");
  text.setMaximumSize(new Dimension(600, 27));
  text.setMinimumSize(new Dimension(300, 27));
  panel.add(text);
  panel.addTextField(text); // This must be valid
  JButton button = new JButton("Browse... ");
  BrowseAction actio = new BrowseAction(text, type);
  button.setAction(actio);
  panel.add(button);
}

代码示例来源:origin: org.junit/com.springsource.junit

private JTextField createOutputField(int width) {
  JTextField field= new JTextField("0", width);
  // force a fixed layout to avoid accidental hiding on relayout
  field.setMinimumSize(field.getPreferredSize());
  field.setMaximumSize(field.getPreferredSize());
  field.setHorizontalAlignment(SwingConstants.LEFT);
  field.setFont(StatusLine.BOLD_FONT);
  field.setEditable(false);
  field.setBorder(BorderFactory.createEmptyBorder());
  return field;
}

相关文章

JTextField类方法