X-Git-Url: http://git.megacz.com/?p=org.ibex.core.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fplat%2FJava2.java;h=7a1909bb1650dec74ce47e5c5b506ceac404bfec;hp=00088d4594bd0ddcbd1670042d9cc6e8a037f709;hb=82817d828b14b3ff025b0b1e0bbbd3ea9c35c5f1;hpb=3591b88b94a6bb378af3d4abe6eb5233ce583104 diff --git a/src/org/ibex/plat/Java2.java b/src/org/ibex/plat/Java2.java index 00088d4..7a1909b 100644 --- a/src/org/ibex/plat/Java2.java +++ b/src/org/ibex/plat/Java2.java @@ -20,13 +20,13 @@ public class Java2 extends AWT { // disable the focus manager so we can intercept the tab key String versionString = System.getProperty("java.version", ""); int secondDecimal = versionString.substring(versionString.indexOf('.') + 1).indexOf('.'); - if (secondDecimal != -1) versionString = versionString.substring(0, secondDecimal); + if (secondDecimal != -1) versionString = versionString.substring(0, versionString.indexOf('.') + 1 + secondDecimal); double version = Double.parseDouble(versionString); if (version >= 1.4) { isJava14 = true; try { Toolkit t = java.awt.Toolkit.getDefaultToolkit(); - Method m = java.awt.Toolkit.class.getMethod("setDynamicLayout", new Class[] { Boolean.class }); + Method m = java.awt.Toolkit.class.getMethod("setDynamicLayout", new Class[] { Boolean.TYPE }); m.invoke(t, new Object[] { Boolean.TRUE }); } catch (Exception e) { Log.info(this, "Exception while trying to enable AWT Dynamic Layout"); @@ -90,7 +90,7 @@ public class Java2 extends AWT { // weaken the binding here to avoid link errors on 1.3.x Class java14SurfaceClass = Class.forName(Java2.class.getName() + "$Java14Surface"); Constructor ctor = java14SurfaceClass.getConstructor(new Class[] { Box.class, Boolean.TYPE }); - return (Surface)ctor.newInstance(new Object[] { root, new Boolean(framed) }); + return (Surface)ctor.newInstance(new Object[] { root, Boolean.valueOf(framed) }); } catch (Exception e) { Log.info(this, e); throw new LinkageError("error: " + e); @@ -159,8 +159,8 @@ public class Java2 extends AWT { } public void mouseWheelMoved(MouseWheelEvent m) { - // TODO: Uncomment this once Scroll is implemented in the core - //if(m.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) { Scroll(m.getUnitsToScroll()); } + if (m.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) + VScroll(m.getUnitsToScroll()); } } @@ -176,17 +176,16 @@ public class Java2 extends AWT { private DataBuffer buf = null; // this doens't seem to work on Windows - public void drawGlyph(Picture source, int dx, int dy, int cx1, int cy1, int cx2, int cy2, int rgb) { - AWTPicture src = (AWTPicture)source; - src.init(); + public void drawGlyph(org.ibex.Font.Glyph source, int dx, int dy, int cx1, int cy1, int cx2, int cy2, int rgb) { + Image i2 = ((AWTGlyph)source).getImage(); Graphics2D g2 = (Graphics2D)i.getGraphics(); g2.setComposite(AlphaComposite.DstOut); g2.setClip(cx1, cy1, cx2 - cx1, cy2 - cy1); - g2.drawImage(src.i, dx, dy, null); + g2.drawImage(i2, dx, dy, null); g2.setComposite(AlphaComposite.DstOver); g2.setColor(new Color((rgb & 0x00FF0000) >> 16, (rgb & 0x0000FF00) >> 8, (rgb & 0x000000FF))); g2.fillRect(dx, dy, cx2 - dx, cy2 - dy); - g2.drawImage(i, 0, 0, null); + g2.drawImage(i2, 0, 0, null); g2.setClip(0, 0, i.getWidth(null), i.getHeight(null)); }