You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PreviewDialog.java 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /* $Id$ */
  18. // Originally contributed by:
  19. // Juergen Verwohlt: Juergen.Verwohlt@jCatalog.com,
  20. // Rainer Steinkuhle: Rainer.Steinkuhle@jCatalog.com,
  21. // Stanislav Gorkhover: Stanislav.Gorkhover@jCatalog.com
  22. package org.apache.fop.render.awt.viewer;
  23. // Java
  24. import java.awt.BorderLayout;
  25. import java.awt.Dimension;
  26. import java.awt.GridBagConstraints;
  27. import java.awt.GridBagLayout;
  28. import java.awt.Insets;
  29. import java.awt.Point;
  30. import java.awt.Toolkit;
  31. import java.awt.event.ActionEvent;
  32. import java.awt.event.ActionListener;
  33. import java.awt.event.KeyEvent;
  34. import java.awt.event.WindowAdapter;
  35. import java.awt.event.WindowEvent;
  36. import java.awt.print.PrinterException;
  37. import java.awt.print.PrinterJob;
  38. import java.text.DecimalFormat;
  39. import java.text.DecimalFormatSymbols;
  40. import java.util.Locale;
  41. import javax.swing.ActionMap;
  42. import javax.swing.BorderFactory;
  43. import javax.swing.ButtonGroup;
  44. import javax.swing.InputMap;
  45. import javax.swing.JComboBox;
  46. import javax.swing.JComponent;
  47. import javax.swing.JFrame;
  48. import javax.swing.JLabel;
  49. import javax.swing.JMenu;
  50. import javax.swing.JMenuBar;
  51. import javax.swing.JOptionPane;
  52. import javax.swing.JPanel;
  53. import javax.swing.JRadioButtonMenuItem;
  54. import javax.swing.JToolBar;
  55. import javax.swing.KeyStroke;
  56. import javax.swing.SwingUtilities;
  57. import org.apache.fop.apps.FOPException;
  58. import org.apache.fop.apps.FOUserAgent;
  59. import org.apache.fop.render.awt.AWTRenderer;
  60. /**
  61. * AWT Viewer main window.
  62. * Surrounds a PreviewPanel with a bunch of pretty buttons and controls.
  63. */
  64. public class PreviewDialog extends JFrame implements StatusListener {
  65. /** The Translator for localization */
  66. protected Translator translator;
  67. /** The AWT renderer */
  68. protected AWTRenderer renderer;
  69. /** The FOUserAgent associated with this window */
  70. protected FOUserAgent foUserAgent;
  71. /** The originally configured target resolution */
  72. protected float configuredTargetResolution;
  73. /**
  74. * Renderable instance that can be used to reload and re-render a document after
  75. * modifications.
  76. */
  77. protected Renderable renderable;
  78. /** The JCombobox to rescale the rendered page view */
  79. private JComboBox scale;
  80. /** The JLabel for the process status bar */
  81. private JLabel processStatus;
  82. /** The JLabel information status bar */
  83. private JLabel infoStatus;
  84. /** The main display area */
  85. private PreviewPanel previewPanel;
  86. /** Formats the text in the scale combobox. */
  87. private DecimalFormat percentFormat = new DecimalFormat("###0.0#",
  88. new DecimalFormatSymbols(Locale.ENGLISH));
  89. /**
  90. * Creates a new PreviewDialog that uses the given renderer.
  91. * @param foUserAgent the user agent
  92. * @param renderable the Renderable instance that is used to reload/re-render a document
  93. * after modifications.
  94. */
  95. public PreviewDialog(FOUserAgent foUserAgent, Renderable renderable) {
  96. renderer = (AWTRenderer) foUserAgent.getRendererOverride();
  97. this.foUserAgent = foUserAgent;
  98. this.configuredTargetResolution = this.foUserAgent.getTargetResolution();
  99. this.renderable = renderable;
  100. translator = new Translator();
  101. //Commands aka Actions
  102. Command printAction = new Command(translator.getString("Menu.Print"), "Print") {
  103. public void doit() {
  104. startPrinterJob(true);
  105. }
  106. };
  107. Command firstPageAction = new Command(translator.getString("Menu.First.page"),
  108. "firstpg") {
  109. public void doit() {
  110. goToFirstPage();
  111. }
  112. };
  113. Command previousPageAction = new Command(translator.getString("Menu.Prev.page"),
  114. "prevpg") {
  115. public void doit() {
  116. goToPreviousPage();
  117. }
  118. };
  119. Command nextPageAction = new Command(translator.getString("Menu.Next.page"), "nextpg") {
  120. public void doit() {
  121. goToNextPage();
  122. }
  123. };
  124. Command lastPageAction = new Command(translator.getString("Menu.Last.page"), "lastpg") {
  125. public void doit() {
  126. goToLastPage();
  127. }
  128. };
  129. Command reloadAction = new Command(translator.getString("Menu.Reload"), "reload") {
  130. public void doit() {
  131. previewPanel.reload();
  132. }
  133. };
  134. Command debugAction = new Command(translator.getString("Menu.Debug"), "debug") {
  135. // TODO use Translator
  136. public void doit() {
  137. previewPanel.debug();
  138. }
  139. };
  140. Command aboutAction = new Command(translator.getString("Menu.About"), "fopLogo") {
  141. public void doit() {
  142. startHelpAbout();
  143. }
  144. };
  145. setTitle("FOP: AWT-" + translator.getString("Title.Preview"));
  146. setDefaultCloseOperation(DISPOSE_ON_CLOSE);
  147. //Sets size to be 61%x90% of the screen size
  148. Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
  149. // Needed due to bug in Sun's JVM 1.5 (6429775)
  150. pack();
  151. //Rather frivolous size - fits A4 page width in 1024x768 screen on my desktop
  152. setSize(screen.width * 61 / 100, screen.height * 9 / 10);
  153. //Page view stuff
  154. previewPanel = new PreviewPanel(foUserAgent, renderable, renderer);
  155. getContentPane().add(previewPanel, BorderLayout.CENTER);
  156. // Keyboard shortcuts - pgup/pgdn
  157. InputMap im = previewPanel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
  158. ActionMap am = previewPanel.getActionMap();
  159. im.put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0), "nextPage");
  160. im.put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0), "prevPage");
  161. im.put(KeyStroke.getKeyStroke(KeyEvent.VK_HOME, 0), "firstPage");
  162. im.put(KeyStroke.getKeyStroke(KeyEvent.VK_END, 0), "lastPage");
  163. previewPanel.getActionMap().put("nextPage", nextPageAction);
  164. previewPanel.getActionMap().put("prevPage", previousPageAction);
  165. previewPanel.getActionMap().put("firstPage", firstPageAction);
  166. previewPanel.getActionMap().put("lastPage", lastPageAction);
  167. //Scaling combobox
  168. scale = new JComboBox();
  169. scale.addItem(translator.getString("Menu.Fit.Window"));
  170. scale.addItem(translator.getString("Menu.Fit.Width"));
  171. scale.addItem("25%");
  172. scale.addItem("50%");
  173. scale.addItem("75%");
  174. scale.addItem("100%");
  175. scale.addItem("150%");
  176. scale.addItem("200%");
  177. scale.setMaximumSize(new Dimension(80, 24));
  178. scale.setPreferredSize(new Dimension(80, 24));
  179. scale.setSelectedItem("100%");
  180. scale.setEditable(true);
  181. scale.addActionListener(new ActionListener() {
  182. public void actionPerformed(ActionEvent e) {
  183. scaleActionPerformed(e);
  184. }
  185. });
  186. //Menu
  187. setJMenuBar(setupMenu());
  188. // Toolbar
  189. JToolBar toolBar = new JToolBar();
  190. toolBar.add(printAction);
  191. toolBar.add(reloadAction);
  192. toolBar.addSeparator();
  193. toolBar.add(firstPageAction);
  194. toolBar.add(previousPageAction);
  195. toolBar.add(nextPageAction);
  196. toolBar.add(lastPageAction);
  197. toolBar.addSeparator(new Dimension(20, 0));
  198. toolBar.add(new JLabel(translator.getString("Menu.Zoom") + " "));
  199. toolBar.add(scale);
  200. toolBar.addSeparator();
  201. toolBar.add(debugAction);
  202. toolBar.addSeparator();
  203. toolBar.add(aboutAction);
  204. getContentPane().add(toolBar, BorderLayout.NORTH);
  205. // Status bar
  206. JPanel statusBar = new JPanel();
  207. processStatus = new JLabel();
  208. processStatus.setBorder(BorderFactory.createCompoundBorder(
  209. BorderFactory.createEtchedBorder(),
  210. BorderFactory.createEmptyBorder(0, 3, 0, 0)));
  211. infoStatus = new JLabel();
  212. infoStatus.setBorder(BorderFactory.createCompoundBorder(
  213. BorderFactory.createEtchedBorder(),
  214. BorderFactory.createEmptyBorder(0, 3, 0, 0)));
  215. statusBar.setLayout(new GridBagLayout());
  216. processStatus.setPreferredSize(new Dimension(200, 21));
  217. processStatus.setMinimumSize(new Dimension(200, 21));
  218. infoStatus.setPreferredSize(new Dimension(100, 21));
  219. infoStatus.setMinimumSize(new Dimension(100, 21));
  220. statusBar.add(processStatus,
  221. new GridBagConstraints(0, 0, 1, 0, 2.0, 0.0,
  222. GridBagConstraints.CENTER,
  223. GridBagConstraints.HORIZONTAL,
  224. new Insets(0, 0, 0, 3), 0, 0));
  225. statusBar.add(infoStatus,
  226. new GridBagConstraints(1, 0, 1, 0, 1.0, 0.0,
  227. GridBagConstraints.CENTER,
  228. GridBagConstraints.HORIZONTAL,
  229. new Insets(0, 0, 0, 0), 0, 0));
  230. getContentPane().add(statusBar, BorderLayout.SOUTH);
  231. }
  232. /**
  233. * Creates and initialize the AWT Viewer main window.
  234. * @param foUserAgent the FO user agent
  235. * @param renderable the target for the rendering
  236. * @return the newly initialized preview dialog
  237. */
  238. public static PreviewDialog createPreviewDialog(FOUserAgent foUserAgent,
  239. Renderable renderable, boolean asMainWindow) {
  240. PreviewDialog frame = new PreviewDialog(foUserAgent, renderable);
  241. if (asMainWindow) {
  242. frame.addWindowListener(new WindowAdapter() {
  243. public void windowClosed(WindowEvent we) {
  244. System.exit(0);
  245. }
  246. });
  247. }
  248. // Centers the window
  249. Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
  250. Dimension frameSize = frame.getSize();
  251. if (frameSize.height > screenSize.height) {
  252. frameSize.height = screenSize.height;
  253. }
  254. if (frameSize.width > screenSize.width) {
  255. frameSize.width = screenSize.width;
  256. }
  257. frame.setLocation((screenSize.width - frameSize.width) / 2,
  258. (screenSize.height - frameSize.height) / 2);
  259. frame.setStatus(frame.translator.getString("Status.Build.FO.tree"));
  260. frame.setVisible(true);
  261. return frame;
  262. }
  263. /**
  264. * Creates a new PreviewDialog that uses the given renderer.
  265. * @param foUserAgent the user agent
  266. */
  267. public PreviewDialog(FOUserAgent foUserAgent) {
  268. this(foUserAgent, null);
  269. }
  270. /**
  271. * Creates a new menubar to be shown in this window.
  272. * @return the newly created menubar
  273. */
  274. private JMenuBar setupMenu() {
  275. JMenuBar menuBar = new JMenuBar();
  276. JMenu menu = new JMenu(translator.getString("Menu.File"));
  277. menu.setMnemonic(KeyEvent.VK_F);
  278. //Adds mostly the same actions, but without icons
  279. menu.add(new Command(translator.getString("Menu.Print"), KeyEvent.VK_P) {
  280. public void doit() {
  281. startPrinterJob(true);
  282. }
  283. });
  284. // inputHandler must be set to allow reloading
  285. if (renderable != null) {
  286. menu.add(new Command(translator.getString("Menu.Reload"), KeyEvent.VK_R) {
  287. public void doit() {
  288. reload();
  289. }
  290. });
  291. }
  292. menu.addSeparator();
  293. menu.add(new Command(translator.getString("Menu.Exit"), KeyEvent.VK_X) {
  294. public void doit() {
  295. dispose();
  296. }
  297. });
  298. menuBar.add(menu);
  299. menu = new JMenu(translator.getString("Menu.View"));
  300. menu.setMnemonic(KeyEvent.VK_V);
  301. menu.add(new Command(translator.getString("Menu.First.page"), KeyEvent.VK_F) {
  302. public void doit() {
  303. goToFirstPage();
  304. }
  305. });
  306. menu.add(new Command(translator.getString("Menu.Prev.page"), KeyEvent.VK_P) {
  307. public void doit() {
  308. goToPreviousPage();
  309. }
  310. });
  311. menu.add(new Command(translator.getString("Menu.Next.page"), KeyEvent.VK_N) {
  312. public void doit() {
  313. goToNextPage();
  314. }
  315. });
  316. menu.add(new Command(translator.getString("Menu.Last.page"), KeyEvent.VK_L) {
  317. public void doit() {
  318. goToLastPage();
  319. }
  320. });
  321. menu.add(new Command(translator.getString("Menu.Go.to.Page"), KeyEvent.VK_G) {
  322. public void doit() {
  323. showGoToPageDialog();
  324. }
  325. });
  326. menu.addSeparator();
  327. JMenu subMenu = new JMenu(translator.getString("Menu.Zoom"));
  328. subMenu.setMnemonic(KeyEvent.VK_Z);
  329. subMenu.add(new Command("25%", 0) {
  330. public void doit() {
  331. setScale(25.0);
  332. }
  333. });
  334. subMenu.add(new Command("50%", 0) {
  335. public void doit() {
  336. setScale(50.0);
  337. }
  338. });
  339. subMenu.add(new Command("75%", 0) {
  340. public void doit() {
  341. setScale(75.0);
  342. }
  343. });
  344. subMenu.add(new Command("100%", 0) {
  345. public void doit() {
  346. setScale(100.0);
  347. }
  348. });
  349. subMenu.add(new Command("150%", 0) {
  350. public void doit() {
  351. setScale(150.0);
  352. }
  353. });
  354. subMenu.add(new Command("200%", 0) {
  355. public void doit() {
  356. setScale(200.0);
  357. }
  358. });
  359. menu.add(subMenu);
  360. menu.addSeparator();
  361. menu.add(new Command(translator.getString("Menu.Default.zoom"), KeyEvent.VK_D) {
  362. public void doit() {
  363. setScale(100.0);
  364. }
  365. });
  366. menu.add(new Command(translator.getString("Menu.Fit.Window"), KeyEvent.VK_F) {
  367. public void doit() {
  368. setScaleToFitWindow();
  369. }
  370. });
  371. menu.add(new Command(translator.getString("Menu.Fit.Width"), KeyEvent.VK_W) {
  372. public void doit() {
  373. setScaleToFitWidth();
  374. }
  375. });
  376. menu.addSeparator();
  377. ButtonGroup group = new ButtonGroup();
  378. JRadioButtonMenuItem single = new JRadioButtonMenuItem(
  379. new Command(translator.getString("Menu.Single"), KeyEvent.VK_S) {
  380. public void doit() {
  381. previewPanel.setDisplayMode(PreviewPanel.SINGLE);
  382. }
  383. });
  384. JRadioButtonMenuItem cont = new JRadioButtonMenuItem(
  385. new Command(translator.getString("Menu.Continuous"), KeyEvent.VK_C) {
  386. public void doit() {
  387. previewPanel.setDisplayMode(PreviewPanel.CONTINUOUS);
  388. }
  389. });
  390. JRadioButtonMenuItem facing = new JRadioButtonMenuItem(
  391. new Command(translator.getString("Menu.Facing"), 0) {
  392. public void doit() {
  393. previewPanel.setDisplayMode(PreviewPanel.CONT_FACING);
  394. }
  395. });
  396. single.setSelected(true);
  397. group.add(single);
  398. group.add(cont);
  399. group.add(facing);
  400. menu.add(single);
  401. menu.add(cont);
  402. menu.add(facing);
  403. menuBar.add(menu);
  404. menu = new JMenu(translator.getString("Menu.Help"));
  405. menu.setMnemonic(KeyEvent.VK_H);
  406. menu.add(new Command(translator.getString("Menu.About"), KeyEvent.VK_A) {
  407. public void doit() {
  408. startHelpAbout();
  409. }
  410. });
  411. menuBar.add(menu);
  412. return menuBar;
  413. }
  414. /** {@inheritDoc} */
  415. public void notifyRendererStopped() {
  416. reload();
  417. }
  418. private void reload() {
  419. setStatus(translator.getString("Status.Show"));
  420. previewPanel.reload();
  421. }
  422. /**
  423. * Changes the current visible page
  424. * @param number the page number to go to
  425. */
  426. public void goToPage(int number) {
  427. if (number != previewPanel.getPage()) {
  428. previewPanel.setPage(number);
  429. notifyPageRendered();
  430. }
  431. }
  432. /**
  433. * Shows the previous page.
  434. */
  435. public void goToPreviousPage() {
  436. int page = previewPanel.getPage();
  437. if (page > 0) {
  438. goToPage(page - 1);
  439. }
  440. }
  441. /**
  442. * Shows the next page.
  443. */
  444. public void goToNextPage() {
  445. int page = previewPanel.getPage();
  446. if (page < renderer.getNumberOfPages() - 1) {
  447. goToPage(page + 1);
  448. }
  449. }
  450. /** Shows the first page. */
  451. public void goToFirstPage() {
  452. goToPage(0);
  453. }
  454. /**
  455. * Shows the last page.
  456. */
  457. public void goToLastPage() {
  458. goToPage(renderer.getNumberOfPages() - 1);
  459. }
  460. /** Shows the About box */
  461. private void startHelpAbout() {
  462. PreviewDialogAboutBox dlg = new PreviewDialogAboutBox(this, translator);
  463. //Centers the box
  464. Dimension dlgSize = dlg.getPreferredSize();
  465. Dimension frmSize = getSize();
  466. Point loc = getLocation();
  467. dlg.setLocation((frmSize.width - dlgSize.width) / 2 + loc.x,
  468. (frmSize.height - dlgSize.height) / 2 + loc.y);
  469. dlg.setVisible(true);
  470. }
  471. /**
  472. * Shows "go to page" dialog and then goes to the selected page
  473. */
  474. private void showGoToPageDialog() {
  475. int currentPage = previewPanel.getPage();
  476. GoToPageDialog d = new GoToPageDialog(this,
  477. translator.getString("Menu.Go.to.Page"), translator);
  478. d.setLocation((int)getLocation().getX() + 50,
  479. (int)getLocation().getY() + 50);
  480. d.setVisible(true);
  481. currentPage = d.getPageNumber();
  482. if (currentPage < 1 || currentPage > renderer.getNumberOfPages()) {
  483. return;
  484. }
  485. currentPage--;
  486. goToPage(currentPage);
  487. }
  488. /** Scales page image */
  489. public void setScale(double scaleFactor) {
  490. scale.setSelectedItem(percentFormat.format(scaleFactor) + "%");
  491. previewPanel.setScaleFactor(scaleFactor / 100d);
  492. }
  493. public void setScaleToFitWindow() {
  494. try {
  495. setScale(previewPanel.getScaleToFitWindow() * 100);
  496. } catch (FOPException fopEx) {
  497. fopEx.printStackTrace();
  498. }
  499. }
  500. public void setScaleToFitWidth() {
  501. try {
  502. setScale(previewPanel.getScaleToFitWidth() * 100);
  503. } catch (FOPException fopEx) {
  504. fopEx.printStackTrace();
  505. }
  506. }
  507. private void scaleActionPerformed(ActionEvent e) {
  508. int index = scale.getSelectedIndex();
  509. if (index == 0) {
  510. setScaleToFitWindow();
  511. } else if (index == 1) {
  512. setScaleToFitWidth();
  513. } else {
  514. String item = (String)scale.getSelectedItem();
  515. setScale(Double.parseDouble(item.substring(0, item.indexOf('%'))));
  516. }
  517. }
  518. /** Prints the document */
  519. public void startPrinterJob(boolean showDialog) {
  520. //Restore originally configured target resolution
  521. float saveResolution = foUserAgent.getTargetResolution();
  522. foUserAgent.setTargetResolution(this.configuredTargetResolution);
  523. PrinterJob pj = PrinterJob.getPrinterJob();
  524. pj.setPageable(renderer);
  525. if (!showDialog || pj.printDialog()) {
  526. try {
  527. pj.print();
  528. } catch (PrinterException e) {
  529. e.printStackTrace();
  530. }
  531. }
  532. foUserAgent.setTargetResolution(saveResolution);
  533. }
  534. /**
  535. * Sets message to be shown in the status bar in a thread safe way.
  536. * @param message the message
  537. */
  538. public void setStatus(String message) {
  539. SwingUtilities.invokeLater(new ShowStatus(message));
  540. }
  541. /** This class is used to show status in a thread safe way. */
  542. private class ShowStatus implements Runnable {
  543. /** The message to display */
  544. private String message;
  545. /**
  546. * Constructs ShowStatus thread
  547. * @param message message to display
  548. */
  549. public ShowStatus(String message) {
  550. this.message = message;
  551. }
  552. public void run() {
  553. processStatus.setText(message.toString());
  554. }
  555. }
  556. /**
  557. * Updates the message to be shown in the info bar in a thread safe way.
  558. */
  559. public void notifyPageRendered() {
  560. SwingUtilities.invokeLater(new ShowInfo());
  561. }
  562. /** This class is used to show info in a thread safe way. */
  563. private class ShowInfo implements Runnable {
  564. public void run() {
  565. String message = translator.getString("Status.Page") + " "
  566. + (previewPanel.getPage() + 1) + " "
  567. + translator.getString("Status.of") + " "
  568. + (renderer.getNumberOfPages());
  569. infoStatus.setText(message);
  570. }
  571. }
  572. /**
  573. * Opens standard Swing error dialog box and reports given exception details.
  574. * @param e the Exception
  575. */
  576. public void reportException(Exception e) {
  577. String msg = translator.getString("Exception.Occured");
  578. setStatus(msg);
  579. JOptionPane.showMessageDialog(
  580. getContentPane(),
  581. "<html><b>" + msg + ":</b><br>"
  582. + e.getClass().getName() + "<br>"
  583. + e.getMessage() + "</html>",
  584. translator.getString("Exception.Error"),
  585. JOptionPane.ERROR_MESSAGE
  586. );
  587. }
  588. }