Related questions
Concept explainers
1). Write a java
- Where appropriate, use this.getWidth() and this.getHeight() so that the output will looks the same regardless of the window size.
- Use fill rectangle commands to produce/draw flag of France. The vertical stripes are same (blue, white, red), they are of the same size, and the same width as well.
import java.wat.;
import javax.swing.JFrame;
public class DisplayGraphics extends Canvas {
public static void main (String [] args) {
DisplayGraphics m=new DisplayGraphics();
jFrame f=new JFrame ();
f.add(m);
f.setSize (400,400);
f.setVisible (true);
public void paint (Graphics g)
{
g.setColor(Color.blue)
g.drawRec(400, 400, 100, 50);
g.fillRec(400, 0, 100, 50);
g.setColor(Color.white);
g.drawRec(400, 400, 100, 50);
g.fillRec();
g.setColor(Color.red);
g.drawRec(400, 400, 100, 50);
g.fillRec();
}
2). Write a java program will draw/produce a concentric circle based on the requirements below. The concentric circle have a small circle in the center and gets bigger and bigger as it goes out.
- The radii of the circle get bigger as it go out or establish a beginning radius radius for the circle that go down to the center of the circle.
- Leave a little gap in between the circles to avoid getting solid or black circle.
- Draw the outer circle that will decrease the size or the radius of the circle the next circle and decrease it by the same amount each step using the for loop.
3). Write a java program that implement the below specification:
- Set the drawing color to green.
- Connect pixel (0,0) to every 5th pixel on the right border of the applet window by drawing a line between them, then set the drawing color to black.
- Connect the pixel in the upper right-hand corner of the applet window to every 5th pixel on the left border by drawing a line between them.
- The y will start at 0 and go by 5 and then x will be get width to what the x change by (0, 0) and then to get width and then y where y is incremented by 5 at a time
4). Write a java program that implements the below.
- Use the fillRec and other methods to draw the flag of United States
- Draw the stripes first and draw a blues rectangle which contains the stars.
- Or use small boxes or small circles for the stars.
to generate a solution
a solution
- Javaarrow_forwardImplement a graphical application that displays a list of courses. Briefly, this GUI will take the inputs (i.e., course information), store them in an array list, and display course information in the output area. Figure 1 shows the layout ofthe CourseDisplay GUI. You should have three Java files: 1. CourseDisplayFrame class that extendsJFrame class (The main part of your program). 2.CourseDisplayViewer class, which contains the main method where a CourseDisplay object will be created, and the GUI will pop up (Suggested frame width of 450, and frame height of 400). 3.Course class, which is the class that models the Course objects (This file will be given to you). In your CourseDisplayFrame class file, you should have the followings: •Input area: –A text label and a text field (suggested width of 30) for course code; –A text label and a text field (suggested width of 30) for course name; –A text label and a text field (suggested width of 30) for course credit; –A text label and a text...arrow_forwardIn Java import java.util.Scanner;public class Image {int numberOfPhotos; // photos on rolldouble fStop; // light let it 1.4,2.0,2.8 ... 16.0int iso; // sensativity to light 100,200, 600int filterNumber; // 1-6String subjectMatter;String color; // black and white or colorString location;boolean isblurry;public String looksBlurry(boolean key){if ( key == true){return "Photo is Blurry";}else{return "Photo is Clear";}}public void printPhotoDetails (String s1){Scanner br= new Scanner(System.in);String subjectMatter=s1;System.out.println("Data of Nature photos:");System.out.println("Enter number of photos:");numberOfPhotos= br.nextInt();int i=1;while(true){System.out.println("Enter Filter number of photos"+i+":");filterNumber= br.nextInt();System.out.println("Enter colour of photo"+i+ ":");String color= br.next();System.out.println("Enter focal length of photo"+i+":");fStop= br.nextInt();System.out.println("Enter location of photo"+i+":");String location= br.next();System.out.println("Enter...arrow_forward
- Write a main program that displays a single frame with the title "My First Frame". Set the size to 800 by 800. Make the frame visible. Create a panel by using the JPanel constructor and add it to the frame. Use Color.RED (a constant in the java.awt package) along with the setBackground() method in JPanel, to set the color of the panel. Add a JButton and a JLabel to the panel before adding the panel to the frame. Display the resultsarrow_forwardWrite a JAVA program that prompts the user to enter the x- and y-position of a center point and a radius, using text fields. When user click on the "Draw" button, draw a circle with the given center and radius in a component.arrow_forwardWrite in Java! Write the Widget class. a. A widget has a name and price. b. The default for name should be "widget" c. Write a constructor (not the no-args), all getters and setters. d. Add a toString method. e. Create an object of type Widget.arrow_forward
- Write down a JavaFX program to draw two circles, square and a triangle on a canvas. Setup the coordinates in such a manner that, the triangle appears to be inside one circle and another circle must appear inside the square. Ensure that each of these two-dimensional shapes are filled with different colors.arrow_forwardImplement the following in the .NET Console App. Write the Bus class. A Bus has a length, a color, and a number of wheels. a. Implement data fields using auto-implemented Properies b. Include 3 constructors: default, the one that receives the Bus length, color and a number of wheels as input (utilize the Properties) and the Constructor that takes the Bus number (an integer) as input.arrow_forwardCreate a JavaFX programme that shows the side view of a spaceship as it follows the mouse. Have a laser beam (one continuous beam, not a moving projectile) blast from the front of the ship when the mouse button is held and continue to do so until the mouse button is removed. Use a different class to define the spacecraft.arrow_forward
- Text book imageDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationText book imageStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONText book imageDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- Text book imageC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONText book imageDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningText book imageProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education