当前位置: 首页>>代码示例>>Java>>正文


Java JTextField.setMaximumSize方法代码示例

本文整理汇总了Java中javax.swing.JTextField.setMaximumSize方法的典型用法代码示例。如果您正苦于以下问题:Java JTextField.setMaximumSize方法的具体用法?Java JTextField.setMaximumSize怎么用?Java JTextField.setMaximumSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JTextField的用法示例。


在下文中一共展示了JTextField.setMaximumSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Ed

import javax.swing.JTextField; //导入方法依赖的package包/类
public Ed(Hideable p) {
  controls = new JPanel();
  controls.setLayout(new BoxLayout(controls, BoxLayout.Y_AXIS));

  hideKeyInput = new NamedHotKeyConfigurer(null, "Keyboard command:  ", p.hideKey);
  controls.add(hideKeyInput.getControls());

  Box b = Box.createHorizontalBox();
  hideCommandInput = new JTextField(16);
  hideCommandInput.setMaximumSize(hideCommandInput.getPreferredSize());
  hideCommandInput.setText(p.command);
  b.add(new JLabel("Menu Text:  "));
  b.add(hideCommandInput);
  controls.add(b);

  colorConfig = new ColorConfigurer(null, "Background color:  ", p.bgColor);
  controls.add(colorConfig.getControls());

  transpConfig = new IntConfigurer(null, "Transparency (%):  ", (int) (p.transparency * 100));
  controls.add(transpConfig.getControls());

  accessConfig = new PieceAccessConfigurer(null, "Can by hidden by:  ", p.access);
  controls.add(accessConfig.getControls());
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:25,代码来源:Hideable.java

示例2: createTopPane

import javax.swing.JTextField; //导入方法依赖的package包/类
private JComponent createTopPane() {
    inputField = new JTextField(40);
    inputField.addActionListener( (e) -> sendMessage() );
    inputField.setMaximumSize( inputField.getPreferredSize() );
    
    JButton sendButton = new JButton( getLocalizedComponentText("sendButton") );
    sendButton.addActionListener( (e) -> sendMessage() );
    
    JPanel pane = new JPanel();
    pane.setLayout( new BoxLayout(pane, BoxLayout.LINE_AXIS) );
    
    crSwitch = new JToggleButton("CR", true);
    lfSwitch = new JToggleButton("LF", true);
    
    pane.add( inputField );
    pane.add( Box.createRigidArea( new Dimension(5, 0) ) );
    pane.add( sendButton );
    pane.add( Box.createGlue() );
    pane.add( crSwitch );
    pane.add( Box.createRigidArea( new Dimension(5, 0) ) );
    pane.add( lfSwitch );        
    
    pane.setBorder( BorderFactory.createEmptyBorder(3, 3, 3, 0) );
    
    return pane;
}
 
开发者ID:chipKIT32,项目名称:chipKIT-importer,代码行数:27,代码来源:SerialMonitorDisplayPane.java

示例3: adjustQuickSearch

import javax.swing.JTextField; //导入方法依赖的package包/类
private void adjustQuickSearch( QuickSearch qs ) {
    qs.setAlwaysShown( true );
    Component qsComponent = panelFilter.getComponent( 0 );
    if( qsComponent instanceof JComponent ) {
        ((JComponent)qsComponent).setBorder( BorderFactory.createEmptyBorder() );
    }
    JTextField textField = getQuickSearchField();
    if( null != textField )
        textField.setMaximumSize( null );
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:TemplatesPanelGUI.java

示例4: addInputString

import javax.swing.JTextField; //导入方法依赖的package包/类
/**
 * Adds an input field to insert a String
 * @param text text to be shown on a label
 * @param property property to be changed in Defaults
 * @param cont container where input field must be added
 */
protected void addInputString(String text, String property, Container cont) {
	JLabel label = new JLabel(text + ":");
	JTextField field = new JTextField(10);
	field.setName(property);
	label.setLabelFor(field);
	field.setText(Defaults.get(property));
	// Sets maximum size to minimal one, otherwise springLayout will stretch this
	field.setMaximumSize(new Dimension(field.getMaximumSize().width, field.getMinimumSize().height));
	field.addKeyListener(stringListener);
	field.addFocusListener(stringListener);
	registeredStringListener.add(field);
	cont.add(label);
	cont.add(field);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:21,代码来源:DefaultsEditor.java

示例5: buildFields

import javax.swing.JTextField; //导入方法依赖的package包/类
/**
 * 
 */
private void buildFields() {
	Vector properties = component.getProperties().getAllProperties();
	GridLayout layout = new GridLayout(properties.size(),2,10,10);
	int cells = 0;
	
	Iterator i = properties.iterator();
	JPanel fieldsPane = new JPanel(layout);
	fieldsPane.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
	
	while (i.hasNext()) {
		try {
			InteractiveProperty property = (InteractiveProperty) i.next();
			
			final JTextField field = new JTextField(property.toString());
			field.addKeyListener(new KeyAdapter() {
				public void keyReleased(KeyEvent e) {
					if (e.getKeyCode() == KeyEvent.VK_ENTER) {
						applyChanges();
					}
					else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
						cancelChanges();
					}
				}
			});
			field.addFocusListener(new FocusAdapter() {
				
				public void focusGained(FocusEvent evt) {
					String text = field.getText();
					field.setSelectionStart(0);
					field.setSelectionEnd(text.length());
				}
			});
			field.setMaximumSize(new Dimension(150,30));
			fields.put(property,field);
			
			fieldsPane.add(new JLabel(property.getName()));
			fieldsPane.add(field);
			
			cells++;
		} catch (ClassCastException exc) {
			/* 
			 * caught to be ignored, so that non-interactive properties
			 * won't be shown in the GUI
			 */
		}
	}
	this.setSize(200,cells * CELL_HEIGHT);
	getContentPane().add(fieldsPane,BorderLayout.CENTER);
}
 
开发者ID:guilhebl,项目名称:routerapp,代码行数:53,代码来源:PropertyInteractionDialog.java

示例6: createPropertieINput

import javax.swing.JTextField; //导入方法依赖的package包/类
/** 
*	Create a property in PropertiesPanel
**/
protected void createPropertieINput(DefaultValueTypeProperty prop){
JTextField jtf = new JTextField(3);
// property default value
jtf.setText(prop.getValue());
jtf.setPreferredSize(new Dimension(200,20));	 	
jtf.setMaximumSize(new Dimension(200,20));	 	
// proprpety name
JLabel jl = new JLabel(prop.getName());
propertiesPanel.add(jl); 
propertiesPanel.add(jtf);
}
 
开发者ID:guilhebl,项目名称:routerapp,代码行数:15,代码来源:SpecialGraphWindow.java

示例7: initComponents

import javax.swing.JTextField; //导入方法依赖的package包/类
private void initComponents(BasicPiece p) {
  panel = new JPanel();
  panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
  picker = new ImagePicker();
  picker.setImageName(p.imageName);
  panel.add(picker);
  cloneKeyInput = new KeySpecifier(p.cloneKey);
  deleteKeyInput = new KeySpecifier(p.deleteKey);
  pieceName = new JTextField(12);
  pieceName.setText(p.commonName);
  pieceName.setMaximumSize(pieceName.getPreferredSize());
  Box col = Box.createVerticalBox();
  Box row = Box.createHorizontalBox();
  row.add(new JLabel("Name:  "));
  row.add(pieceName);
  col.add(row);
  if (p.cloneKey != 0) {
    row = Box.createHorizontalBox();
    row.add(new JLabel("To Clone:  "));
    row.add(cloneKeyInput);
    col.add(row);
  }
  if (p.deleteKey != 0) {
    row = Box.createHorizontalBox();
    row.add(new JLabel("To Delete:  "));
    row.add(deleteKeyInput);
    col.add(row);
  }
  panel.add(col);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:31,代码来源:BasicPiece.java

示例8: SimplePieceEditor

import javax.swing.JTextField; //导入方法依赖的package包/类
public SimplePieceEditor(GamePiece p) {
  String type = null;
  if (p instanceof Decorator) {
    type = ((Decorator) p).myGetType();
  }
  else {
    type = p.getType();
  }
  typeField = new JTextField(type);
  typeField.setMaximumSize(new java.awt.Dimension(typeField.getMaximumSize().width, typeField.getPreferredSize().height));

  String state = null;
  if (p instanceof Decorator) {
    state = ((Decorator) p).myGetState();
  }
  else {
    state = p.getState();
  }
  stateField = new JTextField(state);
  stateField.setMaximumSize(new java.awt.Dimension(stateField.getMaximumSize().width, stateField.getPreferredSize().height));

  panel = new JPanel();
  panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
  Box b = Box.createHorizontalBox();
  b.add(new JLabel("Type: "));
  b.add(typeField);
  panel.add(b);

  b = Box.createHorizontalBox();
  b.add(new JLabel("State: "));
  b.add(stateField);
  panel.add(b);

}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:35,代码来源:SimplePieceEditor.java

示例9: generateControl

import javax.swing.JTextField; //导入方法依赖的package包/类
@Override
public JComponent generateControl()
{
	field = new JTextField();
	field.setMaximumSize(new Dimension(Short.MAX_VALUE, 20));

	if( items.size() >= 1 )
	{
		field.setText(((Item) items.get(0)).getValue());
	}

	JButton browse = new JButton("Browse");
	browse.setIcon(new ImageIcon(getClass().getResource("/images/browse.gif")));
	browse.setHorizontalTextPosition(SwingConstants.RIGHT);
	Dimension browseSize = browse.getPreferredSize();
	browseSize.height = 20;
	browse.setMaximumSize(browseSize);
	browse.addActionListener(this);

	JPanel group = new JPanel();
	group.setLayout(new BoxLayout(group, BoxLayout.X_AXIS));
	group.add(field);
	group.add(Box.createRigidArea(new Dimension(5, 0)));
	group.add(browse);
	group.setAlignmentX(Component.LEFT_ALIGNMENT);

	return group;
}
 
开发者ID:equella,项目名称:Equella,代码行数:29,代码来源:GResourceSelector.java

示例10: generateControl

import javax.swing.JTextField; //导入方法依赖的package包/类
@Override
public JComponent generateControl()
{
	field = new JTextField();
	field.setMaximumSize(new Dimension(Short.MAX_VALUE, 20));

	if( items.size() >= 1 )
	{
		field.setText(((Item) items.get(0)).getValue());
	}

	return field;
}
 
开发者ID:equella,项目名称:Equella,代码行数:14,代码来源:GEditBox.java

示例11: createGUI

import javax.swing.JTextField; //导入方法依赖的package包/类
protected void createGUI()
{
	GridBagLayout gridbag = new GridBagLayout();
	GridBagConstraints c = new GridBagConstraints();

	setLayout(gridbag);
	setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));

	target = new JTextField();
	target.setEditable(false);
	target.setMinimumSize(new Dimension(150, 20));
	target.setPreferredSize(new Dimension(150, 20));
	target.setMaximumSize(new Dimension(150, 20));
	c.gridx = 0;
	c.weightx = 1;
	c.gridy = 0;
	c.fill = GridBagConstraints.HORIZONTAL;
	gridbag.setConstraints(target, c);
	add(target);

	search = new JButton("...");
	search.setFont(new Font("Sans Serif", Font.PLAIN, 8));
	search.addActionListener(this);
	search.setMinimumSize(new Dimension(18, 20));
	search.setPreferredSize(new Dimension(18, 20));
	search.setMaximumSize(new Dimension(18, 20));

	c.gridx = 1;
	c.weightx = 0;
	gridbag.setConstraints(search, c);
	add(search);
}
 
开发者ID:equella,项目名称:Equella,代码行数:33,代码来源:WhereTargetChooser.java

示例12: createGUI

import javax.swing.JTextField; //导入方法依赖的package包/类
private void createGUI()
{
	GridBagLayout gridbag = new GridBagLayout();
	GridBagConstraints c = new GridBagConstraints();

	setLayout(gridbag);
	setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));

	target = new JTextField();
	target.setEditable(false);
	target.setMinimumSize(new Dimension(150, 20));
	target.setPreferredSize(new Dimension(150, 20));
	target.setMaximumSize(new Dimension(150, 20));
	c.gridx = 0;
	c.weightx = 1;
	c.gridy = 0;
	c.fill = GridBagConstraints.HORIZONTAL;
	gridbag.setConstraints(target, c);
	add(target);

	JButton search = new JButton("..."); //$NON-NLS-1$
	search.setFont(new Font("Sans Serif", Font.PLAIN, 8)); //$NON-NLS-1$
	search.addActionListener(new SearchHandler());
	search.setMinimumSize(new Dimension(18, 20));
	search.setPreferredSize(new Dimension(18, 20));
	search.setMaximumSize(new Dimension(18, 20));
	c.gridx = 1;
	c.weightx = 0;
	gridbag.setConstraints(search, c);
	add(search);
}
 
开发者ID:equella,项目名称:Equella,代码行数:32,代码来源:ScriptTargetChooser.java

示例13: makeGUIControl

import javax.swing.JTextField; //导入方法依赖的package包/类
@Override
public JComponent makeGUIControl() {

	final JPanel pan = new JPanel();
	pan.setAlignmentX(Component.LEFT_ALIGNMENT);
	pan.setLayout(new BoxLayout(pan, BoxLayout.X_AXIS));

	final JLabel label = new JLabel(getName());
	label.setToolTipText(
		"<html>" + toString() + "<br>" + getDescription() + "<br>Enter value or use mouse wheel or arrow keys to change value.");
	pan.add(label);

	final JTextField tf = new JTextField();
	tf.setText(Integer.toString(get()));
	tf.setPreferredSize(prefDimensions);
	tf.setMaximumSize(maxDimensions);
	SPIConfigIntActions actionListeners = new SPIConfigIntActions(this);
	tf.addActionListener(actionListeners);
	tf.addFocusListener(actionListeners);
	tf.addKeyListener(actionListeners);
	tf.addMouseWheelListener(actionListeners);
	pan.add(tf);
	setControl(tf);
	addObserver(biasgen);	// This observer is responsible for sending data to hardware
	addObserver(this);		// This observer is responsible for GUI update. It calls the updateControl() method
	return pan;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:28,代码来源:SPIConfigInt.java

示例14: initToolbarWest

import javax.swing.JTextField; //导入方法依赖的package包/类
private void initToolbarWest(JToolBar toolbar, ActionListener outputListener, boolean nbOutputComponent) {

        if (!nbOutputComponent) {
            JButton[] btns = getEditButtons();
            for (JButton btn : btns) {
                if (btn != null) {
                    toolbar.add(btn);
                }
            }
        }

        toolbar.addSeparator(new Dimension(10, 10));

        //add refresh button
        URL url = getClass().getResource(IMG_PREFIX + "refresh.png"); // NOI18N
        refreshButton = new JButton(new ImageIcon(url));
        refreshButton.setToolTipText(NbBundle.getMessage(DataViewUI.class, "TOOLTIP_refresh"));
        refreshButton.addActionListener(outputListener);
        processButton(refreshButton);

        toolbar.add(refreshButton);

        //add limit row label
        limitRow = new JLabel(NbBundle.getMessage(DataViewUI.class, "LBL_max_rows"));
        limitRow.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 8));
        toolbar.add(limitRow);

        //add refresh text field
        refreshField = new JTextField(5);
        refreshField.setMinimumSize(refreshField.getPreferredSize());
        refreshField.setMaximumSize(refreshField.getPreferredSize());
        refreshField.addFocusListener(new FocusAdapter() {
            @Override
            public void focusGained(FocusEvent e) {
                refreshField.selectAll();
            }
        });
        refreshField.addActionListener(outputListener);
        toolbar.add(refreshField);
        toolbar.addSeparator(new Dimension(10, 10));

        JLabel fetchedRowsNameLabel = new JLabel(NbBundle.getMessage(DataViewUI.class, "LBL_fetched_rows"));
        fetchedRowsNameLabel.getAccessibleContext().setAccessibleName(NbBundle.getMessage(DataViewUI.class, "LBL_fetched_rows"));
        fetchedRowsNameLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
        toolbar.add(fetchedRowsNameLabel);
        fetchedRowsLabel = new JLabel();
        toolbar.add(fetchedRowsLabel);

        toolbar.addSeparator(new Dimension(10, 10));
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:51,代码来源:DataViewUI.java

示例15: Ed

import javax.swing.JTextField; //导入方法依赖的package包/类
public Ed(FreeRotator p) {
  nameConfig = new StringConfigurer(null, "Description:  ", p.name);
  cwKeyConfig = new NamedHotKeyConfigurer(null, "Command to rotate clockwise:  ", p.rotateCWKey);
  ccwKeyConfig = new NamedHotKeyConfigurer(null, "Command to rotate counterclockwise:  ", p.rotateCCWKey);
  // random rotate
  rndKeyConfig = new NamedHotKeyConfigurer(null, "Command to rotate randomly:  ", p.rotateRNDKey);
  // end random rotate
  anyConfig = new BooleanConfigurer(null, "Allow arbitrary rotations",
    Boolean.valueOf(p.validAngles.length == 1));
  anyKeyConfig = new NamedHotKeyConfigurer(null, "Command to rotate:  ", p.setAngleKey);
  facingsConfig = new IntConfigurer(null, "Number of allowed facings:  ", p.validAngles.length == 1 ? 6 : p.validAngles.length);

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

  panel.add(nameConfig.getControls());
  panel.add(facingsConfig.getControls());
  cwControls = Box.createHorizontalBox();
  cwControls.add(cwKeyConfig.getControls());
  cwControls.add(new JLabel(" Menu text:  "));
  cwCommand = new JTextField(12);
  cwCommand.setMaximumSize(cwCommand.getPreferredSize());
  cwCommand.setText(p.rotateCWText);
  cwControls.add(cwCommand);
  panel.add(cwControls);

  ccwControls = Box.createHorizontalBox();
  ccwControls.add(ccwKeyConfig.getControls());
  ccwControls.add(new JLabel(" Menu text:  "));
  ccwCommand = new JTextField(12);
  ccwCommand.setMaximumSize(ccwCommand.getPreferredSize());
  ccwCommand.setText(p.rotateCCWText);
  ccwControls.add(ccwCommand);
  panel.add(ccwControls);

  panel.add(anyConfig.getControls());
  anyControls = Box.createHorizontalBox();
  anyControls.add(anyKeyConfig.getControls());
  anyControls.add(new JLabel(" Menu text:  "));
  anyCommand = new JTextField(12);
  anyCommand.setMaximumSize(anyCommand.getPreferredSize());
  anyCommand.setText(p.setAngleText);
  anyControls.add(anyCommand);
  panel.add(anyControls);

  // random rotate
  rndControls = Box.createHorizontalBox();
  rndControls.add(rndKeyConfig.getControls());
  rndControls.add(new JLabel(" Menu text:  "));
  rndCommand = new JTextField(12);
  rndCommand.setMaximumSize(rndCommand.getPreferredSize());
  rndCommand.setText(p.rotateRNDText);
  rndControls.add(rndCommand);
  panel.add(rndControls);
  // end random rotate

  anyConfig.addPropertyChangeListener(this);
  propertyChange(null);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:60,代码来源:FreeRotator.java


注:本文中的javax.swing.JTextField.setMaximumSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。