public ImageFrame(String tit) {
		theDesktop = new JDesktopPane(); // create desktop pane
		add(theDesktop); // add desktop pane to frame

		toolBarPanel = new JPanel();

		functionToolBar = new JToolBar("Toolbar", JToolBar.HORIZONTAL);
		functionToolBar.setBackground(Color.white);
		openButton = new JButton(new ImageIcon("open.png"));
		openButton.setBackground(Color.white);
		openButton.addActionListener(this);
		saveButton = new JButton(new ImageIcon("save.png"));
		saveButton.setBackground(Color.white);
		saveButton.addActionListener(this);
		undoButton = new JButton(new ImageIcon("undo.png"));
		undoButton.setBackground(Color.white);
		undoButton.addActionListener(this);
		redoButton = new JButton(new ImageIcon("redo.png"));
		redoButton.setBackground(Color.white);
		redoButton.addActionListener(this);
		functionToolBar.add(openButton);
		functionToolBar.add(saveButton);
		functionToolBar.add(new JToolBar.Separator());
		functionToolBar.add(undoButton);
		functionToolBar.add(redoButton);

		toolbar = new JToolBar("Toolbar", JToolBar.HORIZONTAL);
		toolbar.setBackground(Color.white);

		toolBarPanel.setLayout(new GridLayout(0, 1));
		toolBarPanel.add(functionToolBar);
		toolBarPanel.add(toolbar);
		toolbar.setVisible(false);
		toolBarPanel.setBackground(Color.white);
		getContentPane().add(toolBarPanel, BorderLayout.NORTH);

		rgRange = new JSlider(JSlider.HORIZONTAL, 0, 80, 40);
		rgRange.setBackground(Color.white);
		rgRange.addChangeListener(this);
		rbRange = new JSlider(JSlider.HORIZONTAL, 0, 80, 40);
		rbRange.setBackground(Color.white);
		rbRange.addChangeListener(this);
		gbRange = new JSlider(JSlider.HORIZONTAL, 0, 80, 40);
		gbRange.setBackground(Color.white);
		gbRange.addChangeListener(this);

		xyVal = new JLabel("          ");
		xyVal.setBackground(Color.white);
		redVal = new JLabel("      ");
		redVal.setBackground(Color.white);
		greenVal = new JLabel("      ");
		greenVal.setBackground(Color.white);
		blueVal = new JLabel("      ");
		blueVal.setBackground(Color.white);

		toolbar.add(new JLabel("(x,y): "));
		toolbar.add(xyVal);
		toolbar.add(new JLabel("(R,G,B) "));
		toolbar.add(redVal);
		toolbar.add(greenVal);
		toolbar.add(blueVal);

		toolbar.add(new JLabel("Red-Green"));
		toolbar.add(rgRange);
		toolbar.add(new JToolBar.Separator());
		toolbar.add(new JLabel("Red-Blue"));
		toolbar.add(rbRange);
		toolbar.add(new JToolBar.Separator());
		toolbar.add(new JLabel("Green-Blue"));
		toolbar.add(gbRange);

		title = tit;
		menuBar = new JMenuBar();

		menuFile = new JMenu("File");
		menuItemOpen = new JMenuItem("Open");
		menuItemOpen.addActionListener(this);
		menuItemSave = new JMenuItem("Save as..");
		menuItemSave.addActionListener(this);
		menuItemExit = new JMenuItem("Exit");
		menuItemExit.addActionListener(this);
		menuFile.add(menuItemOpen);
		menuFile.add(menuItemSave);
		menuFile.addSeparator();
		menuFile.add(menuItemExit);
		menuItemSave.setEnabled(false);

		menuEdit = new JMenu("Edit");
		menuItemUndo = new JMenuItem("Undo");
		menuItemRedo = new JMenuItem("Redo");
		menuItemUndo.addActionListener(this);
		menuItemRedo.addActionListener(this);
		menuEdit.add(menuItemUndo);
		menuEdit.add(menuItemRedo);
		menuItemUndo.setEnabled(false);
		menuItemRedo.setEnabled(false);

		menuProcessing = new JMenu("Processing");
		menuItemBokehTest = new JMenuItem("Bokeh Test");
		menuItemGaussianFilterForGoogleCamera = new JMenuItem("Blur with Depth Map");
		menuItemGetDepthMapFromGoogleCamera = new JMenuItem("Get Depth Map");
		menuItemGaussianFilter = new JMenuItem("Gaussian Blurring");
		menuItemLensBlurFilter = new JMenuItem("Lens Blurring");
		menuItemGrayscale = new JMenuItem("Grayscale");
		menuItemInvert = new JMenuItem("Invert");
		menuItemBrightness = new JMenuItem("Brightness");
		menuItemPreservingPartColor = new JMenuItem("Preserving Partial Colors");
		menuItemRandomPixelMovement = new JMenuItem("Random Pixel Movement");
		menuItemSpinning = new JMenuItem("Spinning");
		menuItemPinching = new JMenuItem("Pinching");
		menuItemPixelate = new JMenuItem("Pixelate");
		menuItemConvertToASCII = new JMenuItem("Image to ASCII");
		menuItemBokehTest.addActionListener(this);
		menuItemGaussianFilterForGoogleCamera.addActionListener(this);
		menuItemGetDepthMapFromGoogleCamera.addActionListener(this);
		menuItemGaussianFilter.addActionListener(this);
		menuItemLensBlurFilter.addActionListener(this);
		menuItemGrayscale.addActionListener(this);
		menuItemInvert.addActionListener(this);
		menuItemBrightness.addActionListener(this);
		menuItemPreservingPartColor.addActionListener(this);
		menuItemRandomPixelMovement.addActionListener(this);
		menuItemSpinning.addActionListener(this);
		menuItemPinching.addActionListener(this);
		menuItemPixelate.addActionListener(this);
		menuItemConvertToASCII.addActionListener(this);
		menuProcessing.add(menuItemBokehTest);
		menuProcessing.add(menuItemGaussianFilterForGoogleCamera);
		menuProcessing.add(menuItemGetDepthMapFromGoogleCamera);
		menuProcessing.add(menuItemGaussianFilter);
		menuProcessing.add(menuItemLensBlurFilter);
		menuProcessing.add(menuItemGrayscale);
		menuProcessing.add(menuItemInvert);
		menuProcessing.add(menuItemBrightness);
		menuProcessing.add(menuItemPreservingPartColor);
		menuProcessing.add(menuItemRandomPixelMovement);
		menuProcessing.add(menuItemSpinning);
		menuProcessing.add(menuItemPinching);
		menuProcessing.add(menuItemPixelate);
		menuProcessing.add(menuItemConvertToASCII);
		menuItemBokehTest.setEnabled(false);
		menuItemGaussianFilterForGoogleCamera.setEnabled(false);
		menuItemGetDepthMapFromGoogleCamera.setEnabled(false);
		menuItemGaussianFilter.setEnabled(false);
		menuItemLensBlurFilter.setEnabled(false);
		menuItemGrayscale.setEnabled(false);
		menuItemInvert.setEnabled(false);
		menuItemBrightness.setEnabled(false);
		menuItemPreservingPartColor.setEnabled(false);
		menuItemRandomPixelMovement.setEnabled(false);
		menuItemSpinning.setEnabled(false);
		menuItemPinching.setEnabled(false);
		menuItemPixelate.setEnabled(false);
		menuItemConvertToASCII.setEnabled(false);

		menuProcessing.setEnabled(false);

		menuLookAndFeel = new JMenu("Look and Feel");
		menuItemMetal = new JRadioButtonMenuItem("Metal");
		menuItemMotif = new JRadioButtonMenuItem("Motif");
		menuItemWindows = new JRadioButtonMenuItem("Windows");
		menuItemMetal.addActionListener(this);
		menuItemMotif.addActionListener(this);
		menuItemWindows.addActionListener(this);
		menuLookAndFeel.add(menuItemMetal);
		menuLookAndFeel.add(menuItemMotif);
		menuLookAndFeel.add(menuItemWindows);
		ButtonGroup lookAndFeelGroup = new ButtonGroup();
		lookAndFeelGroup.add(menuItemMetal);
		lookAndFeelGroup.add(menuItemMotif);
		lookAndFeelGroup.add(menuItemWindows);
		menuItemMetal.setSelected(true);

		menuHelp = new JMenu("Help");
		menuItemAbout = new JMenuItem("About");
		menuItemAbout.addActionListener(this);
		menuHelp.add(menuItemAbout);

		infoBar = new JLabel(" Info.:");
		infoBar.setFont(new Font("Arial", Font.PLAIN, 12));

		menuBar.add(menuFile);
		menuBar.add(menuEdit);
		menuBar.add(menuProcessing);
		menuBar.add(menuLookAndFeel);
		menuBar.add(menuHelp);

		imagePanelOriginal = new ImagePanel(rect);
		imagePanelOriginal.addMouseMotionListener(this);
		imagePanelOriginal.addMouseListener(this);

		imagePanelProcessed = new ImagePanel(rect);
		getContentPane().add(infoBar, BorderLayout.SOUTH);
		setIconImage(new ImageIcon("icon.jpg").getImage());

		inputImage = null;
		resultImage = null;
		mask = null;
		pointColor = new int[3];

		rgRangeValue = 40;
		rbRangeValue = 40;
		gbRangeValue = 40;

		isSelect = false;
	}