Reputation: 517
I want to use GUI tools in Java, my IDE is IntelliJ IDEA in Win8.1 and I have:
java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
in my path and another jdk (1.8) somewhere else.
In the commadLine (using javac) I can make/compile/build codes that are like these:
import java.awt.*; // Using AWT container and component classe
import java.awt.event.*; // Using AWT event classes and listener interfaces
// An AWT program inherits from the top?level container java.awt.Frame
public class AWTCounter extends Frame implements ActionListener {
private Label lblCount; // Declare component Label
private TextField tfCount; // Declare component TextField
private Button btnCount; // Declare component Button
private int count = 0; // Counter's value
(etc, the codes are not really important)
In my project structure in IntelliJ, I have added jdk 1.7.0_51 (same as above) but it says: "cannot resolve symbol 'event'" in the 2nd line:
import java.awt.event.*;
(the color of 'event' is red, means it does not exist)
I may have missed something about path. I spent hours searching and I didn't find anything related.
Upvotes: 1
Views: 2737
Reputation: 517
The problem was declaring Android SDK instead of JDK in my project structure. Android software development kit does not include anything from java.awt
or related packages because Android has it's own graphics package and libraries like android.graphics
or android.widget
.
Upvotes: 1