Commit ddcda823 authored by Rio Koskelo's avatar Rio Koskelo
Browse files

eka commit

parent a32e4e6d
Pipeline #52394 failed with stage
in 4 seconds
......@@ -2,20 +2,46 @@ package org.openjfx;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.Node;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.Parent;
import javafx.fxml.FXMLLoader;
import java.io.IOException;
public class FXMLController {
@FXML
private Label label;
public void handleButtonAction(ActionEvent event) {
Parent root;
try {
root = FXMLLoader.load(getClass().getResource("lomakepohja1.fxml"));
Stage stage = new Stage();
Scene scene = new Scene(root);
stage.setTitle("Lomakepohja 1");
stage.setScene(scene);
stage.show();
((Node)(event.getSource())).getScene().getWindow().hide();
}
catch (IOException e) {
e.printStackTrace();
}
}
@FXML
private void handleButtonAction(ActionEvent event) {
System.out.println("You clicked me!");
label.setText("Hello World!");
public void handleButtonAction2(ActionEvent event) {
try { Parent root = FXMLLoader.load(getClass().getResource("lomakepohja2.fxml"));
Stage stage = new Stage();
Scene scene = new Scene(root);
stage.setTitle("Lomakepohja 2");
stage.setScene(scene);
stage.show();
((Node)(event.getSource())).getScene().getWindow().hide();
}
catch (IOException e) {
e.printStackTrace();
}
}
public void initialize() {
// TODO
}
}
}
\ No newline at end of file
......@@ -12,12 +12,12 @@ public class MainApp extends Application {
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("scene.fxml"));
Parent root = FXMLLoader.load(getClass().getResource("lomakepohja1.fxml"));
Scene scene = new Scene(root);
scene.getStylesheets().add(getClass().getResource("styles.css").toExternalForm());
//scene.getStylesheets().add(getClass().getResource("styles.css").toExternalForm());
stage.setTitle("JavaFX and SBT");
stage.setTitle("Valinta");
stage.setScene(scene);
stage.show();
}
......@@ -33,5 +33,4 @@ public class MainApp extends Application {
public static void main(String[] args) {
launch(args);
}
}
}
\ No newline at end of file
package org.openjfx;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.MenuButton;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyEvent;
public class lp1Controller {
@FXML
private ResourceBundle resources;
@FXML
private URL location;
@FXML
private TextField vuosi;
@FXML
private TextField ala;
@FXML
private TextField vuokra;
@FXML
private MenuButton kuntoNappi;
@FXML
void kuntovaihto(ActionEvent event) {
}
@FXML
void onkoAla(KeyEvent event) {
String tmp = event.getCharacter();
char c = tmp.charAt(0);
if((Character.isLetter(c)) || (ala.getText().length() >6)){
ala.deletePreviousChar();
}
}
@FXML
void onkoVuokra(KeyEvent event) {
String tmp = event.getCharacter();
char c = tmp.charAt(0);
if((Character.isLetter(c))){
vuokra.deletePreviousChar();
}
}
@FXML
void onkoVuosiluku(KeyEvent event) {
String tmp = event.getCharacter();
char c = tmp.charAt(0);
if((Character.isLetter(c)) || (vuosi.getText().length() >4) ){
vuosi.deletePreviousChar();
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Accordion?>
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuButton?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.SeparatorMenuItem?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.effect.Shadow?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.shape.Rectangle?>
<?import javafx.scene.text.Text?>
<VBox prefHeight="800.0" prefWidth="640.0" xmlns="http://javafx.com/javafx/10.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.openjfx.lp1Controller">
<children>
<MenuBar VBox.vgrow="NEVER">
<menus>
<Menu mnemonicParsing="false" text="File">
<items>
<MenuItem mnemonicParsing="false" text="New" />
<MenuItem mnemonicParsing="false" text="Open…" />
<Menu mnemonicParsing="false" text="Open Recent" />
<SeparatorMenuItem mnemonicParsing="false" />
<MenuItem mnemonicParsing="false" text="Close" />
<MenuItem mnemonicParsing="false" text="Save" />
<MenuItem mnemonicParsing="false" text="Save As…" />
<MenuItem mnemonicParsing="false" text="Revert" />
<SeparatorMenuItem mnemonicParsing="false" />
<MenuItem mnemonicParsing="false" text="Preferences…" />
<SeparatorMenuItem mnemonicParsing="false" />
<MenuItem mnemonicParsing="false" text="Quit" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Edit">
<items>
<MenuItem mnemonicParsing="false" text="Undo" />
<MenuItem mnemonicParsing="false" text="Redo" />
<SeparatorMenuItem mnemonicParsing="false" />
<MenuItem mnemonicParsing="false" text="Cut" />
<MenuItem mnemonicParsing="false" text="Copy" />
<MenuItem mnemonicParsing="false" text="Paste" />
<MenuItem mnemonicParsing="false" text="Delete" />
<SeparatorMenuItem mnemonicParsing="false" />
<MenuItem mnemonicParsing="false" text="Select All" />
<MenuItem mnemonicParsing="false" text="Unselect All" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Help">
<items>
<MenuItem mnemonicParsing="false" text="About MyHelloApp" />
</items>
</Menu>
</menus>
</MenuBar>
<AnchorPane maxHeight="-1.0" maxWidth="-1.0" prefHeight="357.0" prefWidth="671.0" VBox.vgrow="ALWAYS">
<children>
<TextField layoutX="109.0" layoutY="38.0" prefHeight="26.0" prefWidth="272.0" promptText="Kohteen nimi" AnchorPane.leftAnchor="109.0" AnchorPane.rightAnchor="259.0" />
<TextField layoutX="109.0" layoutY="84.0" prefHeight="26.0" prefWidth="272.0" promptText="Osoite" />
<Text layoutX="62.0" layoutY="56.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Nimi:" />
<Text layoutX="52.0" layoutY="102.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Osoite:" />
<TextField fx:id="vuosi" layoutX="109.0" layoutY="135.0" onKeyTyped="#onkoVuosiluku" prefHeight="26.0" prefWidth="46.0" promptText="Vuosi" />
<Text layoutX="5.0" layoutY="152.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Rakennusvuosi:" wrappingWidth="93.158203125" />
<TextField fx:id="ala" layoutX="109.0" layoutY="177.0" onKeyTyped="#onkoAla" prefHeight="26.0" prefWidth="78.0" promptText="Pinta-ala" />
<Text layoutX="25.0" layoutY="194.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Neliömäärä:" />
<Text layoutX="191.0" layoutY="194.0" strokeType="OUTSIDE" strokeWidth="0.0" text="m^2" />
<TextField fx:id="vuokra" layoutX="111.0" layoutY="215.0" onKeyTyped="#onkoVuokra" promptText="Vuokra" />
<Text layoutX="25.0" layoutY="232.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Vuokara/kk:" />
<Text layoutX="263.0" layoutY="231.0" strokeType="OUTSIDE" strokeWidth="0.0" text="€/kk" />
<Text layoutX="14.0" layoutY="268.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Kohteen kuva:" />
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="#dfdfdf" height="87.0" layoutX="111.0" layoutY="256.0" stroke="WHITE" strokeType="INSIDE" width="103.0" />
<ImageView blendMode="DARKEN" fitHeight="87.0" fitWidth="103.0" layoutX="111.0" layoutY="256.0" pickOnBounds="true" preserveRatio="true">
<effect>
<Shadow />
</effect>
</ImageView>
<TextArea layoutX="116.0" layoutY="364.0" pickOnBounds="false" prefHeight="200.0" prefWidth="408.0" promptText="Kuvaus" />
<Text layoutX="12.0" layoutY="376.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Vapaa kuvaus:" />
<TextField layoutX="110.0" layoutY="591.0" prefHeight="26.0" prefWidth="408.0" promptText="Ehdot" />
<Text layoutX="26.0" layoutY="608.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Muut ehdot:" />
<Accordion layoutX="110.0" layoutY="639.0" />
<Text layoutX="12.0" layoutY="658.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Kuntoluokitus:" />
<MenuButton fx:id="kuntoNappi" layoutX="113.0" layoutY="641.0" mnemonicParsing="false" onAction="#kuntovaihto" text="Kunto">
<items>
<MenuItem mnemonicParsing="false" text="Hyväkuntoinen" />
<MenuItem mnemonicParsing="false" text="Pientä kunnostusta" />
<MenuItem mnemonicParsing="false" text="Vaatii kunnostuksen" />
</items>
</MenuButton>
</children>
</AnchorPane>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Text" />
</children>
</VBox>
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.Group?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.shape.Rectangle?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<VBox prefHeight="470.0" prefWidth="640.0" xmlns="http://javafx.com/javafx/10.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<AnchorPane maxHeight="-1.0" maxWidth="-1.0" prefHeight="434.0" prefWidth="640.0" VBox.vgrow="ALWAYS">
<children>
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="#e2e2e2" height="143.0" layoutX="-1.0" layoutY="-1.0" stroke="WHITE" strokeType="INSIDE" strokeWidth="0.0" width="640.0" />
<Text layoutX="14.0" layoutY="27.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Asuntohaku">
<font>
<Font size="18.0" />
</font>
</Text>
<Text layoutX="61.0" layoutY="62.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Sijainti:" />
<TextField layoutX="109.0" layoutY="44.0" prefHeight="26.0" prefWidth="346.0" promptText="Osoite/postinumero" />
<Text layoutX="49.0" layoutY="101.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Pinta-ala:" />
<TextField layoutX="109.0" layoutY="83.0" prefHeight="26.0" prefWidth="49.0" promptText="min" />
<Text layoutX="159.0" layoutY="101.0" strokeType="OUTSIDE" strokeWidth="0.0" text="-" />
<TextField layoutX="164.0" layoutY="84.0" prefHeight="26.0" prefWidth="50.0" promptText="max" />
<Text layoutX="221.0" layoutY="102.0" strokeType="OUTSIDE" strokeWidth="0.0" text="m²" />
<Text layoutX="306.0" layoutY="104.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Hnta:" />
<TextField layoutX="339.0" layoutY="85.0" prefHeight="26.0" prefWidth="50.0" promptText="min" />
<Text layoutX="390.0" layoutY="102.0" strokeType="OUTSIDE" strokeWidth="0.0" text="-" />
<TextField layoutX="395.0" layoutY="86.0" prefHeight="26.0" prefWidth="50.0" promptText="max" />
<Text layoutX="443.0" layoutY="103.0" strokeType="OUTSIDE" strokeWidth="0.0" text=" €/kk" />
<Button layoutX="505.0" layoutY="45.0" mnemonicParsing="false" prefHeight="26.0" prefWidth="50.0" text="Hae" />
<Text layoutX="14.0" layoutY="155.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Tulokset:" />
<Group layoutX="14.0" layoutY="167.0">
<children>
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="#fdfdfd" height="215.0" stroke="BLACK" strokeType="INSIDE" width="174.0" />
<Text layoutX="9.0" layoutY="22.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Osoite" wrappingWidth="145.61798095703125" />
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="#d5d5d5" height="108.0" layoutY="33.0" stroke="BLACK" strokeType="INSIDE" width="174.0" />
<Text layoutX="74.0" layoutY="92.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Kuva" />
<Text layoutX="11.0" layoutY="154.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Vuokra (€/kk)" />
<Text fill="#414040" layoutX="11.0" layoutY="175.1298828125" strokeType="OUTSIDE" strokeWidth="0.0" text="Pinta-ala">
<font>
<Font size="11.0" />
</font>
</Text>
</children>
</Group>
<Group layoutX="219.0" layoutY="167.0">
<children>
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="#fdfdfd" height="215.0" stroke="BLACK" strokeType="INSIDE" width="174.0" />
<Text layoutX="9.0" layoutY="22.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Osoite" wrappingWidth="145.61798095703125" />
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="#d5d5d5" height="108.0" layoutY="33.0" stroke="BLACK" strokeType="INSIDE" width="174.0" />
<Text layoutX="74.0" layoutY="92.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Kuva" />
<Text layoutX="11.0" layoutY="154.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Vuokra (€/kk)" />
<Text fill="#414040" layoutX="11.0" layoutY="175.1298828125" strokeType="OUTSIDE" strokeWidth="0.0" text="Pinta-ala">
<font>
<Font size="11.0" />
</font>
</Text>
</children>
</Group>
<Group layoutX="420.0" layoutY="168.0">
<children>
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="#fdfdfd" height="215.0" stroke="BLACK" strokeType="INSIDE" width="174.0" />
<Text layoutX="9.0" layoutY="22.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Osoite" wrappingWidth="145.61798095703125" />
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="#d5d5d5" height="108.0" layoutY="33.0" stroke="BLACK" strokeType="INSIDE" width="174.0" />
<Text layoutX="74.0" layoutY="92.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Kuva" />
<Text layoutX="11.0" layoutY="154.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Vuokra (€/kk)" />
<Text fill="#414040" layoutX="11.0" layoutY="175.1298828125" strokeType="OUTSIDE" strokeWidth="0.0" text="Pinta-ala">
<font>
<Font size="11.0" />
</font>
</Text>
</children>
</Group>
</children>
</AnchorPane>
</children>
</VBox>
\ No newline at end of file
......@@ -6,7 +6,8 @@
<AnchorPane id="AnchorPane" prefHeight="200" prefWidth="320" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.171" fx:controller="org.openjfx.FXMLController">
<children>
<Button layoutX="126" layoutY="90" onAction="#handleButtonAction" text="Click Me!" />
<Button layoutX="80" layoutY="90" onAction="#handleButtonAction" text="Lomake 1" />
<Button layoutX="160" layoutY="90" onAction="#handleButtonAction2" text="Lomake 2" />
<Label fx:id="label" layoutX="126" layoutY="120" minHeight="16" minWidth="69" />
</children>
</AnchorPane>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment