ImageGUI_Solutions - import import import import import...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.awt.*; import java.awt.image.*; import java.util.*; import*; import*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.awt.image.*; /** An instance is a JFrame that contains an image with a title and buttons to cause alteration of the image. When no image is in the JFrame, it is hidden. When an image is placed in it, it becomes visible. */ public class ImageGUI extends JFrame implements ActionListener { // server contains the original and current ImageMaps and // methods that manipulate them. private ImageServer server; // Buttons private JButton buttonrestore= new JButton("restore"); private JButton buttoninvert= new JButton("invert"); private JButton buttontranspose= new JButton("transpose"); private JButton buttonhreflect= new JButton("hor reflect"); private JButton buttonvreflect= new JButton("ver reflect"); private JButton buttonfilter= new JButton("filter"); private JButton buttonhide= new JButton("hide message"); private JButton buttonreveal= new JButton("reveal message"); private Box buttonBox= new Box(BoxLayout.Y_AXIS); // Three radio buttons private JRadioButton greyButton= new JRadioButton("grey", true); private JRadioButton redButton= new JRadioButton("red", false); private JRadioButton greenButton= new JRadioButton("green", false); private JRadioButton blueButton= new JRadioButton("blue", false); private Box checkboxBox= new Box(BoxLayout.X_AXIS); private ButtonGroup group= new ButtonGroup(); /** The panel with the original image, the panel with the current image, and the box that contains both. */ private ImagePanel originalPanel; private ImagePanel currentPanel; Box inputBox= new Box(BoxLayout.Y_AXIS); // The text area for the user to give a message private JTextArea messageArea= new JTextArea(4, 20); private JScrollPane scrollPane= new JScrollPane(messageArea); private JLabel jlabel= new JLabel("Type the message to be hidden in this text area:"); Box areaBox= new Box(BoxLayout.Y_AXIS); // imageBox contains the original image and the current one Box imagebox= new Box(BoxLayout.X_AXIS); /** = the current panel */ public ImagePanel getCurrentPanel() {
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
return currentPanel; } /** = the original panel */ public ImagePanel getOriginalPanel() { return originalPanel; } /** = the ImageServer for the image*/ public ImageServer getserver() { return server; } /** A jframe with a picture in it and the title
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 7

ImageGUI_Solutions - import import import import import...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online