Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Image display with visor

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I have a application that shows a pgm image read it of a file.
When I read the image, I show two frames, one with the original size
(with scrolls) ant another with the same image but with a smaller size.
In this second frame I have to draw a litttle square that represents
the zone of the image diplayed on the frame with the original size.

I display the image, assign it to a label, and run's ok.

To draw a square I think I have to use canvas �?, but when I draw
the square, the label with the image disappear from the frame.

I think I've made something wrong, can somebody help me?
any advice will be welcome.

Thank's for all, and sorry for my English.
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
joan wo
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Craig,

Thank's for you're reply, but I think that how I have my code that's not possible, or at least I don't know how do it.

I have a main class Region.java where I choose a pgm file and then I call to others classes:



In GeneralVisor I create a frame with the pierce of the image to filling oll the available space in the frame.

In GlobalVisor I create a frame with a scaled size of the same image, I read the file again (scaled) and then I show it on this another frame.

I display the image on this method:



Initially I had this here:


and runs ok, but without painting anything over
I've tried to change it by:



when a ImageComponent is the like the class in your comment, but when I run it, appears the next error message:



What's the problem?
I don't know why don't run it ok.

Thank's for all.
 
reply
    Bookmark Topic Watch Topic
  • New Topic