Changeset 215
- Timestamp:
- 08/11/08 18:47:14 (16 years ago)
- Location:
- trunk/src/org/expeditee/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/Popup.java
r189 r215 1 1 package org.expeditee.gui; 2 2 3 import java.awt.BasicStroke; 3 4 import java.awt.Component; 4 5 import java.awt.Container; 5 6 import java.awt.Graphics; 7 import java.awt.Graphics2D; 6 8 import java.awt.LayoutManager; 7 9 … … 23 25 24 26 //Mike says: Can we get the border for the IW to which this popup corresponds? 25 public static final float BORDER_THICKNESS = 1.0F; 26 // private static final Stroke _lineStroke = new BasicStroke(BORDER_THICKNESS); 27 // Brook says: Would be nice - but popups are actually independant from widgets 28 // =>Now: It is up to the user of the popup to set the border thickness 29 private static final BasicStroke DEFAULT_STROKE = new BasicStroke(2.0f); 30 31 private BasicStroke _lineStroke = DEFAULT_STROKE; 27 32 28 33 private boolean _isReadyToPaint = false; … … 53 58 public void paint(Graphics g) { 54 59 super.paint(g); 55 // Draw iwidget-like border for consistancy 56 // ((Graphics2D)g).setStroke(_lineStroke); 57 // g.drawRect(0, 0, getWidth(), getHeight()); 60 61 if (_lineStroke != null) { 62 // Draw iwidget-like border for consistancy 63 ((Graphics2D)g).setStroke(_lineStroke); 64 g.drawRect(0, 0, getWidth(), getHeight()); 65 } 58 66 } 59 67 … … 140 148 } 141 149 150 /** 151 * 152 * @param thickness 153 * The new thickness to set. Null for no border. 154 */ 155 public void setBorderThickness(float thickness) { 156 assert(thickness >= 0); 157 158 if (thickness == 0) _lineStroke = null; 159 else _lineStroke = new BasicStroke(thickness); 160 161 } 142 162 143 163 /** 164 * @return 165 * The border thickness of this popup. Zero or more. 166 */ 167 public float getBorderThickness() { 168 if (_lineStroke == null) return 0.0f; 169 return _lineStroke.getLineWidth(); 170 } 144 171 145 172 -
trunk/src/org/expeditee/gui/PopupManager.java
r183 r215 309 309 310 310 // Invalidate the popup border 311 if ( Popup.BORDER_THICKNESS > 0) {311 if (p.getBorderThickness() > 0.0f) { 312 312 invalidatePopup(p); 313 313 } … … 464 464 private void invalidatePopup(Popup p) { 465 465 FrameGraphics.invalidateArea(ItemUtils.expandRectangle(p.getBounds(), 466 (int)Math.ceil( Popup.BORDER_THICKNESS)));466 (int)Math.ceil(p.getBorderThickness()))); 467 467 } 468 468 … … 599 599 600 600 // Invalidate the popup border 601 if ( Popup.BORDER_THICKNESS > 0) {601 if (ap.popup.getBorderThickness() > 0.0f) { 602 602 invalidatePopup(ap.popup); 603 603 }
Note:
See TracChangeset
for help on using the changeset viewer.