Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting the dropped event problem

 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anyone tell me how can i get the string/value of a droppable JTextfield, I mean, i have a text field and some JLabels, i m dropping the JLabels into textfield, nd i want, whatever the label i dropped i want to get/store that string/value, in a variable, how can i do this??
i did somthing like this, bt it's nt working:

class TextHandler implements ActionListener {
public void actionPerformed(ActionEvent evt) {

String disp = evt.getActionCommand();

JOptionPane.showMessageDialog(null, disp);
System.out.println(disp);
}
}

 
Campbell Ritchie
Sheriff
Pie
Posts: 49734
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is wrong with this?
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:What is wrong with this?


No, Actually my question is, whichever the label i dropped into the text field, i want to get that text, nt the label text, how can i do this?
 
Campbell Ritchie
Sheriff
Pie
Posts: 49734
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure I understand the question, but I know precious little about drag-n-drop. Sorry.

Anybody else?
 
Punit Jain
Ranch Hand
Posts: 1012
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Not sure I understand the question, but I know precious little about drag-n-drop. Sorry.

Anybody else?



it's okay Ritchie....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic