Changeset 2644 in josm for trunk/src/org


Ignore:
Timestamp:
2009-12-16T20:23:20+01:00 (15 years ago)
Author:
Gubaer
Message:

fixed #4176: Display of object deletion dialog wrong

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/actionsupport/DeleteFromRelationConfirmationDialog.java

    r2626 r2644  
    99import java.awt.Dimension;
    1010import java.awt.FlowLayout;
    11 import java.awt.GridBagConstraints;
    12 import java.awt.GridBagLayout;
     11import java.awt.Font;
    1312import java.awt.event.ActionEvent;
    1413import java.awt.event.WindowAdapter;
    1514import java.awt.event.WindowEvent;
     15import java.text.MessageFormat;
    1616import java.util.ArrayList;
    1717import java.util.Collection;
     
    2323import javax.swing.AbstractAction;
    2424import javax.swing.BorderFactory;
    25 import javax.swing.JComponent;
    2625import javax.swing.JDialog;
    27 import javax.swing.JLabel;
     26import javax.swing.JEditorPane;
    2827import javax.swing.JOptionPane;
    2928import javax.swing.JPanel;
    3029import javax.swing.JScrollPane;
    3130import javax.swing.JTable;
     31import javax.swing.UIManager;
    3232import javax.swing.event.TableModelEvent;
    3333import javax.swing.event.TableModelListener;
     
    3535import javax.swing.table.DefaultTableModel;
    3636import javax.swing.table.TableColumn;
     37import javax.swing.text.html.HTMLEditorKit;
     38import javax.swing.text.html.StyleSheet;
    3739
    3840import org.openstreetmap.josm.Main;
     
    7173    /** the data model */
    7274    private RelationMemberTableModel model;
    73     private JLabel lblMessage;
     75    private JEditorPane jepMessage;
    7476    private boolean canceled;
    7577    private SideButton btnOK;
    7678
    7779    protected JPanel buildMessagePanel() {
    78         JPanel pnl = new JPanel();
    79         pnl.setLayout(new GridBagLayout());
    80         GridBagConstraints gc = new GridBagConstraints();
    81         gc.anchor = GridBagConstraints.NORTHWEST;
    82         gc.fill = GridBagConstraints.BOTH;
    83         pnl.add(lblMessage = new JLabel(), gc);
    84         lblMessage.setAlignmentX(JComponent.LEFT_ALIGNMENT);
     80        JPanel pnl = new JPanel(new BorderLayout());
     81        jepMessage = new JEditorPane("text/html", "");
     82        jepMessage.setOpaque(false);
     83        jepMessage.setEditable(false);
     84        Font f = UIManager.getFont("Label.font");
     85        StyleSheet ss = new StyleSheet();
     86        String rule = MessageFormat.format(
     87                "font-family: ''{0}'';font-size: {1,number}pt; font-weight: {2}; font-style: {3}",
     88                f.getName(),
     89                f.getSize(),
     90                f.isBold() ? "bold" : "normal",
     91                        f.isItalic() ? "italic" : "normal"
     92        );
     93        rule = "body {" + rule + "}";
     94        rule = MessageFormat.format(
     95                "font-family: ''{0}'';font-size: {1,number}pt; font-weight: {2}; font-style: {3}",
     96                f.getName(),
     97                f.getSize(),
     98                "bold",
     99                f.isItalic() ? "italic" : "normal"
     100        );
     101        rule = "strong {" + rule + "}";
     102        ss.addRule(rule);
     103        ss.addRule("a {text-decoration: underline; color: blue}");
     104        HTMLEditorKit kit = new HTMLEditorKit();
     105        kit.setStyleSheet(ss);
     106        jepMessage.setEditorKit(kit);
     107
     108        pnl.setLayout(new BorderLayout());
     109        pnl.add(jepMessage, BorderLayout.CENTER);
    85110        pnl.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    86111        return pnl;
     
    131156            msg = tr("<html>Please confirm to remove <strong>{0} objects</strong> from <strong>{1} relations</strong>.</html>", numObjectsToDelete,numParentRelations);
    132157        }
    133         lblMessage.setText(msg);
     158        jepMessage.setText(msg);
    134159        invalidate();
    135160    }
Note: See TracChangeset for help on using the changeset viewer.