javax.swing.JFormattedTextField#setMinimumSize ( )源码实例Demo

下面列出了javax.swing.JFormattedTextField#setMinimumSize ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: snap-desktop   文件: RegionBoundsInputUI.java
private JFormattedTextField createTextField() {
    final int fieldWidth = 60;
    final DoubleFormatter textFormatter = new DoubleFormatter("###0.0##");

    final JFormattedTextField textField = new JFormattedTextField(textFormatter);
    textField.setHorizontalAlignment(JTextField.RIGHT);

    final int defaultHeight = textField.getPreferredSize().height;
    final Dimension size = new Dimension(fieldWidth, defaultHeight);

    textField.setMinimumSize(size);
    textField.setPreferredSize(size);
    textField.setMaximumSize(size);

    return textField;
}
 
源代码2 项目: jdk1.8-source-analysis   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码3 项目: dragonwell8_jdk   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码4 项目: TencentKona-8   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码5 项目: jdk8u60   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码6 项目: JDKSourceCode1.8   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码7 项目: openjdk-jdk8u   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码8 项目: openjdk-jdk8u-backup   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码9 项目: Bytecoder   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码10 项目: openjdk-jdk9   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码11 项目: jdk8u-jdk   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码12 项目: Java8CN   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码13 项目: hottub   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码14 项目: openjdk-8-source   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码15 项目: openjdk-8   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码16 项目: jdk8u_jdk   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码17 项目: jdk8u-jdk   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码18 项目: jdk8u-dev-jdk   文件: ValueFormatter.java
static void init(int length, boolean hex, JFormattedTextField text) {
    ValueFormatter formatter = new ValueFormatter(length, hex);
    text.setColumns(length);
    text.setFormatterFactory(new DefaultFormatterFactory(formatter));
    text.setHorizontalAlignment(SwingConstants.RIGHT);
    text.setMinimumSize(text.getPreferredSize());
    text.addFocusListener(formatter);
}
 
源代码19 项目: opensim-gui   文件: SliderWithTextBox.java
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
private void initComponents() {
    jCoordinateNameLabel = new javax.swing.JLabel();
    jXSlider = new javax.swing.JSlider();
    jFormattedTextField = new JFormattedTextField(formatter);
    jMinimumLabel = new javax.swing.JLabel();
    jMaximumLabel = new javax.swing.JLabel();

    jCoordinateNameLabel.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    jCoordinateNameLabel.setText("coordinate");
    jCoordinateNameLabel.setToolTipText("Name");
    jCoordinateNameLabel.setAlignmentX(1.0F);
    jCoordinateNameLabel.setMaximumSize(new java.awt.Dimension(100, 14));
    jCoordinateNameLabel.setMinimumSize(new java.awt.Dimension(100, 14));
    jCoordinateNameLabel.setPreferredSize(new java.awt.Dimension(100, 14));

    setBorder(javax.swing.BorderFactory.createTitledBorder("Slider label"));
    setAlignmentY(0.0F);
    jXSlider.setMajorTickSpacing(20);
    jXSlider.setMinorTickSpacing(10);
    jXSlider.setToolTipText("Seek");
    jXSlider.setAlignmentX(0.0F);
    jXSlider.setMinimumSize(new java.awt.Dimension(50, 25));
    jXSlider.setPreferredSize(new java.awt.Dimension(50, 25));

    jFormattedTextField.setHorizontalAlignment(javax.swing.JTextField.TRAILING);
    jFormattedTextField.setText("-123.456");
    jFormattedTextField.setToolTipText("Current value");
    jFormattedTextField.setFont(new java.awt.Font("Tahoma", 0, 11));
    jFormattedTextField.setMinimumSize(new java.awt.Dimension(55, 19));
    jFormattedTextField.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jFormattedTextFieldActionPerformed(evt);
        }
    });

    jMinimumLabel.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    jMinimumLabel.setText("-123");
    jMinimumLabel.setToolTipText("Lower bound");
    jMinimumLabel.setFocusable(false);
    jMinimumLabel.setIconTextGap(0);
    jMinimumLabel.setMaximumSize(new java.awt.Dimension(30, 25));
    jMinimumLabel.setMinimumSize(new java.awt.Dimension(30, 25));
    jMinimumLabel.setPreferredSize(new java.awt.Dimension(30, 25));

    jMaximumLabel.setText("123");
    jMaximumLabel.setToolTipText("Upper bound");
    jMaximumLabel.setFocusable(false);
    jMaximumLabel.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
    jMaximumLabel.setIconTextGap(0);
    jMaximumLabel.setMaximumSize(new java.awt.Dimension(25, 25));
    jMaximumLabel.setMinimumSize(new java.awt.Dimension(25, 25));
    jMaximumLabel.setPreferredSize(new java.awt.Dimension(25, 25));

    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
        .add(layout.createSequentialGroup()
            .add(jFormattedTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 55, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
            .add(jMinimumLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
            .add(jXSlider, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE)
            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
            .add(jMaximumLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 25, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
            .add(jMaximumLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
            .add(jFormattedTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
            .add(jMinimumLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
        .add(jXSlider, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 25, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    );
}