|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JPanel | +--ImagePanel
A JPanel
that displays, loads, saves and modifies images.
The refreshImage
method displays an image based on the contents
of an image file. The saveImage
method saves the displayed image
to file. The rotate
method rotates the displayed image. The
removeHorizontalLines
method removes horizontal lines in the
displayed image based on user set thresholds concerning colour and vertical
run length. The showSelectedPixels
method highlights certain pixels
that meet certain user set thresholds concerning colour and vertical run length,
and is useful for debugging. The paintComponent
method is needed
in order to display images and changes to them.
Field Summary |
Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
ImagePanel(String file_path,
MainFrame parent_window)
Basic constructor. |
Method Summary | |
void |
paintComponent(Graphics g)
Allow the image and changes to the image to be displayed. |
void |
refreshImage(String file_path)
Loads the image file with the specified path, stores it in this object's image field and displays it. |
void |
removeHorizontalLines(HorizontalLineRemovalSettingsDialogBox horizontal_line_removal_dialog_box)
Removes horizontal lines from the image held in this object's field. |
void |
rotate(RotateDialogBox rotate_dialog_box)
Rotates the image that is currently held in this object's field by the amount specified by the getRotationAmount method
of the rotate_dialog_box paramater. |
void |
saveImage(File file_to_save_to)
Saves the image that is currently held in this object's field to the specified file. |
void |
showSelectedPixels(HorizontalLineRemovalSettingsDialogBox horizontal_line_removal_dialog_box)
Highlights pixels in the image held in this object's field that pass the succesive filter requirements of the filters selected and there related thresholds in the given horizontal_line_removal_dialog_box parameter. |
Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ImagePanel(String file_path, MainFrame parent_window)
file_path
- The path of the file to be loaded.parent_window
- The window that instantiated this panel.Method Detail |
public void refreshImage(String file_path)
The width and height of the image are stored in this classes fields.
file_path
- The path of the file to be loaded.public void saveImage(File file_to_save_to) throws Exception
file_to_save_to
- The file to save the image to.
Exception
- Throws an exception if there is a problem saving the file.public void rotate(RotateDialogBox rotate_dialog_box)
getRotationAmount
method
of the rotate_dialog_box paramater.
rotate_dialog_box
- Contains the angle by which to rotate the image.public void removeHorizontalLines(HorizontalLineRemovalSettingsDialogBox horizontal_line_removal_dialog_box)
Pixels that are selected through the above method as belonging to a horizontal line are altered by applying a blur filter that averages their new colour to that of the immediately surrounding pixels that are not selected.
Displays an error message if a problem occurs.
horizontal_line_removal_dialog_box
- Specifies parameters needed to determine which pixels belong to horizontal lines.public void showSelectedPixels(HorizontalLineRemovalSettingsDialogBox horizontal_line_removal_dialog_box)
Only the results of the last n filter layers, as set by the Max Layers To Display text area of the horizontal_line_removal_dialog_box are displayed. The pixels surviving the last stage of filtering are set to bright green, those surviving the second to last stage are set to bright orange, those surviving the third to last stage are set to blue, those survivng the fouth to last stage are set to magenta, and those survivng the first stage are set to cyan.
Displays an error message if a problem occurs.
horizontal_line_removal_dialog_box
- Specifies parameters needed to determine which pixels belong to horizontal lines.public void paintComponent(Graphics g)
paintComponent
in class JComponent
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |