Time |
S |
Nick |
Message |
13:52 |
|
|
mr_lou joined ##friendlyjava |
14:21 |
|
aditsu |
mr_lou: hi, so first of all, you're not supposed to write applets :p |
14:21 |
|
mr_lou |
Yes I am! :-D |
14:21 |
|
mr_lou |
But to be honest, I'm not. |
14:21 |
|
mr_lou |
I *am* however working with old Java. As in 1.1.8 |
14:21 |
|
mr_lou |
java.awt stuff |
14:22 |
|
aditsu |
eww |
14:23 |
|
mr_lou |
I'm thinking about making a small Java tool I can use on my old Ericsson MC218 pocket computer, to create graphics for Amstrad CPC retro games. |
14:23 |
|
mr_lou |
Has to be 1.1.8 to run on that old thing. |
14:23 |
|
aditsu |
I tried that code, and it didn't crash |
14:25 |
|
aditsu |
it shows "Bad Double-buffered" and draws a red square that follows the mouse |
14:26 |
|
mr_lou |
Hm |
14:26 |
|
mr_lou |
I can't call a getGraphics() on a java.awt.Image here. |
14:27 |
|
aditsu |
on that device? or on your computer? |
14:29 |
|
aditsu |
also, did you create that image with createImage? |
14:29 |
|
mr_lou |
MC218 |
14:30 |
|
mr_lou |
Yes... created an unusual way though. |
14:30 |
|
aditsu |
so on the device |
14:30 |
|
mr_lou |
In 1.1.8 there's not createImagE(widht,height) |
14:30 |
|
mr_lou |
So I had to use MemoryImageSource |
14:30 |
|
mr_lou |
java.awt.Image.createImage(java.awt.image.MemoryImageSource(parameters here)); |
14:31 |
|
aditsu |
it says @since JDK1.0 |
14:32 |
|
aditsu |
is that inaccurate? or do you have a non-compliant jre? |
14:32 |
|
aditsu |
createImage is in the Component class btw! |
14:33 |
|
mr_lou |
I'm using java.awt.Frame |
14:33 |
|
mr_lou |
Oh |
14:33 |
|
mr_lou |
Sorry |
14:33 |
|
mr_lou |
I'm using java.awt.Toolkit.createImage |
14:33 |
|
aditsu |
maybe that's different |
14:34 |
|
mr_lou |
Maybe |
14:34 |
|
mr_lou |
Trying to prepare a very minimal framework to let me use the same commands on a few different platforms. J2ME, J2SE, Android. |
14:35 |
|
mr_lou |
Just a translation layer for the different java.awt commands. |
14:35 |
|
aditsu |
what "commands" are you referring to? |
14:37 |
|
mr_lou |
Mainly those in java.awt.Graphics |
14:47 |
|
* aditsu |
is trying again to implement a library for OpenDocument files (mainly spreadsheets) |
14:49 |
|
aditsu |
any recommendation for a nice XML parsing API? or should I just go with the standard DOM? |
14:52 |
|
* aditsu |
ponders writing a thin API over DOM |
14:59 |
|
aditsu |
any thoughts on jdom vs dom4j vs xom? |
15:04 |
|
aditsu |
let me take another look at xom.. |
15:11 |
|
mr_lou |
Hm |
15:12 |
|
mr_lou |
I'm the wrong guy to ask. I'm one of those annoying types who prefer writing everything myself. It will have to be an exceptional good API before I trust it to be good enough. |
15:12 |
|
aditsu |
mr_lou: not asking you in particular :) |
15:12 |
|
mr_lou |
Ok then. :-P |
15:13 |
|
aditsu |
from what I remember, xom is nicely designed, but quite old |
15:21 |
|
mr_lou |
Old is good.... usually. |
15:26 |
|
aditsu |
weird, I'm getting a different tar if I download from the browser vs code or wget |
15:26 |
|
aditsu |
but same contents |
15:27 |
|
mr_lou |
Why can't my main class also be a WindowListener? |
15:27 |
|
mr_lou |
It's an object. |
15:27 |
|
mr_lou |
Sure it has a main() but also a constructor. |
15:28 |
|
aditsu |
it probably can, if you implement the interface |
15:28 |
|
mr_lou |
Yet I'm still told "non-static method addWindowListener cannot be referenced from a static context". |
15:28 |
|
mr_lou |
I do |
15:28 |
|
aditsu |
well, you need an instance of it |
15:29 |
|
mr_lou |
Doh I'm a moron. |
15:30 |
|
mr_lou |
I did have an instance of it... but I stll referred to the class instead of the instance... coz I'm a dumbass. |
15:32 |
|
aditsu |
it happens to all of us :p |
15:32 |
|
mr_lou |
You're too kind. |
15:32 |
|
mr_lou |
Takes some getting use to, when my soul has been deeply scared from visits in a certain other #java channel. |
15:33 |
|
aditsu |
about my xom tar.. apparently the browser unpacks the gz automatically, but wget does not |
15:38 |
|
aditsu |
ah yes, xom doesn't use collections, which sucks a lot.. |
15:41 |
|
aditsu |
apparently because it stays compatible with some old java versions so it doesn't use generics |
15:41 |
|
mr_lou |
Hm... why does my Frame only draw sometimes? |
15:41 |
|
* mr_lou |
use NetBeans. |
15:41 |
|
mr_lou |
Press F6 to run. All draws fine. Close the app. Press F6 again. Nothing is drawn. |
15:42 |
|
aditsu |
threads? race condition? |
15:45 |
|
mr_lou |
Ah.. no.... screensize probs.... probably shouldn't call getScreenSize in constructor. |
15:47 |
|
mr_lou |
Hm... that didn't make any differences. |
15:47 |
|
mr_lou |
Toolkit.getScreenSize() sometimes returns 1,1 and sometimes 10,30 and sometimes correctly. Weird. |
15:56 |
|
* aditsu |
is tempted to add generics to xom and make it into a new library |
16:28 |
|
|
nanoz joined ##friendlyjava |
17:06 |
|
mr_lou |
I should be able to call getGraphics on a java.awt.Frame, right? |
17:07 |
|
mr_lou |
Ah yes. Inherited from Component. |
17:59 |
|
mr_lou |
Am I not supposed to be able to call Toolkit.getScreenSize() in a constructor? I'm getting mixed results each time.... which is weird. |
18:00 |
|
mr_lou |
Or... |
18:00 |
|
mr_lou |
Hm |
18:04 |
|
mr_lou |
Oh |
18:04 |
|
mr_lou |
Hm |
18:04 |
|
mr_lou |
Apparently getWidth() and getHeight() of java.awt.Frame doesn't return the same values as set with setSize() |
19:15 |
|
aditsu |
mr_lou: are you using the event dispatch thread? |
19:16 |
|
mr_lou |
um, no. |
19:17 |
|
aditsu |
you probably should |
19:21 |
|
mr_lou |
I have no clue what it is. But it doesn't sound like something that was available back then. |
19:21 |
|
aditsu |
no clue? you've never written a Swing or AWT application? |
19:21 |
|
mr_lou |
Hm.... not really. |
19:22 |
|
mr_lou |
J2ME and Android. |