public Scalar() {
        super("Scalar");

        saveChooser.addChoosableFileFilter(new FileFilter() {

            public boolean accept(File f) {
                if (f.isDirectory()) {
                    return true;
                }
                if (f.getName().endsWith(".jpg")) {
                    return true;
                }
                if (f.getName().endsWith(".gif")) {
                    return true;
                }
                if (f.getName().endsWith(".png")) {
                    return true;
                }

                return false;
            }

            public String getDescription() {
                return "Image files (*.png, *.jpg, *.gif)";
            }

        });
        loadChooser.addChoosableFileFilter(new FileFilter() {

            public boolean accept(File f) {
                if (f.isDirectory()) {
                    return true;
                }
                if (f.getName().endsWith(".jpg")) {
                    return true;
                }
                if (f.getName().endsWith(".gif")) {
                    return true;
                }
                if (f.getName().endsWith(".png")) {
                    return true;
                }

                return false;
            }

            public String getDescription() {
                return "Image files (*.png, *.jpg, *.gif)";
            }

        });

        JMenuBar bar = new JMenuBar();
        JMenu file = new JMenu("File");
        JMenuItem load = new JMenuItem("Load Image");
        JMenuItem save = new JMenuItem("Save Image");
        JMenuItem scale2x = new JMenuItem("Apply Scale2X");
        JMenuItem scale3x = new JMenuItem("Apply Scale3X");
        JMenuItem quit = new JMenuItem("Exit");

        file.add(load);
        file.add(save);
        file.addSeparator();
        file.add(scale2x);
        file.add(scale3x);
        file.addSeparator();
        file.add(quit);
        bar.add(file);
        setJMenuBar(bar);

        load.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                load();
            }

        });
        save.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                save();
            }

        });
        scale2x.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                scale2x();
            }

        });
        scale3x.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                scale3x();
            }

        });
        quit.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                quit();
            }

        });

        addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }

        });

        imagePanel = new ImagePanel();
        setContentPane(new JScrollPane(imagePanel));

        setSize(600, 600);
        Dimension dims = Toolkit.getDefaultToolkit().getScreenSize();
        setLocation((dims.width - getWidth()) / 2, (dims.height - getHeight()) / 2);
        setVisible(true);
    }