Skip to main content

SGComponents does not respond to mouse events in JRE 1.5

3 replies [Last post]
mortennobel
Offline
Joined: 2004-11-03
Points: 0

I just played a bit around with the latest build (rev 314) and found out that SGComponents does not deliver mouse events to its components in JRE 1.5 (it does work fine in JRE 1.6).

Are you aware of this bug?

Kind regards,
Morten

import com.sun.scenario.scenegraph.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;

/**
*
*/
public class JRE15ComponentBug extends JFrame{
private JSGPanel panel = new JSGPanel();
public JRE15ComponentBug() {
super("Component Bug");

getContentPane().setLayout(new BorderLayout());
getContentPane().add(panel, BorderLayout.CENTER);

SGGroup group = new SGGroup();
panel.setScene(group);

SGComponent button = new SGComponent();
JButton button1 = new JButton("Test");
button1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("Never invoked in JRE 1.5");
}
});
button1.addMouseMotionListener(new MouseAdapter() {
public void mouseMoved(MouseEvent e) {
System.out.println("e = " + e);
}
});
button.setComponent(button1);
group.add(SGTransform.createTranslation(50,50,button));

setSize(200,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setVisible(true);
}

public static void main(String[] args){
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new JRE15ComponentBug();
}
});
}
}

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
coffeejolts
Offline
Joined: 2007-05-17
Points: 0

I don't think that it is a bug that JavaFX doesn't work right with JDK 1.5. AFAIK, JavaFX is strictly 1.6+

Toula Michael

So no JavaFX in Applets on the Mac.

On 29 juil. 08, at 18:46, scenario@javadesktop.org wrote:

> I don't think that it is a bug that JavaFX doesn't work right with
> JDK 1.5. AFAIK, JavaFX is strictly 1.6+
> [Message sent by forum member 'coffeejolts' (coffeejolts)]
>
> http://forums.java.net/jive/thread.jspa?messageID=290123
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@scenegraph.dev.java.net
> For additional commands, e-mail: dev-help@scenegraph.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@scenegraph.dev.java.net
For additional commands, e-mail: dev-help@scenegraph.dev.java.net

mortennobel
Offline
Joined: 2004-11-03
Points: 0

After a bit more digging I found the bug was not in Scenegraph at all :-(

The Scenegraph project are compiled using Java 1.6, but with "-target 1.5", so everything should be able to work in 1.5.

The bug was actually in my IDE (IntelliJ), where I had setup the project using the same technique (using 1.6 javac but with target 1.5). When I launched the project, I had specified a alternative JRE (Java 1.5). But my IDE included all Java 1.6 classes, and 'confused' the scenegraph.

Sorry for false alarm :-)

Kind regards,
Morten