source: josm/trunk/src/org/openstreetmap/josm/gui/actionsupport/LogShowDialog.java@ 8426

Last change on this file since 8426 was 8426, checked in by Don-vip, 9 years ago

Accessibility - global use of JLabel.setLabelFor() + various fixes (javadoc, code style)

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