POLITECHNIKA RZESZOWSKA - Wydział Elektrotechniki i Informatyki
ort java.awt.*; import javax.swing.*; public class SwingDnDTest {
public static void main (Stringd args) {
JFrame framę ■ new SwingDnDFrame ();
framę.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true);
)
)
class SwingDnDFrame extends JFrame { public SwingDnDFrame() (
setTitle("SwingDnDTest”);
Container contentPane - getContentPane();
JColorChooser chooser - new JColorChooser(); chooser.setDragEnabled(true); contentPane.add(chooser, BorderLayout.CENTER); JTextField textField = new JTextField("Drag color here' textField.setDragEnabled(true); textField.setTransferHandler(
new TransferHandler("background")); contentPane.add(textField, BorderLayout.SCTJTH)» pack() »
JAKA Wykład 7 Copyright § 2012 Jan PROKOP