Questions tagged [custom-painting]

147 questions
1
vote
0 answers

How would you create a ring of cells in flutter?

I would like to create a widget (I know it must be a CustomPainter) to draw something like this: Notice that there are n concentric cell circles. The main problem is that I need to access/paint each of this cells when needed to repaint it in…
Notbad
  • 5,936
  • 12
  • 54
  • 100
1
vote
1 answer

Flutter Callback Getting Called for Every Frame

I'm learning about custom painting, and I understand that I can tell flutter when to repaint a canvas. But if I'm developing a game, I think things would go smoother if I were called every frame so I could update any state on the gameboard and then…
shawnlg
  • 351
  • 4
  • 12
1
vote
0 answers

animation using drawRRect in flutter

Flutter- Animation using rounded rectangle method in custom painter I am trying to create an animation in custom painter while drawing rectangle using rounded rectangle method I don't know to animate
Dharani
  • 179
  • 1
  • 8
1
vote
1 answer

How to add image and text in motion in java jFrame?

I have similar a marquee to the tags html5, text moving horizontally from right to left, works perfectly without errors. public class texscroll extends JPanel { private int x = 510, y = 25; private String string = "Text in moving similary to…
user10354407
1
vote
1 answer

How can I pass an argument to paintComponent in order to call it in a different class?

In my main class I have the following code to load an image from my machine and display it on the frame to draw things on it: public class ShowMap extends JPanel { private static final int WIDTH = 1340; private static final int HEIGHT =…
1
vote
0 answers

C#: Custom paint scroll on scrollable panel

Could someone provide an example about how to custom paint the scrollbar in a scrollable panel? Thanks in advance.
Daniel Peñalba
  • 30,507
  • 32
  • 137
  • 219
1
vote
1 answer

How to draw the radius of a circle without it being shorter or larger than the circumference

I am working on a program in which I want to draw a line from circle's center to its parametric point. But it draws line out of circumference and inside circumference. I want to draw line exactly on circumference according to X and Y angles. …
1
vote
1 answer

Draw lines for every mouse click and stop drawing when double clicked

I have to draw line as the mouse moves, after the mouse click, the line should be continued to draw until double clicked. Say point A, point B and point C. when mouse clicked at point A, the drawing of line should be started. when mouse is clicked…
User
  • 1,186
  • 4
  • 22
  • 36
1
vote
0 answers

Java, mouse drags AffineTransform

I'm working on Java Swing. I need an application which lets the user scale a drawing. The drawing is done inside a custom JPanel's paintComponent method. A drawing is, lets say, a drawRect method call. There are two ways (let me call them "modes"),…
gthanop
  • 3,035
  • 2
  • 10
  • 27
1
vote
1 answer

how to draw and erase on touch in android

I have got no answer for this question on the internet , I'm trying to paint with different colors which the user can choose from , the problem is this drawview is not drawing anything and i don't know how o ad an on touch eraser to erase only the…
rgl
  • 45
  • 8
1
vote
1 answer

Drawing shapes on a JForm java

I have created this code that is supposed to draw certain things when I selected a radio button on a JForm, I have used NetBeans to create the GUI. When I select a radio button nothing happens. I have been trying to figure out what's wrong for a…
hDDen
  • 145
  • 1
  • 2
  • 13
1
vote
2 answers

Repaint teleports my graphic instead of smoothly moving it

So in my code I repaint my graphic in the desired direction when I press one of the W,A,S,or D keys. Instead of the graphic smoothly moving from left to right or up and down, it just goes invisible and sometimes becomes visible again, but it will…
Yout897
  • 33
  • 2
1
vote
1 answer

android painting pencil effect

I wrote code which can painting in onTouch,this is a my code: class DrawingPanel extends View implements View.OnTouchListener { private static final String TAG = "DrawView"; private static final float MINP = 0.25f; private static final float…
1
vote
2 answers

Switch between drawing a rectangle and by freehand

I have some issues with my paint program in Java. I have a JComboBox where I can choose to draw either a rectangle or by freehand. The objects are added to an ArrayList. I want to be able to switch between drawing a rectangle and by free hand, and…
user2939293
  • 793
  • 5
  • 16
  • 41
1
vote
1 answer

won't repaint a different Month after pressing button in my calendar

I'm trying to build a Calendar in Java as a little project I thought of, But I can't seem to change the name of the Month every time I click the Next button. here's my code! package drawing; import javax.swing.*; import java.awt.*; import…