[jruby-user] Re: Help For JrubyFX

Parham Taheri <[email protected]> Fri, 06 Mar 2015 17:07:20 +0100
Newsgroups gmane.comp.lang.jruby.user
Message-ID <[email protected]>
Thank you very much for the help my problem was resolved
But I have another problem
i wanna to make a window look like this
http://i.cubeupload.com/Zfogxo.png
but when i make this window with jrubyfx i cant transparent full
background
so for me is this
http://i.cubeupload.com/pK5nUr.png

My .rb code

require 'jrubyfx'
import "javafx.stage.StageStyle"
import "javafx.application.Application"
import "javafx.scene.Scene"
import "javafx.scene.layout.VBox"
import "javafx.scene.text.Font"
import "javafx.scene.text.Text"
import "javafx.stage.Stage"

fxml_root File.dirname(__FILE__)


class HelloWorldApp < JRubyFX::Application


    def start(stage)
          stage.fxml HelloWorldController
          stage.initStyle(StageStyle::TRANSPARENT)
          stage.title = "Hello World!"
          stage.width = 800
          stage.height = 600
          stage.show
    end
end

class HelloWorldController
  include JRubyFX::Controller
  fxml "Hello.fxml"
    def event_exit
        stage = @pane1.getScene().getWindow()
        stage.close()

    end
end

HelloWorldApp.launch

And My .fxml code

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.*?>
<?import javafx.scene.image.*?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.paint.*?>
<?import javafx.scene.text.*?>

<Pane fx:id="pane1" cacheShape="false" focusTraversable="true"
maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity"
minWidth="-Infinity" prefHeight="600.0" prefWidth="800.0"
style="-fx-background-image: url(&quot;Bg1.gif&quot;);
-fx-background-size: 800 600; -fx-background-position: center center;
-fx-background-repeat: stretch;" xmlns="http://javafx.com/javafx/8"
xmlns:fx="http://javafx.com/fxml/1">
   <children>
      <Button fx:id="btn1" layoutX="382.0" layoutY="41.0"
mnemonicParsing="false" onMouseClicked="#event_exit" text="Exit" />
      <TextField fx:id="hello_label" layoutX="325.0" layoutY="545.0" />
   </children>
</Pane>

and my bg1.png
http://i.cubeupload.com/Jrw34A.gif

please help me and fix my code

Attachments:
http://www.ruby-forum.com/attachment/10565/Bg1.gif


-- 
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email