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


Java JTextField.selectAll方法代码示例

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


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

示例1: doFind

import javax.swing.JTextField; //导入方法依赖的package包/类
/** This method performs Edit->Find. */
private Runner doFind() {
	if (wrap)
		return wrapMe();
	JTextField x = OurUtil.textfield(lastFind, 30);
	x.selectAll();
	JCheckBox c = new JCheckBox("Case Sensitive?", lastFindCaseSensitive);
	c.setMnemonic('c');
	JCheckBox b = new JCheckBox("Search Backward?", !lastFindForward);
	b.setMnemonic('b');
	if (!OurDialog.getInput("Find", "Text:", x, " ", c, b))
		return null;
	if (x.getText().length() == 0)
		return null;
	lastFind = x.getText();
	lastFindCaseSensitive = c.getModel().isSelected();
	lastFindForward = !b.getModel().isSelected();
	doFindNext();
	return null;
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:21,代码来源:SimpleGUI.java

示例2: setValueFromGUI

import javax.swing.JTextField; //导入方法依赖的package包/类
private void setValueFromGUI(final JTextField tf) {
	final AbstractMultiBitRegisterCP embeddingCP = (AbstractMultiBitRegisterCP) tf.getParent();

	embeddingCP.startEdit();
	try {
		embeddingCP.reg.setPartialValue(componentID, Integer.parseInt(tf.getText()));
		embeddingCP.reg.setFileModified();
		tf.setBackground(Color.white);
	}
	catch (final Exception ex) {
		tf.selectAll();
		tf.setBackground(Color.red);
		log.warning(ex.toString());
	}
	finally {
		embeddingCP.endEdit();
	}
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:19,代码来源:AbstractMultiBitRegisterCP.java

示例3: incValueAndUpdateGUI

import javax.swing.JTextField; //导入方法依赖的package包/类
private void incValueAndUpdateGUI(int inc, final JTextField tf) {
	final AbstractMultiBitRegisterCP embeddingCP = (AbstractMultiBitRegisterCP) tf.getParent();

	embeddingCP.startEdit();
	try {
		embeddingCP.reg.setPartialValue(componentID, embeddingCP.reg.getPartialValue(componentID) + inc);
		embeddingCP.reg.setFileModified();
		tf.setBackground(Color.white);
	}
	catch (final Exception ex) {
		tf.selectAll();
		tf.setBackground(Color.red);
		log.warning(ex.toString());
	}
	finally {
		embeddingCP.endEdit();
	}
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:19,代码来源:AbstractMultiBitRegisterCP.java

示例4: startRename

import javax.swing.JTextField; //导入方法依赖的package包/类
private void startRename() {
	
	// init the text box
	final JTextField text = new JTextField();
	text.setText(m_reference.getNamableName());
	text.setPreferredSize(new Dimension(360, text.getPreferredSize().height));
	text.addKeyListener(new KeyAdapter() {
		@Override
		public void keyPressed(KeyEvent event) {
			switch (event.getKeyCode()) {
				case KeyEvent.VK_ENTER:
					finishRename(text, true);
				break;
				
				case KeyEvent.VK_ESCAPE:
					finishRename(text, false);
				break;
			}
		}
	});
	
	// find the label with the name and replace it with the text box
	JPanel panel = (JPanel)m_infoPanel.getComponent(0);
	panel.remove(panel.getComponentCount() - 1);
	panel.add(text);
	text.grabFocus();
	text.selectAll();
	
	redraw();
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:31,代码来源:Gui.java

示例5: doFind

import javax.swing.JTextField; //导入方法依赖的package包/类
/** This method performs Edit->Find. */
private Runner doFind() {
    if (wrap) return wrapMe();
    JTextField x = OurUtil.textfield(lastFind,30);
    x.selectAll();
    JCheckBox c = new JCheckBox("Case Sensitive?",lastFindCaseSensitive);
    c.setMnemonic('c');
    JCheckBox b = new JCheckBox("Search Backward?",!lastFindForward);
    b.setMnemonic('b');
    if (!OurDialog.getInput("Find", "Text:", x, " ", c, b)) return null;
    if (x.getText().length() == 0) return null;
    lastFind = x.getText();
    lastFindCaseSensitive = c.getModel().isSelected();
    lastFindForward = !b.getModel().isSelected();
    doFindNext();
    return null;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:18,代码来源:SimpleGUI.java

示例6: focusGained

import javax.swing.JTextField; //导入方法依赖的package包/类
public void focusGained(FocusEvent focusEvent) {
    if(selectOnFocusFields == null) return;
    for (JTextField txt : selectOnFocusFields) {
        if(focusEvent.getSource()==txt) {
            txt.selectAll();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:ConnectionType.java

示例7: getTableCellEditorComponent

import javax.swing.JTextField; //导入方法依赖的package包/类
/**
 * calls JTextField.selectAll() before returning it
 */
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
	JTextField c = (JTextField) super.getTableCellEditorComponent(table, value, isSelected, row, column);
	c.selectAll();
	return c;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:10,代码来源:ExactCellEditor.java

示例8: setValueAndUpdateGUI

import javax.swing.JTextField; //导入方法依赖的package包/类
private void setValueAndUpdateGUI(int val) {
	JTextField tf = (JTextField) intConfig.control;
	try {
		intConfig.set(val);
		intConfig.setFileModified();
		tf.setBackground(Color.white);
	}
	catch (final Exception ex) {
		tf.selectAll();
		tf.setBackground(Color.red);
		log.warning(ex.toString());
	}
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:14,代码来源:SPIConfigInt.java

示例9: openDataWindow

import javax.swing.JTextField; //导入方法依赖的package包/类
public void openDataWindow() {
	contentPane = new JPanel( new BorderLayout( 10, 10 ) );
	Border emptyBorder = BorderFactory.createEmptyBorder(10, 10, 10, 10);
	contentPane.setBorder( emptyBorder );
	searchPane = new JPanel( new BorderLayout( 5, 5 ) );
	top = new DefaultMutableTreeNode();
	okButton = new JButton("OK");
	okButton.addActionListener(this);
	searchBar = new JTextField(20);
	searchBar.setText(defaultSearchBarText);
	searchBar.selectAll();
	searchBar.addActionListener(this);
	createNodes(top);
	tree = new JTree(top);
	tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
	tree.addTreeSelectionListener(this);
	JScrollPane treeView = new JScrollPane(tree);
	contentPane.add(treeView, "Center");
	contentPane.add(okButton, "South");
	searchPane.add(searchLabel, "West");
	searchPane.add(searchBar, "Center");
	contentPane.add(searchPane, "North");
	contentPane.setOpaque(true);
	frame.setContentPane(contentPane);
	frame.pack();
	frame.setVisible(true);
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:28,代码来源:AccessAllData.java

示例10: focusGained

import javax.swing.JTextField; //导入方法依赖的package包/类
@Override
public void focusGained(FocusEvent e)
{
    JTextField tf = (JTextField)e.getComponent();
    tf.selectAll();
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:7,代码来源:DriverCarPanel.java

示例11: initGuiComponents

import javax.swing.JTextField; //导入方法依赖的package包/类
protected void initGuiComponents(){
  this.getContentPane().setLayout(new BoxLayout(this.getContentPane(),
                                                BoxLayout.Y_AXIS));

  //name field
  Box nameBox = Box.createHorizontalBox();
  nameBox.add(Box.createHorizontalStrut(5));
  nameBox.add(new JLabel("Name: "));
  nameBox.add(Box.createHorizontalStrut(5));
  nameField = new JTextField(30);
  nameField.setMaximumSize(
      new Dimension(Integer.MAX_VALUE, nameField.getPreferredSize().height));
  nameField.setRequestFocusEnabled(true);
  nameField.selectAll();
  nameField.setVerifyInputWhenFocusTarget(false);
  nameBox.add(nameField);
  nameField.setToolTipText("Enter a name for the resource");
  
  nameBox.add(Box.createHorizontalStrut(5));
  nameBox.add(Box.createHorizontalGlue());
  this.getContentPane().add(nameBox);
  this.getContentPane().add(Box.createVerticalStrut(5));

  //parameters table
  parametersEditor = new ResourceParametersEditor();
  tableScroll = new JScrollPane(parametersEditor);
  this.getContentPane().add(tableScroll);
  this.getContentPane().add(Box.createVerticalStrut(5));
  this.getContentPane().add(Box.createVerticalGlue());
  //buttons box
  JPanel buttonsBox = new JPanel();
  buttonsBox.setLayout(new BoxLayout(buttonsBox, BoxLayout.X_AXIS));
  buttonsBox.add(Box.createHorizontalStrut(10));
  buttonsBox.add(okBtn = new JButton("OK"));
  buttonsBox.add(Box.createHorizontalStrut(10));
  buttonsBox.add(cancelBtn = new JButton("Cancel"));
  buttonsBox.add(Box.createHorizontalStrut(10));
  buttonsBox.add(helpBtn = new JButton("Help"));
  buttonsBox.add(Box.createHorizontalStrut(10));
  this.getContentPane().add(buttonsBox);
  this.getContentPane().add(Box.createVerticalStrut(5));
  setSize(400, 300);

  getRootPane().setDefaultButton(okBtn);
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:46,代码来源:NewResourceDialog.java

示例12: AccessAllData

import javax.swing.JTextField; //导入方法依赖的package包/类
public AccessAllData( haxby.map.MapApp owner , boolean parseLayers) {
	this.parseLayers = parseLayers;

	mapApp = owner;

	switch (mapApp.getMapType()) {
	default:
	case MapApp.MERCATOR_MAP: layersXMLName = "layers.xml"; break;
	case MapApp.SOUTH_POLAR_MAP: layersXMLName = "layers_SP.xml"; break;
	case MapApp.NORTH_POLAR_MAP: layersXMLName = "layers_NP.xml"; break;
	}

	openTreePaths = new Vector();
	layerNameToURL = new Hashtable();
	globalNameToURL = new Hashtable();
	globalNameToType = new Hashtable();
	focusNameToURL = new Hashtable();
	focusNameToType = new Hashtable();
	focusNameToWFSLayer = new Hashtable();
	rootVector = new Vector();
	frame = new JFrame("Available Data");
	contentPane = new JPanel( new BorderLayout( 10, 10 ) );
	Border emptyBorder = BorderFactory.createEmptyBorder(10, 10, 10, 10);
	contentPane.setBorder( emptyBorder );
	searchPane = new JPanel( new BorderLayout( 5, 5 ) );
	top = new DefaultMutableTreeNode();
	okButton = new JButton("OK");
	okButton.addActionListener(this);
	searchBar = new JTextField(20);
	searchBar.setText(defaultSearchBarText);
	searchBar.selectAll();
	searchBar.addActionListener(this);
	createNodes(top);
	tree = new JTree(top);
	tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
	tree.addTreeSelectionListener(this);
	JScrollPane treeView = new JScrollPane(tree);
	contentPane.add(treeView, "Center");
	contentPane.add(okButton, "South");
	searchPane.add(searchLabel, "West");
	searchPane.add(searchBar, "Center");
	contentPane.add(searchPane, "North");
	contentPane.setOpaque(true);
	frame.setContentPane(contentPane);
	frame.pack();
	traverseTree(top, treeMenu);
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:48,代码来源:AccessAllData.java

示例13: focusGained

import javax.swing.JTextField; //导入方法依赖的package包/类
@Override
public void focusGained(FocusEvent e) {
	JTextField tf = (JTextField)e.getComponent();
	tf.selectAll();
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:6,代码来源:TimeEntry.java

示例14: tryDispatchingKeystrokes

import javax.swing.JTextField; //导入方法依赖的package包/类
private static boolean tryDispatchingKeystrokes(final JTextField j) throws Exception {
    requestFocus(j);
    j.selectAll();
    sleep();
    
    pressKey(j, KeyEvent.VK_SHIFT);
    
    typeString("HELLO", j);
    
    releaseKey(j, KeyEvent.VK_SHIFT);
    
    System.err.println("Text area text is now " + j.getText());
    
    return "HELLO".equals(j.getText());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:ExtTestCase.java


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