Questions tagged as 'java2d'

1
answer

How to draw an arrow using Java2D?

I'm trying to draw an arrow inside a circle (similar to a clock hand), but I can not align the tip of the arrow with the rest of the line. I made the this "arrow" based on this SOEn response, but I can not get it to be properly positioned wi...
asked by 09.10.2017 / 16:30
1
answer

How to make the arrow turn several times until it stops by itself after clicking the button?

In the question " How do I rotate an arrow within a circle using Java2D? , I was able to learn how to do the arrow rotates within the circle. But I need to make the arrow spin like a casino roulette, until I stop by myself. I thought about us...
asked by 11.10.2017 / 03:28
2
answers

How do I rotate an arrow within 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 have the arrow turn inside the circle so that the center of the circle is the fixed reference point...
asked by 10.10.2017 / 13:39
1
answer

Doubt regarding the dispose () and repaint () methods

What is the function of .dispose() and repaint() methods in using Graphics in Java?     
asked by 12.03.2018 / 03:34
1
answer

Doubts about the Graphics and Graphics2D classes in Java

I'm having a lot of questions about Java graphical libraries, which are as follows: What is the difference between overwriting the paint(Graphics) method or the paintComponent(Graphics) method? What is the Graphics2D...
asked by 12.03.2018 / 02:15
1
answer

How to change Graphics2d objects out paintComponent

I would like to know how to change the color of a drawRectangle() of Graphics2d of java, outside the @Override paintComponent() method. It turns out that this change should be temporary, only when the mouse pointer passes...
asked by 01.03.2017 / 15:56
1
answer

How to draw lines following the mouse movement?

I need a JPanel , which draws lines following the mouse pointer while it is dragged, and when released it needs to stop drawing. It turns out that whenever you draw two or more rows in a row, they connect to the previous rows, this shou...
asked by 13.03.2017 / 15:55
1
answer

Detect overlapping figures after dragging with the mouse

I drew four pictures with Graphics 2D (two large triangles and two medium triangles), two fixed (1 medium triangle and 1 large triangle) and 2 for movement (1 medium triangle and 1 large triangle). When you move the picture, you need to detec...
asked by 16.04.2018 / 17:24
2
answers

How do I prevent the object from exceeding the screen boundaries?

I started programming a little game where an object moves across the screen through the arrow keys. The difficulty I encountered is that the object exceeds JFrame , that is, there is nothing to block the passage at the limit of JFrame...
asked by 06.05.2018 / 17:28