Changeset 1356 in josm for trunk/src/org
- Timestamp:
- 2009-01-31T20:59:41+01:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r1326 r1356 22 22 23 23 import javax.swing.JComponent; 24 import javax.swing.JFrame; 24 25 import javax.swing.JOptionPane; 25 26 import javax.swing.JPanel; … … 116 117 117 118 /** 119 * The MOTD Layer. 120 */ 121 private GettingStarted gettingStarted=new GettingStarted(); 122 123 /** 118 124 * Print a debug message if debugging is on. 119 125 */ … … 145 151 else { 146 152 old.destroy(); 147 panel.add( new GettingStarted(), BorderLayout.CENTER);153 panel.add(gettingStarted, BorderLayout.CENTER); 148 154 } 149 155 panel.setVisible(true); … … 174 180 platform.startupHook(); 175 181 contentPane.add(panel, BorderLayout.CENTER); 176 if(splash != null) splash.setStatus(tr("Download \"Message of the day\"")); 177 panel.add(new GettingStarted(), BorderLayout.CENTER); 182 panel.add(gettingStarted, BorderLayout.CENTER); 178 183 179 184 if(splash != null) splash.setStatus(tr("Creating main GUI")); … … 274 279 275 280 Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize(); 276 281 String geometry = Main.pref.get("gui.geometry"); 277 282 if (args.containsKey("geometry")) { 278 283 geometry = args.get("geometry").iterator().next(); 279 280 284 } 285 if (geometry.length() != 0) { 281 286 final Matcher m = Pattern.compile("(\\d+)x(\\d+)(([+-])(\\d+)([+-])(\\d+))?").matcher(geometry); 282 287 if (m.matches()) { … … 293 298 } 294 299 bounds = new Rectangle(x,y,w,h); 295 296 297 298 300 if(!Main.pref.get("gui.geometry").equals(geometry)) { 301 // remember this geometry 302 Main.pref.put("gui.geometry", geometry); 303 } 299 304 } else 300 305 System.out.println("Ignoring malformed geometry: "+geometry); … … 411 416 412 417 static public void saveGuiGeometry() { 413 // if the gui.geometry preference is already set, 414 // save the current window geometry 415 String curGeometryPref = pref.get("gui.geometry"); 416 if(curGeometryPref.length() != 0) { 417 Rectangle bounds = parent.getBounds(); 418 pref.put("gui.geometry", 419 (int)bounds.getWidth() + 420 "x" + (int)bounds.getHeight() + 421 "+" + (int)bounds.getX() + 422 "+" + (int)bounds.getY()); 423 } 418 // save the current window geometry 419 String newGeometry = ""; 420 try { 421 if(((JFrame)parent).getExtendedState() == JFrame.NORMAL) { 422 Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize(); 423 Rectangle bounds = parent.getBounds(); 424 int width = (int)bounds.getWidth(); 425 int height = (int)bounds.getHeight(); 426 int x = (int)bounds.getX(); 427 int y = (int)bounds.getY(); 428 if(width > screenDimension.width) 429 width = screenDimension.width; 430 if(height > screenDimension.height) 431 width = screenDimension.height; 432 if(x < 0) 433 x = 0; 434 if(y < 0) 435 y = 0; 436 newGeometry = width + "x" + height + "+" + x + "+" + y; 437 } 438 } 439 catch (Exception e) { 440 System.out.println("Failed to save GUI geometry: " + e); 441 } 442 pref.put("gui.geometry", newGeometry); 424 443 } 425 444 } -
trunk/src/org/openstreetmap/josm/gui/GettingStarted.java
r1350 r1356 33 33 34 34 static private String content = ""; 35 static private String styles = "<style type=\"text/css\">\n"+ 36 "body { font-family: sans-serif; font-weight: bold; }\n"+ 37 "h1 {text-align: center;}\n"+ 38 "</style>\n"; 35 39 36 40 public class LinkGeneral extends JEditorPane implements HyperlinkListener { … … 102 106 motdcontent = wr.read(baseurl + "/wiki/MessageOfTheDay?format=txt"); 103 107 } catch (IOException ioe) { 104 motdcontent = "<html> <body>\n<h1>" +108 motdcontent = "<html>" + styles + "<body><h1>" + 105 109 "JOSM - " + tr("Java OpenStreetMap Editor") + 106 110 "</h1>\n<h2 align=\"center\">(" + … … 179 183 180 184 content = "<html>\n"+ 181 "<style type=\"text/css\">\n"+ 182 "body { font-family: sans-serif; font-weight: bold; }\n"+ 183 "h1 {text-align: center;}\n"+ 184 "</style>\n"+ 185 styles + 185 186 "<h1>JOSM - " + tr("Java OpenStreetMap Editor") + "</h1>\n"+ 186 187 content+"\n"+ … … 190 191 public GettingStarted() { 191 192 super(new BorderLayout()); 192 final LinkGeneral lg = new LinkGeneral(tr("Download \"Message of the day\"")); 193 final LinkGeneral lg = new LinkGeneral( 194 "<html>" + 195 styles + 196 "<h1>" + 197 "JOSM - " + 198 tr("Java OpenStreetMap Editor") + 199 "</h1><h2 align=\"center\">" + 200 tr("Downloading \"Message of the day\"") + 201 "</h2>"); 193 202 JScrollPane scroller = new JScrollPane(lg); 194 // panel.add(GBC.glue(0,1), GBC.eol());195 //panel.setMinimumSize(new Dimension(400, 600));196 203 Component linkGeneral = new LinkGeneral(content); 197 204 scroller.setViewportBorder(new EmptyBorder(10,100,10,100)); -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r1330 r1356 178 178 splash.closeSplash(); 179 179 180 if (!args.containsKey("no-fullscreen") && !args.containsKey("geometry") && Main.pref.get("gui.geometry") == null&& Toolkit.getDefaultToolkit().isFrameStateSupported(JFrame.MAXIMIZED_BOTH))180 if (!args.containsKey("no-fullscreen") && !args.containsKey("geometry") && Main.pref.get("gui.geometry").length() == 0 && Toolkit.getDefaultToolkit().isFrameStateSupported(JFrame.MAXIMIZED_BOTH)) 181 181 mainFrame.setExtendedState(JFrame.MAXIMIZED_BOTH); 182 182
Note:
See TracChangeset
for help on using the changeset viewer.