Beispiel #1
0
 def __init__(self):
     self._editor = MyCodeArea()
     borderPane = BorderPane()
     self._editor.setParagraphGraphicFactory(LineNumberFactory.get(self._editor))
     self._editor.richChanges().filter(jp(lambda ch: not ch.getInserted().equals(ch.getRemoved()))).subscribe(jc(lambda change: self._editor.setStyleSpans(0, computeHighlighting(self._editor.getText()))))
     borderPane.setCenter(VirtualizedScrollPane(self._editor))
     scene = Scene(borderPane)
     scene.getStylesheets().add(ASLANPP_SYNTAX_HIGHLIGHT);
     self.setScene(scene)
Beispiel #2
0
 def __init__(self):
     self._editor = MyCodeArea()
     borderPane = BorderPane()
     self._editor.setParagraphGraphicFactory(
         LineNumberFactory.get(self._editor))
     borderPane.setCenter(VirtualizedScrollPane(self._editor))
     scene = Scene(borderPane)
     #scene.getStylesheets().add(ASLANPP_SYNTAX_HIGHLIGHT);
     self.setScene(scene)
Beispiel #3
0
 def __init__(self,w):
     from javafx.scene.layout import BorderPane
     from javafx.geometry import Insets
     self.ctrl = BorderPane()
     self.ctrl.setPadding(Insets(0, 0, 0, 0))
     if w.content: self.setCenter(EzLayout(w.content,self.ctrl))
     v = EzVBox()
     if w.menu: v.addItem(EzMenuBar(w.menu))
     for m in w.tool:
         v.addItem(EzToolBar(m))
     self.setTop(v.ctrl)
     self.setBottom(EzStatusBar(w.status))
Beispiel #4
0
 def createStage(self):
     stage = Stage()
     bPane = BorderPane()
     scene = Scene(bpane)
     stage.setScene(scene)
     stage.show()
     return bPane
Beispiel #5
0
 def __init__(self):
     from javafx.scene.layout import BorderPane
     from javafx.geometry import Insets
     self.ctrl = BorderPane()
     self.ctrl.setPadding(Insets(0, 0, 0, 0))
Beispiel #6
0
class EzBorderPane():
    def __init__(self):
        from javafx.scene.layout import BorderPane
        from javafx.geometry import Insets
        self.ctrl = BorderPane()
        self.ctrl.setPadding(Insets(0, 0, 0, 0))
    def setTop(self,item):    self.ctrl.setTop(item)
    def setBottom(self,item): self.ctrl.setBottom(item)
    def setLeft(self,item):   self.ctrl.setLeft(item)
    def setRight(self,item):  self.ctrl.setRight(item)
    def setCenter(self,item): self.ctrl.setCenter(item)
Beispiel #7
0
#@OUTPUT javafx.scene.Node node

from javafx.scene.control import Label
from javafx.scene.layout import BorderPane

label = Label("Hello Martians")
borderPane = BorderPane()
borderPane.setCenter(label)

node = borderPane
Beispiel #8
0
    def start(self, primaryStage):
        primaryStage.setTitle("JythonFX Draw")
        root = StackPane()
        screen = javafx.stage.Screen.getPrimary()
        rect = screen.visualBounds
        canvas = Canvas(rect.width/2 + 50,
                        rect.height/2 + 300)
        graphics_context = canvas.graphicsContext2D
        
        def resetAction(event):
            graphics_context.clearRect(1,1,
            graphics_context.canvas.width-2,
            graphics_context.canvas.height-2)
            
        def colorAction(newval):
            idx = newval.value
            if idx == 0:
                new_color = Color.BLACK
            elif idx == 1:
                new_color = Color.BLUE
            elif idx == 2:
                new_color = Color.RED
            elif idx == 3:
                new_color = Color.GREEN
            elif idx == 4:
                new_color = Color.BROWN
            elif idx == 5:
                new_color = Color.ORANGE
            else:
                new_color = Color.BLACK

            graphics_context.setStroke(new_color)
            
        def sizeAction(newval):
            idx = newval.value
            if idx == 0:
                graphics_context.lineWidth = 1
            elif idx == 1:
                graphics_context.lineWidth = 2
            elif idx == 2:
                graphics_context.lineWidth = 3
            elif idx == 3:
                graphics_context.lineWidth = 4
            elif idx == 4:
                graphics_context.lineWidth = 5
            else:
                graphics_context.lineWidth = 1
            
            
        resetButton = javafx.scene.control.Button(
            "Reset", onAction=resetAction)
        resetButton.translateX = 10
        
        colorChooser = javafx.scene.control.ChoiceBox(
        FXCollections.observableArrayList(
        "Black", "Blue", "Red", "Green", "Brown", "Orange"
        ))
        
        cssm = colorChooser.selectionModel
        cssm.selectedIndexProperty().addListener(colorAction)
        
        sizeChooser = javafx.scene.control.ChoiceBox(
            FXCollections.observableArrayList
            ("1", "2", "3", "4", "5")
        )
        
        scsm = sizeChooser.selectionModel
        scsm.selectedIndexProperty().addListener(sizeAction)
        
        def mouse_pressed(event):
            graphics_context.beginPath()
            graphics_context.moveTo(event.x, event.y)
            graphics_context.stroke()
            
        def mouse_dragged(event):
            graphics_context.lineTo(event.x, event.y)
            graphics_context.stroke()
        
        canvas.addEventHandler(MouseEvent.MOUSE_PRESSED,
                               mouse_pressed)
        canvas.addEventHandler(MouseEvent.MOUSE_DRAGGED,
                               mouse_dragged)
        
        buttonBox = HBox()
        buttonBox.children.addAll(colorChooser,
                                  sizeChooser, resetButton)
        
        self.init_draw(graphics_context,
                       canvas.layoutX, canvas.layoutY)
        
        container = BorderPane()
        container.top = buttonBox
        container.center = canvas
        root.children.add(container)
        
        scene = Scene(root, rect.height, rect.width)
        primaryStage.title = "JythonFX Draw"
        primaryStage.scene = scene
        primaryStage.show()