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
7
votes
2 answers

Drawing a tree using recursion

I am trying to draw a tree using recursion. The tree needs to look like this: A short summary of how I'm supposed to do it: The trunk of the tree has length of length and width width The trunk splits into two branches The left one has the 3/4 of…
mythic
  • 895
  • 2
  • 13
  • 31
4
votes
5 answers

How to import stddraw correctly?

Editor: IntelliJ CE What I want: Be able to write setCanvas(500,500); Instead of StdDraw.setcanvas(500,500); Problem: I can't figure out how to correctly import the Stddraw library. If i simply do import StdDraw; IntelliJ tells me "StdDraw"…
Morgantuan
  • 41
  • 1
  • 1
  • 3
3
votes
2 answers

Fill Each Square With A Random Color

I am trying to fill the whole screen with squares, each one filled with a different color. I am able to generate the entire screen full of squares, but I cannot get them to be a random color. Here is what I have so far: import…
inda1
  • 63
  • 1
  • 10
2
votes
0 answers

Draw grid and and make "binary" 2d-array from clicked cells with stddraw-module in python

I would like to draw a grid and show it to the user, like the grid here: Which was generated with this code: def draw_canvas(x,y): # get width and height of the screen width, height = pygame.display.Info().current_w,…
Lenn
  • 1,283
  • 7
  • 20
2
votes
0 answers

How do you make a gif always be the background of an active window (behind other objects)?

How do you make a picture or gif always be a set at a greater depth into your active window than any other visible object? (Using StdDraw.java) I'm trying to set an animated gif into the background of a game I'm making. But whenever I create a new…
CJA1
  • 63
  • 6
1
vote
1 answer

Trying to create a 5x5 grid of squares with std draw but squares are at duplicate coordinates

I am trying to create a 5x5 board of rectangles(squares) with a 2d array but my code draws the 25 squares in only 5 places so it looks like there's only 5 squares diagonally on the "board". I'm assuming something is wrong with the logic in the…
1
vote
0 answers

Why does not gif display work with StdDraw while png work?

I am currently coding a small game, and i have (i think) a very simple bug, but i didn't found the solution anywhere. Here is my problem : when I wants to display a .png image, i have no problem, but it absolutelly don't work at all, saying me that…
1
vote
0 answers

Drawing an Archimedean spiral with lines and tightness parameters using Java

This uses a library called StdDraw to draw a line. I'm trying to make a spiral drawing method that takes in the center coordinates, the number of line segments to use, the maximum radius and the "tightness" of the spiral (spinRate). Here is my code…
weztex
  • 53
  • 6
1
vote
0 answers

StdDraw stop repainting suddenly

I'm developing a game using StdDraw in Bluej, but when I'm testing the game, it suddenly stop repainting the screen and it doesn't do anything else. I'm sure the problem isn't and infinite loop because I have debbuged the code and it is still…
1
vote
3 answers

Freeze moving rectangles

I'm working on a project where we are supposed to have rectangles of random sizes bounce off a wall and change color each time they bounce. When you click on them, they are supposed to freeze in place and turn red. I'm just having trouble having…
donkey brian
  • 29
  • 1
  • 4
1
vote
1 answer

Making a sine graph move

public class SimpleHarmonic { public static void main(String[] args) { StdDraw.setXscale(0,900); StdDraw.setYscale(0,700); while (true) { StdDraw.setPenColor(StdDraw.BLACK); …
Registered User
  • 468
  • 1
  • 7
  • 31
1
vote
1 answer

RandomWalk solution issue

PROBLEM I am working on a code where I am simulating a dog walking in a city - trying to escape the city. The dog makes random choices of which way to go to at each intersection with equal probability.If stuck at a dead end the dog will come…
user4261932
  • 45
  • 1
  • 5
1
vote
2 answers

How to import correct package for StdDraw?

I want to use the StdDraw package, and I've tried many different ways of importing it. Of course I tried: import StdDraw; But, when I look at the documentation from Princeton here, it shows that StdDraw is part of Objects, so I try this: import…
makansij
  • 9,303
  • 37
  • 105
  • 183
1
vote
0 answers

Clearing textbox from StdDraw to write new input

I'm not sure if this would be a simple question to answer on here, just because I'm using the Standard Draw class written by Princeton University, and I'm not sure if it's a globally known class. But I'd much appreciate any feedback from those…
kris
  • 375
  • 2
  • 12
1
vote
2 answers

Problems with Boolean Array in Self-Avoiding Random Walk Program?

My program uses StdDraw to create an N-by-N grid. I'm supposed to accept N and T in the command line (N is the number of lines in the grid, T is the number of times I can try to escape the grid in a random walk). I keep getting an error that…
Bianca Fuller
  • 39
  • 1
  • 9
1
2 3 4 5