package net.katsuster.strview.gui;

import java.awt.Font;
import java.awt.event.*;

import javax.swing.*;

/**
 * <p>
 * バイナリデータを表示するウインドウです。
 * </p>
 *
 * @author katsuhiro
 */
public class BinaryViewerWindow extends JFrame {
    private static final long serialVersionUID = 1L;

    private String filename;

    private BinaryViewer binaryViewer;

    public BinaryViewerWindow(String fn) {
        super();

        //表示するファイルを保持する
        filename = fn;

        setTitle(fn);
        setResizable(true);
        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        setTransferHandler(new FileTransferHandler());

        //メニューを作成する
        JMenuBar topMenuBar = new JMenuBar();
        JMenu menuFile = new JMenu("ファイル(F)");
        menuFile.setMnemonic('f');

        Action actionClose = new MenuActionClose(this, "閉じる(C)");
        actionClose.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_C);
        menuFile.add(actionClose);

        topMenuBar.add(menuFile);
        setJMenuBar(topMenuBar);

        //バイナリビューア
        binaryViewer = new BinaryViewer(fn);
        binaryViewer.setFont(new Font(Font.MONOSPACED, 0, 12));
        getContentPane().add(binaryViewer);
    }

    public String getFilename() {
        return filename;
    }
}

@@ -765,16 +765,102 @@
 ic('f');
+%0A        JMenu menuSetting = new JMenu(%22%E8%A8%AD%E5%AE%9A(S)%22);%0A        menuSetting.setMnemonic('s');
 %0A%0A      
@@ -1033,31 +1033,239 @@
     
-topMenuBar.add(menuFile
+Action actionFont = new MenuActionFont(this, %22%E3%83%95%E3%82%A9%E3%83%B3%E3%83%88(F)...%22);%0A        actionFont.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_F);%0A        menuSetting.add(actionFont);%0A%0A        topMenuBar.add(menuFile);%0A        topMenuBar.add(menuSetting
 );%0A 
@@ -1540,11 +1540,787 @@
 e;%0A    %7D
+%0A%0A    public class MenuActionFont extends AbstractAction %7B%0A        private static final long serialVersionUID = 1L;%0A        private JFrame parent;%0A%0A        public MenuActionFont(JFrame f, String name) %7B%0A            super(name);%0A            parent = f;%0A        %7D%0A%0A        public MenuActionFont(JFrame f, String name, Icon icon) %7B%0A            super(name, icon);%0A            parent = f;%0A        %7D%0A%0A        @Override%0A        public void actionPerformed(ActionEvent e) %7B%0A            JFontChooser chooser = new JFontChooser();%0A%0A            chooser.setSelectedFont(binaryViewer.getFont());%0A            int res = chooser.showDialog(parent);%0A            if (res == JFontChooser.OK_OPTION) %7B%0A                binaryViewer.setFont(chooser.getSelectedFont());%0A            %7D%0A        %7D%0A    %7D
 %0A%7D%0A

Enable to choose font of BinaryViewer.