Hello everyone, i written a java AWT program to drag and drop something my code is:
import java.awt.*; import java.awt.event.*; import javax.swing.*; public class scjp{ JTextField txtField; JLabel lbl; public static void main(String[] args) { scjp sdd = new scjp(); } public scjp(){ JFrame frame = new JFrame("SCJP"); txtField = new JTextField(20); JRadioButton lbl=new JRadioButton("Hello"); lbl.setTransferHandler(new TransferHandler("text")); JRadioButton lbl1=new JRadioButton("Hello1"); lbl.setTransferHandler(new TransferHandler("text")); MouseListener ml = new MouseAdapter(){ public void mousePressed(MouseEvent e){ JComponent jc = (JComponent)e.getSource(); TransferHandler th = jc.getTransferHandler(); th.exportAsDrag(jc, e, TransferHandler.COPY); } }; lbl.addMouseListener(ml); JPanel panel = new JPanel(); panel.add(txtField); frame.add(lbl, BorderLayout.CENTER); frame.add(panel, BorderLayout.NORTH); frame.setSize(400, 400); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); } } Here i create a radio button and a textbox, and i m dragging the radio into the textbox successfully, bt nw i required, when i drag/pick the radio, the radio button label should also appear with my mouse pointer until and unless i drop that radio into textbox... please help me in this asap.... .. -- Punit -- To post to this group, send email to javaprogrammingwithpassion@googlegroups.com To unsubscribe from this group, send email to javaprogrammingwithpassion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en