• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Displaying images in a JESS GUI

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...?
 
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
do you know any jess forum?
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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/
 
Rancher
Posts: 1449
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Paper beats rock. Scissors beats tiny ad.
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic