Changeset 4681 in josm for trunk/src/org/openstreetmap/josm/gui/SplashScreen.java
- Timestamp:
- 2011-12-21T10:24:43+01:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/SplashScreen.java
r4030 r4681 13 13 import java.awt.event.MouseEvent; 14 14 15 import java.util.Arrays; 16 import java.util.LinkedList; 15 17 import javax.swing.JFrame; 16 18 import javax.swing.JLabel; … … 133 135 Dimension d = super.getPreferredSize(); 134 136 if(d.width < 600) d.width = 600; 137 d.height *= MAX_NUMBER_OF_MESSAGES; 135 138 return d; 136 139 } … … 167 170 } 168 171 172 private static final int MAX_NUMBER_OF_MESSAGES = 3; 173 private LinkedList<String> messages = new LinkedList<String>(Arrays.asList("", "", "")); //update when changing MAX_NUMBER_OF_MESSAGES 174 private long time = System.currentTimeMillis(); 175 176 /** 177 * Stores and displays the {@code MAX_NUMBER_OF_MESSAGES} most recent 178 * task titles together with their execution time. 179 */ 169 180 public void setTaskTitle(String taskTitle) { 170 lblTaskTitle.setText(taskTitle); 181 182 while (messages.size() >= MAX_NUMBER_OF_MESSAGES) { 183 messages.removeFirst(); 184 } 185 long now = System.currentTimeMillis(); 186 String prevMessageTitle = messages.getLast(); 187 if (!prevMessageTitle.isEmpty()) { 188 messages.removeLast(); 189 messages.add(tr("{0} ({1} ms)", prevMessageTitle, Long.toString(now - time))); 190 } 191 time = now; 192 if (!taskTitle.isEmpty()) { 193 messages.add(taskTitle); 194 } 195 String html = ""; 196 int i = 0; 197 for (String m : messages) { 198 html += "<p class=\"entry" + (++i) + "\">" + m + "</p>"; 199 } 200 201 lblTaskTitle.setText("<html><style>" 202 + ".entry1{color:#CCCCCC;}" 203 + ".entry2{color:#999999;}" 204 + ".entry3{color:#000000;}</style>" + html + "</html>"); //update when changing MAX_NUMBER_OF_MESSAGES 171 205 repaint(); 172 206 }
Note:
See TracChangeset
for help on using the changeset viewer.
