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

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

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

JTextField.setMinimumSize介绍

暂无

代码示例

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

JLabel mavenDesc = new JLabel("Replaces Maven Central with this repository");
mavenTextField = new JTextField(15);
mavenTextField.setMinimumSize(mavenTextField.getPreferredSize());
mavenLabel.setForeground(new Color(170, 170, 170));
mavenDesc.setForeground(new Color(170, 170, 170));

代码示例来源:origin: stanfordnlp/CoreNLP

jPanel3.add(jLabel1);
urlTextField.setMinimumSize(new java.awt.Dimension(100, 20));
urlTextField.setPreferredSize(new java.awt.Dimension(300, 20));
urlTextField.getDocument().addDocumentListener(new DocumentListener() {

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

txtMessage.setMinimumSize(new java.awt.Dimension(6, 70));
txtMessage.setName(""); // NOI18N
txtMessage.setPreferredSize(new java.awt.Dimension(6, 70));

代码示例来源: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: nodebox/nodebox

portNumberField.setMinimumSize(new Dimension(70, portNumberField.getHeight()));

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

status.setMinimumSize(new Dimension(tableW, 30));
status.setMaximumSize(new Dimension(tableW, 30));
status.setPreferredSize(new Dimension(tableW, 30));

代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql

private JTextField getSizedTextField(Dimension preferredSize) {
 JTextField result = new JTextField();
 result.setPreferredSize(preferredSize);
 result.setMinimumSize(preferredSize);
 result.setEditable(false);
 return result;
}

代码示例来源:origin: realXuJiang/bigtable-sql

private JTextField getSizedTextField(Dimension preferredSize) {
 JTextField result = new JTextField();
 result.setPreferredSize(preferredSize);
 result.setMinimumSize(preferredSize);
 result.setEditable(false);
 return result;
}

代码示例来源: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: triplea-game/triplea

@Override
public JComponent getEditorComponent() {
 final JTextField text = new JTextField(value);
 text.addActionListener(e -> value = text.getText());
 text.addFocusListener(new FocusListener() {
  @Override
  public void focusGained(final FocusEvent e) {}
  @Override
  public void focusLost(final FocusEvent e) {
   value = text.getText();
  }
 });
 final Dimension ourMinimum = new Dimension(80, 20);
 text.setMinimumSize(ourMinimum);
 text.setPreferredSize(ourMinimum);
 return text;
}

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

JPanel panel1= new JPanel();
panel1.setLayout(new BoxLayout(panel1, BoxLayout.Y_AXIS));

JPanel panel2= new JPanel();
panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS));
panel2.setMinimumSize(...); panel2.setMaximumSize(...) ; panel2.setPreferredSize(...);

JPanel panel3 = new JPanel();
panel3.setLayout(new BoxLayout(panel3, BoxLayout.X_AXIS));
panel3 .setMinimumSize(...); panel3 .setMaximumSize(...) ; panel3 .setPreferredSize(...);

JTextField tf1 = new JTextField("text_field_1");
tf1.setMinimumSize(...); tf1.setMaximumSize(...) ; tf1.setPreferredSize(...);

panel2.add(tf1);
panel.add(panel2);
panel.add(panel3);
panel.add(Box.createVerticalGlue());
panel.add(Box.createRigidArea(new Dimension(...)));

代码示例来源:origin: es.ucm.fdi.gaia/jCOLIBRI

/**
 *  Creates a new instance
 */
public FileEditor() {
  text = new JTextField("");
  button = new JButton("...");
  this.add(text);
  this.add(button);
  button.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
      buttonPressed();
    }
  });
  text.setMinimumSize(new java.awt.Dimension(150, 25));
  text.setPreferredSize(new java.awt.Dimension(150, 25));
}

代码示例来源:origin: edu.toronto.cs.savant/savant-core

private void addField(ToolArgument arg, JTextField field, GridBagConstraints gbc) {
  field.addActionListener(executeListener);
  field.getDocument().addDocumentListener(new EditListener(arg));
  field.setMinimumSize(field.getPreferredSize());
  addWidget(arg, field, gbc);
}

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

JTextField t = new JTextField();
t.setMaximumSize(MAX);
t.setMinimumSize(MIN);
t.setBounds(x, y, width, height);

代码示例来源:origin: org.ihtsdo/wb-api

private void init() {
  Box fieldBox = new Box(BoxLayout.X_AXIS);
  fieldBox.setBorder(BorderFactory.createEmptyBorder());
  textField = new JTextField(10);
  textField.setMaximumSize(new Dimension(100, 25));
  textField.setMinimumSize(new Dimension(100, 25));
  textField.setPreferredSize(new Dimension(100, 25));
  textField.setEditable(false);
  popupButton = new JButton("...");
  popupButton.setMargin(new Insets(0, 0, 0, 0));
  popupButton.addActionListener(new PopupListener());
  fieldBox.add(textField);
  fieldBox.add(Box.createRigidArea(new Dimension(5, 5)));
  fieldBox.add(popupButton);
  add(fieldBox);
}

代码示例来源:origin: otros-systems/otroslogviewer

private void startEditing() {
 editor.setVisible(true);
 editor.setText(label.getText());
 editor.selectAll();
 len = editor.getText().length();
 dim = editor.getPreferredSize();
 editor.setMinimumSize(dim);
 remove(label);
 add(editor, 0);
 revalidate();
 editor.requestFocusInWindow();
}

代码示例来源: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;
}

代码示例来源:origin: net.sf.sfac/sfac-core

public JComponent getObjectComponent() {
  if (component == null) {
    component = new JTextField(8);
    component.setMinimumSize(component.getPreferredSize());
    registerFocusListener(component);
    synchronizeEditableState();
    updateView();
  }
  return component;
}

代码示例来源:origin: net.java.dev.designgridlayout/designgridlayout

@Override protected JTextField field(String text)
  {
    JTextField field = super.field(text);
    field.setColumns(10);
    field.setMinimumSize(field.getPreferredSize());
    return field;
  }
}

相关文章

JTextField类方法