I don't want to use the Codename One designer/gui builder, but I want to make my app with manual code. I have gained familiarity with Netbeans over the past three or four months, but when I opened a Codename One project I was confused and am not even sure where to start. This is some of the starting code when opening a new Codename One project:
public void start() {
if(current != null){
current.show();
return;
}
Form hi = new Form("Hi World");
hi.addComponent(new Label("Hi World"));
hi.show();
}
public void stop() {
current = Display.getInstance().getCurrent();
}
public void destroy() {
}
Does any one know where I can find a resource for the Codename One API? (found it) Can someone share some example code with working button on the start screen that takes the user to another screen that might have another button that takes them back to the start screen? (I think some example code would be very helpful to me in figuring out how to build my own application in Netbeans with Codename One.) Also, is there any better/easier way to build an app in Netbeans beside Codename One?
Please don't ask me to post what I have so far so you can help me, because I have nothing so far (in terms of code) -- only an idea of what I want the app to do.
They are all in subversion. You can check it out directly from Google code.
e.g. svn checkout https://codenameone.googlecode.com/svn/trunk/Demos/
Related
I have a problem:
I wrote a lobby plugin for a Minecraft server and now it doesn't quite work anymore.
In what way:
As soon as I reinstall the plugin, everything works perfectly. But as soon as I change something in a config file, only one method of the plugin loads.
I have linked the plugin here:
Plugin
Source Code
Would be cool if you guys can help me.
The issue appear because of lines like this one:
new File("plugins//Lobysystem//preandsuffixes.yml");
1) Don't write your own folder
Spigot already has API to do it. In the onEnable method, you can do saveDefaultConfig() that will create the folder for the plugin's config.
2) Use Spigot's informations
Such as spigot have multiple way to make config file fastly, you can do something like this (already with the plugin instance):
new File(getDataFolder(), "preandsuffixes.yml");
3) The static method will no longer work
Yes, if you have to use the plugin instance, all of the static {} method will not work. If you really want to keep a static method to load everything, you can do something like that:
public static loadConfig(Main plugin) {
myconfig = new File(plugin.getDataFolder(), "preandsuffixes.yml");
}
#Override
public void onEnable() {
loadConfig(this);
}
4) Stackoverflow guidelines
It's off-topic for an answer, but few tips :
Try to don't include link to download unknow source
Add a minimal reproductible example instead of just giving all the code
Don't decompile plugin.
Take the time to identify problem and to be more clear than "it was working but now it's no longer working"
I have lost all the morning searching for this problem on internet and nobody seems to face this problem.
My GWT application navigate very well. But as a logic requirement on my application it generates an email with a link to my application. The link is something like this:
http://server#place:token
Well, it navigate always to the same DefaultPlace i declare on initialization.
I have write a lot of logs in the client side. And it ignores completely the request. Even if i type this url in the browser, it loads default place.
My application navigates very well between places internally but now i realize that it happens not only with one particular place, but any place.
Could some one help me to realize what would be the problem. I could write the code if any want to see.
This is my PlacehistoryMapper:
#WithTokenizers({DefaultPlace.Tokenizer.class,
AuthenticationPlace.Tokenizer.class,
ProcessSnCallbackPlace.Tokenizer.class,
GatherUserInfoPlace.Tokenizer.class,
LoadProfilePlace.Tokenizer.class,
RegisterPlace.Tokenizer.class})
public interface AppPlacesHistoryMapper extends PlaceHistoryMapper
}
This is my ActivityMapper in getActivity override:
#Override
public Activity getActivity(Place place) {
Provider provider = getProvider(place);
if (provider == null) {
browserUtils.log("Error: " + place.getClass().getCanonicalName() + " Place is not mapped.");
return null;
}
return (Activity) provider.get();
}
And all activities all injected by GIN and works fine. But always when debug the default place is the only i see in those line. However if i change the place by goTo it works fine.
Thanks in advance.
Cheers
Albert.
I have developed an augmented reality project for android and I need to know how to use a virtual button to open a URL (website) in the application
thank you
After following the answer given HERE within the OnButtonPressed() function use the Application.OpenURL function to get it through a URL. Use the documentation linked for anything else.
Below is an example of how you might want to go about it.
public void OnButtonPressed(VirtualButtonAbstractBehaviour vb){
//specify which button you want to function by using the if statement
if(vb.name=="ButtonName") {
Application.OpenURL("http://www.xys.com/whateveryouwant")
}
}
Hope it helps.
I'm new at using Selenium and I'm surprised this question hasn't been asked before but, does anymore know how I can check all the links on a page to make sure none of them are broken?
If you want to check all the links on a page using selenium if so the first you need to click and you need to record first. And you can check with assertLocation. It was broken or not.But I want to give you some advice if you have many tests if so please use webdriver. Because IDE have many limitation.
You can check this article for webdriver Finding the broken links in a webpage using Selenium
First you need to fetch all the links.
public static void allLinks(WebDriver driver)
{
List<WebElement> links =driver.findElements(By.tagName("a"));
for(int i =0;i<links.size();i++)
{
System.out.println(links.get(i).getText());
}
}
Here I am just printing all the hyper links by using tag name as all hyperlinks have this anchor tag <a>.
Hope this helps.
I've divided my GWT app into multiple modules, what's the best way to navigate between them?
Currently I'm using Window.Location.assign("foo.html#bar") but is there a better way?
History.newItem only works for history within the current module. To change to another page I think the best way is to use Window.Location.assign.
I don't fully remember the issue (and perhaps it has been fixed now), but in our application we stopped using relative URLs as they would sometimes break (we have a comment referencing http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/f79e7d5e002b48f6).
To this end we had a method that did the following:
public void goToRelativePage(final String relativeURL) {
Window.Location.assign(GWT.getHostPageBaseURL() + relativeURL);
}