JDK 1.4.2_04 and AffineTransform

I use JDev 9.0.3.3 (build 1205)
It started with JDK 1.3.1_02 and I upgraded it to 1.4.2_02.
My simple Swing/JClient program runs fine using JDK1.3 but always crashes when I use 1.4 with the following exception:
java.lang.StackOverflowError
     at java.awt.geom.AffineTransform.translate(AffineTransform.java:1076)
Any clues?

Arie,
Jdeveloper 9.0.3 is tested running with JDK 1.3 (you can switch the JDK for development of your project but not for running JDev).
If you want ot use JDK 1.4 get Oracle JDeveloper 9.0.4.

Similar Messages

  • Font issue between jdk1.4.2_04 and jdk 1.4.2_13 while generating style repo

    Hi ,
    i am generating pdf report using style pro. i am using "Arial" font. UNIX system. I was using jdk1.4.2_04 till date. when i changed to jdk 1.4.2_13 and now the pdf is not getting generated in "Arial" font. It gets populated in some other font.
    Can u people guess what is the issue? Pls give me a solution as soon as possible........

    Plz reply .. its urgent

  • Inconsistent results from AlphaComposite and AffineTransform

    I'm developing a game using Java, and I've run into a fairly major issue. On my primary development machine, I can use combinations of AlphaComposite.SRC_IN and AffineTransforms with rotation just fine (I'm using the composite to create a lighting overlay for the game by drawing light beams onto the alpha channel of an all-black image buffer). On my other computer, while the image itself rotates and draws on the alpha channel fine, the computer also completely clears a bounding rectangle around the rotated image.
    The first computer (the one for which this works) has a GeForce 8800GTS video card, while the second has an older Radeon 9700. The first computer also has the most recent version of the JDK (6). Could either of these factors make the difference?
    edit: Upgrading to JDK 6 fixed it. Will need to include a notice about upgrading to JDK 6 with the game, probably.
    Message was edited by:
    Hyouko

    Hi
    Yes I have a debug line that prints them out in the doAutoLoadBalancing method - this is the point where I am diagnosing the problem. It only prints the correct results after I have already run the procedure from the SQL command line.
    public UserNumber[] doAutoLoadBalancing () throws SQLException {
    autoLBNumbersNeeded.clearParameters();
    autoLBNumbersNeeded.execute();
    mwFF = autoLBNumbersNeeded.getLong(1);
    mwHF = autoLBNumbersNeeded.getLong(2);
    wmFF = autoLBNumbersNeeded.getLong(3);
    wmHF = autoLBNumbersNeeded.getLong(4);
    autoLBNumbersNeeded.clearParameters();
    if (m_cat.isDebugEnabled()) {m_cat.debug("mwFF: "+mwFF+"; mwHF: " +mwHF+"; wmFF: "+wmFF+"; wmHF: "+wmHF);}
    </pre>

  • How to upgrade jdk in standalone forms and reports 10.1.2

    hi all
    i have forms and reports services standalone 10.1.2.0 can any one help me how to upgrade default jdk to jdk 6
    thx very much

    Install JDk6 somewhere else. Rename ORACLE_HOME/jdk to jdk1.4. Create jdk folder in ORACLE_HOME and copy contents of JDK1.6 into jdk.
    But before doing this, check with oralce whether this is compatible. Oracle 0.1.2 supplied JDK is 1.4

  • Difference between SUN JDK V1.4.2_05 and JDK V1.4.2_07

    difference between SUN JDK V1.4.2_05 and JDK V1.4.2_07 and I want to the link in SUN for that. I want to know the bug fixes between them.

    Perhaps you should look at the documentation which comes with JDK 1.4.2_08.
    It has the bugs fixed listed.

  • Do u know what is jdk 1.4.1 and j2ee 1.4.1?

    hi~ do u know what is jdk 1.4.1 and j2ee 1.4.1? Are they sotware program like jbuilderX for example? Do u know which of these 2 is better for jxta? Do u know the installation procedures for jdk1.4.1 and j2ee1.4.1? thanks!

    jdk means J2SE(Java Software Development Kit)
    is it j2ee or jre?
    No they are the main software for run a java program.
    jbuilderX is a editor where you can write java programs using jdk or jre.
    Both are need for jxta.
    Just run jdk 1.4.1 setup.exe file.That automatically install jdk and jre to your PC.

  • Jdk 1.5.0_04 and Eclipse with SuSE Linux - startup problems with Eclipse

    Hi,
    I have SuSE Linux 9.3 and just downloaded Jdk 1.5.0_04 and Eclipse IDE 3.1 for Linux.
    I have sucessfully installed Java in the following directory under Linux:
    '/usr/java/jdk1.5.0_04'
    And I also have downloaded Eclipse IDE 3.1 for Linux. I have unzipped it into the following directory:
    '/home/juergenkemeter/bin/eclipse/eclipse
    I have chosen the upper Java JRE in the Eclipse preferences.
    Now to my problem:
    Sometimes it happens that when I startup Eclipse or try to runa java program, Eclipse is shut down with a) no comment at all, or b) with an error message "JVM terminated. Exit code = 1 (...)". I can send the picture of the whole screenshot of the error message if it helps.
    Now I think that this is due to wrong installation paths of the Jdk and Eclipse?! Perhaps there are some conflicts regarding user rights (admin and the normal user 'juergenkemeter'.
    If anyone has suggestions, that would be helpful. Its nasty when Eclipse shuts down while programming...
    cheers,
    J�rgen

    I only used the getSystemResource because it is slightly more convenient. The
    getResource version requires a "/" in front of the filename, as in:
    java.net.URL imageURL = getClass().getResource("/" + imageName);
    System.out.println("Loading icon: " + imageName);
    for (int i = 0; i < 32000; i++)
    System.out.println(i);
    icon = new ImageIcon(imageURL);
    Unfortunately, this still deadlocks after a few thousand hits.
    Of course, I don't need thousands of icons in my application, but the real-world issue is that the program locks up every few times it is started, which is a real drag for the customers!
    I suppose the InputStream way would work, though it is not very elegant compared to loading the resource in the usual manner. I'll try it if there are no other suggestions.
    Thanks,
    Dan

  • JDK 1.5.0_03 and Jacorb problem (BAD_PARAM)

    I have recently upgraded my computer environment to jacorb 2.2.2 and
    jdk 1.5.0_03 and discovered a log that I cannot find the reason to.
    Previously, I was running jacorb 1.4.1 (with a patch to solve bug
    #445) and jdk 1.4.2_06 and did not experience this problem. The
    problem still remains when using jacorb 1.4.1 (with the patch) and jdk
    1.5.0_03 but not when switching back to jdk 1.4.2_06. Can anyone help
    me explain the reason to this log? Does anybody know what minor code 227 means?
    ---- Extract from log.out -----------
    Aug 18, 2005 9:30:27 AM com.sun.corba.se.spi.orb.ORB$2 run
    FINE: "IOP00110227: (BAD_PARAM) ORBDynamicStubFactoryFactoryClass
    property had value
    com.sun.corba.se.impl.presentation.rmi.bcel.StubFactoryFactoryBCELImpl,
    which could not be loaded by the ORB ClassLoader"
    org.omg.CORBA.BAD_PARAM: vmcid: SUN minor code: 227 completed: No
    at com.sun.corba.se.impl.logging.ORBUtilSystemException.errorInSettingDynamicStubFactoryFactory(ORBUtilSystemException.java:1851)
    at com.sun.corba.se.impl.logging.ORBUtilSystemException.errorInSettingDynamicStubFactoryFactory(ORBUtilSystemException.java:1870)
    at com.sun.corba.se.spi.orb.ORB$2.run(ORB.java:196)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.corba.se.spi.orb.ORB.<clinit>(ORB.java:179)
    at com.sun.corba.se.impl.logging.UtilSystemException.get(UtilSystemException.java:54)
    at com.sun.corba.se.impl.javax.rmi.CORBA.StubDelegateImpl.<clinit>(StubDelegateImpl.java:49)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
    at java.lang.Class.newInstance0(Class.java:350)
    at java.lang.Class.newInstance(Class.java:303)
    at javax.rmi.CORBA.Stub.createDelegateIfSpecified(Stub.java:209)
    at javax.rmi.CORBA.Stub.<clinit>(Stub.java:51)
    at org.jacorb.orb.Delegate.getReference(Unknown Source)
    at org.jacorb.orb.ORB.getReference(Unknown Source)
    at org.jacorb.poa.POA.getReference(Unknown Source)
    at org.jacorb.poa.POA.servant_to_reference(Unknown Source)
    at
    at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.<init>(JUnitTestRunner.java:225)
    at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.<init>(JUnitTestRunner.java:177)
    at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:651)
    at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:558)
    Caused by: java.lang.ClassNotFoundException:
    com.sun.corba.se.impl.presentation.rmi.bcel.StubFactoryFactoryBCELImpl
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at com.sun.corba.se.impl.orbutil.ORBClassLoader.loadClass(ORBClassLoader.java:20)
    at com.sun.corba.se.spi.orb.ORB$2.run(ORB.java:192)
    ... 32 more

    yes ,i tried many Jre versions,
    does anybody knows what Node does in JAVA , what are the library file are there in Linux which takes care of this

  • Text shifts while drawing using Graphics2D, TextLayout and AffineTransform

    Hi,
    Text is drawn to Panel using Graphics2D, TextLayout and AffineTransform. A rectangle is drawn around the text where one side of rectangle touches text. When I rotate Text and Rectangle by 90 degrees around the center, text is shifted by one pixel away from the side of the rectangle.
    Please see the below code: For rotation change the angle from 0 to 90
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.FontMetrics;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.RenderingHints;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.awt.font.TextAttribute;
    import java.awt.font.TextLayout;
    import java.awt.geom.AffineTransform;
    import java.awt.geom.Rectangle2D;
    import java.text.AttributedString;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    public class DrawText extends JPanel {
         public DrawText() {
              setBackground(Color.white);
              setSize(350, 400);
         private static void adjustGraphics(Graphics2D g) {
              g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                        RenderingHints.VALUE_ANTIALIAS_ON);
              g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
                        RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
              g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
                        RenderingHints.VALUE_FRACTIONALMETRICS_ON);
              g.setRenderingHint(RenderingHints.KEY_RENDERING,
                        RenderingHints.VALUE_RENDER_QUALITY);
         public void paintComponent(Graphics g) {
              super.paintComponent(g);
              Graphics2D g2 = (Graphics2D) g;
              adjustGraphics(g2);
              g2.setColor(Color.black);
              String toPrint = "Draw Text Test!";
              double nX = 100, nY = 100, width = 100, height = 0;
              double angle = 0;// Change the angle from 0 to 90
              angle = Math.toRadians(angle);
              FontMetrics fm = this.getFontMetrics(g2.getFont());
              height = fm.getHeight();
              AffineTransform afNew = new AffineTransform();
              afNew.rotate(-angle, nX + width / 2.0, nY + height / 2.0);
              g2.setTransform(afNew);
              g2.draw(new Rectangle2D.Double(nX, nY, width, height));
              nY = nY + (fm.getAscent() - fm.getLeading());
              AttributedString attStr = new AttributedString(toPrint);
              attStr.addAttribute(TextAttribute.FONT, g2.getFont());
              TextLayout textLayout = new TextLayout(attStr.getIterator(), g2
                        .getFontRenderContext());
              nX = nX - textLayout.getBounds().getX();
              textLayout.draw(g2, (float) nX, (float) nY);
         public static void main(String arg[]) {
              JFrame frame = new JFrame();
              frame.addWindowListener(new WindowAdapter() {
                   public void windowClosing(WindowEvent e) {
                        System.exit(0);
              frame.getContentPane().add("Center", new DrawText());
              frame.pack();
              frame.setSize(new Dimension(350, 400));
              frame.setVisible(true);
    }

    Include a timer that slowly increases the the angle from 0 to 90 and repaints each time. You'll notice that at some angles the "D" is flushed with the rectangle, while at other angles (like 90) it's offset by one pixel. If you look at all the letters at once, though, you'll notice they shake about quite a bit. Sometimes one letter is closer to another letter, while other times they're farther apart. A screenshot of any given angle looks OK, but when in slow motion you see just how inexact text rendering under a transformation may be.

  • JRockit 1.4.2_04 and Thinthreads

    Hi,
    I just upgraded to JRockit 1.4.2_04 from 1.4.1_x. With the latter one I used the -Xthinthreads option. Now JRockit tells me there wouldn't be such an option any longer.
    Has this optioned been renamed or is there no thinthreads support any longer?! If so, why has it been removed?
    Thanks!
    Daniel

    Thinthreads has been removed from JRockit which is why the option does not work. The reasons for removing thinthreads was that it provided a too small benefit compared to the engineering and testing resources required to keep it. Only in a small number of applications is the difference between thinthreads and nativethreads significant. There were also some problems in getting thinthreads to work reliably (especially on multiprocessor systems).
    If you are running an application server with JRockit (typically WLS) you should not see much difference between nativethreads and thinthreads. In addition, nativethreads has been improved in later JRockit releases.
    Regards,
    /Staffan

  • JTrees, JDK 1.4.2 and Windows XP

    Hi,
    I noticed that under JDK 1.4.2 with Windows XP, JTrees are drawn without the lines connecing the children the parent node. I want to draw the lines. Can anyone tell me how?
    thanks

    Let me explain a little clearer...
    I am using the System look & feel. I am running on windows xp and the java version is 1.4.2. The problem is that that in the system look and feel of swing under XP, the JTrees are drawn w/o lines connecting the parent folder to the subfolder. I think it's unesthetic and I would like to know if I can "bring back" these lines.
    In the java look and feel it is possible with this method:
    tree.putClientProperty("JTree.lineStyle", "Angled");
    However this only works for the java look and feel. Is there something similar to the this code that works for system look & feel????

  • Component resize, paint and AffineTransform

    Hello,
    I am resizing a JInternalFrame that contains a JPanel.
    When I call:
    MyJPanel.repaint();The paint function gets the dimensions of the JPanel
    using getWidth() and getHeight(), once, at the start of the
    paint function. The function then proceeds to plot some lines and
    points on a graph. Everything appears to work fine for lines and points (ie: drawOval).
    The function then goes on to draw some text for the axes of the graph. The Y axis
    text plots fine. The X axis text is rotated using AffineTransform and plots intermittently
    with the correct and incorrect position.
    Calling repaint() for the JPanel, without resizing,
    everything renders in the proper place
    via the overridden paint() procedure for that panel.
    When I resize the JInternalFrame, thus causing the
    JPanel to also automatically resize and repaint, the JPanel
    paints all lines and points in the correct locations
    with respect to the bounds of the JPanel. The
    Y axis text, drawn using drawText() plots in the correct place.
    The X axis text then plots in the wrong place after AffineTransform
    positioning in a location that would indicate it is transforming based on the
    coordinate system of the JInternalFrame rather than the JPanel (??).
    To create the text transform I am calling the following function:
    public void drawRotatedText(Graphics g, String text, int xoff, int yoff, double angle_degrees){
                        Graphics2D g2d=(Graphics2D)g;
                        AffineTransform old_at=((Graphics2D)g).getTransform();
                        AffineTransform at = new AffineTransform(old_at);
                        at.setToTranslation(xoff, yoff);
                        at.rotate((angle_degrees/360.0)*Math.PI*2.0);
                        g2d.setTransform(at);
                        g2d.drawString(text, 0, 0);
                        g2d.setTransform(old_at);
                    }The parameter Graphics g is the Graphics passed from public void MyJPanel.paint(Graphics g) .
    Why would AffineTransform get confused regarding which component the Graphics is coming from?
    More importantly, how can I avoid the problem?
    Thanks,
    P

    >
    To create the text transform I am calling the following function:
    public void drawRotatedText(Graphics g, String text, int xoff, int yoff, double angle_degrees){
    Graphics2D g2d=(Graphics2D)g;
    AffineTransform old_at=((Graphics2D)g).getTransform();
    AffineTransform at = new AffineTransform(old_at);
    at.setToTranslation(xoff, yoff);
    at.rotate((angle_degrees/360.0)*Math.PI*2.0);
    g2d.setTransform(at);
    g2d.drawString(text, 0, 0);
    g2d.setTransform(old_at);
    The problem is with the use of at.setToTranslation(xoff, yoff); instead of at.translate(xoff, yoff).
    After changing that the problem cleared up.
    P

  • JDK 1.4.2 and full-screen mode

    Hi all,
    I'm messing around with a 2D-elite clone using Java 1.4 full-screen mode. After a few hours of work I am happily zapping asteroids and aliens at a zippy 140 FPS.
    I then switch from JDK 1.4.0_01 to 1.4.2_01 in the hope of getting some extra speed. Without making any other changes to the code, things suddenly start crawling along at <30 FPS.
    I am using BufferStrategy in combination with a VolatileImage to draw everything on. Did I miss any important changes in the newest release of the JDK or am I doing something fundamentally wrong?
    Raf

    Hi Abuse,
    Thanks for answering. First of all, my speed calculations are a bit crufty. In my main thread, I do a System.currentTimeMillis() every 1000th call. I consider 10^6 / (this time in ms - last time in ms) to be the speed in FPS. It's probably wildly off, but the difference in speed between the two JDKs is noticeable even without the numbers.
    Posting all of the code is going to be a bit difficult because there's quite a few classes in the project. However, I'll try to isolate the relevant code below.
    At this point, I'm not entirely convinced that the drawing is the problem. I'm using a shoddy integrated video card which may be causing the issues, but even if I only draw the background starfield I see a significant drop in speed. I'll try to disable some code here and there in the hope of finding something more specific.
    I'm playing some music in the background and there is rather a lot of collision-handling code going on, maybe that's the bottle-neck. When you bump into stuff, the trajectory of your ship and whatever you rammed is altered depending on weight, velocity and angle. It's a lot of fun to watch but still quite buggy at this point. (I've got a planet on-screen which acts rather like a beach-ball when I ram it).
    Anyhow, here's the rendering code:
    This class takes care of the initialization of the full-screen mode.
    Actual drawing is done in the Level class below.
    public class Main implements Runnable {
        private long lastTime = System.currentTimeMillis();
        double frameCount = 0;
        public static final int BUFFER_COUNT = 1;
        private JFrame frame;
        BufferStrategy bufferStrategy;
        GraphicsDevice device;
        private BigScreen screen;
        private static final int DRAW_DELAY = 5;
        public static void main(String[] args) {
            Main main = new Main();
        public Main() {
            this.initializeSettings();
            this.initializeGUI();
            new Thread(this).start();
            new Thread(new HouseKeeping()).start();
        private void initializeSettings() {
            Tools.loadEntityTypes();
            SoundManager.getHandle().playMusic();
        private void initializeGUI() {
            GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
            device = env.getDefaultScreenDevice();
            GraphicsConfiguration gc = device.getDefaultConfiguration();
            frame = new JFrame(gc);
            frame.setTitle("Elite 2D");
            frame.setUndecorated(true);
            frame.setResizable(false);
            frame.setIgnoreRepaint(true);
            frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
            device.setFullScreenWindow(frame);
            Level.getHandle().setDimensions((int) device.getDefaultConfiguration().getBounds().getWidth(),
                    (int) device.getDefaultConfiguration().getBounds().getHeight());
            BufferCapabilities bc = new BufferCapabilities(new ImageCapabilities(true),
                    new ImageCapabilities(true),
                    BufferCapabilities.FlipContents.BACKGROUND
            try {
                frame.createBufferStrategy(BUFFER_COUNT, bc);
            } catch (AWTException e) {
                e.printStackTrace();
            bufferStrategy = frame.getBufferStrategy();
            int width = device.getDisplayMode().getWidth();
            int height = device.getDisplayMode().getHeight();
            screen = new BigScreen(width, height, gc.createCompatibleVolatileImage(width, height));
            frame.getContentPane().add(screen);
            frame.addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent e) {
                    System.exit(0);
                public void windowDeiconified(WindowEvent e) {
                    GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
                    device = env.getDefaultScreenDevice();
                    GraphicsConfiguration gc = device.getDefaultConfiguration();
                    device.setFullScreenWindow(null);
                    device.setFullScreenWindow(frame);
                    BufferCapabilities bc = new BufferCapabilities(new ImageCapabilities(true),
                            new ImageCapabilities(true),
                            BufferCapabilities.FlipContents.COPIED
                    try {
                        frame.createBufferStrategy(BUFFER_COUNT, bc);
                    } catch (AWTException awt) {
                        awt.printStackTrace();
            // Set the cursor to a transparent image
            Image image = Toolkit.getDefaultToolkit().createImage(
                    new MemoryImageSource(16, 16, new int[16 * 16], 0, 16));
            Cursor transparentCursor = Toolkit.getDefaultToolkit().createCustomCursor(image,
                    new Point(0, 0), "invisiblecursor");
            frame.setCursor(transparentCursor);
            screen.setFocusable(false);
            frame.addKeyListener(getKeyListener());
        public KeyAdapter getKeyListener() {
            return new KeyAdapter() {
                public void keyPressed(KeyEvent e) {
                    Level.getHandle().getPlayer().handleKeyUp(e.getKeyCode());
                public void keyReleased(KeyEvent e) {
                    Level.getHandle().getPlayer().handleKeyDown(e.getKeyCode());
        public void run() {
            while (true) {
                if (frameCount++ % 1000 == 0) {
                    long thisTime = System.currentTimeMillis();
                    // aantal ms voor 1000 frames
                    // 1000 * (aantal frames / seconde)
                    double fps = thisTime - lastTime;
                    lastTime = thisTime;
                    Level.getHandle().getConsole().addConsoleMessage("FPS : " + 1000000 / fps);
                Graphics g = bufferStrategy.getDrawGraphics();
                screen.paintSurroundings();
                g.drawImage(screen.background, 0, 0, null);
                g.dispose();
                bufferStrategy.show();
                try {
                    Thread.sleep(DRAW_DELAY);
                } catch (InterruptedException e) {
                } catch (IllegalStateException i) {
        public Rectangle getScreenDimensions() {
            return frame.getGraphicsConfiguration().getBounds();
        public void exitFullScreen() {
            device.setFullScreenWindow(null);
    } // End class Main// The rendering-code in Level is done in the updateStatus-method.
    // Once again, rendering is delegated to the current SolarSystem class.
    public class Level {
        private static Level handle;
        public SolarSystem currentSolarSystem;
        private Console console;
        private int width, height;
        private Ship player;
        // All ships within this radius of the player get to act
        private static final int ACTION_RADIUS = 5000;
        // All entities within this radius of the player qualify for drawing
        private static final int VISIBILITY_RADIUS = 2000;
        private Level() {
            console = new Console();
            currentSolarSystem = new SolarSystem();
            Equipment[] weapons = new Equipment[3];
            weapons[0] = new BeamWeapon(Color.red, 1000, 0.02, 0.1);
            weapons[1] = new PulseWeapon(Color.blue, 500, 0, 400, 1);
            weapons[2] = new MissileLauncher();
            player = new Ship(100, 100, weapons, currentSolarSystem);
            currentSolarSystem.addEntity(new Entity(1000, 1000, Tools.getEntityType("planet"), currentSolarSystem));
            for (int i = 0; i < 20; i++) {
                Entity asteroid = Tools.getEntityType("asteroid").createEntity(200 * i, 0, currentSolarSystem);
                asteroid.setSpeed(Tools.getRandom(asteroid.getMaxSpeed()));
                asteroid.setAccelerationAngle(Tools.getRandom(Tools.TWOPI));
                currentSolarSystem.addEntity(asteroid);
            for (int i = 0; i < 5; i++) {
                currentSolarSystem.addEntity(Tools.getEntityType("enemy").createEntity(
                        Tools.getRandom(-1000, 1000), Tools.getRandom(-1000, 1000), currentSolarSystem));
        public SolarSystem getActiveSolarSystem() {
            return this.currentSolarSystem;
        public Console getConsole() {
            return this.console;
        public void setDimensions(int x, int y) {
            this.width = x;
            this.height = y;
        public int getWidth() {
            return this.width;
        public int getHeight() {
            return this.height;
        public static Level getHandle() {
            if (handle == null) {
                handle = new Level();
            return handle;
        public ArrayList getEntitiesInRectangle(int x1, int y1, int w1, int h1) {
            ArrayList intersects = new ArrayList();
            for (int i = 0; i < currentSolarSystem.getEntities().size(); i++) {
                Entity e = (Entity) currentSolarSystem.getEntities().get(i);
                if ((x1 + w1 > e.getX()) && (e.getX() + e.getWidth() > x1) && (y1 + h1 > e.getHeight())
                        && (e.getY() + e.getHeight() > y1)) {
                    intersects.add(e);
            return intersects;
        public ArrayList getEntitiesInLine(double x1, double y1, double x2, double y2) {
            ArrayList intersects = new ArrayList();
            Line2D line = new Line2D.Double(x1, y1, x2, y2);
            for (int i = 0; i < currentSolarSystem.getEntities().size(); i++) {
                Entity e = (Entity) currentSolarSystem.getEntities().get(i);
                // System.out.println(e.getBoundingShape() + " vs " + x1 + "x" + y1 + ", " + x2 + "x" + y2);
                if (line.intersects(e.getBoundingShape().getBounds2D())) {
                    intersects.add(e);
            return intersects;
        public Entity getNearestEntityToLineOrigin(double x1, double y1, double x2, double y2) {
            double closestIndex = 0;
            Entity closestEntity = null;
            Line2D line = new Line2D.Double(x1, y1, x2, y2);
            for (int i = 0; i < currentSolarSystem.getEntities().size(); i++) {
                Entity e = (Entity) currentSolarSystem.getEntities().get(i);
                // System.out.println(e.getBoundingShape() + " vs " + x1 + "x" + y1 + ", " + x2 + "x" + y2);
                if (line.intersects(e.getBoundingShape().getBounds2D())) {
                    double distance = Tools.getDistance(x1, y1, e);
                    if (closestEntity == null) {
                        closestEntity = e;
                        closestIndex = distance;
                    } else if (distance < closestIndex) {
                        closestEntity = e;
            return closestEntity;
        public Ship getPlayer() {
            return player;
        public void updateStatus(Graphics g, int width, int height) {
            getActiveSolarSystem().updateStatus(g, getPlayer(), width, height);
            getConsole().showConsoleMessages(g);
    }Draws a starfield and all visible entities in sight. So far I'm just
    drawing all entities in the solar system. Seems to be faster than
    figuring out whether objects are near the player for <100 objects.
    public class SolarSystem {
        private static final int BIG_STARS = 20;
        private static final int MAX_STARS = 1000;
        private static final int STAR_AREA = 1400;
        private int[][] stars;
        private ArrayList entities;
        private ArrayList explosions;
        public SolarSystem() {
            entities = new ArrayList();
            explosions = new ArrayList();
            this.initializeStarField();
        public ArrayList getEntities() {
            return entities;
        public ArrayList getExplosions() {
            return explosions;
        public void addEntity(Entity e) {
            entities.add(e);
        public void removeEntity(Entity e) {
            entities.remove(e);
        public void addExplosion(int x, int y, int size, int max) {
            // System.out.println("Adding explosion at " + x + " " + y);
            explosions.add(new Explosion(x, y, size, max));
        public void updateStatus(Graphics g, Ship player, int width, int height) {
            this.pollEntities(player);
            this.drawScene(g, player, width, height);
        private void drawScene(Graphics g, Ship player, int width, int height) {
            // Make sure nothing extraneous gets drawn
            g.clipRect(0, 0, width, height);
            // Clear the surface and set the background
            g.setColor(Color.black);
            g.fillRect(0, 0, width, height);
            // Draw explosions & remove from the buffer if needed
            Explosion[] expl = (Explosion[]) getExplosions().toArray(new Explosion[explosions.size()]);
            int centerX = (int) player.getX();
            int centerY = (int) player.getY();
            int widthOffset = centerX + width / 2;
            int heightOffset = centerY + height / 2;
            this.drawStarField(g, player);
            for (int i = expl.length - 1; i >= 0; i--) {
                Explosion ex = expl;
    g.setColor(new Color(Math.max(255 - ex.size, 0), 0, 0));
    g.drawOval(ex.x - widthOffset, ex.y - heightOffset, ex.size, ex.size);
    if (ex.size < ex.max) {
    ex.size += 2;
    ex.x--;
    ex.y--;
    explosions.set(i, ex);
    } else {
    explosions.remove(i);
    // todo - can we re-use the active entities table here?
    Entity[] entities = getVisibleEntities(player);
    for (int i = 0; i < entities.length; i++) {
    entities[i].drawEntity((int) (entities[i].getX() - player.getX() + width / 2),
    (int) (entities[i].getY() - player.getY() + height / 2), g);
    player.drawEntity(width / 2, height / 2, g, entities, width, height);
    private void drawStarField(Graphics g, Ship player) {
    g.setColor(new Color(255, 255, 255));
    int starX = ((int) player.getX() % STAR_AREA);
    int starY = ((int) player.getY() % STAR_AREA);
    for (int i = 0; i < BIG_STARS; i++) {
    g.fillOval((stars[i][0] - starX) % STAR_AREA, (stars[i][1] - starY) % STAR_AREA, 3, 3);
    for (int i = BIG_STARS; i < MAX_STARS; i++) {
    g.drawLine((stars[i][0] - starX) % STAR_AREA, (stars[i][1] - starY) % STAR_AREA,
    (stars[i][0] - starX) % STAR_AREA, (stars[i][1] - starY) % STAR_AREA);
    * Includes the player as an active entity
    * @param player
    * @return
    private Entity[] getActiveEntities(Ship player) {
    Entity[] activeEntities = (Entity[]) entities.toArray(new Entity[entities.size() + 1]);
    activeEntities[activeEntities.length - 1] = player;
    return activeEntities;
    private void pollEntities(Ship player) {
    this.purgeDestroyedObjects();
    Entity[] activeEntities = this.getActiveEntities(player);
    for (int i = 0; i < activeEntities.length; i++) {
    activeEntities[i].resolveAction();
    // todo - Handle gravitational pull
    //if (activeEntities[i].hasGravitationalPull()) {
    // Handle collisions
    for (int i = activeEntities.length - 1; i >= 0; i--) {
    if (activeEntities[i] != null && !activeEntities[i].isTransparent() && !activeEntities[i].isDestroyed()) {
    for (int j = i - 1; j >= 0; j--) {
    if (activeEntities[i] != null && activeEntities[j] != null &&
    !activeEntities[j].isTransparent() && Tools.entitiesCollide(activeEntities[i], activeEntities[j])) {
    handleCollision(activeEntities[i], activeEntities[j]);
    // todo - seems redundant - remove by avoiding player ?
    if (activeEntities[i].isDestroyed()) {
    // System.out.println("Removing " + activeEntities[i]);
    activeEntities[i] = null;
    if (activeEntities[j].isDestroyed()) {
    // System.out.println("Removing " + activeEntities[j]);
    activeEntities[j] = null;
    private void purgeDestroyedObjects() {
    for (int i = entities.size() - 1; i >= 0; i--) {
    if (((Entity) entities.get(i)).isDestroyed()) {
    entities.remove(i);
    private void handleCollision(Entity one, Entity two) {
    // Base damage is a factor of total speed & angle.
    double collisionFactor = Math.abs(Math.sin((one.getAccelerationAngle() - two.getAccelerationAngle()) / 2));
    double explosiveDamage = 0;
    if (one.explodesOnImpact()) {
    one.onDestroy();
    explosiveDamage += one.getExplosiveDamage();
    if (two.explodesOnImpact()) {
    two.onDestroy();
    explosiveDamage += two.getExplosiveDamage();
    one.applyDamage(explosiveDamage + (collisionFactor * two.getMass() / one.getMass()));
    two.applyDamage(explosiveDamage + (collisionFactor * one.getMass() / two.getMass()));
    // Introducing the FACTOR-variable also causes stickiness (two objects glued together after collision)
    // FACTOR determines how much of the energy is transfered from entity 1 to 2, and how much remains
    double FACTOR = 0.9;
    // Don't delete v1 and a1!
    double v1 = one.getSpeed();
    double a1 = one.getAccelerationAngle();
    double spinFactor = Math.cos(one.getAccelerationAngle() - two.getAccelerationAngle());
    if (!one.isDestroyed()) {
    one.setSpeed(two.getSpeed() * FACTOR + one.getSpeed() * (1 - FACTOR));
    one.setAccelerationAngle(two.getAccelerationAngle());
    one.applySpin(spinFactor);
    if (!two.isDestroyed()) {
    two.setSpeed(v1 * FACTOR + two.getSpeed() * (1 - FACTOR));
    two.setAccelerationAngle(a1);
    two.applySpin(-spinFactor);
    public Entity[] getVisibleEntities(Entity center) {
    return (Entity[]) entities.toArray(new Entity[entities.size()]);
    private void initializeStarField() {
    stars = new int[MAX_STARS][2];
    for (int i = 0; i < MAX_STARS; i++) {
    setStar(i);
    private void setStar(int index) {
    stars[index][0] = Tools.getRandom(STAR_AREA) + STAR_AREA;
    stars[index][1] = Tools.getRandom(STAR_AREA) + STAR_AREA;
    Finally, the Entity class. All in-game objects extend Entity. Rendering is done in the drawEntity-method. Each Entity has an EntityType which contains parameters like the weight, maximum acceleration and turn rate etc... Images are also stored in EntityType.
    public class Entity {
        public static final double TWOPI = Math.PI * 2;
        protected double speed;
        protected double turnRate;
        protected double x, y;
        protected double heading;
        protected double accelerationAngle;
        protected boolean destroyed = false;
        protected double energy;
        protected EntityType type;
        private Equipment activeEquipment;
        private SolarSystem solar;
        public Entity(int xPos, int yPos, EntityType type, SolarSystem solar) {
            this.x = xPos;
            this.y = yPos;
            this.type = type;
            this.energy = this.getEntityType().getEnergy();
            this.solar = solar;
         * Basic entity drawing function doesn't taken rotation into account
        public void drawEntity(int xLocation, int yLocation, Graphics g) {
            if (this.getActiveEquipment() != null && this.getActiveEquipment().isActive()) {
                this.getActiveEquipment().applyEffect(this, g);
    //        Level.getHandle().getConsole().addConsoleMessage(xLocation + "x" + yLocation);
            g.drawImage(getIcon(), xLocation, yLocation, null);
        public Shape getBoundingShape() {
            return new Rectangle((int) getX(), (int) getY(), getWidth(), getHeight());

  • JDK 1.4.2 and scr-directory

    Does anyone know from where I can download the src-directory for JDK 1.4.2 ? I downloaded JDK 1.4.2 from the javasoft.com and got all directorys except that one.

    multi-post http://forums.java.sun.com/thread.jsp?forum=1&thread=422755&tstart=0&trange=15

  • Installing jdk 1.4.2 and 1.5 parallel

    Hello,
    I would like to know it is possible to install jdk 1.5 on a windows XP machine already countaining jdk 1.4.2.
    I need both versions. I want to switch between them with Eclipse build in features or by selecting the whole path to the bin folder of the target version in batch scripts.
    Is this possible or does dll or registry stuff collide?
    Tanks in advance.
    Alex

    When you install a JDK in Windows, you are given the choice to not install a JRE (it's installed by default).
    The JRE uses the Registry and also installs copies of java.exe, javaw.exe, and javaws.exe in /Windows/System32 directory. The JDK doesn't alter or install anything outside of the directory it installs into.
    You can have as many JDK installs (directories) of different versions as you want, and access the programs in each with a full path to the program. You can provide the path information either from the commandline or a .bat file.
    If any of the installs also install a JRE, then the Registry entries and java files in the System32 directory will be for the last version installed. There can only be one active JRE installed.
    Whatever version's files are found first on the PATH environment variable's list will be the version executed when a naked java command (without the path) is issued. This also means that you will [usually] execute the version whose files are in the System32 directory, since that directory is [usually] the first directory listed in the PATh list.

Maybe you are looking for