Questions tagged [stddraw]

A Java GUI API containing common drawing operations which is part of the Princeton collection of standard java utilities for use in teaching their Computer Science classes and available under the GNU General Public License, version 3 (GPLv3)

StdDraw is part of the stdlib.jar distribution.

61 questions
0
votes
0 answers

Java StdDraw animation

So I need to make a simple game for a project, and the StdDraw from princeton library was provided. From looking through the source code it seems like the library handles animation by drawing on two (for double buffering) BufferedImages and then…
epep
  • 51
  • 4
0
votes
0 answers

How to show images in runnable JAR File exported from a java project using stdDraw?

I'm using StdDraw jar file to show pictures (StdDraw.picture("path")) in my project, and want to export it to a runnable jar file. I use eclipse to do it. I have added the folder of images in build path. I know there are some solutions to add…
0
votes
0 answers

How Can I Calculate the Correct X and Y coordinates of a Recursive Square Transformation?

I am working on a fractal design known as the dragon curve done with Java recursion and StdDraw. It is made up of a square with two other squares branching off from it, one at 30 degrees clockwise and the other 60 degrees counter-clockwise. My…
0
votes
2 answers

i am trying to use isKeyPressed method and its just not working, is there a specific place i have to hit key?

I want to make a game were a circle jumps over obstacles but I can't get it to jump I've tried all keys on keyboard import java.awt.event.KeyEvent; public class Game { public static void main(String[] args) { StdDraw.setCanvasSize(); …
0
votes
1 answer

StdDraw - Java - Show a gif

I'm making a game and I want show a gif with the stdDraw method but this doesn't work. So if someone can explain me a method to show a gif with stdDraw, this will be cool !
0
votes
0 answers

Why can't I use the STDdraw and STDAudio classes at the same time in java?

I am working a program that plays sounds by clicking keyboard keys. I have gotten it to work, however when I try to visualize that sound, The sound stops playing. So I can either play the sounds, or make the waves but not both. How do I make them…
0
votes
0 answers

Unfreezing colliding rectangles?

I need help with a project. For this project we have created moving rectangles that "freeze" when clicked on. We are also supposed to make frozen rectangles unfrozen if they collide with another. I have gotten the first step done but I can't seem to…
0
votes
1 answer

Standard Draw Java window

I am having a problem with StdDraw and resizing the window so points appear. I have a Point class with a draw() method /** * Draws this point to standard draw. */ public void draw() { /* DO NOT MODIFY */ StdDraw.point(x, y); } Then in a…
Paul
  • 409
  • 4
  • 12
0
votes
2 answers

Freeze Moving Rectangles After Multiple Clicks

For my project we are supposed to assign moving rectangles a random value between 1 and 3. After each click it should decrease the amount of required clicks to freeze. When the count reaches 0 it freezes. If the frozen rectangle is touched by…
donkey brian
  • 29
  • 1
  • 4
0
votes
1 answer

Turtle Project Java

I'm working on a project where we are supposed to have a turtle that can take the commands forward, left, right, penUp, penDown, penColor and quit. When the pen is down it's supposed to draw a line between points. As the turtle moves it should leave…
donkey brian
  • 29
  • 1
  • 4
0
votes
2 answers

Java Mouse Click issues

I've been trying to make this tick tack toe game using several static methods. I am relatively new to this still and can't quite figure out the whole idea of mouse clicks. I've read about the mouseclick and mouseevent, but it doesn't make complete…
0
votes
1 answer

Food flickering and not being eaten in dodge game

old code Currently, I am trying to make a game in which the mouse controls a block that will move around, gathering little balls. Every time a ball spawns, an enemy will appear, moving in a linear path. My program attempts to implement that, however…
Registered User
  • 468
  • 1
  • 7
  • 31
0
votes
2 answers

Draw a 4x4 Grid Java

I am trying to draw a 4x4 grid using a 2D array. When I run the code, I only draw a square in the lower left corner. I think the issue might be with my y-coordinate but I am not completely sure. StdDraw.setScale(0,4); int[][] grid = new…
inda1
  • 63
  • 1
  • 10
0
votes
0 answers

How to leave a little space between the button and the title?

Hi I am trying to implement RadioButtons which is a subclass of GUIelements. In the drawing part I was asked to override the superclass draw method and draw a circle . It should also draw its text just to the right of the button and I was asked to…
0
votes
2 answers

StdDraw main method?

Error: Main method not found in class StdDraw, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application I'm getting the above error when I run the…