Description
Hello
Here is the code I am testing.
`import javax.swing.JFrame;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.JFileChooser;
PImage img;
final JFileChooser chooser = new JFileChooser();
FileNameExtensionFilter filter = new FileNameExtensionFilter("JPG image","jpg");
void setup () {
size(600, 600);
imageMode(CENTER);
img = loadImage("img000.jpg");
}
void draw () {
background(25);
image(img, width/2, height/2);
}
void keyPressed() {
chooser.setFileFilter(filter);
if (key=='l') {
int returnVal = chooser.showOpenDialog(new JFrame());
if (returnVal == JFileChooser.APPROVE_OPTION) {
System.out.println("You chose to open this file: " +
chooser.getSelectedFile().getName());
}
String path=chooser.getSelectedFile().getAbsolutePath();
println(path);
img = loadImage(path);
}
}`
processing console gives me the following error message:
- WARNING in C:\Users\Jeason\AppData\Local\Temp\android5988581650947227062sketch\src\processing\test\imgload\MainActivity.java (at line 11)
import android.support.v4.content.ContextCompat;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The import android.support.v4.content.ContextCompat is never used
- WARNING in C:\Users\Jeason\AppData\Local\Temp\android5988581650947227062sketch\src\processing\test\imgload\MainActivity.java (at line 15)
import android.Manifest;
^^^^^^^^^^^^^^^^
The import android.Manifest is never used
- WARNING in C:\Users\Jeason\AppData\Local\Temp\android5988581650947227062sketch\src\processing\test\imgload\MainActivity.java (at line 49)
int check;
^^^^^
The value of the local variable check is not used
- ERROR in C:\Users\Jeason\AppData\Local\Temp\android5988581650947227062sketch\src\processing\test\imgload\imgload.java (at line 8)
import javax.swing.JFrame;
^^^^^^^^^^^
The import javax.swing cannot be resolved
- ERROR in C:\Users\Jeason\AppData\Local\Temp\android5988581650947227062sketch\src\processing\test\imgload\imgload.java (at line 9)
import javax.swing.filechooser.FileNameExtensionFilter;
^^^^^^^^^^^
The import javax.swing cannot be resolved
- ERROR in C:\Users\Jeason\AppData\Local\Temp\android5988581650947227062sketch\src\processing\test\imgload\imgload.java (at line 10)
import javax.swing.JFileChooser;
^^^^^^^^^^^
The import javax.swing cannot be resolved
- ERROR in C:\Users\Jeason\AppData\Local\Temp\android5988581650947227062sketch\src\processing\test\imgload\imgload.java (at line 27)
final JFileChooser chooser = new JFileChooser();
^^^^^^^^^^^^
JFileChooser cannot be resolved to a type
- ERROR in C:\Users\Jeason\AppData\Local\Temp\android5988581650947227062sketch\src\processing\test\imgload\imgload.java (at line 27)
final JFileChooser chooser = new JFileChooser();
^^^^^^^^^^^^
JFileChooser cannot be resolved to a type
- ERROR in C:\Users\Jeason\AppData\Local\Temp\android5988581650947227062sketch\src\processing\test\imgload\imgload.java (at line 28)
FileNameExtensionFilter filter = new FileNameExtensionFilter("JPG image","jpg");
^^^^^^^^^^^^^^^^^^^^^^^
FileNameExtensionFilter cannot be resolved to a type
- ERROR in C:\Users*****\AppData\Local\Temp\android5988581650947227062sketch\src\processing\test\imgload\imgload.java (at line 28)
FileNameExtensionFilter filter = new FileNameExtensionFilter("JPG image","jpg");
^^^^^^^^^^^^^^^^^^^^^^^
FileNameExtensionFilter cannot be resolved to a type
- ERROR in C:\Users*****\AppData\Local\Temp\android5988581650947227062sketch\src\processing\test\imgload\imgload.java (at line 41)
chooser.setFileFilter(filter);
^^^^^^^
JFileChooser cannot be resolved to a type
- ERROR in C:\Users*****\AppData\Local\Temp\android5988581650947227062sketch\src\processing\test\imgload\imgload.java (at line 41)
chooser.setFileFilter(filter);
^^^^^^
FileNameExtensionFilter cannot be resolved to a type
- ERROR in C:\Users******\AppData\Local\Temp\android5988581650947227062sketch\src\processing\test\imgload\imgload.java (at line 43)
int returnVal = chooser.showOpenDialog(new JFrame());
^^^^^^^
JFileChooser cannot be resolved to a type
- ERROR in C:\Users*****\AppData\Local\Temp\android5988581650947227062sketch\src\processing\test\imgload\imgload.java (at line 43)
int returnVal = chooser.showOpenDialog(new JFrame());
^^^^^^
JFrame cannot be resolved to a type
- ERROR in C:\Users******\AppData\Local\Temp\android5988581650947227062sketch\src\processing\test\imgload\imgload.java (at line 44)
if (returnVal == JFileChooser.APPROVE_OPTION) {
^^^^^^^^^^^^
JFileChooser cannot be resolved to a variable
- ERROR in C:\Users*****\AppData\Local\Temp\android5988581650947227062sketch\src\processing\test\imgload\imgload.java (at line 46)
chooser.getSelectedFile().getName());
^^^^^^^
JFileChooser cannot be resolved to a type
- ERROR in C:\Users*****\AppData\Local\Temp\android5988581650947227062sketch\src\processing\test\imgload\imgload.java (at line 49)
String path=chooser.getSelectedFile().getAbsolutePath();
^^^^^^^
JFileChooser cannot be resolved to a type
17 problems (14 errors, 3 warnings)
BUILD FAILED
C:\Users*\AppData\Local\Temp\android5988581650947227062sketch\build.xml:15: The following error occurred while executing this line:
C:\Users*\AppData\Local\Temp\android5988581650947227062sketch\build.xml:28: Compile failed; see the compiler error output for details.