I want to add the contents of an arraylist has meu in a jsf page but playing me anything can you help me !!!! thnks
this is the method where i fill my arraylist from database in bean
public List<String> profession_pere_list;
public String profession_pere;
//....setters & getters
public List<String> getSelectProfessions() throws SQLException, NamingException{
profession_pere_list = new ArrayList<String>();
initctx = (Context) new InitialContext();
Context envContext = (Context) initctx.lookup("java:comp/env");
ds = (DataSource) envContext.lookup("jdbc/reinscription");
cnx = ds.getConnection();
state = cnx.createStatement();
rst = state.executeQuery("select profession from professions");
while(rst.next())
{
etu = new etudiants();
prof =rst.getString(1);
etu.setProfession_pere(prof);
//profession_pere=prof;
//etu.setProfession_pere(rst.getString(1).toString());
profession_pere_list.add(prof);
}
return profession_pere_list;}
and my jsf page:
<h:selectOneMenu value="#{etudiants.profession_pere}">
<f:selectItems value="#{etudiants.profession_pere_list}"/>
so i have this error unknown source !!!
javax.servlet.ServletException
javax.faces.webapp.FacesServlet.service(Unknown Source)
cause mère
java.lang.NullPointerException
com.sun.faces.renderkit.SelectItemsIterator$GenericObjectSelectItemIterator$GenericObjectSelectItem.updateItem(Unknown Source)
com.sun.faces.renderkit.SelectItemsIterator$GenericObjectSelectItemIterator$GenericObjectSelectItem.access$600(Unknown Source)
com.sun.faces.renderkit.SelectItemsIterator$GenericObjectSelectItemIterator.getSelectItemFor(Unknown Source)
com.sun.faces.renderkit.SelectItemsIterator$IterableItemIterator.next(Unknown Source)
com.sun.faces.renderkit.SelectItemsIterator$IterableItemIterator.next(Unknown Source)
com.sun.faces.renderkit.SelectItemsIterator.next(Unknown Source)
com.sun.faces.renderkit.html_basic.MenuRenderer.renderOptions(Unknown Source)
com.sun.faces.renderkit.html_basic.MenuRenderer.renderSelect(Unknown Source)
com.sun.faces.renderkit.html_basic.MenuRenderer.encodeEnd(Unknown Source)
javax.faces.component.UIComponentBase.encodeEnd(Unknown Source)
javax.faces.component.UIComponent.encodeAll(Unknown Source)
javax.faces.component.UIComponent.encodeAll(Unknown Source)
com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(Unknown Source)
com.sun.faces.application.view.MultiViewHandler.renderView(Unknown Source)
com.sun.faces.lifecycle.RenderResponsePhase.execute(Unknown Source)
com.sun.faces.lifecycle.Phase.doPhase(Unknown Source)
com.sun.faces.lifecycle.LifecycleImpl.render(Unknown Source)
javax.faces.webapp.FacesServlet.service(Unknown Source)
I had the same issue and the rason was a List modified concurently by different HTTP threads in ViewScoped bean:
#ViewScoped
public class Bean {
private List<Object> list;
public List<Object> getList() {
this.list = new ArrayList<>();
// code which modifies list
return this.list;
}
}
Solution - synchronize access to list:
public synchronized List<Object> getList() {
In my case I had sometimes your exception and sometimes ConcurrentModificationException.
I have also found another explanation:
http://www.adam-bien.com/roller/abien/entry/jsf_nullpointerexception_in_selectitemsiterator_java
When SelectItem label is null - you can also get your exception.
Related
let's consider this
We have an article and an article may be stored in many magasins(Stores)
and vice versa we can store many articles in one Store.
lets say we have
class Article{
int id_article;
String name;
List<Magasin> magasins;
List<Magasin> getMagasins{
return magasins;
}
lets say that Magasin class look like this
class Magasin{
int id_magasin;
String name;
//getters and setters
}
And let's say I have My tableView in javafx :
TableView tblArticles;
first column contain article name and second column Want it to contain name of all magasins (stores ) that the articles is stored in ( magasin-1, magasin-2 .. magasin-N)
I want also to ask if I can make the cell as a column that means that every name of song will be display vertically just like a list view and all of them for sure for one specif artist ..
UPDATE :
this is the code I have added to my controller :
//FRom FXML file
#FXML
TableColumn<Article, List<Magasin>> colMag ;
PropertyValueFactory<Article, List<Magasin>> mag = new PropertyValueFactory<>("magasins");
//CellValueFactory
colMag.setCellValueFactory(mag);
//cell Factory
colMag2.setCellFactory( col -> {
ListView<Magasin> listView = new ListView<>();
listView.setCellFactory(lv -> new ListCell<Magasin>() {
#Override
public void updateItem(Magasin magasin, boolean empty) {
super.updateItem(magasin, empty);
if (empty) {
setText(null);
} else {
setText(magasin.getLibelle());
}
}
});
return new TableCell<Article, List<Magasin>>() {
#Override
public void updateItem(List<Magasin> mags, boolean empty) {
super.updateItem(mags, empty);
if (empty) {
setGraphic(null);
} else {
listView.getItems().setAll(mags);
setGraphic(listView);
}
}
};
});
When I run this I got the error :
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$154(LauncherImpl.java:182)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
at java.util.AbstractCollection.addAll(AbstractCollection.java:343)
at javafx.collections.ModifiableObservableListBase.addAll(ModifiableObservableListBase.java:99)
at javafx.collections.ModifiableObservableListBase.setAll(ModifiableObservableListBase.java:88)
at controllers.DashboardController$6.updateItem(DashboardController.java:1180)
at controllers.DashboardController$6.updateItem(DashboardController.java:1173)
at javafx.scene.control.TableCell.updateItem(TableCell.java:663)
at javafx.scene.control.TableCell.indexChanged(TableCell.java:468)
at javafx.scene.control.IndexedCell.updateIndex(IndexedCell.java:116)
at com.sun.javafx.scene.control.skin.TableRowSkinBase.updateCells(TableRowSkinBase.java:533)
at com.sun.javafx.scene.control.skin.TableRowSkinBase.init(TableRowSkinBase.java:147)
at com.sun.javafx.scene.control.skin.TableRowSkin.<init>(TableRowSkin.java:64)
at javafx.scene.control.TableRow.createDefaultSkin(TableRow.java:212)
at javafx.scene.control.Control.impl_processCSS(Control.java:872)
I am writing junit for post using rest-assured, and while executing
My Test Class:
public class PolicyResourceTest {
private static MockRESTServer server;
#BeforeClass
public static void setUpBeforeClass() throws Exception {
server = new MockRESTServer(8080, new PolicyResource());
server.start();
}
#AfterClass
public static void tearDownAfterClass() throws Exception {
server.stop();
}
#Test
public final void testCreatePolicy() {
Policy policy=new Policy();
policy.setName("policy123");
RestAssured.with()
.contentType("application/json")
.accept("application/json")
.body(policy)
.post("/create")
.then()
.assertThat()
.statusCode(200);
}
My Resource Class:
#Path("/")
public class PolicyResource {
#POST
#Path("/create")
#Consumes(MediaType.APPLICATION_JSON)
#Produces(MediaType.APPLICATION_JSON)
public Response test( Policy messageBody) {
System.out.println("policy: "+messageBody);
return Response.ok().status(200).build();
}
}
I am getting below exception:
org.apache.http.NoHttpResponseException: localhost:8080 failed to respond
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:281)
at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:257)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:207)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:684)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:486)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:835)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
at org.apache.http.client.HttpClient$execute$0.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
at io.restassured.internal.RequestSpecificationImpl$RestAssuredHttpBuilder.doRequest(RequestSpecificationImpl.groovy:2028)
at io.restassured.internal.http.HTTPBuilder.post(HTTPBuilder.java:349)
at io.restassured.internal.http.HTTPBuilder$post$2.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
at io.restassured.internal.RequestSpecificationImpl.sendRequest(RequestSpecificationImpl.groovy:1202)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
#Anju Singh, Make sure your back end is working properly.
I tried the request on my local as we as on the mock api and was successfully able to test for Objects as well. The exception you received org.apache.http.NoHttpResponseException: localhost:8080 failed to respond is from the Server. There is no issue from RestAssured or JUnit to resolve.
#Test(enabled=true)
public void sampleTester() {
EnrollEmail email = new EnrollEmail();
email.setEmailAddress("sample#domain.com");
RestAssured.given().contentType(ContentType.JSON).body(email).when().post("https://jsonplaceholder.typicode.com/posts").then()
.assertThat()
.statusCode(201);
}
#Test(enabled=true)
public void sampleTester2() {
EnrollEmail email = new EnrollEmail();
email.setEmailAddress("sample#domain.com");
RestAssured.given().contentType(ContentType.JSON).body(email).when().post("http://localhost:8089/posts").then()
.assertThat()
.statusCode(201);
}
I have tried this simple example and after hours spent still can not resolve the problem. I was wondering if anyone has any idea?
import org.apache.jena.rdf.model.*;
import org.apache.jena.vocabulary.*;
/** Tutorial 1 creating a simple model
*/
public class Tutorial01 extends Object {
// some definitions
static String personURI = "http://somewhere/JohnSmith";
static String fullName = "John Smith";
public static void main (String args[]) {
// create an empty model
Model model = ModelFactory.createDefaultModel();
// create the resource
Resource johnSmith = model.createResource(personURI);
// add the property
johnSmith.addProperty(VCARD.FN, fullName);
}
}
After running the program..
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/jena/rdf/model/ModelFactory
at jena.Tutorial01.main(Tutorial01.java:17)
Caused by: java.lang.ClassNotFoundException:
org.apache.jena.rdf.model.ModelFactory
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
I am trying to learn JavaFX with the library OpenCV for my degree. I want to make a program that detects people. We can name it people counter. I saw some videos already and I want to do that too.
The problem is that I have to start to learn JavaFX and the library OpenCV.
So I started to create a simple project that starts / pause the webcam and take a snapshot. I saw someone on youtube doing this and I started to recreate it.
The problem is that I have this error:
Exception in Application start method
java.lang.reflect.InvocationTargetException
My code is:
Main
package application;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.fxml.FXMLLoader;
public class Main extends Application {
#Override
public void start(Stage primaryStage) {
try {
BorderPane root = (BorderPane) FXMLLoader.load(getClass().getResource("Camera.fxml"));
Scene scene = new Scene(root, 400, 400);
scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show();
} catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
launch(args);
}
}
CameraController
package application;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import javax.imageio.ImageIO;
import javafx.embed.swing.SwingFXUtils;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.image.ImageView;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.MatOfByte;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.videoio.VideoCapture;
public class CameraController {
// definitions
#FXML
private Button btn_start, btn_pause, btn_snapshot;
#FXML
private ImageView imgView;
private DaemonThread myThread = null;
int count = 0;
VideoCapture webSource = null;
Mat frame = new Mat();
MatOfByte mem = new MatOfByte(); /// start button
#FXML
protected void startClick(ActionEvent event) {
webSource =new VideoCapture(0);
myThread = new DaemonThread();
Thread t = new Thread(myThread);
t.setDaemon(true);
myThread.runnable = true;
t.start();
btn_start.setDisable(true);
btn_pause.setDisable(false); // stop button
}
#FXML
protected void pauseClick(ActionEvent event) {}
#FXML
protected void snapshotClick(ActionEvent event) {}
class DaemonThread implements Runnable {
protected volatile boolean runnable = false;
#Override
public void run() {
synchronized (this) {
while (runnable) {
if (webSource.grab()) {
try {
webSource.retrieve(frame);
Imgcodecs.imencode(".bmp", frame, mem);
Image im = ImageIO.read(new ByteArrayInputStream(mem.toArray()));
BufferedImage buff = (BufferedImage) im;
imgView.setImage(SwingFXUtils.toFXImage(buff, null));
if (!runnable) {
System.out.println("Going to wait()");
this.wait();
}
} catch (Exception ex) {
System.out.println("Error");
}
}
}
}
}
}
/////////////////////////////////////////////////////////
}
}
The problem is on this line:
BorderPane root = (BorderPane) FXMLLoader.load(getClass().getResource("Camera.fxml"));
Scene scene = new Scene(root,400,400);
Full console error:
Exception in Application start method
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(LauncherImpl.java:182)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.UnsatisfiedLinkError: org.opencv.core.Mat.n_Mat()J
at org.opencv.core.Mat.n_Mat(Native Method)
at org.opencv.core.Mat.<init>(Mat.java:24)
at application.CameraController.<init>(CameraController.java:34)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.reflect.misc.ReflectUtil.newInstance(Unknown Source)
at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:927)
at javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:971)
at javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:220)
at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:744)
at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2707)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2527)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
at application.Main.start(Main.java:15)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
... 1 more
Exception running application application.Main
Thank you in advance!
Try this it worked for me nu.pattern.OpenCV.loadShared();
I fixed the problem by just adding System.loadLibrary(Core.NATIVE_LIBRARY_NAME):
public static void main(String[] args) {
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
launch(args);
}
I encountered really a strange problem with using a ControlP5 ListBox in my program. I found an example of ListBox use from the official page of ControlP5 library: http://www.sojamo.de/libraries/controlP5/examples/controllers/ControlP5listBox/ControlP5listBox.pde I did some simple changes like changing listbox width and height, setting different colors. The main difference consist in the fact I'm using an arrayList of Strings to populate listbox. Here is the complete code for this scetch:
import javax.swing.*;
PFrame f;
public class PFrame extends JFrame {
public SecondApplet s;
public PFrame(int width, int height,ArrayList<String> companiesTxt) {
setBounds(100, 100, width, height);
s = new SecondApplet(companiesTxt);
add(s);
s.init();
show();
}
}
public class SecondApplet extends PApplet {
ArrayList<String> companiesText;
ControlP5 cp5;
ListBox l;
ControlWindow controlWindow;
SecondApplet(ArrayList<String> cmpTxt){
companiesText = cmpTxt;
}
void setup(){
size(400, 720);
ControlP5.printPublicMethodsFor(ListBox.class);
cp5 = new ControlP5(this);
l = cp5.addListBox("myList")
.setPosition(0, 0)
.setSize(382, 720)
.setItemHeight(18)
.setBarHeight(18)
.setColorBackground(color(243, 45,98))
.setColorActive(color(0))
.setColorForeground(color(255, 100,0))
;
l.captionLabel().toUpperCase(true);
l.captionLabel().set("Companies");
l.captionLabel().setColor(0xffff0000);
l.captionLabel().style().marginTop = 3;
l.valueLabel().style().marginTop = 3;
for (int i=0;i != companiesText.size();i++) {
ListBoxItem lbi = l.addItem(companiesText.get(i), i);
lbi.setColorBackground(color(243, 45,98));
}
}
void draw(){
}
}
When I try to scroll this listbox, I get an exception:
java.lang.ArrayIndexOutOfBoundsException: 8217
at controlP5.BitFont.getGlyph(Unknown Source)
at processing.core.PGraphics.textCharImpl(PGraphics.java:4681)
at processing.core.PGraphics.textLineImpl(PGraphics.java:4669)
at processing.core.PGraphicsJava2D.textLineImpl(PGraphicsJava2D.java:1787)
at processing.core.PGraphics.textLineAlignImpl(PGraphics.java:4659)
at processing.core.PGraphics.text(PGraphics.java:4356)
at processing.core.PGraphics.text(PGraphics.java:4307)
at processing.core.PApplet.text(PApplet.java:13183)
at controlP5.ControlFont.draw(Unknown Source)
at controlP5.Label.draw(Unknown Source)
at controlP5.Label$SinglelineLabel.draw(Unknown Source)
at controlP5.Label.draw(Unknown Source)
at controlP5.Button$ButtonView.display(Unknown Source)
at controlP5.Button$ButtonView.display(Unknown Source)
at controlP5.Controller.draw(Unknown Source)
at controlP5.ControllerGroup.drawControllers(Unknown Source)
at controlP5.ControllerGroup.draw(Unknown Source)
at controlP5.ControllerGroup.drawControllers(Unknown Source)
at controlP5.ControllerGroup.draw(Unknown Source)
at controlP5.ControlWindow.draw(Unknown Source)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at processing.core.PApplet$RegisteredMethods.handle(PApplet.java:1236)
at processing.core.PApplet$RegisteredMethods.handle(PApplet.java:1229)
at processing.core.PApplet.handleMethods(PApplet.java:1423)
at processing.core.PApplet.handleDraw(PApplet.java:2401)
at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:240)
at processing.core.PApplet.run(PApplet.java:2256)
at java.lang.Thread.run(Unknown Source)
I'm almost desperate because I do not understand what can be wrong in this case? Please, can you give me any suggestions?
The problem was resolved. I was using some strings that are not aschii characters. GetGlyph function looks like this:
public Glyph getGlyph(char c) {
return glyphs[(int) (c)];
}
So, when you want to use a listbox convert characters to aschii:
for (int i=0;i < companiesText.size();i++) {
try{
ListBoxItem lbi = l.addItem(newString(companiesText.get(i).getBytes("US-ASCII"),"US-ASCII"), i);
lbi.setColorBackground(color(243, 45,98));
}catch(Exception e){
}
}