Exemplo n.º 1
0
 def SetIcon(self,icon,size=None,top=False):
     from javafx.scene.control import ContentDisplay;
     if os.path.isfile(icon):
         iv = ImageView(Image(FileInputStream(icon)))
         if size: iv.setFitHeight(size); iv.setFitWidth(size)
         self.ctrl.setGraphic(iv)
         if top: self.ctrl.setContentDisplay(ContentDisplay.TOP)
Exemplo n.º 2
0
class EzImageView(EzControl):
    def __init__(self,h,parent):
        if h.get('file'): self.ctrl = ImageView(Image(File(h['file']).toURI().toString()))
        else: self.ctrl = ImageView()
        self.ctrl.setPreserveRatio(True);
        if h.get('fitwidth'): self.ctrl.setFitWidth(h['fitwidth'])
        if h.get('fitheight'): self.ctrl.setFitHeight(h['fitheight'])
        if h.get('bindwidth'): self.ctrl.fitWidthProperty().bind(parent.widthProperty())
        if h.get('bindheight'): self.ctrl.fitHeightProperty().bind(parent.heightProperty())  
        self.Initialize(h)
        if h.get('handler'): self.ctrl.setOnAction(h['handler'])