Changeset 2185 in josm for trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
- Timestamp:
- 2009-09-23T11:14:18+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.