當前位置: 首頁>>代碼示例>>Java>>正文


Java JFormattedTextField.setValue方法代碼示例

本文整理匯總了Java中javax.swing.JFormattedTextField.setValue方法的典型用法代碼示例。如果您正苦於以下問題:Java JFormattedTextField.setValue方法的具體用法?Java JFormattedTextField.setValue怎麽用?Java JFormattedTextField.setValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JFormattedTextField的用法示例。


在下文中一共展示了JFormattedTextField.setValue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getImageSizePanel

import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
private JPanel getImageSizePanel() {
	JPanel imageSizePanel = new JPanel();
	imageSizePanel.setLayout(new GridLayout(1, 4));
	
    NumberFormat format = NumberFormat.getInstance();
    format.setGroupingUsed(false);
    NumberFormatter formatter = new NumberFormatter(format);
    formatter.setValueClass(Integer.class);
    formatter.setMinimum(0);
    formatter.setMaximum(Integer.MAX_VALUE);
    formatter.setCommitsOnValidEdit(true);
    widthTF = new JFormattedTextField(formatter);
    widthTF.setValue(1200);
    addFocusListener(widthTF);
    heightTF = new JFormattedTextField(formatter);
    heightTF.setValue(1000);
    addFocusListener(heightTF);
    
    imageSizePanel.add(new JLabel(" Width:"));
    imageSizePanel.add(widthTF);
    imageSizePanel.add(new JLabel(" Height:"));
    imageSizePanel.add(heightTF);
    
	return imageSizePanel;
}
 
開發者ID:sing-group,項目名稱:la-images,代碼行數:26,代碼來源:ExportAllAsPngDialog.java

示例2: getImageSizePanel

import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
private JPanel getImageSizePanel() {
	JPanel imageSizePanel = new JPanel();
	imageSizePanel.setLayout(new GridLayout(1, 4));
	
    NumberFormat format = NumberFormat.getInstance();
    format.setGroupingUsed(false);
    NumberFormatter formatter = new NumberFormatter(format);
    formatter.setValueClass(Integer.class);
    formatter.setMinimum(0);
    formatter.setMaximum(Integer.MAX_VALUE);
    formatter.setCommitsOnValidEdit(true);
    widthTF = new JFormattedTextField(formatter);
    widthTF.setValue(1200);
    widthTF.addFocusListener(FOCUS_LISTENER);
    heightTF = new JFormattedTextField(formatter);
    heightTF.setValue(1000);
    heightTF.addFocusListener(FOCUS_LISTENER);
    
    imageSizePanel.add(new JLabel(" Width:"));
    imageSizePanel.add(widthTF);
    imageSizePanel.add(new JLabel(" Height:"));
    imageSizePanel.add(heightTF);
    
	return imageSizePanel;
}
 
開發者ID:sing-group,項目名稱:la-images,代碼行數:26,代碼來源:ExportAsPngDialog.java

示例3: setupIntegerFieldTrackingValue

import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
/**
 * Sets integer number format to JFormattedTextField instance,
 * sets value of JFormattedTextField instance to object's field value,
 * synchronizes object's field value with the value of JFormattedTextField instance.
 *
 * @param textField  JFormattedTextField instance
 * @param owner      an object whose field is synchronized with {@code textField}
 * @param property   object's field name for synchronization
 */
public static void setupIntegerFieldTrackingValue(final JFormattedTextField textField,
                                                  final InspectionProfileEntry owner,
                                                  final String property) {
    NumberFormat formatter = NumberFormat.getIntegerInstance();
    formatter.setParseIntegerOnly(true);
    textField.setFormatterFactory(new DefaultFormatterFactory(new NumberFormatter(formatter)));
    textField.setValue(getPropertyValue(owner, property));
    final Document document = textField.getDocument();
    document.addDocumentListener(new DocumentAdapter() {
        @Override
        public void textChanged(DocumentEvent e) {
            try {
                textField.commitEdit();
                setPropertyValue(owner, property,
                        ((Number) textField.getValue()).intValue());
            } catch (ParseException e1) {
                // No luck this time
            }
        }
    });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:31,代碼來源:SingleIntegerFieldOptionsPanel.java

示例4: GridEditPanel

import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
public GridEditPanel(int rasterSize) {

    JLabel lblSize = new JLabel("size (px)");
    lblSize.setFont(Program.TEXT_FONT.deriveFont(Font.BOLD).deriveFont(10f));

    textField = new JFormattedTextField(NumberFormat.getIntegerInstance());

    textField.setText("16");
    textField.setFont(Program.TEXT_FONT.deriveFont(10f));
    textField.setColumns(10);
    textField.setValue(rasterSize);
    GroupLayout groupLayout = new GroupLayout(this);
    groupLayout.setHorizontalGroup(
        groupLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(groupLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblSize, GroupLayout.PREFERRED_SIZE, 44, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(textField, GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE)
                .addGap(34)));
    groupLayout.setVerticalGroup(
        groupLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(groupLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(lblSize, GroupLayout.PREFERRED_SIZE, 13, GroupLayout.PREFERRED_SIZE)
                    .addComponent(textField, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE))
                .addContainerGap(46, Short.MAX_VALUE)));
    setLayout(groupLayout);
  }
 
開發者ID:gurkenlabs,項目名稱:litiengine,代碼行數:31,代碼來源:GridEditPanel.java

示例5: IntegerEditor

import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
public IntegerEditor(int min, int max) {
    super(new JFormattedTextField());
    ftf = (JFormattedTextField) getComponent();
    minimum = new Integer(min);
    maximum = new Integer(max);

    // Set up the editor for the integer cells.
    integerFormat = NumberFormat.getIntegerInstance();
    NumberFormatter intFormatter = new NumberFormatter(integerFormat);
    intFormatter.setFormat(integerFormat);
    intFormatter.setMinimum(minimum);
    intFormatter.setMaximum(maximum);

    ftf.setFormatterFactory(new DefaultFormatterFactory(intFormatter));
    ftf.setValue(minimum);
    ftf.setHorizontalAlignment(JTextField.TRAILING);
    ftf.setFocusLostBehavior(JFormattedTextField.PERSIST);

    // React when the user presses Enter while the editor is
    // active. (Tab is handled as specified by
    // JFormattedTextField's focusLostBehavior property.)
    ftf.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "check");
    ftf.getActionMap().put("check", new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            if (!ftf.isEditValid()) { // The text is invalid.
                if (userSaysRevert()) { // reverted
                    ftf.postActionEvent(); // inform the editor
                }
            } else
                try { // The text is valid,
                    ftf.commitEdit(); // so use it.
                    ftf.postActionEvent(); // stop editing
                } catch (java.text.ParseException exc) {
                }
        }
    });
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:38,代碼來源:IntegerEditor.java

示例6: AutoSwivelPanel

import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
public AutoSwivelPanel()
{
    maxSwivelField = new JFormattedTextField(NumberFormat.getNumberInstance());
    minSwivelField = new JFormattedTextField(NumberFormat.getNumberInstance());
    freedomOfTheGaussianMeanField = new JFormattedTextField(NumberFormat.getNumberInstance());
    
    maxSwivelField.setValue(maxSwivel);
    minSwivelField.setValue(minSwivel);
    freedomOfTheGaussianMeanField.setValue(freedomOfTheGaussianMean);
    
    panel.add(setupSwivelParam("min swivel", minSwivelField));
    panel.add(setupSwivelParam("max swivel", maxSwivelField));
    panel.add(setupSwivelParam("freedom of the Gaussian mean", freedomOfTheGaussianMeanField));
    panel.add(swivelLabel);
}
 
開發者ID:ArticulatedSocialAgentsPlatform,項目名稱:HmiCore,代碼行數:16,代碼來源:AutoSwivelPanel.java

示例7: SimulationSpeedControlPanel

import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
public SimulationSpeedControlPanel( Font titleFont, Font controlFont, OTClock clock ) {
    super();
    
    _clock = clock;
    _clock.addConstantDtClockListener( new ConstantDtClockAdapter() {
        public void dtChanged( ConstantDtClockEvent event ) {
            //XXX handle dt changes that are performed by someone else
        };
    });
    
    // Title
    JLabel titleLabel = new JLabel( OTResources.getString( "label.simulationSpeed" ) );
    titleLabel.setFont( titleFont );
    
    // Slider
    _slider = new SimulationSpeedSlider( clock.getSlowRange(), clock.getFastRange(), clock.getDt() );
    _slider.addChangeListener( new ChangeListener() {
        public void stateChanged( ChangeEvent e ) {
            setSimulationSpeed( _slider.getValue() );
        }
    });
    PhetPCanvas canvas = new PhetPCanvas();
    canvas.setBackground( getBackground() );
    canvas.setBorder( null );
    canvas.getLayer().addChild( _slider );
    int margin = 2;
    int xOffset = (int) -_slider.getFullBounds().getX() + margin;
    int yOffset = (int) -_slider.getFullBounds().getY() + margin;
    _slider.setOffset( xOffset, yOffset );
    int w = (int) _slider.getFullBounds().getWidth() + ( 2 * margin );
    int h = (int) _slider.getFullBounds().getHeight() + ( 2 * margin );
    canvas.setPreferredSize( new Dimension( w, h ) );
    
    // Textfield
    _textField = new JFormattedTextField( VALUE_FORMAT );
    _textField.setFont( controlFont );
    _textField.setValue( new Double( _slider.getValue() ) );
    _textField.setHorizontalAlignment( JTextField.RIGHT );
    _textField.setColumns( VALUE_COLUMNS );
    TextFieldListener textFieldListener = new TextFieldListener();
    _textField.addActionListener( textFieldListener );
    _textField.addFocusListener( textFieldListener );
    
    // Units
    JLabel unitsLabel = new JLabel( OTResources.getString( "units.time" ) );
    unitsLabel.setFont( controlFont );
    
    EasyGridBagLayout layout = new EasyGridBagLayout( this );
    this.setLayout( layout );
    layout.setAnchor( GridBagConstraints.WEST );
    layout.setFill( GridBagConstraints.HORIZONTAL );
    layout.setInsets( OTConstants.SUB_PANEL_INSETS );
    int row = 0;
    int column = 0;
    layout.addComponent( titleLabel, row, column++ );
    layout.addComponent( _textField, row, column++ );
    layout.addComponent( unitsLabel, row, column++ );
    row++;
    column = 0;
    layout.addComponent( canvas, row, column, 3, 1 );
    
    setSimulationSpeed( clock.getDt() );
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:64,代碼來源:SimulationSpeedControlPanel.java

示例8: ConcentrationControlNode

import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
public ConcentrationControlNode( double min, double max ) {
    super();
    
    changeListeners = new ArrayList<ChangeListener>();
    
    sliderNode = new ConcentrationSliderNode( min, max );
    addChild( sliderNode );
    sliderNode.addChangeListener( new SliderListener() );
    
    textField = new JFormattedTextField( TEXTFIELD_FORMAT );
    textField.setFont( TEXTFIELD_FONT );
    textField.setValue( new Double( sliderNode.getValue() ) );
    textField.setHorizontalAlignment( JTextField.RIGHT );
    textField.setColumns( TEXTFIELD_COLUMNS );
    TextFieldListener textFieldListener = new TextFieldListener();
    textField.addActionListener( textFieldListener );
    textField.addFocusListener( textFieldListener );
    textField.addKeyListener( textFieldListener );
    
    JLabel unitsLabel = new JLabel( AABSStrings.UNITS_MOLES_PER_LITER );
    unitsLabel.setFont( UNITS_FONT );
    
    JPanel panel = new JPanel();
    panel.setOpaque( false );
    panel.add( textField );
    panel.add( unitsLabel );
    
    PSwing panelWrapper = new PSwing( panel );
    addChild( panelWrapper );
    
    // slider
    double xOffset = 0;
    double yOffset = 0;
    sliderNode.setOffset( xOffset, yOffset );
    // text field to the right of slider, vertically centered
    xOffset = sliderNode.getFullBoundsReference().getMaxX() + X_SPACING;
    yOffset = sliderNode.getFullBoundsReference().getCenterY() - ( panelWrapper.getFullBoundsReference().getHeight() / 2 );
    panelWrapper.setOffset( xOffset, yOffset );
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:40,代碼來源:ConcentrationControlNode.java

示例9: getTableCellEditorComponent

import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
    JFormattedTextField ftf = (JFormattedTextField) super.getTableCellEditorComponent(table, value, isSelected, row, column);
    ftf.setValue(value);
    return ftf;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:6,代碼來源:IntegerEditor.java

示例10: getTableCellEditorComponent

import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
    JFormattedTextField ftf = (JFormattedTextField) super.getTableCellEditorComponent(table, value, isSelected, row, column);
    ftf.setValue(value);
    return ftf;
}
 
開發者ID:takun2s,項目名稱:smile_1.5.0_java7,代碼行數:7,代碼來源:DateCellEditor.java

示例11: IntegerCellEditor

import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
/**
 * Constructor.
 * @param min the minimum of valid values.
 * @param max the maximum of valid values. 
 */
public IntegerCellEditor(int min, int max) {
    super(new JFormattedTextField());
    textField = (JFormattedTextField) getComponent();
    minimum = new Integer(min);
    maximum = new Integer(max);

    // Set up the editor for the integer cells.
    integerFormat = NumberFormat.getIntegerInstance();
    NumberFormatter intFormatter = new NumberFormatter(integerFormat);
    intFormatter.setFormat(integerFormat);
    intFormatter.setOverwriteMode(false);
    intFormatter.setMinimum(minimum);
    intFormatter.setMaximum(maximum);

    textField.setFormatterFactory(new DefaultFormatterFactory(intFormatter));
    textField.setValue(minimum);
    textField.setHorizontalAlignment(JTextField.TRAILING);
    textField.setFocusLostBehavior(JFormattedTextField.PERSIST);

    // React when the user presses Enter while the editor is
    // active.  (Tab is handled as specified by
    // JFormattedTextField's focusLostBehavior property.)
    textField.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "check");
    textField.getActionMap().put("check", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (!textField.isEditValid()) { //The text is invalid.
                Toolkit.getDefaultToolkit().beep();
                textField.selectAll();
            } else {
                try {              //The text is valid,
                    textField.commitEdit();     //so use it.
                    textField.postActionEvent(); //stop editing
                } catch (java.text.ParseException ex) {
                }
            }
        }
    });
}
 
開發者ID:takun2s,項目名稱:smile_1.5.0_java7,代碼行數:46,代碼來源:IntegerCellEditor.java

示例12: DoubleCellEditor

import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
/**
 * Constructor.
 * @param min the minimum of valid values.
 * @param max the maximum of valid values. 
 */
public DoubleCellEditor(double min, double max) {
    super(new JFormattedTextField());
    textField = (JFormattedTextField) getComponent();
    minimum = new Double(min);
    maximum = new Double(max);

    // Set up the editor for the double cells.
    doubleFormat = NumberFormat.getNumberInstance();
    NumberFormatter doubleFormatter = new NumberFormatter(doubleFormat);
    doubleFormatter.setFormat(doubleFormat);
    doubleFormatter.setOverwriteMode(false);
    doubleFormatter.setMinimum(minimum);
    doubleFormatter.setMaximum(maximum);

    textField.setFormatterFactory(new DefaultFormatterFactory(doubleFormatter));
    textField.setValue(minimum);
    textField.setHorizontalAlignment(JTextField.TRAILING);
    textField.setFocusLostBehavior(JFormattedTextField.PERSIST);

    // React when the user presses Enter while the editor is
    // active.  (Tab is handled as specified by
    // JFormattedTextField's focusLostBehavior property.)
    textField.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "check");
    textField.getActionMap().put("check", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (!textField.isEditValid()) { //The text is invalid.
                Toolkit.getDefaultToolkit().beep();
                textField.selectAll();
            } else {
                try {              //The text is valid,
                    textField.commitEdit();     //so use it.
                    textField.postActionEvent(); //stop editing
                } catch (java.text.ParseException ex) {
                }
            }
        }
    });
}
 
開發者ID:takun2s,項目名稱:smile_1.5.0_java7,代碼行數:46,代碼來源:DoubleCellEditor.java

示例13: SoftSphereSolidEOSCalculator

import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
public SoftSphereSolidEOSCalculator() {
		super(new BorderLayout());
		
		double density = 1.1964;
		double temperature = 1.0;
		double[] quantity = getAllQuantity(FCC, n, temperature, density);
		
		//Create the labels.
		densityLabel = new JLabel(densityString);
		temperatureLabel = new JLabel(temperatureString);
		bALabel = new JLabel(bAString);
		ZLabel = new JLabel(ZString);
		bULabel = new JLabel(bUString);
		
		//Create the text fields and set them up.
		densityField = new JFormattedTextField(densityFormat);
		densityField.setValue(new Double(density));
		densityField.setColumns(10);
		densityField.addPropertyChangeListener("value", this);
		
		temperatureField = new JFormattedTextField(temperatureFormat);
		temperatureField.setValue(new Double(temperature));
		temperatureField.setColumns(10);
		temperatureField.addPropertyChangeListener("value", this);
		
		bAField = new JFormattedTextField(bAFormat);
		bAField.setValue(new Double(quantity[0]));
		bAField.setColumns(10);
		bAField.setEditable(false);
//		paymentField.setForeground(Color.red);
		
		ZField = new JFormattedTextField(ZFormat);
		ZField.setValue(new Double(quantity[1]));
		ZField.setColumns(10);
		ZField.setEditable(false);
		
		bUField = new JFormattedTextField(bUFormat);
		bUField.setValue(new Double(quantity[2]));
		bUField.setColumns(10);
		bUField.setEditable(false);
		
		//Tell accessibility tools about label/textfield pairs.
		densityLabel.setLabelFor(densityField);
		temperatureLabel.setLabelFor(temperatureField);
		bALabel.setLabelFor(bAField);
		ZLabel.setLabelFor(ZField);
		bULabel.setLabelFor(bUField);
		
		//Lay out the labels in a panel.
		JPanel labelPane = new JPanel(new GridLayout(0,1));
		labelPane.add(densityLabel);
		labelPane.add(temperatureLabel);
		labelPane.add(bALabel);
		labelPane.add(ZLabel);
		labelPane.add(bULabel);
		
		//Layout the text fields in a panel.
		JPanel fieldPane = new JPanel(new GridLayout(0,1));
		fieldPane.add(densityField);
		fieldPane.add(temperatureField);
		fieldPane.add(bAField);
		fieldPane.add(ZField);
		fieldPane.add(bUField);
		
		//Put the panels in this panel, labels on left,
		//text fields on right.
		setBorder(BorderFactory.createEmptyBorder(40, 40, 40, 40));
		add(labelPane, BorderLayout.CENTER);
		add(fieldPane, BorderLayout.LINE_END);
		

//		LayoutStyle layout = new 
	}
 
開發者ID:etomica,項目名稱:etomica,代碼行數:74,代碼來源:SoftSphereSolidEOSCalculator.java

示例14: AbstractValueControl

import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
/**
 * Constructor.
 *
 * @param slider
 * @param label            label that appears to the left of the value
 * @param textFieldPattern pattern used to format the text field (see DecimalFormat)
 * @param units            units that appear to the right of the value
 * @param layoutStrategy
 * @throws IllegalArgumentException
 */
public AbstractValueControl( AbstractSlider slider, String label, String textFieldPattern, String units, ILayoutStrategy layoutStrategy ) {
    super();

    _slider = slider;
    _slider.setPaintTicks( true ); // Needed to make the knob reasonably large, see #2979.

    _majorTickSpacing = _slider.getModelRange(); // default is major tick marks at min and max
    _minorTickSpacing = 0;
    _upDownArrowDelta = _slider.getModelRange() / 100;
    _slider.setUpDownArrowDelta( _upDownArrowDelta );

    _textFieldFormat = new DecimalFormat( textFieldPattern );
    _tickFormat = new DecimalFormat( textFieldPattern ); // use same format for ticks and textfield
    _majorTicksVisible = true; // major tick labels visible
    _minorTicksVisible = false; // minor tick labels are typically not visible
    _labelTable = null; // instantiated when addTickLabel is called
    _paintTickLabels = true;
    _signifyOutOfBounds = true;

    _notifyWhileAdjusting = true; // provide change notification while slider is dragging
    _isAdjusting = false;
    _font = new PhetFont();
    _listenerList = new EventListenerList();

    // Labels
    _valueLabel = new HTMLLabel( label );
    _unitsLabel = new HTMLLabel( units );

    // Textfield
    _textField = new JFormattedTextField( _textFieldFormat );
    _textField.setValue( new Double( _value ) );
    _textField.setHorizontalAlignment( JTextField.RIGHT );
    _textField.setColumns( textFieldPattern.length() );

    // Layout the components
    layoutStrategy.doLayout( this );

    // Listeners
    _sliderListener = new SliderListener();
    _slider.addChangeListener( _sliderListener );
    _slider.addMouseListener( _sliderListener );
    _textFieldListener = new TextFieldListener();
    _textField.addActionListener( _textFieldListener );
    _textField.addFocusListener( _textFieldListener );
    _textField.addKeyListener( _textFieldListener );

    updateTickLabels();

    _value = _slider.getModelMin() - 1; // force setValue to initalize the components
    setValue( slider.getModelValue() );

    _initialized = true;
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:64,代碼來源:AbstractValueControl.java

示例15: ReturnIFrame

import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
public ReturnIFrame() {
	super();
	setIconifiable(true);							// ���ô������С������������
	setClosable(true);								// ���ô���ɹرգ���������
	setTitle("��ӹ黹��Ϣ");						// ���ô�����⣭��������
	setBounds(100, 50, 500, 225);

	//������ͷͼƬ
	final JLabel logoLabel = new JLabel();
	ImageIcon readerAddIcon=CreateIcon.add("tback.jpg");
	logoLabel.setIcon(readerAddIcon);
	logoLabel.setOpaque(true);
	logoLabel.setBackground(Color.white);
	logoLabel.setPreferredSize(new Dimension(400, 60));
	getContentPane().add(logoLabel, BorderLayout.NORTH);

	//����һ�������������
	final JPanel panel = new JPanel();
	panel.setLayout(new FlowLayout());
	getContentPane().add(panel);

	//�������������Ƕ�����1,���ڷ��÷ǰ�ť���
	final JPanel panel_1 = new JPanel();
	final GridLayout gridLayout = new GridLayout(2, 2);
	gridLayout.setVgap(20);
	panel_1.setLayout(gridLayout);
	panel.add(panel_1);

	final JLabel label_2 = new JLabel();
	label_2.setText("���ļ�¼��ţ�");
	panel_1.add(label_2);
	id = new JTextField(10);
	id.setDocument(new MyDocument(256));
	panel_1.add(id);
	
	final JLabel label_3 = new JLabel();
	label_3.setText("�黹���ڣ�");
	panel_1.add(label_3);
	return_date = new JFormattedTextField();
	return_date.setValue("XXXX-XX-XX");
	return_date.addKeyListener(new DateListener());
	panel_1.add(return_date);
	
	//����������Ƕ��һ�����ڷ��Ű�ť�����
	final JPanel panel_2 = new JPanel();
	panel_2.setPreferredSize(new Dimension(450, 100));
	panel.add(panel_2);
	
	final JRadioButton radioButton1 = new JRadioButton();

	//�����������
	final JButton submit = new JButton();
	panel_2.add(submit);
	submit.setText("�ύ");
	submit.addActionListener((ActionListener) new ButtonAddListener(radioButton1));
	
	//�����������
	final JButton back = new JButton();
	panel_2.add(back);
	back.setText("����");
	back.addActionListener(new CloseActionListener());

	setVisible(true);
}
 
開發者ID:GooZy,項目名稱:LibraryManagementSystem,代碼行數:65,代碼來源:ReturnIFrame.java


注:本文中的javax.swing.JFormattedTextField.setValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。