Questions tagged [java-2d]

Java 2D is an API for drawing two-dimensional graphics using the Java programming language.

1076 questions
-2
votes
3 answers

Change coordinates to bottom left corner

How can I change coordinates to bottom left corner? I know that's in Java the coordinates begin from Top=Left corner, but I'm asking if can someone help me how can I change it to begin (0,0) coordinates from Bottom-Left corner?
a14
  • 31
  • 15
-2
votes
1 answer

Filling triangles without fillpolygon?

So I've written a program that compiles, but it won't do what I want it do. It supposed to fill a triangle without using fill polygon. I'm trying to keep the code restricted to loops. The point is to make the three lines smaller and smaller to fill…
munchschair
  • 1,593
  • 3
  • 19
  • 43
-2
votes
1 answer

Thread help. Paint

Can someone please help me with the comment lines except the ones where it asks to delete things. Thank you! public class ex1011c extends JApplet implements ActionListener { // get rid of all winkbutton code JButton winkbutton = new…
-2
votes
1 answer

Code to draw a star

I looked up how to draw a star in Java, and I found the following code: public void paint(Graphics g) { drawStar(g,Color.BLACK,5,300,300,100,1… drawStar(g,Color.RED,6,100,100,20,20); drawStar(g,Color.BLUE,9,200,400,40,40)… …
user2578330
  • 57
  • 1
  • 2
  • 6
-2
votes
1 answer

Image Resize UpScale lost Quality

I want to try up scale image up to 3 times. For example, Up Scaled Image I am using this library for Image Resizing. The following code snipped does the trick, public static BufferedImage getScaledSampledImage(BufferedImage img, int…
Mihir
  • 2,480
  • 7
  • 38
  • 57
-2
votes
3 answers

taking Graphics reference will work?

import javax.swing.*; import java.awt.event.*; import java.awt.*; class GraphicsFunda extends JPanel implements ActionListener { Graphics myg; JButton jb; GraphicsFunda() { jb = new JButton("Draw"); add(jb); setBackground(Color.YELLOW); …
-2
votes
2 answers

java animation trouble getting the x and y cordinates of the mouse

so i wrote this code but im not sure of where does the mouse listener goes and also how to loop the program. im trying to achieve a particle explosion passing the x and y coordinates of the mouse when it's clicked. also i want to loop it till the…
Rui Monroy
  • 1
  • 1
  • 1
-2
votes
1 answer

draw ellipse2d around mouse click java

I am making a program that draws ellipses when the user clicks the screen. Currently when the ellipse is drawn the origin is (0,0) so it is being drawn from the top right. I want it to be drawn around the mouse click so then center is exactly where…
user2150807
  • 411
  • 2
  • 7
  • 14
-2
votes
1 answer

Write an applet that displays “UT” in blue in a yellow circle

Write an applet that displays “UT” in blue in a yellow circle Here is the code public void paint(Graphics g) { g.setColor(Color.blue); Font f = new Font("TimesRoman", Font.PLAIN, 72); g.setFont(f); g.drawString("UT.", 10,…
Akmal Rasool
  • 496
  • 2
  • 7
  • 17
-2
votes
1 answer

How to draw a String to an applet screen at the point of mouse click?

EDIT: Okay, so I've managed to get it working now with the help of a friend. =) I am currently creating a Java applet. The applet works by taking text input from the user and displaying it to the screen when they press return. This is the point up…
-2
votes
2 answers

How to blur an image under the mouse

I am working in java, and have an image being generated. When the mouse passes over the generated image, I need the image to use a blur or pixelation filter. What methods should I use to accomplish this?
ppst99
  • 69
  • 1
  • 13
-2
votes
1 answer

How to create this custom component?

LEC Cube Software as seen below. Any good idea how to draw the component on the left side in a Java application? Thought about Java2D. But I think with Java2D you can only draw those lines and no checkboxes. Perhaps any good LayoutManager to solve…
-2
votes
2 answers

How to Produce Physical Dimension of an Image drawn using Java

I have drawn a square on JPanel in Swing Applet.now i want to print this square having physical dimension 50cm * 50 cm on to paper.it means the print measurement of the square is 50 * 50 cm in real world which i drawn on to panel of an applet .the…
Mihir
  • 2,480
  • 7
  • 38
  • 57
-2
votes
1 answer

Add image to panel not using swings

how to we add bitmap image in panel and then get the graphics that the image is using and tell the panel to draw a line using the same graphics inside the image.
maddy
  • 109
  • 4
  • 13
-2
votes
1 answer

How to select a figure to move, rotate and scale with Java2D

I have problems that are not as selecting a figure and that figure selected apply a rotation as many figures as I do not do the following as the first two points and I have but not the third: The program should allow multiple draw figures in the…
user1387989
  • 77
  • 1
  • 2
  • 8
1 2 3
71
72