Questions tagged [custom-painting]

147 questions
0
votes
1 answer

Can't close window after adding canvas in Java

public class Screen extends Canvas{ private BufferedImage image; private int height = Toolkit.getDefaultToolkit().getScreenSize().height-37; private int width = Toolkit.getDefaultToolkit().getScreenSize().width; private boolean…
0
votes
4 answers

Unconnected ovals while drawing too fast

I'm writing Applet which have to draw smooth connected lines, I'm doing it with this line (user is entering the pen's width) public void mouseDragged(MouseEvent arg0) { g.setColor(kolor); int…
Pacxiu
  • 23
  • 1
  • 7
0
votes
1 answer

How to efficiently paint custom JPanel as ViewportView of JScrollPane?

I have a JScrollPane displaying (as its viewport view) MyPanel, a subclass of JPanel. MyPanel implements custom painting by overloading paintComponent. The total size of the displayable content of MyPanel is generally quite wide (meaning 50x to…
ags
  • 719
  • 7
  • 23
0
votes
1 answer

Adding path2d to a jpanel

Im having a lot of problems with this really trivial thing. I want to take a path2d object and add it to a jpanel and display it in my gui. Can I get some guidance as to what I am doing incorrectly. I used the search here and with google and…
user583507
-1
votes
1 answer

How to know the colour of a certain point in the canvas in flutter custom painter?

I am making a painter program and I want know the colour of a point when tapping on it
-1
votes
1 answer

Swing and multi threading: why are the cars colliding?

This is the implementation I made for cross-road concurrent app with a graphical user interface but there's a collision somehow after running the app for a while and can't really get my head around the actual problem please forgive the poor…
-1
votes
1 answer

Draw Shapes on overlapping Panels, One panel Draw Stationary and another Draw Movable

I am creating Swing application. It is kind of road map with moving object application. I divide my shape components in two JPanels. One is static component JPanel, and second for dynamic component JPanel, and both added in mainPanel. Both panels…
virendra
  • 21
  • 4
-1
votes
2 answers

Java drawing on JPanel which on a JFrame

Hi I have a JFrame and there are two JPanels on top of it. My intention is to draw on the JPanels. Can anyone please share any Java code?
extremecoder
  • 15
  • 1
  • 1
  • 2
-2
votes
1 answer

Use Buttons and mouse to control draw-board

I am doing a GUI that is supposed to work like a Paint application. My current problem is adding proper functionality to my draw line and draw rectangle buttons. They currently don't work as I expected them to work. Help will be greatly appreciated.…
-2
votes
2 answers

how to output a user selected shape & color, whose location and dimensions depend upon the coordinate location of user clicks

As part of a larger project I'm trying to create a basic UI that will allow a user to click a JButton to select a desired color and then allow that user to click another JButton to designate a shape to be displayed, filled in according to the…
Trixie the Cat
  • 317
  • 3
  • 18
-2
votes
1 answer

Create the square, rectangle, triangle of java in jframe

I have a problem with Java As I understood not come Draw Geometric figures in Java, the code and the Following you can help me? This is the code: public class Gioco { public static void main (String args []) { PaintRect(); } …
Sasapp
  • 11
  • 1
  • 1
  • 4
-6
votes
3 answers

How to create button in flutter?

How do you create this button in this way? Need for my academic work. Please help me!! enter image description here
1 2 3
9
10