1

I am dragging and dropping the jTable cell from one jTable to another jTable.For Now it is showing me default drag drop icon.

I am using TransferHandler class to implement this.

I Override getDragImage(image) to put my customize image But it is not working.

This way i implemented my code Implementation

I tried this code into this method.

 File newFile = new File("./dragImage.jpeg");
             Font font = new Font("Tahoma", Font.PLAIN, 11);
             FontRenderContext frc = new FontRenderContext(null, true, true);
             Rectangle2D bounds = font.getStringBounds(l_value, frc);
             int w = (int) bounds.getWidth();
             int h = (int) bounds.getHeight();

             BufferedImage image = new BufferedImage(10,10,   BufferedImage.TYPE_INT_RGB);
             Graphics2D g = image.createGraphics();
             g.setColor(Color.WHITE);
             g.fillRect(0, 0, 10, 10);
             g.setColor(Color.BLACK);
             g.setFont(font);
             g.drawString(l_value, (float) bounds.getX(), (float) -bounds.getY());
             g.dispose();

            return image;  

This code is working in my main method but here in this function it is not working.

4

0 回答 0