java - Displaying form on codition codename one

I am developing a application in codename one that required a user to login.I created a login form and a main form.I want to add a functionality that if the user is already logged in. main form will show.The function check if the app has a preference token of username with some open main form if the token does not have a value the login form will appear.i need help to know how to open forms designed in GUI Builderto be called in code.If you are experiencing an issue please mention the full platform your issue applies to:IDE: NetBeans/E...Read more

java - CodenameOne: convert smartphone / tablet app to Linux desktop app

I've written an app that works fine in the Codename One simulator (on smartphone and tablet Android / iOS virtual devices).Now I need to make it a Linux desktop application. According to the web page "How Do I - Create A Desktop Application With Codename One?", the automatic conversion to a desktop app is available only for Windows and Mac (for paid users).Is there any way to convert my app to a Linux executable, also manually? For semplicity, I don't need an installer and I can assume that the target Linux machines have JRE installed.Thank you...Read more

mobile - Getting Text from TextField in CodeName One for Java

I have designed the GUI elements and put everything together using CodeName One plugin for Netbeans 8.1. I am first working on my client information GUI that has textfields and a submit button. I'm looking to retrieve the textfield imputs via the submit button action event(I will use the first name textfield as an example:@Overrideprotected void onAddRecordGUI_SubmitButtonAction(Component c, ActionEvent event) { ..I tried this String Fname = findTxt_Firstn(c).getText(); ..I also tried this String FirstName = findTxt_Firstn.getText()...Read more

java - How can I make method final variable NOT change while entering in lambda

To begin with I am not sure how to express the issue but I am really stuck (I read this Why can I still make changes to this final variable? but it didn't help). I use CodenameOne framework but I am not sure too the issue spurts from it, it could be general java.In my App I am sending Reports to the server. It works great. The method is as follows in the Report class: public void sendAsync(SuccessCallback<Report> onSuccess) { // Update : With a shallow copy it does not work // final Report currentReport = this; // But with...Read more

java - Change Image with toggle button

I am new to Android developing. I managed to do a task to change an image for clicking two different buttons.My com.example.sandorhorvath.imageviewchange;import;import android.os.Bundle;import android.view.View;import android.widget.ImageView;public class MainActivity extends AppCompatActivity { public void lightBox(View view) { ImageView image = (ImageView) findViewById(; image.setImageResource(R.drawable.kawa2); } public void lightBox1(View ...Read more

AWS Lambda Java to S3 - java.lang.ClassNotFoundException on

I tried running the code below locally (as a maven project in Intellij) and it runs OK. When you try to run it as a Lambda function, I always get a java.lang.NoClassDefFoundError Somehow, lambda makes it so the class cannot be found when you include the AmazonS3 line below.package example;import;import;import;import;public class ParserLambda implements RequestHandl...Read more

java - How to implement clojure ISeq inJava?

I want to pass to Clojure a map of Java functions. The functions use Java anonymous classes that implement the IFn interface. I also need to implement the ISeq interface to pass lists. The ISeq interface is simple but has no documentation. I need to know what each method in ISeq does and/or find Java code of a class that implements all ISeq methods (I do not want to copy my lists to Clojure structures)....Read more

How to change this java code to clojure with same function?

How to change this java code to clojure?Let clojure code do the same thing? b;public class B { int c;} b;import java.util.*;public class A { public static void findElement(List<B> a) { a.forEach((z) -> { if (z.c == 1) { System.out.println(z.c); } }); } public static void main(String[] args) { // TODO Auto-generated method stub B x = new B(); x.c = 1; B y = new B(); y.c = 2; List<B> d = new ArrayList<B>(); d.add(x); d.add(y); findElement(d)...Read more

java - What exactly is Apache Camel?

I don't understand what exactly Camel does.If you could give in 101 words an introduction to Camel:What exactly is it? How does it interact with an application written in Java? Is it something that goes together with the server? Is it an independent program? Please explain what Camel is....Read more

java - Unzip a file using Apache Camel UnZippedMessageProcessor

Trying to unzip a file using Apache Camel, I tried the example given in but I can't find UnZippedMessageProcessor class. Here's the code:import java.util.Iterator;import org.apache.camel.builder.RouteBuilder;import org.apache.camel.dataformat.zipfile.ZipFileDataFormat;public class TestRoute extends RouteBuilder {@Overridepublic void configure() throws Exception { ZipFileDataFormat zipFile = new ZipFileDataFormat(); zipFile.setUsingIterator(true); from("file:src/test/resources/org/apache/...Read more

java - What are Apache Camel beans?

I have very recently started working with Apache Camel. I have an OK grasp of components, endpoints, routes and processors and I have started learning some EIPs as well.However, I can't seem to understand what are Camel Beans. At first I thought they were just POJOs, but apparently they are related to Camel's registry and I am confused: someone be kind enough to give me a "What are Camel Beans for dummies" definition?Thanks in advance, Pedro....Read more

java - Apache Camel : ValidatingProcessor : XSD validation

I'm trying to create a bundle and run it inside ServiceMix.I've encoutered a problem, any help is appreciated.What I'm trying to do:Produce SOAP messages from a CXF Endpoint and validate them against a XSD schema using Apache ServiceMix 5.0.0 (Camel 2.12.3).What I've done:Implemented a route that produces messages from a CXF endpoint and then validates them.The route's configure method:private RouteBuilder getInputRoute() { SoapValidatingProcessor soapValidatingProcessor = new SoapValidatingProcessor(); inputRoute = new RouteBuilder() { ...Read more

java - Apache Camel XmlJsonDataFormat XML to JSON

I have the following code, which I have taken from the Apache Camel web site:XmlJsonDataFormat xmlJsonFormat = new XmlJsonDataFormat();xmlJsonFormat.setEncoding("UTF-8");xmlJsonFormat.setForceTopLevelObject(true);xmlJsonFormat.setTrimSpaces(true);xmlJsonFormat.setRootName("newRoot");xmlJsonFormat.setSkipNamespaces(true);xmlJsonFormat.setRemoveNamespacePrefixes(true);xmlJsonFormat.setExpandableProperties(Arrays.asList("d", "e"));// from XML to JSONfrom("direct:marshal").marshal(xmlJsonFormat).to("mock:json"); // 1At the last line (marked 1), I ...Read more

java - camel AdviceWithRouteBuilder deprecation

I'm using camel 2.15.1 and I'm trying to use adviceWith() but I keep getting deprecation warnings. Below is the relevant snippet:routeDefinition.adviceWith(camelContext, new AdviceWithRouteBuilder(){ @Override public void configure() throws Exception { interceptSendToEndpoint("direct:doSomething") .skipSendToOriginalEndpoint() } });I know I can avoid the deprecation warnings by casting camelContext to ModelCamelContext but casting like that has a bit of a smell to it. Is casting the right way to...Read more