java gui
friends... good day..
i have doubt in java gui.
? i created 1 java gui application. That has two text fields jtext1,jtext2.
case: user entered value in first textfield(jtext1) and pressed the enter key . the cursor must go to the next text field(jtext2). How can i arrange this. which code can i use from the action listener of jtext1 to happen like this.
View Answers
August 3, 2011 at 11:13 AM
import java.awt.*;
import javax.swing.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
class JavaGUI{
public static void main(String[] args){
JFrame f=new JFrame();
JTextField text1=new JTextField(20);
final JTextField text2=new JTextField(20);
text1.addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent e) {
if( e.getKeyCode() == KeyEvent.VK_ENTER ){
text2.requestFocus();
}
}
});
JPanel p=new JPanel(new GridLayout(2,1));
p.add(text1);
p.add(text2);
f.add(p);
f.setVisible(true);
f.pack();
}
}
August 3, 2011 at 1:30 PM
ya...very vry thanx dude....
its very helpful 2 me....
August 3, 2011 at 1:40 PM
KeyEvent.VK_ENTER is for getting enterkey.
then how can get other keys...?
Ads
Related Tutorials/Questions & Answers:
java gui
java gui friends... good day..
i have doubt in
java gui.
? i created 1
java gui application. That has two text fields jtext1,jtext2.
case: user entered value in first textfield(jtext1) and pressed the enter key . the cursor
Java GUI
Java GUI 1) Using
Java GUI, create a rectangular box that changes color each time a user click a change color button.
2) Modify Question 1 to include a new button named insert image, that allow user to insert a bitmap image
Advertisements
GUI
GUI How to
GUI in Net-beans ... ??
Please visit the following link:
http://www.roseindia.net/
java/
java-tips/background/30java_tools/netbeans.shtml
java gui-with jscroll pane
java gui-with jscroll pane Dear friends..
I have a doubt in my
gui application.
I developed 1 application. In this application is 1 Jscrollpane of height 600 and width 400. Normally it is showing 200 height and 400 width
java gui-with jscroll pane
java gui-with jscroll pane Dear friends..
I have a doubt in my
gui application.
I developed 1 application. In this application is 1 Jscrollpane of height 600 and width 400. Normally it is showing 200 height and 400 width
Java GUI - Applet
Java GUI HELLO,
i am working on
java chat server, i add JFrame and make
GUI structure by draging buttons and labels, now i want to insert... but not resolve my prob.
dear friend, i add JFrame Form in
java package and put
Chat in Java wih GUI
Chat in
Java wih GUI Welcome all >> << how is everybody >< i wanna Chat program in
java server & client
thanks
Java scroll pane-java GUI
Java scroll pane-
java GUI Dear friends.. Very Good morning.
I have a doubt in my
gui application.
Take ex:- My
gui application has 1 Jscrollpane of height 600 and width 400. normally it is showing 200 height and 400 width
GUI
GUI Write a
GUI application for the WebBuy Company that allows a user to compose the three parts of a complete email message: the â??To:â??, â??Subject:â?? and â??Message:â?? text. The â??To:â??, and â??Subject:â?? Text areas
Java GUI code- creating a circle
Java GUI code- creating a circle My assignment is to write a program...;
//
GUI components
JLabel lClx, lCly, lCircumrx, lCircumry, lRadius...
//constructor
public CircleGUI() {
//create
GUI
lClx
How to convert this Java code into GUI?
How to convert this
Java code into
GUI? import java.util.Scanner;
public class StudentMarks {
double totalMarks;
String grade;
public void setTotalMarks(double totalMarks) {
this.totalMarks = totalMarks
Accessing Ms access data in JAVA GUI Envi.
Accessing Ms access data in
JAVA GUI Envi. Q.How to insert data into ms access data in
java using swing ?
Q.How to slove (access denided ("java.lang.RuntimePermission" "accessClassInPackage.sun.jdbc.odbc")" these exception
Catching Exceptions in GUI Code - Java Tutorials
.style1 {
text-align: center;
}
Catching uncaught exception in
GUI
In this section, we will discuss how to catch uncaught exceptions in
GUI.
Lets see... javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
public class
Gui
Java GUI to build a Student Registration Program
Java GUI to build a Student Registration Program Write a program to register students for a college. Students have names, addresses and courses. Implement the
interface class RegisterStudent. RegisterStudent has one method
Login Form with Java GUI using Netbeans
Login Form with
Java GUI using Netbeans Hi there!
I'm a beginner in
Java. I've created 2 class files:
1) TestAssign.java
2) NewFrame.java
How can I have different user to login? Now that I've only administrator who is able
Magic Matrix in GUI
Magic Matrix in GUI I want program in
java GUI contain magic matrix for numbers