|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object PictureExplorer
public class PictureExplorer
Displays a picture and lets you explore the picture by displaying the x, y, red, green, and blue values of the pixel at the cursor when you click a mouse button or press and hold a mouse button while moving the cursor. It also lets you zoom in or out. You can also type in a x and y value to see the color at that location. Originally created for the Jython Environment for Students (JES). Modified to work with DrJava by Barbara Ericson
Constructor Summary | |
---|---|
PictureExplorer(DigitalPicture picture)
Public constructor |
Method Summary | |
---|---|
void |
actionPerformed(ActionEvent a)
Controls the zoom menu bar |
void |
changeToBaseOne()
Changes the number system to start at one |
void |
checkScroll()
Method to check that the current position is in the viewing area and if not scroll to center the current position if possible |
JPanel |
createLocationPanel(Font labelFont)
Create the pixel location panel |
void |
displayPixelInformation(String xString,
String yString)
Method to display the pixel information from the passed x and y but also converts x and y from strings |
static void |
main(String[] args)
Test Main. |
void |
mouseClicked(MouseEvent e)
Method called when the mouse is clicked |
void |
mouseDragged(MouseEvent e)
Called when the mouse is dragged (button held down and moved) |
void |
mouseEntered(MouseEvent e)
Method called when the component is entered (mouse moves over it) |
void |
mouseExited(MouseEvent e)
Method called when the mouse moves over the component |
void |
mouseMoved(MouseEvent e)
Method called when the mouse is moved with no buttons down |
void |
mousePressed(MouseEvent e)
Method called when the mouse button is pushed down |
void |
mouseReleased(MouseEvent e)
Method called when the mouse button is released |
void |
repaint()
Repaints the image on the scrollpane. |
void |
setTitle(String title)
Set the title of the frame |
void |
zoom(double factor)
Zooms in the on picture by scaling the image. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PictureExplorer(DigitalPicture picture)
picture
- the picture to exploreMethod Detail |
---|
public void changeToBaseOne()
public void setTitle(String title)
title
- the title to use in the JFramepublic JPanel createLocationPanel(Font labelFont)
labelFont
- the font for the labels
public void checkScroll()
public void zoom(double factor)
factor
- the amount to zoom bypublic void repaint()
public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
e
- MouseEvent to trackpublic void displayPixelInformation(String xString, String yString)
xString
- the x value as a string from the useryString
- the y value as a string from the userpublic void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
e
- the mouse eventpublic void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
e
- the mouse eventpublic void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
e
- the mouse eventpublic void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
e
- the mouse eventpublic void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
e
- the mouse eventpublic void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
e
- the mouse eventpublic void actionPerformed(ActionEvent a)
actionPerformed
in interface ActionListener
a
- ActionEvent to trackpublic static void main(String[] args)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |