- Timestamp:
- 2009-09-23T11:14:18+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r2169 r2185 526 526 // save the current window geometry and the width of the toggle dialog area 527 527 String newGeometry = ""; 528 String newToggleDlgWidth = "";528 String newToggleDlgWidth = null; 529 529 try { 530 530 if (((JFrame)parent).getExtendedState() == JFrame.NORMAL) { … … 549 549 newGeometry = width + "x" + height + "+" + x + "+" + y; 550 550 } 551 552 newToggleDlgWidth = Integer.toString(map.getToggleDlgWidth()); 553 if (newToggleDlgWidth.equals(Integer.toString(map.DEF_TOGGLE_DLG_WIDTH))) { 554 newToggleDlgWidth = ""; 551 552 if (map != null) { 553 newToggleDlgWidth = Integer.toString(map.getToggleDlgWidth()); 554 if (newToggleDlgWidth.equals(Integer.toString(map.DEF_TOGGLE_DLG_WIDTH))) { 555 newToggleDlgWidth = ""; 556 } 555 557 } 556 558 } 557 559 catch (Exception e) { 558 560 System.out.println("Failed to save GUI geometry: " + e); 561 e.printStackTrace(); 559 562 } 560 563 pref.put("gui.geometry", newGeometry); 561 pref.put("toggleDialogs.width", newToggleDlgWidth); 564 if (newToggleDlgWidth != null) { 565 pref.put("toggleDialogs.width", newToggleDlgWidth); 566 } 562 567 } 563 568 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r2162 r2185 6 6 import java.awt.Component; 7 7 import java.awt.Dimension; 8 import java.awt.Graphics; 8 9 import java.awt.GridBagLayout; 9 10 import java.awt.Image; … … 24 25 import javax.swing.ImageIcon; 25 26 import javax.swing.JButton; 27 import javax.swing.JComponent; 26 28 import javax.swing.JDialog; 27 29 import javax.swing.JLabel; … … 415 417 */ 416 418 private class TitleBar extends JPanel { 417 private JLabel leftPart;419 final private JLabel lblTitle; 418 420 419 421 public TitleBar(String toggleDialogName, String iconName) { … … 425 427 ImageIcon inIcon = ImageProvider.get("dialogs", iconName); 426 428 ImageIcon smallIcon = new ImageIcon(inIcon.getImage().getScaledInstance(16 , 16, Image.SCALE_SMOOTH)); 427 leftPart = new JLabel("",smallIcon, JLabel.TRAILING); 428 leftPart.setIconTextGap(8); 429 add(leftPart, GBC.std()); 430 add(Box.createHorizontalGlue(),GBC.std().fill(GBC.HORIZONTAL)); 429 lblTitle = new JLabel("",smallIcon, JLabel.TRAILING); 430 lblTitle.setIconTextGap(8); 431 432 JPanel conceal = new JPanel(); 433 conceal.add(lblTitle); 434 conceal.setVisible(false); 435 add(conceal, GBC.std()); 436 437 // Cannot add the label directly since it would displace other elements on resize 438 JComponent lblTitle_weak = new JComponent() { 439 @Override 440 public void paintComponent(Graphics g) { 441 lblTitle.paint(g); 442 } 443 }; 444 lblTitle_weak.setPreferredSize(new Dimension(Integer.MAX_VALUE,20)); 445 lblTitle_weak.setMinimumSize(new Dimension(0,20)); 446 add(lblTitle_weak, GBC.std().fill(GBC.HORIZONTAL)); 447 431 448 addMouseListener( 432 449 new MouseAdapter() { … … 468 485 469 486 public void setTitle(String title) { 470 l eftPart.setText(title);487 lblTitle.setText(title); 471 488 } 472 489 473 490 public String getTitle() { 474 return l eftPart.getText();491 return lblTitle.getText(); 475 492 } 476 493 }
Note:
See TracChangeset
for help on using the changeset viewer.