Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

ScintillationGrids.java University of Texas CS MISC

Rating
-
Sold
-
Pages
2
Grade
A+
Uploaded on
03-02-2023
Written in
2022/2023

import .Graphics; import .Color; import .IOException; /* * A program to print out various scintillation grids and a student designed drawing. */ public class ScintillationGrid { // Main method that creates the DrawingPanel with scintillation grids. // Restricted to chapters 1 - 3 of Building Java Programs public static void main(String[] args) { /* In the final version of the program DO NOT call method drawingOne from main or anywhere else in the program */ final int WIDTH = 950; final int HEIGHT = 650; DrawingPanel dp = new DrawingPanel(WIDTH, HEIGHT); Background(Color.CYAN); Graphics g = Graphics(); // Add your four methods calls to draw the four // required scintillation grids here. drawGrid(g, 0, 0, 75, 3, 16); drawGrid(g, 400, 50, 50, 6, 12); drawGrid(g, 50, 400, 100, 1, 20); drawGrid(g, 500, 500, 15, 7, 4); // do not alter this line of codes saveDrawingPanel(dp,

Show more Read less
Institution
Course

Content preview

import java.awt.Graphics;
import java.awt.Color;
import java.io.IOException;

/*
* A program to print out various scintillation grids and a student designed
drawing.
*/

public class ScintillationGrid {

// Main method that creates the DrawingPanel with scintillation grids.
// Restricted to chapters 1 - 3 of Building Java Programs
public static void main(String[] args) {
/* In the final version of the program DO NOT call method drawingOne
from main or anywhere else in the program */
final int WIDTH = 950;
final int HEIGHT = 650;
DrawingPanel dp = new DrawingPanel(WIDTH, HEIGHT);

dp.setBackground(Color.CYAN);
Graphics g = dp.getGraphics();

// Add your four methods calls to draw the four
// required scintillation grids here.

drawGrid(g, 0, 0, 75, 3, 16);
drawGrid(g, 400, 50, 50, 6, 12);
drawGrid(g, 50, 400, 100, 1, 20);
drawGrid(g, 500, 500, 15, 7, 4);

// do not alter this line of codes
saveDrawingPanel(dp, "grid.png");
}

// The drawGrid method is responsible for drawing the scintillation
// grids, which are then called upon by the main method.

public static void drawGrid(Graphics g, int x, int y, int size,
int lineNumber, int lineThickness){

// Establishes the grid
g.setColor(Color.BLACK);
int bigSquare = size + ((size + lineThickness) * lineNumber);
g.fillRect(x, y, bigSquare, bigSquare);

// Draws the vertical and horizontal lines repectively in the grid

for(int i = 1; i <= lineNumber; i++){
g.setColor(Color.GRAY);

g.fillRect( x + ((size * i) + (lineThickness * (i - 1))),
y, lineThickness, bigSquare);

g.fillRect( x, y + ((size * i) + (lineThickness * (i - 1))),
bigSquare, lineThickness);

}


This study source was downloaded by 100000858936669 from CourseHero.com on 02-02-2023 23:09:44 GMT -06:00


https://www.coursehero.com/file/56363391/ScintillationGridsjava/

Written for

Course

Document information

Uploaded on
February 3, 2023
Number of pages
2
Written in
2022/2023
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$5.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
ExamsConnoisseur Self
Follow You need to be logged in order to follow users or courses
Sold
587
Member since
3 year
Number of followers
344
Documents
1492
Last sold
1 week ago

4.2

68 reviews

5
40
4
11
3
13
2
1
1
3

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions