Skip to main content
Filter by
Sorted by
Tagged with
1 vote
2 answers
103 views

I'm trying to replicate this image using java2d, and I've almost done it, but there's a slight difference. In the original image, there are 4 circles overlapping in the center, but in my output there'...
user29898's user avatar
2 votes
0 answers
102 views

I'm working with an AWT Canvas with a triple buffered BufferStrategy. The application runs a loop that renders the screen with a set maximum FPS. Specifically I'm drawing multiple characters on screen ...
Marlo Kuisma's user avatar
3 votes
0 answers
161 views

I’m generating text images for different .ttf fonts in a method using Java2D, most of the fonts it works fine. The issue is with some fonts it return wrong "Y" value. // params File ...
spring_dev101's user avatar
3 votes
2 answers
109 views

I am going to improve and supplement this question but maybe I'm right and someone knowing can help shortcut this question/issue... Isn't the following web documentation by Oracle incorrect? https://...
kansasSamurai's user avatar
1 vote
1 answer
87 views

I am using client host commands from powershell to launch a Oracle forms FSAL via the following command: java -jar "fsal jar location" -url "url" This command works except there ...
IT Alex's user avatar
  • 200
0 votes
1 answer
68 views

I am trying to draw the map of my game, it has tiles object with x & y location. The image of the tiles are hold by 1 class, and I resize them once I finished zooming. I want to draw the images ...
Pulsi_'s user avatar
  • 11
0 votes
1 answer
115 views

I am using the java.awt.font.TextLayout class to measure the bounds of a text string. In this measurement I need to include any trailing whitespace. However it seems that by default, TextLayout ...
Grodriguez's user avatar
  • 22.1k
1 vote
1 answer
86 views

The following code successfully displays a blank canvas with a small red square: (ns test-rect (:require [clojure2d.core :as c2d]) (:require '[clojure2d.extra.utils :refer [show-image]])) (c2d/...
Francois's user avatar
  • 2,086
0 votes
1 answer
421 views

I am trying to figure out how to use PDFBox (2.0.30) to render image from a PDF document in a native application based on Spring Boot (3.2.1). PDF generation works fine, but image rendering fails. ...
Nicolas JANET's user avatar
1 vote
0 answers
37 views

I already have a working API in java that takes text in request, and creates a PNG image from this text using custom fonts and returns a BASE64 encoded data of the image. Now, I need to modify this ...
Gladiator9120's user avatar
0 votes
1 answer
117 views

My problem is I need to use only one drawLine. I couldn't figure out how am I supposed to make changes at the same time in x and y while not messing with one and another. I can't use a rectangle. int ...
Muhammed Argun's user avatar
0 votes
1 answer
48 views

Let's say I have a JPG image that's completely white except for a green filled in square that's placed randomly. The square has equal side lengths of between 20 and 30 pixels. I'd like to write a Java ...
Sander Smith's user avatar
  • 1,437
0 votes
1 answer
248 views

I'm trying to make a game, and in the game is a background that has many small stars that slowly travel from right to left. With a full screen I may have 170 stars being drawn each frame. The ...
working_man's user avatar
1 vote
0 answers
139 views

Is it possible to scale or rotate a Rectangle2D and get a new transformed Rectangle2D? I know it is possible to get a Shape or Path2D, but how to get a new Rectangle2D from a specific Affine transform ...
jazznbass's user avatar
-1 votes
1 answer
62 views

I want to draw some images on screen alongside some JButtons placed in different places of the screen. However whenever I have setLayout(null); the images do not show up on screen. If i don't set it ...
Zolak's user avatar
  • 23
1 vote
1 answer
160 views

I'm trying to make a racing game with the top down view on a static player in the middle of the screen, so instead of moving the player through the map, the map would move around the player. Since it'...
kaman5's user avatar
  • 13
0 votes
0 answers
73 views

How can I know if the user has clicked inside a Pentagon and a Ellipse? I was able to create a method for Circle, Triangle and Rect, but I got stucked in those two figures. Rect: public boolean ...
Sule26's user avatar
  • 1
0 votes
1 answer
426 views

I am working with the Java Swing library. I have two rectangles of the same width and height and the same coordinates. I want to combine them into one so I can get a cross. How can I achieve it?
KAWFVKe24's user avatar
0 votes
1 answer
210 views

I am having a problem with a school project in Which I create a Polygon that when I insert points the polygon update after the insertion of every point. For example My program: The result I want: ...
MJ99's user avatar
  • 5
0 votes
0 answers
166 views

Trying to make a rainbow using 2 arcs and filling the lines between with the FXgraphics2D drawArc and drawLine functions. Its not working as expected. The assignment is to make a rainbow starting and ...
oknorton's user avatar
1 vote
1 answer
51 views

I just started to learn Java and tried to draw some rectangles. I have run this example and can't understand one thing: class ShapesDemo2D has a constructor: public void init() { //Initialize ...
prupru's user avatar
  • 135
0 votes
1 answer
909 views

I have a fairly complex list of short line segments that taken together form a line. I'd like to take this line and draw it 4 times along the 4 edges of a polygon. Obviously, for each side of the ...
Sander Smith's user avatar
  • 1,437
-1 votes
1 answer
675 views

I am making a java program that reads a binary file, which contains multiple images (in PNG format), and some binary data. How can i load the images (specifically, as java.awt.Image's) ? So far the ...
TwilCynder's user avatar
1 vote
1 answer
89 views

For my program, I want to have two ovals overlap and then create a new shape out of the overlapped area. So that I can later combine the resulting shape again with another shape. In the end, I want to ...
TomSu's user avatar
  • 13
1 vote
1 answer
225 views

Well, lets say I have the Shape of an O and I want to render it. Now my current rendering code is this: public void fill(Shape shape, float xOffset, float yOffset) { AffineTransform transform ...
DasBabyPixel's user avatar
1 vote
0 answers
190 views

I am trying to read all glyphs the font has available, in my case 547. Here's what I've done so far: private static String getCharacters(Font font) { final int glyphs = font.getNumGlyphs();...
DasBabyPixel's user avatar
0 votes
1 answer
1k views

I know you can set the factor via -Dsun.java2d.uiScale=2 but what if I want to let the System choose the Value, how do I get the value set? Where is it saved?
Gianluca Corazza's user avatar
0 votes
1 answer
1k views

I'm just learning how GUI works and I wanted to write a code where following happens: firstly we see red rectangle after a click it changes into a circle in gradient (I picked orange and pink) + the ...
Lucyna Min's user avatar
0 votes
1 answer
410 views

As the title states, I am trying to detect a mouse hover over an object that is not a JComponent. Right now I have a window with a green JPanel. When you left-click on this JPanel you create a point. ...
HygrowCarpets's user avatar
0 votes
1 answer
4k views

I've a little confusion, when we declare & initialize a 2D array in java like given below int arr[][]={{1,2,3,4},{4,3,2,1}}; This work correct, but when do do the above action like given below ...
M Nasir Baloch's user avatar
0 votes
2 answers
166 views

I have the following code. import java.awt.*; public class ShowScreenSize { public static void main(String[] args) { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); ...
Eddward's user avatar
4 votes
2 answers
686 views

A while back, I had written and had working a Zoom to Mouse Swing panel that handled highlighting, pan, mouse zoom, selection, etc. It was very nice. I went to play with it some more today, and it ...
Will Hartung's user avatar
0 votes
0 answers
344 views

I have a java application with old vector graphics editor written in pure Java Swing and Java2D. Now I want to migrate the whole application to Javafx toolkit, except graphics editor. Graphics editor ...
Koyotter's user avatar
1 vote
1 answer
294 views

I am trying to understand the use of Java's Arc2D. Don't know how to calculate the start angle and extent when creating an arc out of an ellipse (not a circle). I want an arc of an ellipse with ry = 2 ...
MuffinMan's user avatar
0 votes
1 answer
96 views

The Java SE 8 app I'm developing needs to run on Win10 and MacOS, and I'm using a Font (Ariel) that renders well on both platforms: Here is an example of how it normally looks (MacOS 10.13): I was ...
pbierre's user avatar
  • 354
0 votes
0 answers
186 views

As seen in the Javadoc, most of the methods on rendering are abstract. How are they implemented? How do Java2D draw a square on my screen? (the answer I'm looking for is not "via 2 triangles&...
Doga Oruc's user avatar
  • 845
0 votes
1 answer
190 views

Using Java graphics, I tried to draw a circle, draw lines inside it, then check if the mouse is inside the circle and print the position of the mouse. The lines I draw exceed the circle and when I ...
lulyerenia's user avatar
0 votes
2 answers
113 views

I'm experimenting with 2D painting in Swing, and I'd like to paint a JLabel in the middle of an empty JList. Thus I came up with: public class MyJList<T> extends JList<T> { private final ...
LppEdd's user avatar
  • 21.3k
0 votes
0 answers
166 views

I have to draw the figure on the link in java as an assignment.The assignment So far I have been able to draw the first arc using CubicCurve2D, as seen on the picture on the second link, but now I ...
Blend Sadikaj's user avatar
0 votes
0 answers
41 views

Code to paint a picture to a panel: public class MyDraw extends JPanel { background = new ImageIcon("src/background.jpg").getImage(); @Override protected void paintComponent(Graphics ...
ElsaKombat's user avatar
0 votes
1 answer
69 views

I have this strange problem with Java2D. I have a Path2D.Double that I want to draw, but depending on the stroke size, all segments are drawn correctly (curved) but when the stroke size is greater or ...
David Gutiérrez Rubio's user avatar
2 votes
0 answers
318 views

I was trying to move a square on Y-axis with the help of buttons up "upp" and down "ner". But I am not really good at JFrame functions so I need help. Edit: Fix the issue by ...
Turhan Ergene's user avatar
-1 votes
2 answers
111 views

This question was answered many time but I still can't apply it to my situation. I want to rotate image on 90 degrees clockwise. I'm currently having following code: private void writeImage(...
AstroCool's user avatar
0 votes
1 answer
388 views

I'm trying to make a Brick Breaker game where the ball which is initially on the paddle(referred to as BAR in the code below) is launched with a speed(approx 100) in some random direction, if it hits ...
Sora's user avatar
  • 3
1 vote
1 answer
65 views

I'm trying to make a game like Tank Trouble. The problem is that when I'm trying to rotate and draw a tank picture, all other tanks pictures will be rotated. Here is my code: // draw tanks ArrayList&...
ali asad's user avatar
0 votes
1 answer
418 views

I want to draw polyline with positive and negative coordinates. e.g. 125,66 126,62 -128,59 -127,55 -125,51 -124,47 -122,43 -121,40 -119,38 -118,36 These are the sample coordinate to draw the ...
Yogesh's user avatar
  • 313
0 votes
0 answers
54 views

my current project is a small desktop application in Java that functions like a room decorator similar to the IKEA software that lets you plan out your room before you go and buy furniture. When I ...
Sepx3's user avatar
  • 38
0 votes
0 answers
99 views

I have recently moved to Linux Mint 19.3 and run my Java game. In one hand I have FPS that's higher than on Windows 10 (~150 FPS VS ~4000 FPS). But in another hand my game is very lag. And I don't ...
Archer's user avatar
  • 67
-1 votes
1 answer
498 views

I have BufferedImage that stores .png image (320 x 240) and I draw it on Сanvas with Graphics.drawImage(). But if you look closely, for example, the cross 3 by 3 pixels is actually 4 by 3 pixels. Look ...
Archer's user avatar
  • 67
0 votes
1 answer
87 views

I have two rectangles, and I want to figure out which side they are intersecting on. I can use Rectangle.intersects(Rectangle) but it only tells me that the rectangles are intersecting. What I am ...
Spencer Nold's user avatar

1
2 3 4 5
22