當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。