Component addKeyListener - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Component addKeyListener method.

This code example shows how to use the following methods:addKeyListener, setSize, getPreferredSize
    
    
   public TextPropertyEditor()  { 
       super(); 
        
       textField = new JTextField(20);
        
       textField.setSize(textField.getPreferredSize());
 
       setSize(textField.getPreferredSize());       
       setActualSize(textField.getPreferredSize());
        
       add(textField);
        
       // allow the text editor to move as the user moves the edited target 
       //getTargetComponent().addFollower(this); 
        
       textField.addKeyListener(this);
       setFocusable(true); 
       setOpaque(true); 

7
CodeRank
This code example shows how to use the following methods:addKeyListener, setBackground, setEnabled, setToolTipText, setDisabledTextColor
 
    public FloatPropertyView(Item item, Packet in, XAppDbgConnection connection) throws IOException {
        super(item, in.getChannel(), connection);
 
        // Setup UI 
        mField = new JTextField();
        mField.setDisabledTextColor(Color.DARK_GRAY);
        add(mField, BorderLayout.CENTER);
        mField.addKeyListener(this);
        mField.setToolTipText(item.getDescription());
 
        if (item.isReadable()) {
            // Read initial value 
            mCachedValue = mOrigValue = in.readFloat();
            showValue(); 
        } 
 
        if (!item.isWritable()) {
            mField.setEnabled(false);
        } 

7
CodeRank
This code example shows how to use the following methods:addKeyListener, setBackground, setEnabled, setToolTipText, setDisabledTextColor
            add(btnHex, BorderLayout.EAST);
            btnHex.addActionListener(this);
            btnHex.setSelected(false);
        } 
 
        mField = new JTextField();
        mField.setDisabledTextColor(Color.DARK_GRAY);
        add(mField, BorderLayout.CENTER);
        mField.addKeyListener(this);
        mField.setToolTipText(item.getDescription());
 
        if (item.isReadable()) {
            // Read initial value 
            mCachedValue = mOrigValue = in.readInt();
            showValue(); 
        } 
 
        if (!item.isWritable()) {
            mField.setEnabled(false);
        } 

7
CodeRank
This code example shows how to use the following methods:addKeyListener, setBackground, setEnabled, setToolTipText, setDisabledTextColor
            mBtnSetNull = new JButton("Set NULL");
            add(mBtnSetNull, BorderLayout.EAST);
            mBtnSetNull.addActionListener(this);
        } 
 
        mField = new JTextField();
        mField.setDisabledTextColor(Color.DARK_GRAY);
        add(mField, BorderLayout.CENTER);
        mField.addKeyListener(this);
        mField.setToolTipText(item.getDescription());
 
        if (item.isReadable()) {
            // Read initial value 
            mCachedValue = mOrigValue = Util.readString(in);
            showValue(); 
        } 
 
        if (!item.isWritable()) {
            mField.setEnabled(false);
            mBtnNull.setEnabled(false);

7
CodeRank
This code example shows how to use the following methods:addKeyListener, setName
This code example shows how to use the following methods:addKeyListener, addActionListener, getSelectedItem, setSelectedIndex
		this.innerPanel.add(moduleTypeLabel);
		String[] translatedModuleTypes = {ServiceProvider.getInstance().getLocaleService().getTranslatedString("SubSystem"),
				ServiceProvider.getInstance().getLocaleService().getTranslatedString("Layer"),  
				ServiceProvider.getInstance().getLocaleService().getTranslatedString("Component"),  
				ServiceProvider.getInstance().getLocaleService().getTranslatedString("ExternalLibrary")}; 
		this.moduleTypeComboBox = new JComboBox<>(translatedModuleTypes);
		this.moduleTypeComboBox.setSelectedIndex(0);
		this.moduleTypeComboBox.addActionListener(this);
		this.moduleTypeComboBox.addKeyListener(this);
		this.innerPanel.add(this.moduleTypeComboBox);
	} 
	 
	protected void addButtons() { 
		this.cancelButton = new JButton();
		this.innerPanel.add(this.cancelButton);
		this.cancelButton.setText(ServiceProvider.getInstance().getLocaleService().getTranslatedString("Cancel"));
		this.cancelButton.addActionListener(this);
		 
		this.saveButton = new JButton();
		this.innerPanel.add(this.saveButton);

6
CodeRank
This code example shows how to use the following methods:addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, getGraphicsConfiguration
import com.google.inject.Inject; 
 
public class Java2dDesktopApplication { 
 
	Java2dWindow java2dWindow;
	 
	@Inject 
	KeyboardInput keyboardInput;
	 
	@Inject 
	MouseInput mouseInput;
	 
	@Inject 
	Java2dGame java2dGame;
 
	boolean exitOnClose;
 
	public void init(String title, Dimension dimension, boolean exitOnClose) {
		this.exitOnClose = exitOnClose;
		createWindow(title, dimension, java2dGame);

6
CodeRank
This code example shows how to use the following methods:addKeyListener, setLineWrap, setText
6
CodeRank
This code example shows how to use the following methods:addKeyListener, requestFocus, setText
    @Before 
    public void setUp() throws Exception {
        dialog = new DialogForTesting(getName());
        dialog.addTextField("textfield", "doesn't matter");
        textField = dialog.getTextField();
        textField.setText("text");
        dialog.show();
        textField.requestFocus();
        keyListener = new KeyListenerMock();
        textField.addKeyListener(keyListener);
    } 
 
    private String getName() {
        return getClass().getName();
    } 
 
    @After 
    public void tearDown() throws Exception {
        try { 
            dialog.dispose();
6
CodeRank
This code example shows how to use the following methods:addKeyListener, addActionListener, setText
5
CodeRank
addKeyListener Method Overview
Adds the specified key listener to receive key events from this component.
See Code Examples for other Java 8 Component Methods: