Java Code Examples for javafx.scene.Group#setScaleY()

The following examples show how to use javafx.scene.Group#setScaleY() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AudioClipSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public static Group createRectangle(Color color, double tx, double ty, double sx, double sy) {
    Group squareGroup = new Group();
    Rectangle squareShape = new Rectangle(1.0, 1.0);
    squareShape.setFill(color);
    squareShape.setTranslateX(-0.5);
    squareShape.setTranslateY(-0.5);
    squareGroup.getChildren().add(squareShape);
    squareGroup.setTranslateX(tx);
    squareGroup.setTranslateY(ty);
    squareGroup.setScaleX(sx);
    squareGroup.setScaleY(sy);
    return squareGroup;
}
 
Example 2
Source File: AudioClipSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public static Group createRectangle(Color color, double tx, double ty, double sx, double sy) {
    Group squareGroup = new Group();
    Rectangle squareShape = new Rectangle(1.0, 1.0);
    squareShape.setFill(color);
    squareShape.setTranslateX(-0.5);
    squareShape.setTranslateY(-0.5);
    squareGroup.getChildren().add(squareShape);
    squareGroup.setTranslateX(tx);
    squareGroup.setTranslateY(ty);
    squareGroup.setScaleX(sx);
    squareGroup.setScaleY(sy);
    return squareGroup;
}
 
Example 3
Source File: AudioClipSample.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
public static Node createIconContent() {
    Group rectangleGroup = new Group();

    double xStart = 5.0;
    double xOffset = 30.0;
    double yPos = 230.0;
    double barWidth = 22.0;
    double barDepth = 7.0;

    Group base1Group = createRectangle(new Color(0.2, 0.12, 0.1, 1.0), 
                                       xStart + 135, yPos + 20.0, barWidth*11.5, 10.0);
    Group base2Group = createRectangle(new Color(0.2, 0.12, 0.1, 1.0), 
                                       xStart + 135, yPos - 20.0, barWidth*11.5, 10.0);
    Group bar1Group = createRectangle(Color.PURPLE, 
                                      xStart + 1*xOffset, yPos, barWidth, 100.0);
    Group bar2Group = createRectangle(Color.BLUEVIOLET,
                                      xStart + 2*xOffset, yPos, barWidth, 95.0);
    Group bar3Group = createRectangle(Color.BLUE,
                                      xStart + 3*xOffset, yPos, barWidth, 90.0);
    Group bar4Group = createRectangle(Color.GREEN,
                                      xStart + 4*xOffset, yPos, barWidth, 85.0);
    Group bar5Group = createRectangle(Color.GREENYELLOW,
                                      xStart + 5*xOffset, yPos, barWidth, 80.0);
    Group bar6Group = createRectangle(Color.YELLOW,
                                      xStart + 6*xOffset, yPos, barWidth, 75.0);
    Group bar7Group = createRectangle(Color.ORANGE,
                                      xStart + 7*xOffset, yPos, barWidth, 70.0);
    Group bar8Group = createRectangle(Color.RED,
                                      xStart + 8*xOffset, yPos, barWidth, 65.0);

    Light.Point light = new Light.Point();
    light.setX(-20);
    light.setY(-20);
    light.setZ(100);

    Lighting l = new Lighting();
    l.setLight(light);
    l.setSurfaceScale(1.0f);

    bar1Group.setEffect(l);
    bar2Group.setEffect(l);
    bar3Group.setEffect(l);
    bar4Group.setEffect(l);
    bar5Group.setEffect(l);
    bar6Group.setEffect(l);
    bar7Group.setEffect(l);
    bar8Group.setEffect(l);

    rectangleGroup.getChildren().add(base1Group);
    rectangleGroup.getChildren().add(base2Group);
    rectangleGroup.getChildren().add(bar1Group);
    rectangleGroup.getChildren().add(bar2Group);
    rectangleGroup.getChildren().add(bar3Group);
    rectangleGroup.getChildren().add(bar4Group);
    rectangleGroup.getChildren().add(bar5Group);
    rectangleGroup.getChildren().add(bar6Group);
    rectangleGroup.getChildren().add(bar7Group);
    rectangleGroup.getChildren().add(bar8Group);
    rectangleGroup.setScaleX(0.4);
    rectangleGroup.setScaleY(0.4);

    return rectangleGroup;
}
 
Example 4
Source File: AudioClipSample.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
public static Node createIconContent() {
    Group rectangleGroup = new Group();

    double xStart = 5.0;
    double xOffset = 30.0;
    double yPos = 230.0;
    double barWidth = 22.0;
    double barDepth = 7.0;

    Group base1Group = createRectangle(new Color(0.2, 0.12, 0.1, 1.0), 
                                       xStart + 135, yPos + 20.0, barWidth*11.5, 10.0);
    Group base2Group = createRectangle(new Color(0.2, 0.12, 0.1, 1.0), 
                                       xStart + 135, yPos - 20.0, barWidth*11.5, 10.0);
    Group bar1Group = createRectangle(Color.PURPLE, 
                                      xStart + 1*xOffset, yPos, barWidth, 100.0);
    Group bar2Group = createRectangle(Color.BLUEVIOLET,
                                      xStart + 2*xOffset, yPos, barWidth, 95.0);
    Group bar3Group = createRectangle(Color.BLUE,
                                      xStart + 3*xOffset, yPos, barWidth, 90.0);
    Group bar4Group = createRectangle(Color.GREEN,
                                      xStart + 4*xOffset, yPos, barWidth, 85.0);
    Group bar5Group = createRectangle(Color.GREENYELLOW,
                                      xStart + 5*xOffset, yPos, barWidth, 80.0);
    Group bar6Group = createRectangle(Color.YELLOW,
                                      xStart + 6*xOffset, yPos, barWidth, 75.0);
    Group bar7Group = createRectangle(Color.ORANGE,
                                      xStart + 7*xOffset, yPos, barWidth, 70.0);
    Group bar8Group = createRectangle(Color.RED,
                                      xStart + 8*xOffset, yPos, barWidth, 65.0);

    Light.Point light = new Light.Point();
    light.setX(-20);
    light.setY(-20);
    light.setZ(100);

    Lighting l = new Lighting();
    l.setLight(light);
    l.setSurfaceScale(1.0f);

    bar1Group.setEffect(l);
    bar2Group.setEffect(l);
    bar3Group.setEffect(l);
    bar4Group.setEffect(l);
    bar5Group.setEffect(l);
    bar6Group.setEffect(l);
    bar7Group.setEffect(l);
    bar8Group.setEffect(l);

    rectangleGroup.getChildren().add(base1Group);
    rectangleGroup.getChildren().add(base2Group);
    rectangleGroup.getChildren().add(bar1Group);
    rectangleGroup.getChildren().add(bar2Group);
    rectangleGroup.getChildren().add(bar3Group);
    rectangleGroup.getChildren().add(bar4Group);
    rectangleGroup.getChildren().add(bar5Group);
    rectangleGroup.getChildren().add(bar6Group);
    rectangleGroup.getChildren().add(bar7Group);
    rectangleGroup.getChildren().add(bar8Group);
    rectangleGroup.setScaleX(0.4);
    rectangleGroup.setScaleY(0.4);

    return rectangleGroup;
}
 
Example 5
Source File: TabDemo.java    From phoebus with Eclipse Public License 1.0 4 votes vote down vote up
@Override
  public void start(final Stage stage)
  {
      // TabPane with some tabs
      final TabPane tabs = new TabPane();
      tabs.setStyle("-fx-background-color: red;");
      for (int i=0; i<3; ++i)
      {
          final Rectangle rect = new Rectangle(i*100, 100, 10+i*100, 20+i*80);
          rect.setFill(Color.BLUE);
          final Pane content = new Pane(rect);
          final Tab tab = new Tab("Tab " + (i+1), content);
          tab.setClosable(false);
          tabs.getTabs().add(tab);
      }
      tabs.setMinSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
      tabs.setPrefSize(400, 300);

      final Group widgets = new Group(tabs);
      widgets.setScaleX(0.5);
      widgets.setScaleY(0.5);
      final Group scroll_content = new Group(widgets);
      final ScrollPane scroll = new ScrollPane(scroll_content);
      final Scene scene = new Scene(scroll);
      stage.setTitle("Tab Demo");
      stage.setScene(scene);
      stage.show();

      // Unfortunately, the setup of ScrollPane -> Group -> Group -> TabPane
      // breaks the rendering of the TabPane.
      // While the red background shows the area occupied by TabPane,
      // the actual Tabs are missing..
      System.out.println("See anything?");
      scene.addEventFilter(KeyEvent.KEY_PRESSED, (KeyEvent event) ->
{
	if (event.getCode() == KeyCode.SPACE)
       {   // .. until 'side' or 'tabMinWidth' or .. are twiddled to force a refresh
           tabs.setSide(Side.BOTTOM);
           tabs.setSide(Side.TOP);
           System.out.println("See it now?");
       }
});
  }