All Questions
64 questions
0
votes
0
answers
64
views
How would I make a projectile move using java.swing by constantly updating its points?
I have a Java final, and I would like to make a bullet hell type game, but what I'm stumped on is how to make the projectiles move. My first idea would be to constantly update the projectile; I just ...
0
votes
1
answer
176
views
Index 16 out of bounds for length 16 Array of Tiles in RPG
public void draw(Graphics2D g2) {
int worldCol = 0;
int worldRow = 0;
while(worldCol < map.maxWorldCol && worldRow < map.maxWorldRow) {
...
0
votes
1
answer
154
views
How to print a Tag Cloud using Java Canvas and Rectangles
My program's goal is to print a Tag Cloud of words from a TreeMap of Strings with integer values. The string with the highest number will be the word with the biggest font and so on. The only issue I ...
0
votes
1
answer
38
views
Having troubles with JPanel, 2D Graphics, and MouseListener
I'm having trouble with my code as I'm trying to make a blackjack game for a final project, I have the board all made with 2D graphics and the images work, but when I try to add controls like, ...
0
votes
1
answer
347
views
Draw rows of cells using array (Java)
I have to make a java program which shows rows of squares using arrays.
Here is my code:
@Override
public void paint(Graphics g)
{
for(int i=0;i<50;i++)
{
...
0
votes
1
answer
166
views
How can you print a Java array in neat columns using Graphics?
I am trying to create a function that takes a java array and the number of elements per row and returns the formatted string to be displayed. Here is my code:
public String displayArray(double [] arr,...
0
votes
0
answers
32
views
The shape rotation using the transform matrix
I'm trying to write a simple program that will rotate a randomly generated polygon by a given angle. However, this algorithm does not perform the necessary task. Can someone help with solving this ...
0
votes
1
answer
52
views
How can i save File Reader input in Array and then make a Graphic [Java]?(Question for Pros, test yourself)
I tried to input some Numbers in Java from "input1.txt" File, save them in 3 Arrays and make a Vertex for a Graph with those Numbers, but it doesn't work . It returns error "Compute launch button ...
-1
votes
2
answers
436
views
Can I add JLabels into an array? [closed]
I want to clean up my code and I was wondering if I could put these JLabels into an ArrayList.
This is going to be used for a do-while loop in which the collisions of my player will be checked.
Below ...
0
votes
1
answer
73
views
How do I call a graphics method with an parameter including an array in java?
I am having challenges calling my graphics method in my main method so that it can paint a triangle using points from an array. When I don't use an array and just use regular numbers the painting ...
-1
votes
2
answers
4k
views
How to remove object from array without using ArrayList? [duplicate]
How to remove an object from an array without using ArrayList?
I try to create miniaplication using Swing.
At this moment it contains the main window, and circles in it, that going around, and when ...
0
votes
0
answers
50
views
I can't turn a matrix with values of 0-1023 to all 0s and 1s (Complex)
I am using a space filling curve (Hilbert Curve) to try to approximate the fastest way to go through a set of cities in a matrix). My last step in the project is to turns all the numbers into 0s and ...
0
votes
0
answers
146
views
Java: Drawing grid to screen using 2D Array without lag/screen flickering
I am attempting to create a very simple top-down game in Java, but I am unsure how to approach a problem dealing with program performance.
I used a 2D array to store certain values that represent ...
0
votes
1
answer
36
views
error when trying to display a rectangle with arrays as arguments in java
So this is my code:
import javax.swing.*;
import java.awt.*;
public class ShapeTest extends JFrame{
public ShapeTest(){
setSize(600,600);
setDefaultCloseOperation(JFrame....
0
votes
0
answers
34
views
Adding a class into a frame and fixing button
Ok so i made this program that moves the picture to the end and when you click on a button, it draws a line from the picture to this point. I am able to make the whole button thing, however, I suck at ...