Most voted "java2d" questions
9 questions
Sort by count of
-
7
votes1
answer612
viewsHow to draw an arrow using Java2d?
I’m trying to draw an arrow inside a circle (similar to a clock pointer), but I’m not able to align the arrowhead with the rest of the line. I made the "arrow" based in this reply by Soen, but I’m…
-
6
votes1
answer204
viewsHow to make the arrow rotate several times until it stops by itself after clicking the button?
In the question "How to rotate an arrow inside a circle using Java2d?", i managed to learn how to make the arrow rotate within the circle. Only I need to make the arrow rotate like a casino…
-
4
votes2
answers622
viewsHow to rotate an arrow inside a circle using Java2d?
Previously, I asked "How to draw an arrow using Java2d?" and now with the arrow drawn correctly and positioned within my circle, I would like to make the arrow rotate within the circle so that the…
-
2
votes1
answer220
viewsHow to change Graphics2d objects off paintComponent
I wonder how to change the color of a drawRectangle() of Graphics2d java, out of the way @Override paintComponent(). It turns out that this change should be temporary, only when the mouse pointer…
-
2
votes1
answer305
viewsQuestions about the Graphics and Graphics2d classes in Java
I am having many doubts regarding the graphic libraries of Java, which are the following: What is the difference between overwriting the method paint(Graphics) or the method…
-
2
votes1
answer32
viewsDoubt regarding the Dysplasia() and Repaint() methods
What is the function of the methods .dispose() and repaint() using Graphics in Java?
-
1
votes1
answer899
viewsHow to draw lines following the mouse movement?
I need a JPanel, that draws lines following the mouse pointer while it is dragged, and when released it needs to stop drawing. It turns out that whenever two or more lines are drawn in a row, they…
-
1
votes1
answer150
viewsDetect overlay of figures after dragging with the mouse
I drew four figures with Graphics 2D (two large and two medium triangles), being two fixed (1 medium triangle and 1 large triangle) and 2 for movement (1 medium triangle and 1 large triangle). When…
-
0
votes2
answers465
viewsHow to prevent the object to exceed the limits of the screen?
I started programming a little game where an object moves across the screen via the arrow keys on the keyboard. The difficulty I found is the fact that the object surpasses the JFrame, that is,…