Search in sources :

Example 1 with GoToBinaryPanel

use of com.mucommander.viewer.binary.ui.GoToBinaryPanel in project mucommander by mucommander.

the class BinaryBase method goToPosition.

public void goToPosition() {
    CodeArea codeArea = binaryComponent.getCodeArea();
    FocusDialog dialog = new FocusDialog(windowFrame, Translator.get("binary_viewer.go_to.dialog_title"), windowFrame);
    Container contentPane = dialog.getContentPane();
    GoToBinaryPanel goToPanel = new GoToBinaryPanel();
    goToPanel.setCursorPosition(codeArea.getDataPosition());
    goToPanel.setMaxPosition(codeArea.getDataSize());
    contentPane.add(goToPanel, BorderLayout.CENTER);
    final JButton okButton = new JButton(Translator.get("binary_viewer.go_to.ok"));
    JButton cancelButton = new JButton(Translator.get("cancel"));
    contentPane.add(DialogToolkit.createOKCancelPanel(okButton, cancelButton, dialog.getRootPane(), e -> {
        Object source = e.getSource();
        if (source == okButton) {
            goToPanel.acceptInput();
            long targetPosition = goToPanel.getTargetPosition();
            codeArea.setCaretPosition(targetPosition);
            codeArea.revealCursor();
        }
        dialog.dispose();
    }), BorderLayout.SOUTH);
    SwingUtilities.invokeLater(goToPanel::initFocus);
    dialog.showDialog();
}
Also used : Color(java.awt.Color) EditOperation(org.exbin.bined.EditOperation) CodeType(org.exbin.bined.CodeType) GoToBinaryPanel(com.mucommander.viewer.binary.ui.GoToBinaryPanel) FocusDialog(com.mucommander.commons.util.ui.dialog.FocusDialog) MenuToolkit(com.mucommander.commons.util.ui.helper.MenuToolkit) ParametersAreNonnullByDefault(javax.annotation.ParametersAreNonnullByDefault) EditMode(org.exbin.bined.EditMode) SwingUtilities(javax.swing.SwingUtilities) Charset(java.nio.charset.Charset) JMenuItem(javax.swing.JMenuItem) MnemonicHelper(com.mucommander.commons.util.ui.helper.MnemonicHelper) CodeArea(org.exbin.bined.swing.basic.CodeArea) FontChangedEvent(com.mucommander.ui.theme.FontChangedEvent) CodeAreaCaretPosition(org.exbin.bined.CodeAreaCaretPosition) ThemeManager(com.mucommander.ui.theme.ThemeManager) EditModeCapable(org.exbin.bined.capability.EditModeCapable) Container(java.awt.Container) BorderLayout(java.awt.BorderLayout) JFrame(javax.swing.JFrame) Translator(com.mucommander.text.Translator) Nonnull(javax.annotation.Nonnull) ColorChangedEvent(com.mucommander.ui.theme.ColorChangedEvent) KeyStroke(javax.swing.KeyStroke) JButton(javax.swing.JButton) DialogToolkit(com.mucommander.commons.util.ui.dialog.DialogToolkit) Theme(com.mucommander.ui.theme.Theme) ButtonGroup(javax.swing.ButtonGroup) JMenu(javax.swing.JMenu) BinaryStatusPanel(com.mucommander.viewer.binary.ui.BinaryStatusPanel) KeyEvent(java.awt.event.KeyEvent) MouseEvent(java.awt.event.MouseEvent) Dimension(java.awt.Dimension) CodeCharactersCase(org.exbin.bined.CodeCharactersCase) ThemeListener(com.mucommander.ui.theme.ThemeListener) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) JPanel(javax.swing.JPanel) Container(java.awt.Container) JButton(javax.swing.JButton) FocusDialog(com.mucommander.commons.util.ui.dialog.FocusDialog) GoToBinaryPanel(com.mucommander.viewer.binary.ui.GoToBinaryPanel) CodeArea(org.exbin.bined.swing.basic.CodeArea)

Aggregations

DialogToolkit (com.mucommander.commons.util.ui.dialog.DialogToolkit)1 FocusDialog (com.mucommander.commons.util.ui.dialog.FocusDialog)1 MenuToolkit (com.mucommander.commons.util.ui.helper.MenuToolkit)1 MnemonicHelper (com.mucommander.commons.util.ui.helper.MnemonicHelper)1 Translator (com.mucommander.text.Translator)1 ColorChangedEvent (com.mucommander.ui.theme.ColorChangedEvent)1 FontChangedEvent (com.mucommander.ui.theme.FontChangedEvent)1 Theme (com.mucommander.ui.theme.Theme)1 ThemeListener (com.mucommander.ui.theme.ThemeListener)1 ThemeManager (com.mucommander.ui.theme.ThemeManager)1 BinaryStatusPanel (com.mucommander.viewer.binary.ui.BinaryStatusPanel)1 GoToBinaryPanel (com.mucommander.viewer.binary.ui.GoToBinaryPanel)1 BorderLayout (java.awt.BorderLayout)1 Color (java.awt.Color)1 Container (java.awt.Container)1 Dimension (java.awt.Dimension)1 KeyEvent (java.awt.event.KeyEvent)1 MouseEvent (java.awt.event.MouseEvent)1 Charset (java.nio.charset.Charset)1 Nonnull (javax.annotation.Nonnull)1