Questions tagged [custom-painting]
147 questions
4
votes
5 answers
When does a JPanel paint (or repaint) its child components?
I've got a JButton which is painted using a custom UI delegate (CustomButtonUI extends BasicButtonUI). The CustomButtonUI's paint() method draws the button with rounded "antialiased" corners, to make the apperance as "smooth" as possible.
Somehow…

sbrattla
- 5,274
- 3
- 39
- 63
4
votes
1 answer
Graphics2D line and shape drawing issues (rendered in wrong place)
I've drawn three arrows using Graphics2D.
three drawLines
draw(Shape)
fill(Shape)
Here's what it looks like enlarged:
I cannot understand two things:
Why is the filled one smaller and shifted?
Secondly, why do arrows 1. and 3. look different?…

PKua
- 463
- 3
- 15
3
votes
2 answers
How to remove "stretch marks" on custom button border?
When performing some custom painting on a button's Graphics2D object, I get the following results:
The leftmost button is untoggled and the other is toggled. As you can see, the toggled button has these white "stretch marks." Why are these there…

mre
- 43,520
- 33
- 120
- 170
3
votes
0 answers
flutter: Make layers of CustomPaint drawing complement each other instead of blending into each other
I'm painting two layers of graphs on one CustomPaint. The first will occlude over half of the second layer.
Problem
Currently I just paint the first data and then second data using two Paints, with their blendMode set.
This creates an overlay of two…

kakyo
- 10,460
- 14
- 76
- 140
3
votes
1 answer
Flutter draw widget to canvas at certain path position
I have this custom path in my page
class TestPathPainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
final paint = Paint()
..style = PaintingStyle.stroke
..strokeWidth = 2.0
..color =…

ibrahim
- 573
- 1
- 6
- 20
3
votes
0 answers
Using an eraser over image in Flutter
I'm making a kind-of painting app that has you paint over a background image. There's a couple of tools like pen and then there's eraser. Ideally, we would just paint over the background color, but it's an image. We had the idea of removing the…

Benjamin
- 5,783
- 4
- 25
- 49
3
votes
1 answer
Flutter how to paint custom gradients
I recently experienced a problem when I was trying to create following AppBar with gradient.
When I tried to replicate this design in flutter with the colors
rose = Color(0xFFec15ee),
purple = Color(0xFF8561f5) and
blue = Color(0xFF1eaefc) and…

Christian X
- 1,919
- 1
- 15
- 21
3
votes
1 answer
Can't draw line(method: paintComponent) - Java
I'm trying to draw a line in a JFrame, but line isn't drawn.
I tried to use the method setOpaque(true) for contentPane, lblNewLabel and l but nothing changed. I also tried call repaint(); outside this class but the situation is still the same.…

demic
- 65
- 3
3
votes
1 answer
How to position a CustomPaint in a Row widget?
I'm new with flutter.
I want to position a progressbar (made with custompainter) in a row but I do not know how to do it. I want all the elements of the row to be aligned, centered vertically and with the same space between them.
my code is…

sub
- 89
- 3
- 11
3
votes
1 answer
Snake game in Java Swing - My snake only grows
I'm trying to do the classic Snake game in Swing and I managed to make Snake move, but when it moves, it becomes infinitely long because it never erases its tail.
I have been using validate() and repaint() but nothing works.
Problem
This is my…

Óscar73
- 37
- 6
3
votes
2 answers
Painting custom background of parent and parent children in C#
I am trying to use this tutorial so that I can have a transparent button. It works fine for the main background, but it doesn't draw over the other children. If I use BringToFront() it then doesn't have the other child's drawing where it should…

David
- 4,744
- 5
- 33
- 64
3
votes
1 answer
How can I get the CellPainting event of my DataGridView to work with partially displayed cells?
I have a datagridview in C# winforms 4.0. I am doing some custom cell painting to the background color and for the borders. Here is my code from the CellPainting event:
//Background color
if (e.RowIndex / 3 % 2 == 0 && e.RowIndex > -1)
…

Brent
- 33
- 1
- 3
2
votes
1 answer
Flutter use Hero transition between Custom Painter
Want I want
Hello, I want to realize a function in my application which is based on brainstorming applications.
What I do
Here is my application
I have a wheel which is the first page, when I click on one of the "balls" it opens and shows me the…

xenos92
- 231
- 6
- 26
2
votes
1 answer
How setState and shouldRepaint are coupled in CustomPainter?
Minimal reproducible code:
void main() => runApp(MaterialApp(home: HomePage()));
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State {
final…

iDecode
- 22,623
- 19
- 99
- 186
2
votes
3 answers
How to create buttons in Flutter
How do you create these buttons this way? Needed for my academic work. Please help me.

ChaNuka
- 59
- 1
- 1
- 4