source: josm/trunk/src/org/openstreetmap/josm/gui/dialogs/LogShowDialog.java@ 15889

Last change on this file since 15889 was 15775, checked in by simon04, 4 years ago

Use (correct) magic constants

  • Property svn:eol-style set to native
File size: 1.7 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.dialogs;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.awt.Dimension;
7import java.awt.Font;
8import java.awt.GridBagLayout;
9
10import javax.swing.JLabel;
11import javax.swing.JPanel;
12import javax.swing.JScrollPane;
13
14import org.openstreetmap.josm.gui.ExtendedDialog;
15import org.openstreetmap.josm.gui.MainApplication;
16import org.openstreetmap.josm.gui.widgets.JosmEditorPane;
17import org.openstreetmap.josm.tools.GBC;
18
19/**
20 * Generic dialog with message and scrolling area
21 * @author Alexei
22 * @since 5114
23 */
24public class LogShowDialog extends ExtendedDialog {
25
26 /**
27 * Constructs a new {@code LogShowDialog}.
28 * @param title The text that will be shown in the window titlebar
29 * @param msg Single-line Label
30 * @param log Multi-line log
31 */
32 public LogShowDialog(String title, String msg, String log) {
33 super(MainApplication.getMainFrame(), title, tr("OK"));
34 setButtonIcons("ok");
35 setContent(build(msg, log));
36 }
37
38 protected final JPanel build(String msg, String log) {
39 JPanel p = new JPanel(new GridBagLayout());
40 JLabel lbl = new JLabel(msg);
41
42 lbl.setFont(lbl.getFont().deriveFont(Font.PLAIN, 14));
43
44 p.add(lbl, GBC.eol().insets(5, 0, 5, 0));
45 JosmEditorPane txt = new JosmEditorPane();
46 txt.setContentType("text/html");
47 txt.setText(log);
48 txt.setEditable(false);
49 txt.setOpaque(false);
50
51 lbl.setLabelFor(txt);
52
53 JScrollPane sp = new JScrollPane(txt);
54 sp.setOpaque(false);
55 sp.setPreferredSize(new Dimension(600, 300));
56
57 p.add(sp, GBC.eop().insets(5, 15, 0, 0).fill(GBC.HORIZONTAL));
58
59 return p;
60 }
61}
Note: See TracBrowser for help on using the repository browser.