Simple code to see if array of primitives has duplicates. The aim is to only check if there are any duplicates, but not to check what element is repeated, or its position etc. PS: Do you know some handy snippet? Don't way, post it!

Member Avatar
Member Avatar
+4 forum 5

Sometimes one line of tool tip is not enough. You may want to try and play around with JToolTip, but if you in hurry this "little hack" can be handy. With little of HTML plus CSS code you can work out various formats (font, colour, alignment, size etc.).

Member Avatar
Member Avatar
+2 forum 3

In my current project we need to provide drag&drop functionality of items from left to right and vice-versa and on click of the button send array of item IDs to server. Main problem was that we couldn't get array across to server and online examples that we found did not work. Above snippet will grab "id" attribute of all list elements (order/unorder list) from container with ID of "sortable2". Push IDs from listed elements to array "ids". After that, it will get currently selected value from drop down menu and store it in "id" variable that is used in next …

Member Avatar
+2 forum 0

Here is simple example of static image to be displayed as logo on the start-up/splash screen. This can be improved by creating animation out of series of images or use of flash file through [URL="http://developer.sonyericsson.com/site/global/newsandevents/latestnews/newsapr08/p_project_capuchin_announcement.jsp"]Project Capuchin[/URL] library. As for location of image file this was placed in new folder called "res" as resources. The folder is on same level as "myProject" folder that holds Java classes. If you decide to have "res" folder placed inside "myProject" folder then image path will be [icode]/myProject/res/IMAGE_NAME[/icode] ProjectMIDlet.java [code=Java]package myProject; /** * Created by IntelliJ IDEA. * User: Peter * URL: [url]http://www.peterscorner.co.uk[/url] * Date: …

Member Avatar
+6 forum 0

This is simple example how to get data reading from mobile phone's in-built sensor with JSR-256 and Java Microedition SensorMidlet.java [code=java]/** * * @author Peter Miklosko * @homepage http://www.peterscorner.co.uk */ import javax.microedition.midlet.MIDlet; import javax.microedition.lcdui.Canvas; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.CommandListener; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Displayable; public class SensorMidlet extends MIDlet implements CommandListener { private Canvas mCanvas; private Command exitCommand; private SensorData sd = new SensorData(); public void startApp() { Display display = Display.getDisplay(this); if(mCanvas == null) { mCanvas = new SensorCanvas(sd); exitCommand = new Command("Exit", Command.EXIT, 0); mCanvas.addCommand(exitCommand); mCanvas.setCommandListener(this); } display.setCurrent(mCanvas); } public void pauseApp() { } public void destroyApp(boolean unconditional) { } …

Member Avatar
+0 forum 0

The End.