Questions tagged [custom-painting]
147 questions
0
votes
0 answers
Custom tSpeedButton painting
I have two TSpeedButton buttons on a form. When one button is enabled, the other is disabled and vice versa. I want to paint the buttons with custom colors to reflect whether they are enabled or disabled.
I coded a procedure named SetButtonsColors.…

user2383818
- 709
- 1
- 8
- 19
0
votes
1 answer
Colouring all the borders with ControlPaint.DrawBorder
I'm trying to do a bit of painting on my Winform controls through the Paint event because why not. I've got this hooked up, because StackOverlfow told me it would work:
private void PaintLines(object sender, PaintEventArgs e)
{
…

AmiralPatate
- 125
- 1
- 7
0
votes
0 answers
Win32 C++ Custom painting subclassed radiobutton initial background issue
I am trying to draw a radiobutton with a transparent background using a subclassed radiobutton & WM_PAINT. I know how to do this using the TransparentBlt function & an off-screen (back)buffer.
My problem is that intially the radiobutton by default…

Joey Muiser
- 55
- 8
0
votes
1 answer
Swing custom painting animation stops after reaching half width of frame
I was trying to answer a question related to moving a ball across the screen while changing its color over time, however I came through a weird bug, (most probably in my code) and while asking this question I came to a related question but that…

Frakcool
- 10,915
- 9
- 50
- 89
0
votes
1 answer
drawingPanel color change with displacement
I'm using JGrasp, and in drawingPanel, I'm trying to create a ball that changes colors as it moves across the screen. Right now, I've got:
for (int i = 10; i<=i; i++) {
Color c = new Color(i*i, 0, 0);
pen.setColor(c);
My full simplified…

Molly Taylor
- 71
- 9
0
votes
1 answer
How can I add more than one paintComponent() to a frame?
So this is my main class:
package testgame;
import java.awt.EventQueue;
import javax.swing.JFrame;
public class Game extends JFrame {
public static JFrame frame = new JFrame("Just a test!");
public static void LoadUI() {
…
0
votes
0 answers
Trying to draw lines in my form created dynamically, the lines a regather drawn on the main form.. what should I do?
I am Using Netbeans .. I am trying to create an invoice application.So i created and invoice jframe form on the first .. This form accepts all the invoice details in a tabular manner and i have overridden the paint method to draw some lines in the…
0
votes
1 answer
Draw on one side of a JPanel
I want to program an application that lets you draw circles with a mouse click on the left side of a JFrame, and all the points are getting "mirrored" to the right side. The first problem I encountered was that when I try to implement this…

MassU
- 51
- 1
- 2
- 5
0
votes
0 answers
JPanel components won't display
I try to add some components to an JPanel. paintComponent() is called, but the components won't display. revalidate() didn't work.
The structure looks like the following:
public class AbstractView extends JPanel implements ViewInterface {
}
public…

jesper
- 1
- 3
0
votes
3 answers
Custom painting code does not update correctly and I try to honor the clip area. Run it and see
This is runnable java code. If you want to test it, copy the two code excerpts below. compile and run Triangleframe.java
I am drawing two triangles(may be I add more later) on a JPanel. I click on
one of the triangles and drag it. This used to work…

Tore Bjerkan
- 17
- 5
0
votes
1 answer
Java Painting not working
So I have this code:
package tictactoe;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class TicTacToe extends JFrame {
public static void main(String[] args) {
JFrame…

Avi Caspe
- 537
- 4
- 12
0
votes
1 answer
Trouble with repainting the screen, but not clearing previous shapes
I am working on simulation of the chaos game for the sierpinski triangle.
I'm trying to paint a new point, without clearing the last one. As the number of points increases on the GUI to create the sierpinski triangle image, the speed in which…

Trevor Mayo
- 13
- 4
0
votes
1 answer
After cicking button its not showing any shape in my panel
I am trying to draw rectangle in my panel. Below it is my graphics class:
class MyComponent extends JComponent {
public void paint(Graphics g) {
g.fillRect(30, 30, 100, 100);
}
}
And I have rectangle button…

Jahidul Islam
- 29
- 2
- 7
0
votes
0 answers
Custom painted JButton shows artifacts on hover
I'm writing little game that requires small buttons over custom painted JPanel. My solution is quite simple, but it has some issues.
class TargetButton extends JButton {
private Point point;
public TargetButton(Point point) {
…

Arrvi
- 539
- 6
- 13
0
votes
2 answers
Custom mouse cursor drawing in Java (swing)
I'm looking to create a custom mouse cursor for a drawing app in Java. The app needs to be able to run on Windows and due to the restrictions in windows with relation to the size of the cursor (32 * 32 px) it is impossible to use the build-in Cursor…

Hayeb
- 3
- 3