aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/org/jdesktop/j3d/examples/background
diff options
context:
space:
mode:
authorjada <jada@28c7f869-5b4e-e670-f602-82bfaf57f300>2006-02-11 00:55:33 +0000
committerjada <jada@28c7f869-5b4e-e670-f602-82bfaf57f300>2006-02-11 00:55:33 +0000
commit7f2ec5f282081ddc2510dc03d5d625f3e6078833 (patch)
tree4b38f9c6647c31a5bd31f39de2ed7d7723090a15 /src/classes/org/jdesktop/j3d/examples/background
parentbdf61f929eb2c5ff73be8020719790048972ae7c (diff)
Modified a couple of the examples programs to access data files in the resources directory.
Diffstat (limited to 'src/classes/org/jdesktop/j3d/examples/background')
-rw-r--r--src/classes/org/jdesktop/j3d/examples/background/BackgroundGeometry.java25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/classes/org/jdesktop/j3d/examples/background/BackgroundGeometry.java b/src/classes/org/jdesktop/j3d/examples/background/BackgroundGeometry.java
index e6ea23c..86c380a 100644
--- a/src/classes/org/jdesktop/j3d/examples/background/BackgroundGeometry.java
+++ b/src/classes/org/jdesktop/j3d/examples/background/BackgroundGeometry.java
@@ -48,12 +48,12 @@ import com.sun.j3d.utils.image.TextureLoader;
import com.sun.j3d.utils.behaviors.mouse.*;
import java.applet.Applet;
import java.awt.*;
-import java.awt.event.*;
import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.geometry.*;
import com.sun.j3d.utils.universe.*;
import javax.media.j3d.*;
import javax.vecmath.*;
+import org.jdesktop.j3d.examples.Resources;
public class BackgroundGeometry extends Applet {
@@ -169,14 +169,12 @@ public class BackgroundGeometry extends Applet {
if (bgImage == null) {
// the path to the image for an applet
- try {
- bgImage = new java.net.URL(getCodeBase().toString() +
- "../images/bg.jpg");
- }
- catch (java.net.MalformedURLException ex) {
- System.out.println(ex.getMessage());
- System.exit(1);
- }
+ bgImage = Resources.getResource("resources/images/bg.jpg");
+ if (bgImage == null) {
+ System.err.println("resources/images/bg.jpg not found");
+ System.exit(1);
+ }
+
}
setLayout(new BorderLayout());
GraphicsConfiguration config =
@@ -225,11 +223,10 @@ public class BackgroundGeometry extends Applet {
System.out.println(" Note that the background geometry only changes with rotation");
// the path to the image file for an application
java.net.URL bgurl = null;
- try {
- bgurl = new java.net.URL("file:../images/bg.jpg");
- }
- catch (java.net.MalformedURLException ex) {
- System.out.println(ex.getMessage());
+
+ bgurl = Resources.getResource("resources/images/bg.jpg");
+ if (bgurl == null) {
+ System.err.println("resources/images/bg.jpg not found");
System.exit(1);
}
new MainFrame(new BackgroundGeometry(bgurl), 750, 750);