Questions tagged [java-2d]

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

1076 questions
0
votes
1 answer

Roles of JavaFx 2.0, Swing, and Java 2D in Java 7 Ecosystem

I am a bit confused as to the new standards. To the best of my understanding Swing -- the former standard interface library -- is based on it's predecesor, AWT, and the Java 2D graphics libraries. Now that JavaFx 2.0 has replaced Swing my question…
Marc H
  • 1,228
  • 3
  • 18
  • 29
0
votes
1 answer

Complex background images for Java2D applications

I am developing a (card) game and for the background I need something fancy. On my research I found Microsoft's Solitaire game with this really nice green background, which tries to imitate a card table. Actually it does this really well. So my…
mythbu
  • 657
  • 2
  • 7
  • 16
0
votes
2 answers

Transformations in Java2D API

I am attempting to test for a collision with a Rectangle2D.Float and a Point2D.Float. I have a 2D world that contains a camera (which transforms the graphics2D canvas based off the camera's AffineTransform). I then have a list of objects X that…
Matthew
  • 3,886
  • 7
  • 47
  • 84
0
votes
1 answer

How to place the smaller rectangles inside larger rectangle using Java?

I stumbled upon a problem which i would like to solve it using Java. User inputs Larger Rectangle dimension (i.e L_width and L_height) and smaller rectangle dimension (i.e S_width and S_height). I would like to place as many smaller rectangle inside…
Learner
  • 962
  • 4
  • 15
  • 30
0
votes
2 answers

drawLine() using double variables instead of integers

I would like to ask whether it is possible to draw a line using double variables instead of integers. If yes how?
MBC870
  • 373
  • 3
  • 8
  • 16
0
votes
2 answers

Simple image rotation

I am making a game in Java. I made a planet seen from outer space and I want to make it appear like the planet is slowly rotating. But I don't know how to rotate a image. I need a simple command that rotates my image 1 degree around its own center…
0
votes
1 answer

Testing how close together two letters can be (2D)

I'm working on a small design project, part of which involved writing out text in a given font such that the letters of a word are just touching each other on their right and left sides. I've thought of implementing this as follows - create…
Erwin
  • 93
  • 1
  • 5
0
votes
1 answer

Stopping the animation after you let go of a key

What I have right now is an animation that starts when I press space: if(input.isKeyDown(Input.KEY_SPACE)) player = movingRightSwingingSword; However when I stop clicking space my animation continues. until I move my player, how do I make it so it…
Michael Zeuner
  • 1,736
  • 3
  • 15
  • 23
0
votes
1 answer

Intensity to pixel conversion

I hava a data of images 20 x 20 pixel in the form of intensities normalized by anti-aliasing.I took this data from THE MNIST DATABASE I want to convert these intensities to pixel (0-255) so that i can visualize these grayscale images it in java.…
M Faisal Hameed
  • 673
  • 1
  • 7
  • 25
0
votes
1 answer

Merge four CMYK images into one RGB Image Java

Thanks in advance for any help you could provide to me, and sorry for my bad english. I know there's a lot of questions about this topic, but I have looked a lot on all the Internet (and StackOverflow too) but I haven't found any answer for…
0
votes
1 answer

resize cubiccurve on jframe resisize

I have this curve shape, and I wanted the width and height resize accordingly relative to the size of my JFrame, for example my JFrame size is setSize(440, 300); -- and then if I maximize my JFrame I wanted the curve shape to get resized as well, so…
eLL
  • 11
  • 2
0
votes
1 answer

Triangle inside rectangular grids

I have written a code that draws grids and a triangle inside one grid cell. The grid size is increased/decreased when the window is maximized or minimized. My requirement is that the triangle size should also increase/decrease to fit the grid cell…
user1382494
  • 85
  • 1
  • 1
  • 7
0
votes
2 answers

How to draw 1024 cross 1024 grid cells in java on a JFrame?

import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import javax.swing.JComponent; import javax.swing.JPanel; public class Grid extends JComponent { public void paint(Graphics g){ super.paintComponent(g); …
user1401644
0
votes
1 answer

Update graphics with repaint() in the run() method?

I'm having a problem with updating the screen in this game of Pong here. The run() method draws shapes to a graphics (myBuffer), which is then drawn to a bufferedImage (myImage). I'm implementing a run() method for Threads so that the paddles can…
Zchpyvr
  • 1,119
  • 3
  • 12
  • 26
-1
votes
2 answers

how can i do to a 2D image and spin it around it's X, Y, or Z axis as if it were a 3D image.in java?

I want to achieve the effect of a 2D image I have but a little inclined, for example a plane, I want the image can be rotated about its axis Y. .. anyone can help me with some idea of how to do ..**
franvergara66
  • 10,524
  • 20
  • 59
  • 101