1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
miskamm [114]
3 years ago
13

write a java program that displays a picture of a tree, try to make it to where the program does not close until the user clicks

the red [X]
Computers and Technology
2 answers:
Elza [17]3 years ago
8 0
The java script will give you the deta
Fantom [35]3 years ago
4 0
Import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.JFrame;

public class PaintTree extends JFrame {

private static final long serialVersionUID = 1L;
private final String imagePath; // the image path
private BufferedImage image; // image loader

public PaintTree(String imagePath) {
this.imagePath = imagePath;
try {
image = ImageIO.read(new File(imagePath)); // creates the image from path
} catch (IOException e) { e.printStackTrace();
}
}

public void createAndShowGUI() {
setPreferredSize(new Dimension(400, 400)); // sets preferred size for the jframe

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pack();
setVisible(true);
}

 // this is automatically called
@Override public void paint(Graphics g) {
super.paint(g);   
    
g.drawImage(image, 0, 0, null); // the method for painting
}

public static void main(String... args) {  
PaintTree pt = new PaintTree("C:\\full\\path\\to\\image"); // set path
 
pt.createAndShowGUI(); // now create the gui
}
}

This is directly copied from my IDE

Hope this helps!
You might be interested in
Your team at amazon is overseeing the design of a new high-efficiency data center at hq2. a power grid need to be generated for
elixir [45]

Answer:

void print2(int row) {

for (int i = 0; i < row; i++) {

 char ch = 'a';

 char print = ch;

 for (int j = 0; j <= i; j++) {

  cout << print++;

 }

 cout << endl;

}

}

int count_digits(int num) {

int count = 0;

int temp = num;

while (temp != 0) {

 temp = temp / 10;

 count++;

}

return (num % count);

}

Explanation:

3 0
2 years ago
A related database stores data in the form of______
avanturin [10]

Answer:

Lists.

Explanation:

A relational database stores data in the form of lists.

6 0
3 years ago
Which task might be suitable for moving into a separate function so you can re-use it from multiple places in your code?
Fudgin [204]

Answer:

The answer is "All of these could make good functions ".

Explanation:

In the given question some information is missing, that is options which can be described as follows:

a. Ask the user to confirm an input with a yes/no answer

b. Sort some input data into an ordered list

c. All of these could make good functions

d. Calculate a complex mathematical expression

A method is a collection of ordered code and provides a generic code, that is used to execute a single, connected operation.

  • A good function is a function, which takes values from the user and it will sort all the data and store in memory, and whenever we call the function, it will give the values.
  • It is also used to calculate some complex values,
8 0
3 years ago
If a 9V, 7W radio is on from 9am to 12pm. Calculate the amount of charge that flows through it, hence or otherwise the total num
vredina [299]

Answer:

Q=It

and

p=IV

Given, v=9V P= 7W

I=P/V

I =7/9

Also, time(t) from 9am to 12pm is 3hrs

Converting into sec =3×3600

t=10800

Q= 7/9 ×10800

Q =8400C

6 0
3 years ago
Technician A says that reprogramming a PCM using the J2534 system requires a factory scan tool, while Technician B says it requi
Dmitry [639]

Answer:

Technician B only

Explanation:

6 0
3 years ago
Other questions:
  • Assume that getPlayer2Move works as specified, regardless of what you wrote in part (a) . You must use getPlayer1Move and getPla
    14·1 answer
  • The cost of large ground based telescopes has remained the same since the 1800's costing the equivalent of about a billion dolla
    9·1 answer
  • &gt;&gt;&gt; import math &gt;&gt;&gt; print(math.Pi) 3.141592653589793 &gt;&gt;&gt; def print_volume(): print ("What is the radi
    12·1 answer
  • The two key elements of any computer system are the____and the _____.
    7·1 answer
  • Greg is the network administrator for a large stadium that hosts many events throughout the course of the year. They equip usher
    7·1 answer
  • The World Wide Web is full of unstructured data. Search engines like Google, Bing and Yahoo have been doing a good job of allowi
    5·1 answer
  • Write a function that takes an integer value and returns the number with its digits reversed. for example, given the number 7631
    10·1 answer
  • What is one effective way for employees to keep their skillsets current?
    8·2 answers
  • Write Tic tac toe program in python for beginners pls
    10·1 answer
  • What time is it NOW??
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!