<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>406 Not Acceptable &#187; j2me</title>
	<atom:link href="http://406notacceptable.com/category/java/j2me/feed/" rel="self" type="application/rss+xml" />
	<link>http://406notacceptable.com</link>
	<description>406 Not Acceptable, not just an error message, but now a blog!</description>
	<lastBuildDate>Tue, 28 Jun 2011 15:13:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>ArrayList in J2ME and generics</title>
		<link>http://406notacceptable.com/java/j2me/arraylist-in-j2me-and-generics/</link>
		<comments>http://406notacceptable.com/java/j2me/arraylist-in-j2me-and-generics/#comments</comments>
		<pubDate>Thu, 01 Apr 2010 10:09:33 +0000</pubDate>
		<dc:creator>Jim</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[j2me]]></category>
		<category><![CDATA[arraylists]]></category>
		<category><![CDATA[j2me code]]></category>
		<category><![CDATA[j2me performance]]></category>
		<category><![CDATA[J2ME Polish]]></category>
		<category><![CDATA[NaStar]]></category>

		<guid isPermaLink="false">http://www.406notacceptable.com/?p=130</guid>
		<description><![CDATA[As you may, or may not know, J2ME does not support the ArrayList functionality of standard Java. In addition, as J2ME is based on Java 1.3 it does not feature generics. This means as a developer you are stuck with a choice of using arrays or vectors. Now arrays are fast, but you are stuck [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>As you may, or may not know, J2ME does not support the ArrayList functionality of standard Java. In addition, as J2ME is based on Java 1.3 it does not feature generics. This means as a developer you are stuck with a choice of using arrays or vectors. Now arrays are fast, but you are stuck with the initial size and a number of other issues. These are things you really do not want to be messing around with, unless speed is of the highest priority.</p>
<p>Whilst Vectors are dynamic, they bring about one annoying issue &#8211; you have to cast each entry back from an Object type to its original type on retrieval. This takes up a lot of processor cycles, and on phones processor cycles are a limited commodity. Secondly, you will have to use the Vector enumerator to iterate through your vectors. This is very processor intensive, in NaStar I found this was using around 30% of my cycles! Finally Vectors are synchronised, this means they are thread safe. Now a synchronised collection is much slower than an unsynchonised one; plus, you will most likely not need the safety benefits synchronisation brings. As you will usually be using one thread for acessing your collections in a game (in the main game loop.)</p>
<p>Now the J2ME Polish project gives you the chance to use some Java 1.5 features, most importantly generics are included. Second, an arraylist implementation is included, which uses generics. However, many people have had issues with integrating this plugin to their chosen IDE. I have worked out some <a title="J2ME Polish Netbeans Integration" href="http://www.406notacceptable.com/j2me/fixing-j2me-polish-integration-with-netbeans-6/" target="_self">fixes for Netbeans J2ME Polish integration</a>, but when coding my project decided against using the tools.</p>
<p>So you now find yourself stuck between no generics, slow vectors, or fixing (and maintaining) a plugin.</p>
<p>If all you want is access to ArrayLists or generics, your best bet is to strip the ArrayList code from J2ME Polish and create your own lists. I guess you could simply find an implementation of ArrayList floating around on the web, but the J2ME Polish code is very good. You will then simply create a number of new ArrayList classes, such as SpriteList, EnemyList, et al. There will be two other classes that the ArrayList depends on, you should also clone these for each implementation; these will let you use for each loops! Let each list only deal with one defined type. Now you will no longer have to deal with Vectors and their iterators and will find your game runs a lot faster! I found around 20 &#8211; 60% of processor time was dealing with Iterators; whilst ArrayLists cut this down to under 10%. For my project this was the best performance tweak available.</p>
<p>Before anyone asks, no you can&#8217;t play my game! Sadly the rights are held by the University of Birmingham <img src='http://406notacceptable.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  Whilst I doubt they care much about a J2Me game!</p>


<p>No related posts.</p><hr />
<p><small>&copy; jim for <a href="http://406notacceptable.com">406 Not Acceptable</a>, 2010. |
<a href="http://406notacceptable.com/java/j2me/arraylist-in-j2me-and-generics/">Permalink</a> |
<a href="http://406notacceptable.com/java/j2me/arraylist-in-j2me-and-generics/#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://406notacceptable.com/java/j2me/arraylist-in-j2me-and-generics/&amp;title=ArrayList in J2ME and generics">del.icio.us</a>
<br/>
Post tags: <a href="http://406notacceptable.com/tag/arraylists/" rel="tag">arraylists</a>, <a href="http://406notacceptable.com/tag/j2me-code/" rel="tag">j2me code</a>, <a href="http://406notacceptable.com/tag/j2me-performance/" rel="tag">j2me performance</a>, <a href="http://406notacceptable.com/tag/j2me-polish/" rel="tag">J2ME Polish</a>, <a href="http://406notacceptable.com/tag/nastar/" rel="tag">NaStar</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://406notacceptable.com/java/j2me/arraylist-in-j2me-and-generics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Collision detection in J2ME</title>
		<link>http://406notacceptable.com/java/j2me/collision-detection-in-j2me/</link>
		<comments>http://406notacceptable.com/java/j2me/collision-detection-in-j2me/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 13:20:49 +0000</pubDate>
		<dc:creator>Jim</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[j2me]]></category>
		<category><![CDATA[java code]]></category>
		<category><![CDATA[game development]]></category>
		<category><![CDATA[j2me code]]></category>

		<guid isPermaLink="false">http://www.406notacceptable.com/?p=144</guid>
		<description><![CDATA[I am going to show a basic exclusion collision algorithm for J2ME. Whilst the Sprite class has collision detection methods, they are not very flexible and are useless when checking how objects collide. For example, in a bat and ball game you probably will want to know which edge the ball collides with in order [...]


Related posts:<ol><li><a href='http://406notacceptable.com/java/j2me/arraylist-in-j2me-and-generics/' rel='bookmark' title='Permanent Link: ArrayList in J2ME and generics'>ArrayList in J2ME and generics</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I am going to show a basic exclusion collision algorithm for J2ME. Whilst the Sprite class has collision detection methods, they are not very flexible and are useless when checking how objects collide. For example, in a bat and ball game you probably will want to know which edge the ball collides with in order to bet the ball to bounce correctly.</p>
<p>Exclusion collision detection is done by checking where certain parts of the two items are in correspondence to each other. Basically if the highest point of item A is lower than the lowest part of item B, it is not possible for the items to collide.</p>
<p>In addition, you can order your method based on which direction you are expecting collisions to usually occur from. This will then be more efficient than even the box detection method offered by the Sprite class.</p>
<p>public boolean collisionBetween(Sprite a, Sprite b)</p>
<p>{</p>
<p>if (a.getY() &gt; (b.getY() + b.getHeight()))<br />
{<br />
//Not collided b is above a</p>
<p>return false;<br />
}<br />
else<br />
{<br />
if ((a.getY() + a.getHeight()) &lt; b.getY())<br />
{<br />
//Not collided b is below a</p>
<p>return false;<br />
}<br />
else<br />
{<br />
if (a.getX() &gt; (b.getY() + b.getWidth()))<br />
{<br />
//Not collided b is to the left of a</p>
<p>return false;<br />
}<br />
else<br />
{<br />
if ((a.getX() + a.getWidth()) &lt; b.getX())<br />
{<br />
//Not collided b is to the right of a</p>
<p>return false;<br />
}<br />
}<br />
}<br />
}</p>
<p>//There is a collision</p>
<p>return true;</p>
<p>}<br />
There might be a parenthesis error in here, as I did this in notepad at work. So I couldn&#8217;t check the syntax! From the formatting &#8212; which Wordpress kindly destroyed &#8212; it looks fine though.</p>


<p>Related posts:<ol><li><a href='http://406notacceptable.com/java/j2me/arraylist-in-j2me-and-generics/' rel='bookmark' title='Permanent Link: ArrayList in J2ME and generics'>ArrayList in J2ME and generics</a></li>
</ol></p><hr />
<p><small>&copy; jim for <a href="http://406notacceptable.com">406 Not Acceptable</a>, 2008. |
<a href="http://406notacceptable.com/java/j2me/collision-detection-in-j2me/">Permalink</a> |
<a href="http://406notacceptable.com/java/j2me/collision-detection-in-j2me/#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://406notacceptable.com/java/j2me/collision-detection-in-j2me/&amp;title=Collision detection in J2ME">del.icio.us</a>
<br/>
Post tags: <a href="http://406notacceptable.com/tag/game-development/" rel="tag">game development</a>, <a href="http://406notacceptable.com/tag/j2me/" rel="tag">j2me</a>, <a href="http://406notacceptable.com/tag/j2me-code/" rel="tag">j2me code</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://406notacceptable.com/java/j2me/collision-detection-in-j2me/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sorry about the lack of J2ME&#8230;</title>
		<link>http://406notacceptable.com/java/j2me/sorry-abo/</link>
		<comments>http://406notacceptable.com/java/j2me/sorry-abo/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 13:21:13 +0000</pubDate>
		<dc:creator>Jim</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[j2me]]></category>
		<category><![CDATA[university]]></category>
		<category><![CDATA[games]]></category>

		<guid isPermaLink="false">http://www.406notacceptable.com/java/sorry-abo/</guid>
		<description><![CDATA[I&#8217;ve decided that it would be best to me to hold back any articles on J2Me until after I have finished my project. I am not doing this because I do not have the time, but instead for plagiarism purposes. After all I would be posting code from my project onto this site and that [...]


Related posts:<ol><li><a href='http://406notacceptable.com/java/j2me/arraylist-in-j2me-and-generics/' rel='bookmark' title='Permanent Link: ArrayList in J2ME and generics'>ArrayList in J2ME and generics</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve decided that it would be best to me to hold back any articles on J2Me until after I have finished my project. I am not doing this because I do not have the time, but instead for plagiarism purposes. After all I would be posting code from my project onto this site and that may flag up on some plagiarism detection program and give me some serious hassle. The bigger issue is if anyone steals the content from this site (unlikely) and that gets picked up&#8230; then I&#8217;d have even more hassle to deal with.</p>
<p>Anyway, expect this stuff in September/October. I&#8217;ll have a few articles written ready for when I finish the project.</p>
<p>What&#8217;s really annoying is that some people get an extra 4 days to do their coding&#8230; that&#8217;s not what I&#8217;d be calling fair&#8230;</p>


<p>Related posts:<ol><li><a href='http://406notacceptable.com/java/j2me/arraylist-in-j2me-and-generics/' rel='bookmark' title='Permanent Link: ArrayList in J2ME and generics'>ArrayList in J2ME and generics</a></li>
</ol></p><hr />
<p><small>&copy; jim for <a href="http://406notacceptable.com">406 Not Acceptable</a>, 2008. |
<a href="http://406notacceptable.com/java/j2me/sorry-abo/">Permalink</a> |
<a href="http://406notacceptable.com/java/j2me/sorry-abo/#comments">One comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://406notacceptable.com/java/j2me/sorry-abo/&amp;title=Sorry about the lack of J2ME&#8230;">del.icio.us</a>
<br/>
Post tags: <a href="http://406notacceptable.com/tag/games/" rel="tag">games</a>, <a href="http://406notacceptable.com/tag/j2me/" rel="tag">j2me</a>, <a href="http://406notacceptable.com/tag/java/" rel="tag">Java</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://406notacceptable.com/java/j2me/sorry-abo/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fixing J2ME Polish Integration With Netbeans 6</title>
		<link>http://406notacceptable.com/java/j2me/fixing-j2me-polish-integration-with-netbeans-6/</link>
		<comments>http://406notacceptable.com/java/j2me/fixing-j2me-polish-integration-with-netbeans-6/#comments</comments>
		<pubDate>Thu, 21 Aug 2008 13:07:41 +0000</pubDate>
		<dc:creator>Jim</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[j2me]]></category>
		<category><![CDATA[J2ME Polish]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[Netbeans J2ME Polish]]></category>

		<guid isPermaLink="false">http://www.406notacceptable.com/j2me/fixing-j2me-polish-integration-with-netbeans-6/</guid>
		<description><![CDATA[J2ME Polish is a really neat package for J2ME programming. Really all I want it for is to change all my annoying Vectors into ArrayLists for speed. Now there are a few issues with the integration plugin on both Windows and Linux when using Netbeans. Heck it doesn&#8217;t even work properly on Netbeans 5.5, never [...]


Related posts:<ol><li><a href='http://406notacceptable.com/java/j2me/arraylist-in-j2me-and-generics/' rel='bookmark' title='Permanent Link: ArrayList in J2ME and generics'>ArrayList in J2ME and generics</a></li>
<li><a href='http://406notacceptable.com/operating-systems/fixing-flac-music-for-the-n900-media-player/' rel='bookmark' title='Permanent Link: Fixing FLAC music for the N900 media player'>Fixing FLAC music for the N900 media player</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>J2ME Polish is a really neat package for J2ME programming. Really all I want it for is to change all my annoying Vectors into ArrayLists for speed. Now there are a few issues with the integration plugin on both Windows and Linux when using Netbeans. Heck it doesn&#8217;t even work properly on Netbeans 5.5, never mind Netbeans 6, 6.1, or 6.5&#8230;</p>
<p>Now what&#8217;s the only thing better than a poor integration plugin? No support, that&#8217;s what! A quick check on the J2ME Polish forums and you will find numerous posts asking how to fix these errors. So if you&#8217;ve tried going to the forums and had no luck (like everyone else,) you&#8217;ve come to the right place.</p>
<p>So here are a list of the problems and how to fix them.</p>
<p><strong>Â When starting NetBeans it prompts you with a message that states &#8220;org.netbeans.modules.java.platform/1 &gt;1.10 required version found 1.9.2&#8243;(Or some other version) with options &#8220;Disable and continue or Exit&#8221;.</strong></p>
<p>This one&#8217;s an annoying one, which occurs every now and again. I got this on 6.0 on Linux and 5.5 on Windows, but not with 6.5 on Windows. So how do you fix it?</p>
<p>Go to:</p>
<p>/usr/share/netbeans/platform7/modules</p>
<p>or in Windows (x being a version number)</p>
<p>Program Files\NetBeans 6.x\nb6.x\modules</p>
<p>If you can&#8217;t find this folder just search forÂ  &#8220;de-enough-polish-netbeans.jar&#8221; as this is the file you need to edit. Open up &#8220;de-enough-polish-netbeans.jar&#8221; with a zip program (Winrar, rileroller, Winzip, etc) and edit the file at META-INF/MANIFEST.MF wih a text editor (notepad.) There will be a sentence that states:</p>
<p>org.netbeans.modules.java.platform/1 &gt; 1.10</p>
<p>Change it to</p>
<p>org.netbeans.modules.java.platform/1 &gt; 1.0</p>
<p>Reactivate the plugin in Netbeans and enjoy!</p>
<p><strong>You are prompted to resolve reference problems relating to &#8220;Emulator Platform&#8221; or &#8220;SUN WTK 2.2 etc&#8230;&#8221; not being found.</strong></p>
<p>This occurs to everyone&#8230;</p>
<p>Go to your an existing (non polish) project folder and open the folder nbproject. There should be a file called project.properties, open this with a text editor. Scroll down and there should be two lines stating:</p>
<p>platform.active=Sun_Java_TM__Wireless_Toolkit_2_5_2_for_CLDC<br />
platform.active.description=Sun Java(TM) Wireless Toolkit 2.5.2 for CLDC</p>
<p>The versions may be different, as you may have a later Wireless Toolkit!</p>
<p>Now open the same file in your J2ME Polish project and replace the platform.active and platform.active.description lines with the ones from the non polish project.</p>
<p>Replace every occurance of &#8220;MPowerPlayer&#8221; with Sun_Java_TM__Wireless_Toolkit_2_5_2_for_CLDC (or what you had in your old project.)</p>
<p>Replace every occurance of &#8220;Emulator Platform&#8221; with Sun Java(TM) Wireless Toolkit 2.5.2 for CLDCÂ  (or what you had in your old project.)</p>
<p>Close Netbeans and reopen and all should be fixed!</p>


<p>Related posts:<ol><li><a href='http://406notacceptable.com/java/j2me/arraylist-in-j2me-and-generics/' rel='bookmark' title='Permanent Link: ArrayList in J2ME and generics'>ArrayList in J2ME and generics</a></li>
<li><a href='http://406notacceptable.com/operating-systems/fixing-flac-music-for-the-n900-media-player/' rel='bookmark' title='Permanent Link: Fixing FLAC music for the N900 media player'>Fixing FLAC music for the N900 media player</a></li>
</ol></p><hr />
<p><small>&copy; jim for <a href="http://406notacceptable.com">406 Not Acceptable</a>, 2008. |
<a href="http://406notacceptable.com/java/j2me/fixing-j2me-polish-integration-with-netbeans-6/">Permalink</a> |
<a href="http://406notacceptable.com/java/j2me/fixing-j2me-polish-integration-with-netbeans-6/#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://406notacceptable.com/java/j2me/fixing-j2me-polish-integration-with-netbeans-6/&amp;title=Fixing J2ME Polish Integration With Netbeans 6">del.icio.us</a>
<br/>
Post tags: <a href="http://406notacceptable.com/tag/j2me/" rel="tag">j2me</a>, <a href="http://406notacceptable.com/tag/j2me-polish/" rel="tag">J2ME Polish</a>, <a href="http://406notacceptable.com/tag/java/" rel="tag">Java</a>, <a href="http://406notacceptable.com/tag/netbeans/" rel="tag">netbeans</a>, <a href="http://406notacceptable.com/tag/netbeans-j2me-polish/" rel="tag">Netbeans J2ME Polish</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://406notacceptable.com/java/j2me/fixing-j2me-polish-integration-with-netbeans-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

