File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Displaying images in a JESS GUI

 
Manu
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone

i have some problems displaying a jpg in a jess GUI.
i created a frame like this:


can anybody help me to get a jpg into this...?
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may have better luck posting to a "JESS" forum. I've never heard of it.
 
Manu
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do you know any jess forum?
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After a quick google, I see that JESS was written by Javaranch bartender and regular, Ernest Friedman-Hill, so I'd expect he'll see this thread soon. Until then, that same quick google found the JESS home page, which includes a wiki: http://herzberg.ca.sandia.gov/jess/
 
John Wetherbie
Rancher
Posts: 1449
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
M.K.,

Please review the JavaRanch naming policy and update your user name. I'll get hold of Ernest and see where he thinks this question can best be answered.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All you need to know is how to do it in Java -- then you simply do the same thing, only in Jess syntax. One convenient way to display a picture in a Swing GUI is using a JLabel with an ImageIcon in it, like this:

frame.getContentPane().add(new JLabel(new ImageIcon("foo.jpg")));

If you do this before you "pack" the frame, then the image will show up correctly right away. In Jess, this would look like

((?*frame* getContentPane) add (new JLabel (new ImageIcon "foo.jpg")))

Regarding Jess forums: I often answer Jess questions in the "Other Java Products and Servers" forum here at the Ranch, but the most active venue for Jess questions is the jess-users mailing list. See here for information about that.
 
Manu
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please review the JavaRanch naming policy and update your user name.

sorry about this...

All you need to know is how to do it in Java

i just begann java/jess programmin so somebody told me how to do it in java. unfortunately it was not the correct way, so i couldn't success in jess :-(

If you do this before you "pack" the frame, then the image will show up correctly right away. In Jess, this would look like

i did as you told me, but the only thing i get, is an empty window, the jpg is missing. does it matter in which directory the picture is saved?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Manu:

does it matter in which directory the picture is saved?


Where I wrote "foo.jpg", you'd have to write the path (absolute, or relative to the current directory) of an actual JPEG file. If you include directories in your path, be sure to use "/", not "\", as separator characters.

Sorry to have to say this, but the naming policy requires two names: "Manu Smith", for example, would be valid.
 
Manu
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ernest Friedman-Hill:


Where I wrote "foo.jpg", you'd have to write the path (absolute, or relative to the current directory) of an actual JPEG file. If you include directories in your path, be sure to use "/", not "\", as separator characters.]


SUCCESS!!! THANK YOU!!!

Sorry to have to say this, but the naming policy requires two names: "Manu Smith", for example, would be valid.


ay caramba
 
John Wetherbie
Rancher
Posts: 1449
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Manu",

As Ernest points out we are a picky lot about the naming policy. Don't let it scare you away, though...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic