I Don't want to use keyListeners anymore since it's there's too many unfixable bugs with it.

Problem#1: I am now trying to have a Label say "Enter a consonant" and beside it a textField that should be the size of one character.
I tried setColumns(1) but it won't work and my text has setMaximumSize(new Dimension(16,60) which fits 'm" because it's fatter than all the other characters.

But it still lets me show multiple characters but setColumns is only suppose to show 1 character at a time.

This is why i am beginning to hate Java. That even if i look up documentation, it won't work.

http://java.sun.com/javase/6/docs/api/javax/swing/JTextField.html

void setColumns(int columns)
Sets the number of columns in this TextField, and then invalidate the layout

Problem #2: I am now trying to get actionPerformed to get info from my textbox.
How do i get it to so that it knows which textbox it came from because now I have two since that awful keyListener don't work :@ for MOST people but it's fine on my machine.
For my consonant entered, i want it to know it came from the KeyEntered JTextfield and NOT the Solution JTextfield.

But i can't seem to find the proper command in java docs about how to access the name of the textfield it came from.http://java.sun.com/j2se/1.3/docs/api/java/awt/event/ActionEvent.html
http://java.sun.com/javase/6/docs/api/java/awt/event/ActionEvent.html

getActionCommand() will only get what is was typed inside the JTextfield and not it's source.

I'm sorry i don't know how to find anything on java sun docs.
I am frustrated. After this, i don't think i will want to program in Java again. Java has too many bugs. I am still bitter about that keyListener only was able to work on some computers including mine but not on a majority of a computer owners. Not only that i can't even control the event. It's utter useless if it won't work for a majority of people.

I still can't post on java sun forums. It's been a headache with their email address not being validated even though i clicked that link and it said "Thank you for validating your email address". It still won't let me post any forums because it still insists my email address isn't validated.
I've sent two feedbacks already. I joined that java sun forum the day before I joined daniweb and still not been able to post anything there. :@

Recommended Answers

All 7 Replies

The only bug I see is you accusing a programming language which has been around for decades, used by thousands, for your incompetence.

Just because you can't get it to work doesn't mean it has a bug, it means you don't know what you are doing.

It is OK not to know, it is not ok to say that "java" has a bug when no one else has complained just because you rushed into doing something without the proper experience

This simple example can be found anywhere:

JButton butt = new JButton();
JTextField field  =new JTextField();

public void actionPerformed(ActionEvent e) {
Object source = e.getSource();
  if (source==butt) {

  } else if (source==field) {

  }
}

That is how you know what was clicked

commented: Yup, you're a legitimate owner of a 'Featured' badge :) +21

The only bug I see is you accusing a programming language which has been around for decades, used by thousands, for your incompetence.

Just because you can't get it to work doesn't mean it has a bug, it means you don't know what you are doing.

It is OK not to know, it is not ok to say that "java" has a bug when no one else has complained just because you rushed into doing something without the proper experience

This simple example can be found anywhere:

JButton butt = new JButton();
JTextField field  =new JTextField();

public void actionPerformed(ActionEvent e) {
Object source = e.getSource();
  if (source==butt) {

  } else if (source==field) {

  }
}

That is how you know what was clicked

Please don't insult me. The above WAS NOT THE BUG i was talking about that i couldn't get trhough. It's merely a work around because people were complaining that they can't play my game.

Why didn't you answer my previous post then if you think you're so smart.

Also my Java applets won't run on machines with a Macintosh. So how do you fix that?

I AM A NEWBIE TO JAVA.

I should have the right to delete my own posts. I may not be an expert JAVA program but i should have the right to delete my own posts.

The only bug I see is you accusing a programming language which has been around for decades, used by thousands, for your incompetence.

Just because you can't get it to work doesn't mean it has a bug, it means you don't know what you are doing.

It is OK not to know, it is not ok to say that "java" has a bug when no one else has complained just because you rushed into doing something without the proper experience

This simple example can be found anywhere:

JButton butt = new JButton();
JTextField field  =new JTextField();

public void actionPerformed(ActionEvent e) {
Object source = e.getSource();
  if (source==butt) {

  } else if (source==field) {

  }
}

That is how you know what was clicked

Please don't insult me. The above WAS NOT THE BUG i was talking about that i couldn't get trhough. It's merely a work around because people were complaining that they can't play my game.

Why didn't you answer my previous post then if you think you're so smart.

javaAddict is not insulting you, just telling the truth. Your answer is not very polite.

Also my Java applets won't run on machines with a Macintosh. So how do you fix that?

I AM A NEWBIE TO JAVA.

It is obvious that you are a newbie to Java, you do not have to shout it so loud.
The only one who is going to "fix" anything in your code is you. On this forum you can ask for help but you can not tell people to "fix" things for you.

I should have the right to delete my own posts. I may not be an expert JAVA program but i should have the right to delete my own posts.

The right to delete a post has nothing to do whit your programming skills. You should send a message to one of the moderators and ask for help.

Why didn't you answer my previous post then if you think you're so smart.

What previous post? Not to mention that no one here is obligated to solve every single thread as if we have some sort of deadline. I don't know what post you are referring to, but if I didn't answer it, that was my choice. I don't have to do it.

Also you never posted your code describing where is your problem and what you are trying to accomplish. We would have seen what you have written and provided solution. You just said that java has a bug and is preventing you from writing your code, because it is java's fault

Sorry I forgot this in my previous post... :)

... I'm sorry i don't know how to find anything on java sun docs.
I am frustrated. ...:@

I can really understand that frustration.
It took me a long time to understand the API and sometimes I still do not get it right. But it is really good that you use it and tries because once you have got a hang of it the API is very useful.

Java tutorials are a good complement to the API and you will find them here:
http://java.sun.com/docs/books/tutorial/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.