Error executing processing program
in
Contributed Library Questions
•
2 years ago
Hi everyone, i'm doing an application with processing ide and when i click to play button it sends me this error message:
File C:UsrgankAppDataLocalTempuild5772272317183868757.tmpSlider.java is missing
Exception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsException: String index out of range: 1027
at java.lang.String.charAt(String.java:686)
at processing.app.syntax.Brackets.findMatchingBracket(Brackets.java:69)
at processing.app.syntax.JEditTextArea.updateBracketHighlight(JEditTextArea.java:1701)
at processing.app.syntax.JEditTextArea.select(JEditTextArea.java:1146)
at processing.app.syntax.JEditTextArea$DragHandler.mouseDragged(JEditTextArea.java:2011)
at java.awt.AWTEventMulticaster.mouseDragged(AWTEventMulticaster.java:302)
at java.awt.Component.processMouseMotionEvent(Component.java:6311)
at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3285)
at java.awt.Component.processEvent(Component.java:6032)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4255)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
I have 3 clases in the proyect:
Interficie
File C:UsrgankAppDataLocalTempuild5772272317183868757.tmpSlider.java is missing
Exception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsException: String index out of range: 1027
at java.lang.String.charAt(String.java:686)
at processing.app.syntax.Brackets.findMatchingBracket(Brackets.java:69)
at processing.app.syntax.JEditTextArea.updateBracketHighlight(JEditTextArea.java:1701)
at processing.app.syntax.JEditTextArea.select(JEditTextArea.java:1146)
at processing.app.syntax.JEditTextArea$DragHandler.mouseDragged(JEditTextArea.java:2011)
at java.awt.AWTEventMulticaster.mouseDragged(AWTEventMulticaster.java:302)
at java.awt.Component.processMouseMotionEvent(Component.java:6311)
at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3285)
at java.awt.Component.processEvent(Component.java:6032)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4255)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
I have 3 clases in the proyect:
Interficie
- import controlP5.*;
class Interficie extends PApplet{
Cargador car;
Slider slider;
ControlP5 controlP5;
void setup() {
size(800,600);
background(0);
String folderPath = selectFolder(); // Opens file chooser
if (folderPath == null) {
// If a folder was not selected
println("No folder was selected...");
}
else {
// If a folder was selected, print path to folder
println(folderPath);
}
car = new Cargador(folderPath+"");
car.cargar();
slider = new Slider(car.getImagenes(),this);
controlP5 = new ControlP5(this);
controlP5.addButton("Siguiente",0,100,100,80,19);
controlP5.addButton("Anterior",255,100,120,80,19);
}
public void draw() {
stroke(255);
background(0);
slider.display();
image(slider.getImagenActual(),width/4,height/4,width/2,height/2);
}
/*public void mousePressed(){
car.imagenSiguiente();
}*/
public void Siguiente(int valor) {
slider.Siguiente(valor);
}
public void Anterior(int valor) {
slider.Anterior(valor);
}
public void mousePressed() {
slider.mousePressed();
}
- import java.util.ArrayList;
public class Cargador {
private ArrayList<PImage> imagenes;
private String ruta;
private int pos;
private PImage imgAct;
public Cargador(String ruta) {
this.ruta = ruta;
}
public void cargar() {
imagenes = new ArrayList();
String[] nombres = listarArchivos(ruta);
println(nombres);
for(int i= 0; i< nombres.length;i++) {
imagenes.add(loadImage(ruta+nombres[i]));
}
pos=0;
imgAct =(PImage)imagenes.toArray()[0];
}
String[] listarArchivos(String dir) {
File file = new File(dir);
if(file.isDirectory()) {
String names[] = file.list();
return names;
}
else {
return null;
}
}
public void imagenSiguiente() {
pos=(pos+1)%imagenes.size();
imgAct = (PImage)imagenes.toArray()[pos];
}
public void imagenAnterior() {
pos=(pos-1);
if(pos<0) {
pos=imagenes.size();
}
}
public ArrayList<PImage> getImagenes(){
return imagenes;
}
}
- class Slider{
ArrayList<PImage> imagenes;
private int numImagenes;
private int alto;
private int separacionx,separaciony;
private int posicion;
private int imgAct;
private float anchoImagen,altoImagen;
private PApplet parent;
public Slider(ArrayList<PImage> imagenes,PApplet parent){
this.imagenes = imagenes;
this.numImagenes = (10 > imagenes.size() ? imagenes.size():10);
this.alto = 100;
this.separacionx = 20;
this.separaciony=10;
this.posicion = 0;
this.imgAct=0;
this.parent = parent;
}
void display(){
parent.fill(255);
parent.rect(0,height-this.alto,width,height);
anchoImagen = ((width-(this.separacionx * (this.numImagenes+1)))/this.numImagenes);
altoImagen = (alto-this.separaciony*2);
for(int i = 0; i<numImagenes;i++){
int nImg = (int)(mouseX/(anchoImagen+separacionx));
println(mouseX);
if(mouseY >height - alto+separaciony && mouseY <height-separaciony && mouseX > anchoImagen*nImg + separacionx*(nImg+1) && nImg == i+posicion){
parent.image((PImage)imagenes.toArray()[i+posicion],(separacionx*(i+1)+(i*anchoImagen))-20,(height-alto+separaciony)-20,anchoImagen+40,altoImagen+40);
}
else{
image((PImage)imagenes.toArray()[i+posicion],separacionx*(i+1)+(i*anchoImagen),height-alto+separaciony,anchoImagen,altoImagen);}
}
}
public void Siguiente(int valor){
if(posicion+numImagenes+1 < imagenes.size()){
posicion++;
println(posicion);
}
}
public void Anterior(int valor){
if(posicion>=1){
posicion--;
println(posicion);
}
}
void mousePressed(){
if(mouseY >height - alto+separaciony && mouseY <height-separaciony){
int nImg = (int)(mouseX/(anchoImagen+separacionx));
if(mouseX > anchoImagen*nImg + separacionx*(nImg+1)){
imgAct = nImg;
}
}
}
PImage getImagenActual(){
return (PImage)imagenes.toArray()[imgAct];
}
}
1