Exemplo n.º 1
0
 public void setScale(double s) {
   if (_namedIcon != null) {
     _namedIcon.scale(s, this);
     super.setIcon(_namedIcon);
     updateSize();
   }
 }
Exemplo n.º 2
0
 public Positionable finishClone(Positionable p) {
   PositionableLabel pos = (PositionableLabel) p;
   pos._text = _text;
   pos._icon = _icon;
   pos._control = _control;
   //        pos._rotateText = _rotateText;
   pos._unRotatedText = _unRotatedText;
   pos.setLocation(getX(), getY());
   pos._displayLevel = _displayLevel;
   pos._controlling = _controlling;
   pos._hidden = _hidden;
   pos._positionable = _positionable;
   pos._showTooltip = _showTooltip;
   pos.setTooltip(getTooltip());
   pos._editable = _editable;
   if (getPopupUtility() == null) {
     pos.setPopupUtility(null);
   } else {
     pos.setPopupUtility(getPopupUtility().clone(pos, pos.getTextComponent()));
   }
   pos.setOpaque(isOpaque());
   if (_namedIcon != null) {
     pos._namedIcon = cloneIcon(_namedIcon, pos);
     pos.setIcon(pos._namedIcon);
     pos.rotate(_degrees); // this will change text in icon with a new _namedIcon.
   }
   pos.updateSize();
   return pos;
 }
Exemplo n.º 3
0
 public void rotate(int deg) {
   log.debug("rotate({}) with _rotateText {}, _text {}, _icon {}", deg, _rotateText, _text, _icon);
   _degrees = deg;
   if (_rotateText || deg == 0) {
     if (deg == 0) { // restore unrotated whatever
       _rotateText = false;
       if (_text) {
         log.debug("   super.setText(\"{}\");", _unRotatedText);
         super.setText(_unRotatedText);
         if (_popupUtil != null) {
           setOpaque(_popupUtil.hasBackground());
           _popupUtil.setBorder(true);
         }
         if (_icon) {
           String url = _namedIcon.getURL();
           _namedIcon = new NamedIcon(url, url);
         } else {
           _namedIcon = null;
         }
         super.setIcon(_namedIcon);
       } else {
         _namedIcon.rotate(deg, this);
         super.setIcon(_namedIcon);
       }
     } else {
       if (_text & _icon) { // update text over icon
         _namedIcon = makeTextOverlaidIcon(_unRotatedText, _namedIcon);
       } else if (_text) { // update text only icon image
         _namedIcon = makeTextIcon(_unRotatedText);
       }
       _namedIcon.rotate(deg, this);
       super.setIcon(_namedIcon);
       setOpaque(false); // rotations cannot be opaque
     }
   } else {
     if (deg != 0) { // first time text or icon is rotated from horizontal
       if (_text && _icon) { // text overlays icon  e.g. LocoIcon
         _namedIcon = makeTextOverlaidIcon(_unRotatedText, _namedIcon);
         super.setText(null);
         _rotateText = true;
         setOpaque(false);
       } else if (_text) {
         _namedIcon = makeTextIcon(_unRotatedText);
         super.setText(null);
         _rotateText = true;
         setOpaque(false);
       }
       if (_popupUtil != null) {
         _popupUtil.setBorder(false);
       }
       _namedIcon.rotate(deg, this);
       super.setIcon(_namedIcon);
     } else if (_namedIcon != null) {
       _namedIcon.rotate(deg, this);
       super.setIcon(_namedIcon);
     }
   }
   updateSize();
 }
Exemplo n.º 4
0
 protected void editIcon() {
   String url = _iconEditor.getIcon("plainIcon").getURL();
   _namedIcon = NamedIcon.getIconByName(url);
   super.setIcon(_namedIcon);
   updateSize();
   _iconEditorFrame.dispose();
   _iconEditorFrame = null;
   _iconEditor = null;
   invalidate();
 }
Exemplo n.º 5
0
 protected void rotateOrthogonal() {
   _namedIcon.setRotation(_namedIcon.getRotation() + 1, this);
   super.setIcon(_namedIcon);
   updateSize();
   repaint();
 }
Exemplo n.º 6
0
 public void updateIcon(NamedIcon s) {
   _namedIcon = s;
   super.setIcon(_namedIcon);
   updateSize();
 }