Drag « Drag Drop « Java Swing Q&A





1. Dragging handle in Java Swing    stackoverflow.com

I can't seem to figure out how to make a resize drag handle in Java Swing. If you're not sure what I mean, open up the "Ask Question" page on this ...

2. Draggable component at runtime    stackoverflow.com

i would like to know if it is possible at runtime to list all panel from the application and make them draggable ? The reason is that i would like ...

3. why cannot drag edge to resize form? snaps back. NB 6.5 GUI Designer    forums.netbeans.org

Pavel, Thank you for replying. I found a workaround last night. By chance, I put the loose components into a JPanel. I found that this allowed me to drag the edge ...

4. why cannot drag edge to resize form? snaps back. NB 6.5 GUI Designer    forums.netbeans.org

I've noticed similiar behavior. I found that, for me, if I resize the component (JPanel) from the left side (instead of from the right side) then I am able to resize ...

5. not able to run my drag and droppable application on HPUX    coderanch.com

Hi I developed an application on NT system using JFC and using jdk2 for my development . But my application gives drag and drop exception most of the time but it runs fine on NT system . It usually thow exception DND exception :sytem not in valid state. can anyone help me in this matter thanks in advance

6. Urgent - Draggable Components??    coderanch.com

7. Dragging a Polygon shape and I have a corner anchor    coderanch.com

I'm using the following code in my paintComponent public synchronized void paintComponent(Graphics g) { super.paintComponent(g); if(dragPolicy == MOUSEDRAG_SCALE && draging) { g.setColor(Color.green); g.drawRect(Math.min(oldMousePosition.x, dragPosition.x), Math.min(oldMousePosition.y, dragPosition.y), Math.abs(oldMousePosition.x - dragPosition.x), Math.abs(oldMousePosition.y - dragPosition.y)); } if(manualroi) { Graphics2D g2d = (Graphics2D)g; g2d.setColor(Color.green); g2d.setStroke(new BasicStroke(2)); if(draging) { GeneralPath polygon = new GeneralPath(GeneralPath.WIND_EVEN_ODD, currentROI.xpoints.length); polygon.moveTo(currentROI.xpoints[0], currentROI.ypoints[0]); for(int i = 1; i < currentROI.xpoints.length; i++) { ...

8. Dragging all sorts of JComponents?    coderanch.com

9. drag rect    coderanch.com





10. How to get the drag content    coderanch.com

11. How can I drag a JComponent?    coderanch.com

There are a number of ways to do this. Working with the Drag and Drop trail in the java tutorial is one way. You could add your mouse listeners directly to the JToolBar components and to the target drop panel(s). You could use a glass pane or an OverlayLayout with a nonopaque top panel for your mouse listeners. This example app ...

12. adding drag functionality    coderanch.com

13. Draggable "stuff", snaped on a table    coderanch.com

Hi folks, I have an idea that trots into my mind since a bit. I would like to create a nice GUI, just for fun, that would allow the user to take and drag a kind of square icon (lets say 64x64) and to drop it on a table, which could embed 4 of these icons in X and Y. The ...

14. scaling a font when resizing by dragging    coderanch.com

import java.awt.*; import java.awt.font.*; import java.awt.geom.AffineTransform; import javax.swing.*; public class FittingAFont extends JPanel { String s = "Hello World"; protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); Font font = g2.getFont().deriveFont(36f); g2.setFont(font); FontRenderContext frc = g2.getFontRenderContext(); LineMetrics metrics = font.getLineMetrics(s, frc); // Try omitting the descent from the height variable. float height = metrics.getAscent() + ...

15. Paint Drag Preview    coderanch.com

Hi there, Here's a challenging little problem I need to solve. Below is a test project whose sole purpose is to demonstrate, what I call, a "paintDragPreview". What I mean by this is show the drawn outline of a component as it is being dragged to another position on a JPanel. For purposes of simplicity and education, I'm not actually going ...





17. Parallel dragging    coderanch.com

Hello coders, I'm experimenting with mouseListeners and I have an interesting problem (I think). I've searched the forum for similar posts but found none. Sorry if I missed any. In my program I'm trying to move parts of shapes by dragging one of its points. I've already implemented the mousePressed() and mouseDragged() methods, and I can move single points. But I ...

18. how can i drag the picture to my GUi interface?    forums.oracle.com

Don't use code-generation software especially at your stage. If you are just learning Java, code-generation will set you back in your Java education by months or even years. Once you learn how to use Swing, then it's OK to use it as you'll know how to modify things, but not until then. For now I recommend that you go to the ...