Mercurial > cgi-bin > hgweb.cgi > JpegWasher
comparison src/name/blackcap/exifwasher/HelpDialog.kt @ 50:fb407182ba76
Add help menu item, UNTESTED.
author | David Barts <davidb@stashtea.com> |
---|---|
date | Thu, 07 May 2020 08:29:58 -0700 |
parents | |
children | 39895d44a287 |
comparison
equal
deleted
inserted
replaced
48:35fb8de77c7d | 50:fb407182ba76 |
---|---|
1 /* | |
2 * The dialog that displays the Exif data in a single file (display only, | |
3 * no changing). We do this after washing. | |
4 */ | |
5 package name.blackcap.exifwasher | |
6 | |
7 import java.awt.Color | |
8 import java.awt.Dimension | |
9 import java.awt.event.ActionEvent | |
10 import java.awt.event.ActionListener | |
11 import java.io.File | |
12 import java.io.IOException | |
13 import java.io.BufferedReader | |
14 import java.io.InputStream | |
15 import java.io.InputStreamReader | |
16 import java.util.logging.Level | |
17 import java.util.logging.Logger | |
18 import javax.swing.* | |
19 import javax.swing.table.DefaultTableModel | |
20 import javax.swing.table.TableColumn | |
21 import javax.swing.table.TableColumnModel | |
22 | |
23 import name.blackcap.exifwasher.exiv2.* | |
24 | |
25 class HelpDialog : JDialog(Application.mainFrame) { | |
26 private val BW = 9 | |
27 private val BW2 = BW * 2 | |
28 private val WIDTH = 640 | |
29 private val HEIGHT = 480 | |
30 | |
31 private val dismissButton = JButton("Dismiss").also { | |
32 it.addActionListener(ActionListener { setVisible(false) }) | |
33 } | |
34 | |
35 private val helpPane = JTextPane().also { | |
36 it.contentType = "text/html"; | |
37 it.text = ::class.java.getResourceAsStream("help.html").bufferedReader().use { it.readText() } | |
38 } | |
39 | |
40 init { | |
41 setVisible(false) | |
42 title = "Help" | |
43 contentPane.apply { | |
44 layout = BoxLayout(this, BoxLayout.Y_AXIS) | |
45 add(JScrollPane(helpPane).apply { | |
46 alignmentX = JScrollPane.CENTER_ALIGNMENT | |
47 border = BorderFactory.createEmptyBorder(BW2, BW2, BW, BW2) | |
48 verticalScrollBarPolicy = ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS | |
49 horizontalScrollBarPolicy = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER | |
50 preferredSize = Dimension(WIDTH, HEIGHT) | |
51 background = Application.mainFrame.background | |
52 }) | |
53 add(Box(BoxLayout.X_AXIS).apply { | |
54 alignmentX = Box.CENTER_ALIGNMENT | |
55 border = BorderFactory.createEmptyBorder(BW, BW2, BW2, BW2) | |
56 add(Box.createHorizontalGlue()) | |
57 add(dismissButton) | |
58 }) | |
59 } | |
60 pack() | |
61 } | |
62 } |