1 56 57 package org.objectstyle.cayenne.dataview.dvmodeler; 58 59 import java.util.*; 60 import java.awt.*; 61 import javax.swing.*; 62 63 68 69 class ErrorsPanel extends JPanel{ 70 public ErrorsPanel(java.util.List errors, String labelText){ 71 super(); 72 73 String htmlErrors = "<html><body><font size=-1 >"; 74 for (Iterator j = errors.iterator(); j.hasNext();){ 75 htmlErrors += (String )j.next(); 76 } 77 htmlErrors += "</font></body></html>"; 78 79 JEditorPane editorPane = new JEditorPane(); 80 editorPane.setEditable(false); 81 editorPane.setContentType("text/html"); 82 83 editorPane.setText(htmlErrors); 84 85 JScrollPane scrollPane = new JScrollPane(editorPane); 86 scrollPane.setPreferredSize(new Dimension(500, 280)); 87 scrollPane.setMinimumSize(new Dimension(5, 200)); 88 scrollPane.setAlignmentX(LEFT_ALIGNMENT); 89 90 this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); 91 92 JLabel label = new JLabel(labelText); 93 label.setLabelFor(editorPane); 94 label.setAlignmentX(LEFT_ALIGNMENT); 95 this.add(label); 96 this.add(Box.createRigidArea(new Dimension(0,5))); 97 this.add(scrollPane); 98 } 99 } 100 | Popular Tags |