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
1
vote
1 answer

Getting coordinates of mouse click on grid easy java StdDraw

okay so I am trying to get the coordinates on a grid of which square a mouse was clicked on (why i casted into int) and this is giving me like the current position of the mouse,however, I want the position after a click and for nothing to happen…
user3075559
  • 23
  • 1
  • 6
1
vote
1 answer

Limit length of line in standard draw

I currently have a program with a grid and lines that will be drawn between dots in the grid. It uses standard draw. I wish to limit the length of the lines, so that they can only go from the adjacent points, but do not know how I would do this.…
0
votes
1 answer

Why can't I draw a picture using stddraw?

I'm trying to simply draw a picture using stddraw with this code: def main(): if len(sys.argv) <= 1: stdio.writeln("ERROR: Too few Arguments") else: pic = sys.argv[1] stddraw.picture(pic) stddraw.show() if…
0
votes
0 answers

Drawing a polygon using StdDraw, by mouse clicks (JAVA)

I'm trying to write code that draws a polygon according to the user mouse clicks. I've figured out how to draw simple shapes such as segments (2 mouse clicks) how ever I'm facing a problem with creating a polygon (aka 3 or more mouse clicks). …
iVi
  • 31
  • 3
0
votes
0 answers

StdDraw set Title Issue

So I'm trying to write a program that will eventually become more than this small test of stddraw but I wanted to change the window's name to the woah variable. Currently My code looks like this: public class Circles { public static void main…
Joey
  • 1
  • 2
0
votes
0 answers

How to expand the StdDraw library without using AWT or SWING

So in the beginner coding classes I teach, they've (the district) moved us away from the Graphics library with java.awt.* and java.swing.* to the simplified standard graphics library, StdDraw -- not necessarily a bad thing as it has most of the…
Skelefish
  • 1
  • 2
0
votes
0 answers

How to set size of screen in Java StdDraw.filledPolygon(x[],y[]) without using SetXScale and YScale? Are there any limitations for array inputs?

public static void filledTriangle(double x, double y, double length) { // add length / 2 to shift right the filled triangle double[] xArray = { x - length / 2 + length / 2, x + length / 2 + length /…
0
votes
0 answers

My code detects Key Presses in Java but does detect when the key is lifted in StdDraw?

So my project requires me to only use StdIn, StdOut and StdDraw. I have got code to detect when certain keys are pressed but it doesn't stop moving until the boundary is hit. I need it to only move 1 space but it moves across the entire the board…
Jaya
  • 1
0
votes
1 answer

How can I fix 'color' module import error?

I have a problem with stddraw python file, when I want to import it I face module not found error >> no module named 'color' I tried to install color from pip but it didn't work again!!!
0
votes
1 answer

How to make use of key events USing Intellij IDE and StdDraw as GUI?

I need to make space invaders in java. I am however struggling to implement key events into my program. Currently I have 2 classes, MainMenu.java and FrameListener.java. Noting happens when I press keys. What am I doing wrong? MAINMENU.JAVA import…
0
votes
2 answers

Is there a way to draw to the screen faster with StdDraw in java?

I am using the StdDraw library from https://introcs.cs.princeton.edu/java/stdlib/StdDraw.java. To my knowledge it just implements a simple interface for drawing to the screen using JFrame. In my implementation, I simply have a 2d array of pixels,…
yeeshue99
  • 238
  • 2
  • 8
0
votes
0 answers

Triangle Drawing not repeating for recursion code

I am writing a recursion code for my triangle drawing. For some reason, it wont do the recursion, but it will do the base drawing. Would like some help in figuring out why my code isn't repeating. Also, if someone could help me figure out how to…
0
votes
1 answer

Need help using StdDraw to draw a 2D array

So I already have a method which reads a file which I have converted into a 2d array(therefore the dimensions of the array could be different each time depending on which file I use). Now I am trying to draw a rectangle using this and it wont work.…
0
votes
1 answer

Java double for-loop and condition usng stdDraw to draw a picture, can not find the failure

I am learning java at home since university has been closed. recently I am trying to draw a picture using StdDraw as you see in the picture below, but I don't understand, why the red circle in the middle is missing, I hope you could help me, thank…
Rodomo
  • 5
  • 2
0
votes
1 answer

Java: Make Draw-program run in fullscreen

I am using the Draw.java class from the Princeton library for a small graphics program. Currently it runs in a window. I want to make it scaleable and full-screen. How can I achieve that? I looked into Full-Screen Exclusive Mode but am not quite…
Brixzz
  • 21
  • 7