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();
}
Aggregations