Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #3490
| From | "John B. Matthews" <john.b..matthews@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Re: Image Displayer |
| Message-ID | <nospam-11D243.23143409052008@news-server.woh.rr.com> (permalink) |
| Newsgroups | comp.lang.java.gui |
| References | <76f67313-1255-4056-b072-8dc634fa0c42@c65g2000hsa.googlegr |
| Date | 2011-04-27 15:45 +0000 |
| Organization | TDS.net |
To: comp.lang.java.programmer
In article
<76f67313-1255-4056-b072-8dc634fa0c42@c65g2000hsa.googlegroups.com>,
Chase Preuninger <chasepreuninger@gmail.com> wrote:
> I want to figure out how to read a JPG file by just using the read
> method in the InputStream class then I want to create a GUI component
> that can display it.
>
> 1) How are the bytes formatted in a JPG file?
> 2) What is the best way to color individual pixels in a JComponent.
>
> [elided]
Just to get started, use one of the ImageIO.read() methods to get your
image into a BufferedImage. Then call getRaster() and have fun with the
raster's numerous setXXX methods. Then override paintComponent() in
whatever Component you extend:
protected void paintComponent(Graphics g) {
g.drawImage(bufferedImage, 0, 0, this);
}
John
--
John B. Matthews
trashgod at gmail dot com
home dot woh dot rr dot com slash jbmatthews
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
Back to comp.lang.java.gui | Previous | Next | Find similar
Re: Image Displayer "John B. Matthews" <john.b..matthews@THRWHITE.remove-dii-this> - 2011-04-27 15:45 +0000
csiph-web