1

I need to make a program in Eclipse that uses AWT to make a house for my Computer Science 101 course. I have several pieces of reference material to base the program from and have made sure that the program itself is correct, but Eclipse can't find a source or Javadoc for most of the commands, resulting in nothing but a blank frame.

I'm using JavaSE-1.8 as the library for this program (this was the library we used for a practice AWT program in class and JavaSE-9 only gave me a blank error box when I tried to run the program) and this is the code:

package spleydon0_AWTHouseProgram;
import java.awt.*;
import java.util.*;

public class spleydon0_AWTFirst {
    public static void main(String[] args) {

        double response = 0;
        Scanner input = new Scanner(System.in);

        Frame f = new Frame("Sean's AWT House Frame");
        f.setSize(1000, 500); //in pixels
        f.setVisible(true);

        Graphics g;
        g = f.getGraphics();

        while (response < 10000);
        {
            //House
            //House outline
            g.drawRect(325, 200, 350, 250);
            g.drawLine(325, 200, 500, 50);
            g.drawLine(500, 50, 675, 200);
            //House windows
            g.setColor(Color.BLUE);
            g.fillRect(350, 225, 75, 75);
            g.fillRect(575, 225, 75, 75);
            //House door
            Color BROWN = new Color(139, 69, 19);
            g.setColor(BROWN);
            g.fillRect(450, 325, 75, 125);
            //House doorknob
            g.setColor(Color.BLACK);
            g.fillOval(500, 325, 13, 13);

            //Tree
            //Tree trunk
            g.setColor(BROWN);
            g.fillRect(75, 200, 75, 250);
            //Tree leaves
            g.setColor(Color.GREEN);
            g.fillOval(50, 75, 150, 150);

            response++;
        }//end while loop

        System.out.print("Type 1 to exit");
        response = input.nextDouble();
        System.exit(0);

    }//end method

}//end class

For almost every line in this program, when I hover the cursor over the command and bring up the box, Eclipse adds a note onto the bottom of the box that reads:

Note: This element has no attached source and the Javadoc could not be found in the attached Javadoc.

I genuinely don't understand what the issue is and I can't find any descriptive or relevant information about it. What similar cases I've found all used different formats, coding languages, imports, or a combination of the three, and the solutions to each appeared to be specific to each case. Does anyone have any information on how to resolve this?

Sean
  • 41
  • 1
  • Menu: `Window` > `Preferences...` > `Java` > `Installed JREs` ; selected the JRE and `Edit...` ; selected the 6 first JARs (directly in lib, not the ones in lib/ext) and `Javadoc Location...` default: `https://docs.oracle.com/javase/8/docs/api/` or use a local downloaded version. See also https://stackoverflow.com/q/9870448/85421 – user85421 Apr 25 '18 at 21:33
  • Does your project's JRE System Library on it's Java Build Path point to a JRE instead of a JDK? If you're writing Java, during development you should always use a JDK when possible. – nitind Apr 26 '18 at 03:26

0 Answers0