1,661
questions
0
votes
1
answer
42
views
I'm trying to draw a 2d tile map from a .txt file in java but it is only using one of the tiles accross the map and not using whats in the .txt file
I'm following a java 2d game tutorial from ryisnow on youtube. https://www.youtube.com/watch?v=ugzxCcpoSdE
I was able to display each tile on its own but I don't know why the .txt isnt working
here is ...
0
votes
0
answers
35
views
The Graphics2D.drawImage() method works, but the image doesn't appear on the panel
I'm trying to draw an image on this panel for a game similar to Window Kill. Using the System.out.println() method, it seems the image is being drawn, and I call the repaint() method in the thread. ...
0
votes
0
answers
16
views
Make JButton paintComponent draw on top of parent's border
I have a verticalBox with a border of 1px on all sides. Insede the vb there are buttons. I would like for the selected button to draw on top of the right border of the vb. The desired result would be ...
0
votes
1
answer
58
views
Buffered Image wont draw but will load
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.*;
import javax.swing.Timer;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
...
0
votes
0
answers
32
views
Java paintComponent not display background image on JFrame
I am trying to display an image that have in a subdirectory of my project src, and from the testing that I have done, the path reference to utilize the image is correct, however, when I run the ...
-1
votes
1
answer
46
views
paintComponent invoked many times
I'm creating a shooting game. When the bullet (which is a JLabel) passes through the enemy (which is a JPanel) then the paintComponent() method gets invoked until the bullet has passed through the ...
-2
votes
1
answer
66
views
Java Swing JPanel rapaint doesn't call paintcomponent
I have the following code:
package de.luiskun.handling;
import de.luiskun.UtilityTool;
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;
public class PixelArtCreator ...
1
vote
3
answers
142
views
I want to create a simple Paint in Java
I want to modify the program to connect the series of dots that make up one stroke of a letter with a straight line so that words can be drawn but i don't really have a idea of how to do it so i want ...
0
votes
1
answer
75
views
My Sine Graph doesn't carry on when zooming out but carrys on when making the app window longer not sure where its wro
Before Zooming Out
After Zooming Out
When making the window longer it carries on on the left
This is the JPanel of my project.
package SineWave;
import java.awt.Color;
import java.awt.Graphics;
...
0
votes
0
answers
22
views
Draw Line in recycler view and fill space below | Android | Kotlin
I have made Item decorator for drawing line in recycler view it works well. Now I want to fill everything below the line. Also I want to make line connection more smooth, I have tried increasing the ...
0
votes
0
answers
39
views
repaint() method inside ActionListener and paintComponent method
So i've created a Snake game but i have somekind fo a theoretical question.
Im using paintComponent to drawImage every pixel, but im also implementing ActionListener so im bound to using ...
0
votes
1
answer
48
views
Rectangular doesnt move through KeyListener
Well, I tried to make rectangular moving while typing arrows on Keyboard. It must work mostly like hitboxes
import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
...
0
votes
1
answer
37
views
Java - Multiple Panels in JFrame
I'm developing a hide and seek game for a school project, where two players move using the keyboard and if the hunter touches the survivor, the game is over. My initial approach is for each player to ...
0
votes
0
answers
36
views
My JFrame project won't paint some PNGs and will paint others even though everything is in the same directory
I have a minesweeper project that uses pngs to paint the icons for my cells. For some reason, my paint/draw methods will fill in all of the cells except mines. Everything is in the same directory. In ...
3
votes
1
answer
37
views
Can I tell the JPanel paintComponent(Graphics g) function to only repaint the object I'm editing?
I'm writing an app in java using a JPanel to draw maps, I've used Landmass as a class, and the workspace (extends JPanel) uses multiple landmasses to represent each continent/island.
currently, the ...