4

Enter key does not work after encoding with java

 3 years ago
source link: https://www.codesd.com/item/enter-key-does-not-work-after-encoding-with-java.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Enter key does not work after encoding with java

advertisements

i get a trouble when i write this code for a jButton to open new jfame and all that is by using the "Enter key" but it didn't work ,this the code i have writen :

 if(evt.getKeyCode()==KeyEvent.VK_ENTER){
         Chooser ch = new Chooser();
           ch.setVisible(true);

    }

So! why? Please help me and thanks.


Buttons don't need a KeyListener (and for the most part shouldn't use them), they use an ActionListener to respond to all activation events, including the action key (which isn't always the Enter), mouse clicks, keyboard shortcuts and programmatically triggered events, it's a much more simplified API.

See How to Use Buttons, Check Boxes, and Radio Buttons, How to Write an Action Listeners and How to Use Actions for more details

You can also set a button as the "default" button which can be activated when not focused (so long as the currently focused component doesn't use/consume the Enter key)

See JRootPane#setDefaultButton and How to Use Root Panes for more details

Related Articles

pressing the ENTER key does not work for TextField in the applet

I have a JTextField in a JApplet with a ActionListener. I compiled it using Eclipse and it works fine. But when I try to load it in a .html file using applet, the JTextField does not register/recognize the ENTER key when I press it. It seems like the

HTML Form - Triggering the form using the Enter key does not work when the focus is on a selected list

I'm stuck on the above problem. I have a simple form as follows, with a text input, a select list and a submit button. When focus is on the text input and I hit Enter, the form submits. If focus is on the select list the submit does not fire. I want

The ENTER key does not work correctly

while i am pressing enter key its calls function which automatically refreshing the page. the function i wrote for cancel button <form name="myForm"> <div > <input type="text" placeholder="First Name" required

adapt.notifyDataSetChanged does not work after searching with the search view

I have a search view that filter recycler view items; it properly filter items but when I close search view my adapter notifyDataSetChanged wont work for example if I add new item to recycler view until I close the app and open it again. This is my c

Datatable filtering Primefaces on the Enter key does not work

I added a global filter to the primefaces datatable. When I hit enter, the filter text is not being sent to the server for query. My code is as follows : <h:form id="searchResultsForm"> <p:dataTable value="#{searchController.result

Java 7 features does not work on Ubuntu with java version & ldquo; 1.7.0_51 & quot;

According to java -version this is what my Ubuntu Java environment is like: java version "1.7.0_51" OpenJDK Runtime Environment (IcedTea 2.4.4) (7u51-2.4.4-0ubuntu0.12.04.2) OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode) My javac -versio

jquery .html load html to div form key does not work

I am loading a dynamic html form with javascript into a div using jquery().html(), which inserts, and displays the form perfectly. The javascript executes as well. The problem I am having is that on the form, the tab key does not work. There are tabi

datepicker on an ASP text box does not work after a return event

$(document).ready( function () { $("#txtDate").datepicker({ dateFormat: 'dd MM yy' }).val(); }); <asp:TextBox ID="txtDate" TabIndex="8" CssClass="txtalign" BackColor="White" ClientIDMode="Static&qu

Google Maps V2 does not work in production with the correct key

I'm having major troubles getting Google Maps working in production within an Android app. This is what I am currently getting (the bottom is just ads). Key Steps I have followed: 1) I have ensured I have got the correct SHA1 Production Key and have

Jquery textarea append does not work after the text box has been reset with val (& ldquo; & rdquo ;;)

I am able to successfully append to a textarea element like the following: jQuery("#edit-submitted-document-requests_mine").append("ITEM_0: selected \n\r"); but then I empty out the textarea with the following: jQuery("#edit-submi

On click does not work after inserting dynamic HTML with jquery

This question already has an answer here: adding jQuery click events to dynamically added content 4 answers I am trying to achieve code reusability by whenever a div is clicked, it gives out the div's numberDiv attribute. It works on the first defaul

Delete key does not work

I added setOnKeyListener for Enter keyevent. However, after I adding setOnKeyListener , delete (backspace) key is not working. When I removed the setOnKeyListener , delete key is working fine. How to fix the delete key working well ? final EditText e

Self-signed SSL does not work after upgrading from iojs to nodejs v4.4.4

I was using iojs and koa in my application and recently I decided to update iojs to nodejs v4.4.4. The update was very smooth and my application was running in no time. The problem is that I am using a self signed SSL certificate on my development ma

The Asp button does not work after clicking the RadGrid Export to Excel button

There is a RadGrid with Export to Excel button in it. And there is a asp Button along with 2 DropDowns outside of RadGrid, in one of the web page in my Web Application. 2 DropDowns are used to filter the records of RadGrid on click of asp Button. HTM

Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK