001    package org.openstreetmap.josm.gui.actionsupport;
002    
003    import java.awt.Dimension;
004    import java.awt.GridBagLayout;
005    import javax.swing.*;
006    import org.openstreetmap.josm.Main;
007    import org.openstreetmap.josm.data.Preferences;
008    import org.openstreetmap.josm.gui.ExtendedDialog;
009    import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;
010    import org.openstreetmap.josm.gui.preferences.advanced.AdvancedPreference;
011    import org.openstreetmap.josm.gui.widgets.HtmlPanel;
012    import org.openstreetmap.josm.tools.GBC;
013    
014    import static org.openstreetmap.josm.tools.I18n.tr;
015    
016    /**
017     * Generic dialog with message and scrolling area
018     * @author Alexei
019     */
020    public class LogShowDialog extends ExtendedDialog {
021    
022    
023        public LogShowDialog (String title, String msg, String log) {
024            super(Main.parent, title, new String[] {tr("OK")});
025            setButtonIcons(new String[] {"ok.png"});
026            setContent(build(msg, log));
027        }
028    
029        protected JPanel build(String msg, String log) {
030            JPanel p = new JPanel(new GridBagLayout());
031            JLabel lbl = new JLabel(msg);
032            
033            lbl.setFont(lbl.getFont().deriveFont(0, 14));
034            
035            p.add(lbl, GBC.eol().insets(5,0,5,0));
036            JEditorPane txt = new JEditorPane();
037            txt.setContentType("text/html");
038            txt.setText(log);
039            txt.setEditable(false);
040            txt.setOpaque(false);
041            
042            JScrollPane sp = new JScrollPane(txt);
043            sp.setOpaque(false);
044            sp.setPreferredSize(new Dimension(600,300));
045            
046            
047            p.add(sp, GBC.eop().insets(5,15,0,0).fill(GBC.HORIZONTAL));
048    
049            return p;
050        }
051    }
052     
053