Matt De

Greenhorn
+ Follow
since Jul 29, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Matt De

saagar. I did get it working with the other example, but am just curious on your reply. Could you further explain or show an example? I do not complete understand what your saying, but I think I do. I am still new with events and stuff and Java as a whole so that probably explains my confusion and not anything that you said. Thanks
18 years ago
Second reply was a great help it working just as I wanted now thanks for the help. I had something similar too, but not working... I need to get better at working with the API to get what I need. Thanks a bunch!
18 years ago
Could someone explain to me how to make a Key Event Happen. I have done some button listeners for example.
usernameButton.addActionListener(new UsernameButtonListener());
Do I set up a key event the same way? If so what is the correct syntax when doing this?
I then have my actual even for the button listener as follows:
public class UsernameButtonListener implements ActionListener
{
public void actionPerformed(ActionEvent ev)
{
try
{
username.setEditable(false);
outgoing.setEditable(true);
}//close try
catch(Exception ex)
{
ex.printStackTrace();
}// close catch
outgoing.setText("");
outgoing.requestFocus();
}// close actionPerformed
}// close UsernameButtonListener

That all works properly. I want to make a key event listener so when I press enter I can send text somewhere. I have looked and saw some stuff on Key Event and like virtual keyboard enter for the enter key and so forth. Could someone just give me a quick example of code to create a key event and make it so that when I press a key I fire off an event. Thanks this is my first attempt at a Key Event and I am still trying to get used to the Java API so I can figure out what the heck I need to do on my own lol, but I am not completely there yet.
18 years ago
Thanks got it to work. I saw something on setCaretPosition but didn't understand it completely. Thanks
18 years ago
I am making a chat like client. I want it to auto scroll down to keep up with the text. Right now the text is added but the scroll bar doesn't move. I was looking at some scrollable stuff in the API, but I am still new to java and it is hard for me to find the right methods and stuff for what I want to do. I have programming experience, but am still a little confused on find what I need to accomplish certain tasks in java. Thanks for any help given. I have scrollbars in place already I just need any info on how to make the JTextField scroll along as new text extends past the bottom of my JTextField.
18 years ago