1 package be
.nikiroo
.fanfix
.reader
.ui
;
3 import java
.awt
.BorderLayout
;
6 import java
.awt
.Toolkit
;
7 import java
.awt
.datatransfer
.DataFlavor
;
8 import java
.awt
.event
.ActionEvent
;
9 import java
.awt
.event
.ActionListener
;
10 import java
.awt
.event
.KeyEvent
;
11 import java
.awt
.event
.MouseEvent
;
12 import java
.awt
.event
.WindowEvent
;
14 import java
.io
.IOException
;
16 import java
.net
.UnknownHostException
;
17 import java
.util
.ArrayList
;
18 import java
.util
.HashMap
;
19 import java
.util
.List
;
21 import java
.util
.Map
.Entry
;
23 import javax
.swing
.BoxLayout
;
24 import javax
.swing
.JFileChooser
;
25 import javax
.swing
.JFrame
;
26 import javax
.swing
.JLabel
;
27 import javax
.swing
.JMenu
;
28 import javax
.swing
.JMenuBar
;
29 import javax
.swing
.JMenuItem
;
30 import javax
.swing
.JOptionPane
;
31 import javax
.swing
.JPanel
;
32 import javax
.swing
.JPopupMenu
;
33 import javax
.swing
.JScrollPane
;
34 import javax
.swing
.SwingConstants
;
35 import javax
.swing
.SwingUtilities
;
36 import javax
.swing
.filechooser
.FileFilter
;
37 import javax
.swing
.filechooser
.FileNameExtensionFilter
;
39 import be
.nikiroo
.fanfix
.Instance
;
40 import be
.nikiroo
.fanfix
.bundles
.Config
;
41 import be
.nikiroo
.fanfix
.bundles
.UiConfig
;
42 import be
.nikiroo
.fanfix
.data
.MetaData
;
43 import be
.nikiroo
.fanfix
.data
.Story
;
44 import be
.nikiroo
.fanfix
.library
.BasicLibrary
;
45 import be
.nikiroo
.fanfix
.library
.BasicLibrary
.Status
;
46 import be
.nikiroo
.fanfix
.library
.LocalLibrary
;
47 import be
.nikiroo
.fanfix
.output
.BasicOutput
.OutputType
;
48 import be
.nikiroo
.fanfix
.reader
.BasicReader
;
49 import be
.nikiroo
.fanfix
.reader
.ui
.GuiReaderBook
.BookActionListener
;
50 import be
.nikiroo
.utils
.Progress
;
51 import be
.nikiroo
.utils
.Version
;
52 import be
.nikiroo
.utils
.ui
.ConfigEditor
;
53 import be
.nikiroo
.utils
.ui
.ProgressBar
;
56 * A {@link Frame} that will show a {@link GuiReaderBook} item for each
57 * {@link Story} in the main cache ({@link Instance#getCache()}), and offer a
58 * way to copy them to the {@link GuiReader} cache (
59 * {@link BasicReader#getLibrary()}), read them, delete them...
63 class GuiReaderFrame
extends JFrame
{
64 private static final long serialVersionUID
= 1L;
65 private GuiReader reader
;
66 private Map
<GuiReaderGroup
, String
> booksByType
;
67 private Map
<GuiReaderGroup
, String
> booksByAuthor
;
70 private ProgressBar pgBar
;
72 private GuiReaderBook selectedBook
;
73 private boolean words
; // words or authors (secondary info on books)
76 * A {@link Runnable} with a {@link Story} parameter.
80 private interface StoryRunnable
{
87 public void run(Story story
);
91 * Create a new {@link GuiReaderFrame}.
94 * the associated {@link GuiReader} to forward some commands and
95 * access its {@link LocalLibrary}
97 * the type of {@link Story} to load, or NULL for all types
99 public GuiReaderFrame(GuiReader reader
, String type
) {
100 super(String
.format("Fanfix %s Library", Version
.getCurrentVersion()));
102 this.reader
= reader
;
104 setDefaultCloseOperation(JFrame
.EXIT_ON_CLOSE
);
106 setLayout(new BorderLayout());
109 pane
.setLayout(new BoxLayout(pane
, BoxLayout
.PAGE_AXIS
));
111 Integer icolor
= Instance
.getUiConfig().getColor(
112 UiConfig
.BACKGROUND_COLOR
);
113 if (icolor
!= null) {
114 color
= new Color(icolor
);
115 setBackground(color
);
116 pane
.setBackground(color
);
119 JScrollPane scroll
= new JScrollPane(pane
);
120 scroll
.getVerticalScrollBar().setUnitIncrement(16);
121 add(scroll
, BorderLayout
.CENTER
);
123 String message
= reader
.getLibrary().getLibraryName();
124 if (!message
.isEmpty()) {
125 JLabel name
= new JLabel(message
, SwingConstants
.CENTER
);
126 add(name
, BorderLayout
.NORTH
);
129 pgBar
= new ProgressBar();
130 add(pgBar
, BorderLayout
.SOUTH
);
132 pgBar
.addActionListener(new ActionListener() {
134 public void actionPerformed(ActionEvent e
) {
136 pgBar
.setProgress(null);
142 pgBar
.addUpdateListener(new ActionListener() {
144 public void actionPerformed(ActionEvent e
) {
151 booksByType
= new HashMap
<GuiReaderGroup
, String
>();
152 booksByAuthor
= new HashMap
<GuiReaderGroup
, String
>();
154 pane
.setVisible(false);
155 final Progress pg
= new Progress();
156 final String typeF
= type
;
157 outOfUi(pg
, new Runnable() {
160 BasicLibrary lib
= GuiReaderFrame
.this.reader
.getLibrary();
161 Status status
= lib
.getStatus();
163 if (status
== Status
.READY
) {
166 setJMenuBar(createMenu(true));
167 addBookPane(typeF
, true);
170 pane
.setVisible(true);
173 setJMenuBar(createMenu(false));
176 String err
= lib
.getLibraryName() + "\n";
179 err
+= "Library not valid";
183 err
+= "You are not allowed to access this library";
187 err
+= "Library currently unavailable";
191 err
+= "An error occured when contacting the library";
195 error(err
, "Library error", null);
203 private void addSourcePanes() {
205 GuiReaderGroup bookPane
= new GuiReaderGroup(reader
, "Sources", color
);
207 List
<MetaData
> sources
= new ArrayList
<MetaData
>();
208 for (String source
: reader
.getLibrary().getSources()) {
209 MetaData mSource
= new MetaData();
210 mSource
.setLuid(null);
211 mSource
.setTitle(source
);
212 mSource
.setSource(source
);
213 sources
.add(mSource
);
216 bookPane
.refreshBooks(sources
, false);
224 bookPane
.setActionListener(new BookActionListener() {
226 public void select(GuiReaderBook book
) {
231 public void popupRequested(GuiReaderBook book
, MouseEvent e
) {
232 JPopupMenu popup
= new JPopupMenu();
233 popup
.add(createMenuItemOpenBook());
234 popup
.show(e
.getComponent(), e
.getX(), e
.getY());
238 public void action(final GuiReaderBook book
) {
240 addBookPane(book
.getMeta().getSource(), true);
247 * Add a new {@link GuiReaderGroup} on the frame to display the books of the
248 * selected type or author.
251 * the author or the type, or NULL to get all the
254 * TRUE for type, FALSE for author
256 private void addBookPane(String value
, boolean type
) {
259 if (Instance
.getUiConfig().getBoolean(UiConfig
.SOURCE_PAGE
,
263 for (String tt
: reader
.getLibrary().getSources()) {
265 addBookPane(tt
, type
);
270 for (String tt
: reader
.getLibrary().getAuthors()) {
272 addBookPane(tt
, type
);
280 GuiReaderGroup bookPane
= new GuiReaderGroup(reader
, value
, color
);
282 booksByType
.put(bookPane
, value
);
284 booksByAuthor
.put(bookPane
, value
);
293 bookPane
.setActionListener(new BookActionListener() {
295 public void select(GuiReaderBook book
) {
300 public void popupRequested(GuiReaderBook book
, MouseEvent e
) {
301 JPopupMenu popup
= new JPopupMenu();
302 popup
.add(createMenuItemOpenBook());
303 popup
.addSeparator();
304 popup
.add(createMenuItemExport());
305 popup
.add(createMenuItemMove(true));
306 popup
.add(createMenuItemSetCover());
307 popup
.add(createMenuItemClearCache());
308 popup
.add(createMenuItemRedownload());
309 popup
.addSeparator();
310 popup
.add(createMenuItemDelete());
311 popup
.show(e
.getComponent(), e
.getX(), e
.getY());
315 public void action(final GuiReaderBook book
) {
321 private void removeBookPanes() {
323 booksByAuthor
.clear();
332 * Refresh the list of {@link GuiReaderBook}s from disk.
334 private void refreshBooks() {
335 for (GuiReaderGroup group
: booksByType
.keySet()) {
336 List
<MetaData
> stories
= reader
.getLibrary().getListBySource(
337 booksByType
.get(group
));
338 group
.refreshBooks(stories
, words
);
341 for (GuiReaderGroup group
: booksByAuthor
.keySet()) {
342 List
<MetaData
> stories
= reader
.getLibrary().getListByAuthor(
343 booksByAuthor
.get(group
));
344 group
.refreshBooks(stories
, words
);
352 * Create the main menu bar.
355 * the library can be queried
359 private JMenuBar
createMenu(boolean libOk
) {
360 bar
= new JMenuBar();
362 JMenu file
= new JMenu("File");
363 file
.setMnemonic(KeyEvent
.VK_F
);
365 JMenuItem imprt
= new JMenuItem("Import URL...", KeyEvent
.VK_U
);
366 imprt
.addActionListener(new ActionListener() {
368 public void actionPerformed(ActionEvent e
) {
372 JMenuItem imprtF
= new JMenuItem("Import File...", KeyEvent
.VK_F
);
373 imprtF
.addActionListener(new ActionListener() {
375 public void actionPerformed(ActionEvent e
) {
379 JMenuItem exit
= new JMenuItem("Exit", KeyEvent
.VK_X
);
380 exit
.addActionListener(new ActionListener() {
382 public void actionPerformed(ActionEvent e
) {
383 GuiReaderFrame
.this.dispatchEvent(new WindowEvent(
384 GuiReaderFrame
.this, WindowEvent
.WINDOW_CLOSING
));
388 file
.add(createMenuItemOpenBook());
389 file
.add(createMenuItemExport());
390 file
.add(createMenuItemMove(libOk
));
399 JMenu edit
= new JMenu("Edit");
400 edit
.setMnemonic(KeyEvent
.VK_E
);
402 edit
.add(createMenuItemClearCache());
403 edit
.add(createMenuItemRedownload());
405 edit
.add(createMenuItemDelete());
409 JMenu view
= new JMenu("View");
410 view
.setMnemonic(KeyEvent
.VK_V
);
411 JMenuItem vauthors
= new JMenuItem("Author");
412 vauthors
.setMnemonic(KeyEvent
.VK_A
);
413 vauthors
.addActionListener(new ActionListener() {
415 public void actionPerformed(ActionEvent e
) {
421 JMenuItem vwords
= new JMenuItem("Word count");
422 vwords
.setMnemonic(KeyEvent
.VK_W
);
423 vwords
.addActionListener(new ActionListener() {
425 public void actionPerformed(ActionEvent e
) {
433 JMenu sources
= new JMenu("Sources");
434 sources
.setMnemonic(KeyEvent
.VK_S
);
436 List
<String
> tt
= new ArrayList
<String
>();
438 tt
.addAll(reader
.getLibrary().getSources());
442 for (final String type
: tt
) {
443 JMenuItem item
= new JMenuItem(type
== null ?
"All" : type
);
444 item
.addActionListener(new ActionListener() {
446 public void actionPerformed(ActionEvent e
) {
448 addBookPane(type
, true);
455 sources
.addSeparator();
461 JMenu authors
= new JMenu("Authors");
462 authors
.setMnemonic(KeyEvent
.VK_A
);
464 List
<String
> aa
= new ArrayList
<String
>();
466 aa
.addAll(reader
.getLibrary().getAuthors());
469 for (final String author
: aa
) {
470 JMenuItem item
= new JMenuItem(author
== null ?
"All"
471 : author
.isEmpty() ?
"[unknown]" : author
);
472 item
.addActionListener(new ActionListener() {
474 public void actionPerformed(ActionEvent e
) {
476 addBookPane(author
, false);
482 if (author
== null || author
.isEmpty()) {
483 authors
.addSeparator();
489 JMenu options
= new JMenu("Options");
490 options
.setMnemonic(KeyEvent
.VK_O
);
491 options
.add(createMenuItemConfig());
492 options
.add(createMenuItemUiConfig());
499 * Create the Fanfix Configuration menu item.
503 private JMenuItem
createMenuItemConfig() {
504 final String title
= "Fanfix Configuration";
505 JMenuItem item
= new JMenuItem(title
);
506 item
.setMnemonic(KeyEvent
.VK_F
);
508 item
.addActionListener(new ActionListener() {
510 public void actionPerformed(ActionEvent e
) {
511 ConfigEditor
<Config
> ed
= new ConfigEditor
<Config
>(
512 Config
.class, Instance
.getConfig(),
513 "This is where you configure the options of the program.");
514 JFrame frame
= new JFrame(title
);
516 frame
.setSize(800, 600);
517 frame
.setVisible(true);
525 * Create the UI Configuration menu item.
529 private JMenuItem
createMenuItemUiConfig() {
530 final String title
= "UI Configuration";
531 JMenuItem item
= new JMenuItem(title
);
532 item
.setMnemonic(KeyEvent
.VK_U
);
534 item
.addActionListener(new ActionListener() {
536 public void actionPerformed(ActionEvent e
) {
537 ConfigEditor
<UiConfig
> ed
= new ConfigEditor
<UiConfig
>(
538 UiConfig
.class, Instance
.getUiConfig(),
539 "This is where you configure the graphical appearence of the program.");
540 JFrame frame
= new JFrame(title
);
542 frame
.setSize(800, 600);
543 frame
.setVisible(true);
551 * Create the export menu item.
555 private JMenuItem
createMenuItemExport() {
556 final JFileChooser fc
= new JFileChooser();
557 fc
.setAcceptAllFileFilterUsed(false);
559 final Map
<FileFilter
, OutputType
> filters
= new HashMap
<FileFilter
, OutputType
>();
560 for (OutputType type
: OutputType
.values()) {
561 String ext
= type
.getDefaultExtension(false);
562 String desc
= type
.getDesc(false);
564 if (ext
== null || ext
.isEmpty()) {
565 filters
.put(createAllFilter(desc
), type
);
567 filters
.put(new FileNameExtensionFilter(desc
, ext
), type
);
571 // First the "ALL" filters, then, the extension filters
572 for (Entry
<FileFilter
, OutputType
> entry
: filters
.entrySet()) {
573 if (!(entry
.getKey() instanceof FileNameExtensionFilter
)) {
574 fc
.addChoosableFileFilter(entry
.getKey());
577 for (Entry
<FileFilter
, OutputType
> entry
: filters
.entrySet()) {
578 if (entry
.getKey() instanceof FileNameExtensionFilter
) {
579 fc
.addChoosableFileFilter(entry
.getKey());
584 JMenuItem export
= new JMenuItem("Save as...", KeyEvent
.VK_S
);
585 export
.addActionListener(new ActionListener() {
587 public void actionPerformed(ActionEvent e
) {
588 if (selectedBook
!= null) {
589 fc
.showDialog(GuiReaderFrame
.this, "Save");
590 if (fc
.getSelectedFile() != null) {
591 final OutputType type
= filters
.get(fc
.getFileFilter());
592 final String path
= fc
.getSelectedFile()
594 + type
.getDefaultExtension(false);
595 final Progress pg
= new Progress();
596 outOfUi(pg
, new Runnable() {
600 reader
.getLibrary().export(
601 selectedBook
.getMeta().getLuid(),
603 } catch (IOException e
) {
604 Instance
.getTraceHandler().error(e
);
617 * Create a {@link FileFilter} that accepts all files and return the given
625 private FileFilter
createAllFilter(final String desc
) {
626 return new FileFilter() {
628 public String
getDescription() {
633 public boolean accept(File f
) {
640 * Create the refresh (delete cache) menu item.
644 private JMenuItem
createMenuItemClearCache() {
645 JMenuItem refresh
= new JMenuItem("Clear cache", KeyEvent
.VK_C
);
646 refresh
.addActionListener(new ActionListener() {
648 public void actionPerformed(ActionEvent e
) {
649 if (selectedBook
!= null) {
650 outOfUi(null, new Runnable() {
653 reader
.clearLocalReaderCache(selectedBook
.getMeta()
655 selectedBook
.setCached(false);
656 GuiReaderBook
.clearIcon(selectedBook
.getMeta());
657 SwingUtilities
.invokeLater(new Runnable() {
660 selectedBook
.repaint();
673 * Create the delete menu item.
676 * the library can be queried
680 private JMenuItem
createMenuItemMove(boolean libOk
) {
681 JMenu moveTo
= new JMenu("Move to...");
682 moveTo
.setMnemonic(KeyEvent
.VK_M
);
684 List
<String
> types
= new ArrayList
<String
>();
687 types
.addAll(reader
.getLibrary().getSources());
690 for (String type
: types
) {
691 JMenuItem item
= new JMenuItem(type
== null ?
"New type..." : type
);
695 moveTo
.addSeparator();
698 final String ftype
= type
;
699 item
.addActionListener(new ActionListener() {
701 public void actionPerformed(ActionEvent e
) {
702 if (selectedBook
!= null) {
705 Object rep
= JOptionPane
.showInputDialog(
706 GuiReaderFrame
.this, "Move to:",
708 JOptionPane
.QUESTION_MESSAGE
, null, null,
709 selectedBook
.getMeta().getSource());
715 type
= rep
.toString();
718 final String ftype
= type
;
719 outOfUi(null, new Runnable() {
722 reader
.changeSource(selectedBook
.getMeta()
727 SwingUtilities
.invokeLater(new Runnable() {
730 setJMenuBar(createMenu(true));
744 * Create the redownload (then delete original) menu item.
748 private JMenuItem
createMenuItemRedownload() {
749 JMenuItem refresh
= new JMenuItem("Redownload", KeyEvent
.VK_R
);
750 refresh
.addActionListener(new ActionListener() {
752 public void actionPerformed(ActionEvent e
) {
753 if (selectedBook
!= null) {
754 final MetaData meta
= selectedBook
.getMeta();
755 imprt(meta
.getUrl(), new StoryRunnable() {
757 public void run(Story story
) {
758 reader
.delete(meta
.getLuid());
759 GuiReaderFrame
.this.selectedBook
= null;
760 MetaData newMeta
= story
.getMeta();
761 if (!newMeta
.getSource().equals(meta
.getSource())) {
762 reader
.changeSource(newMeta
.getLuid(),
766 }, "Removing old copy");
775 * Create the delete menu item.
779 private JMenuItem
createMenuItemDelete() {
780 JMenuItem delete
= new JMenuItem("Delete", KeyEvent
.VK_D
);
781 delete
.addActionListener(new ActionListener() {
783 public void actionPerformed(ActionEvent e
) {
784 if (selectedBook
!= null) {
785 outOfUi(null, new Runnable() {
788 reader
.delete(selectedBook
.getMeta().getLuid());
800 * Create the open menu item for a book or a source (no LUID).
804 private JMenuItem
createMenuItemOpenBook() {
805 JMenuItem open
= new JMenuItem("Open", KeyEvent
.VK_O
);
806 open
.addActionListener(new ActionListener() {
808 public void actionPerformed(ActionEvent e
) {
809 if (selectedBook
!= null) {
810 if (selectedBook
.getMeta().getLuid() == null) {
812 addBookPane(selectedBook
.getMeta().getSource(), true);
815 openBook(selectedBook
);
825 * Create the SetCover menu item for a book to change the linked source
830 private JMenuItem
createMenuItemSetCover() {
831 JMenuItem open
= new JMenuItem("Set as cover for source", KeyEvent
.VK_C
);
832 open
.addActionListener(new ActionListener() {
834 public void actionPerformed(ActionEvent e
) {
835 if (selectedBook
!= null) {
836 reader
.getLibrary().setSourceCover(
837 selectedBook
.getMeta().getSource(),
838 selectedBook
.getMeta().getLuid());
839 MetaData source
= selectedBook
.getMeta().clone();
840 source
.setLuid(null);
841 GuiReaderBook
.clearIcon(source
);
850 * Open a {@link GuiReaderBook} item.
853 * the {@link GuiReaderBook} to open
855 private void openBook(final GuiReaderBook book
) {
856 final Progress pg
= new Progress();
857 outOfUi(pg
, new Runnable() {
861 reader
.read(book
.getMeta().getLuid(), pg
);
862 SwingUtilities
.invokeLater(new Runnable() {
865 book
.setCached(true);
868 } catch (IOException e
) {
869 // TODO: error message?
870 Instance
.getTraceHandler().error(e
);
877 * Process the given action out of the Swing UI thread and link the given
878 * {@link ProgressBar} to the action.
880 * The code will make sure that the {@link ProgressBar} (if not NULL) is set
881 * to done when the action is done.
884 * the {@link ProgressBar} or NULL
888 private void outOfUi(Progress progress
, final Runnable run
) {
889 final Progress pg
= new Progress();
890 final Progress reload
= new Progress("Reload books");
891 if (progress
== null) {
892 progress
= new Progress();
895 pg
.addProgress(progress
, 90);
896 pg
.addProgress(reload
, 10);
899 pgBar
.setProgress(pg
);
903 new Thread(new Runnable() {
912 // will trigger pgBar ActionListener:
917 }, "outOfUi thread").start();
921 * Import a {@link Story} into the main {@link LocalLibrary}.
923 * Should be called inside the UI thread.
926 * TRUE for an {@link URL}, false for a {@link File}
928 private void imprt(boolean askUrl
) {
929 JFileChooser fc
= new JFileChooser();
933 String clipboard
= "";
935 clipboard
= ("" + Toolkit
.getDefaultToolkit()
936 .getSystemClipboard().getData(DataFlavor
.stringFlavor
))
938 } catch (Exception e
) {
939 // No data will be handled
942 if (clipboard
== null || !clipboard
.startsWith("http")) {
946 url
= JOptionPane
.showInputDialog(GuiReaderFrame
.this,
947 "url of the story to import?", "Importing from URL",
948 JOptionPane
.QUESTION_MESSAGE
, null, null, clipboard
);
949 } else if (fc
.showOpenDialog(this) != JFileChooser
.CANCEL_OPTION
) {
950 url
= fc
.getSelectedFile().getAbsolutePath();
955 if (url
!= null && !url
.toString().isEmpty()) {
956 imprt(url
.toString(), null, null);
961 * Actually import the {@link Story} into the main {@link LocalLibrary}.
963 * Should be called inside the UI thread.
966 * the {@link Story} to import by {@link URL}
968 * Action to execute on success
970 private void imprt(final String url
, final StoryRunnable onSuccess
,
971 String onSuccessPgName
) {
972 final Progress pg
= new Progress();
973 final Progress pgImprt
= new Progress();
974 final Progress pgOnSuccess
= new Progress(onSuccessPgName
);
975 pg
.addProgress(pgImprt
, 95);
976 pg
.addProgress(pgOnSuccess
, 5);
978 outOfUi(pg
, new Runnable() {
984 story
= reader
.getLibrary().imprt(BasicReader
.getUrl(url
),
986 } catch (IOException e
) {
990 final Exception e
= ex
;
992 final boolean ok
= (e
== null);
994 pgOnSuccess
.setProgress(0);
996 if (e
instanceof UnknownHostException
) {
997 error("URL not supported: " + url
, "Cannot import URL",
1000 error("Failed to import " + url
+ ": \n"
1001 + e
.getMessage(), "Cannot import URL", e
);
1004 if (onSuccess
!= null) {
1005 onSuccess
.run(story
);
1014 * Enables or disables this component, depending on the value of the
1015 * parameter <code>b</code>. An enabled component can respond to user input
1016 * and generate events. Components are enabled initially by default.
1018 * Disabling this component will also affect its children.
1021 * If <code>true</code>, this component is enabled; otherwise
1022 * this component is disabled
1025 public void setEnabled(boolean b
) {
1030 for (GuiReaderGroup group
: booksByType
.keySet()) {
1031 group
.setEnabled(b
);
1033 for (GuiReaderGroup group
: booksByAuthor
.keySet()) {
1034 group
.setEnabled(b
);
1036 super.setEnabled(b
);
1041 * Display an error message and log the linked {@link Exception}.
1046 * the title of the error message
1048 * the exception to log if any
1050 private void error(final String message
, final String title
, Exception e
) {
1051 Instance
.getTraceHandler().error(title
+ ": " + message
);
1053 Instance
.getTraceHandler().error(e
);
1056 SwingUtilities
.invokeLater(new Runnable() {
1059 JOptionPane
.showMessageDialog(GuiReaderFrame
.this, message
,
1060 title
, JOptionPane
.ERROR_MESSAGE
);