• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How can i resize scene in javafx 8?

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I pressed Key Button in NumericKeypad.fxml Key Panel should appear and when i click on it again it should hide and stage should be shrink.
I Have try KeyPane.setPrefSize(0, 0); Keypad get disappear but whole scene is still on same size.

AddItemController.java
@FXML
public void handleAddUPCButtonAction(ActionEvent a){
try {
Stage stg=new Stage();
FXMLLoader fxml=new FXMLLoader(getClass().getResource("NumericKeyPad.fxml"));
Parent root=(Parent)fxml.load();
stg.setScene(new Scene(root));
stg.show();
} catch (IOException ex) {
Logger.getLogger(SelectDeptController.class.getName()).log(Level.SEVERE, null, ex);
}
}

NumericKeypad.fxml

<AnchorPane id="AnchorPane" prefHeight="493.0" prefWidth="521.0" styleClass="mainFxmlClass" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="finaldemo.Controller.NumericKeyPadController" fx:id="mainPane">
<stylesheets>
<URL value="@numerickeypad.css" />
</stylesheets>
<children>
<Pane layoutX="6.0" prefHeight="105.0" prefWidth="428.0">
<children>
<TextField layoutX="89.0" layoutY="13.0" prefHeight="25.0" prefWidth="284.0" />
<Button layoutX="52.0" layoutY="61.0" mnemonicParsing="false" prefHeight="32.0" prefWidth="78.0" text="Key>>" />
<Button layoutX="190.0" layoutY="62.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="78.0" text="OK" />
<Button layoutX="337.0" layoutY="66.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="78.0" text="Cancel" />
</children>
</Pane>
<Pane fx:id="KeyPanel" layoutX="14.0" layoutY="144.0" prefHeight="341.0" prefWidth="418.0">
<children>
<Button layoutX="14.0" layoutY="7.0" mnemonicParsing="false" prefHeight="50.0" prefWidth="112.0" text="1" />
<Button layoutX="153.0" layoutY="7.0" mnemonicParsing="false" prefHeight="50.0" prefWidth="112.0" text="2" />
<Button layoutX="14.0" layoutY="91.0" mnemonicParsing="false" prefHeight="50.0" prefWidth="112.0" text="4" />
<Button layoutX="153.0" layoutY="91.0" mnemonicParsing="false" prefHeight="50.0" prefWidth="112.0" text="5" />
<Button layoutX="300.0" layoutY="7.0" mnemonicParsing="false" prefHeight="50.0" prefWidth="112.0" text="3" />
<Button layoutX="300.0" layoutY="91.0" mnemonicParsing="false" prefHeight="50.0" prefWidth="112.0" text="6" />
<Button layoutX="153.0" layoutY="185.0" mnemonicParsing="false" prefHeight="50.0" prefWidth="112.0" text="8" />
<Button layoutX="14.0" layoutY="185.0" mnemonicParsing="false" prefHeight="50.0" prefWidth="112.0" text="7" />
<Button layoutX="294.0" layoutY="185.0" mnemonicParsing="false" prefHeight="50.0" prefWidth="112.0" text="9" />
<Button layoutX="294.0" layoutY="282.0" mnemonicParsing="false" prefHeight="50.0" prefWidth="112.0" text="Delete" />
<Button layoutX="153.0" layoutY="282.0" mnemonicParsing="false" prefHeight="50.0" prefWidth="112.0" text="00" />
<Button layoutX="14.0" layoutY="282.0" mnemonicParsing="false" prefHeight="50.0" prefWidth="112.0" text="0" />
</children>
</Pane>
</children>
</AnchorPane>
 
reply
    Bookmark Topic Watch Topic
  • New Topic