*
The moose likes Swing / AWT / SWT and the fly likes Displaying images in a JESS GUI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Displaying images in a JESS GUI" Watch "Displaying images in a JESS GUI" New topic
Author

Displaying images in a JESS GUI

Manu
Greenhorn

Joined: Jan 05, 2006
Posts: 4
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

Joined: Sep 16, 2005
Posts: 1780
You may have better luck posting to a "JESS" forum. I've never heard of it.


There is no emoticon for what I am feeling!
Manu
Greenhorn

Joined: Jan 05, 2006
Posts: 4
do you know any jess forum?
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
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

Joined: Apr 05, 2000
Posts: 1441
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.


The only reason for time is so that everything doesn't happen all at once.
- Buckaroo Banzai
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

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.


[Jess in Action][AskingGoodQuestions]
Manu
Greenhorn

Joined: Jan 05, 2006
Posts: 4
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

Joined: Jul 08, 2003
Posts: 24183
    
  34

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

Joined: Jan 05, 2006
Posts: 4
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

Joined: Apr 05, 2000
Posts: 1441
"Manu",

As Ernest points out we are a picky lot about the naming policy. Don't let it scare you away, though...
 
 
subject: Displaying images in a JESS GUI
 
Similar Threads
Click a button to display an image. Trouble with add panel to a frame. Help !!
container sixe
JFrame not displaying text.
GridBagLayout Question: Irregular Spacing
jess