Skip to content
Snippets Groups Projects
Commit 9396209e authored by Anders Langlie's avatar Anders Langlie :crab:
Browse files

Merge branch '7-display-list-w-thought-constructor' into 'master'

Resolve "Display List /w thought constructor"

Closes #7

See merge request !10
parents 9f7d5e5b 39e3abc4
No related branches found
No related tags found
1 merge request!10Resolve "Display List /w thought constructor"
......@@ -2,19 +2,37 @@ package sample;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import java.net.ContentHandlerFactory;
public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception{
Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
primaryStage.setTitle("Hurl your thoughts");
primaryStage.setScene(new Scene(root, 700, 498));
Scene sceneMain = new Scene(root, 700, 498);
primaryStage.setScene(sceneMain);
//get access to the text field:
ScrollPane scrollyPlane = (ScrollPane) sceneMain.lookup("#scrollyboi");
Node content = scrollyPlane.getContent();
Text ta = (Text) content.lookup("#thoughtId");
ta.setText("testing");
ThoughtManager tm = new ThoughtManager();
tm.makeList();
primaryStage.show();
}
......
package sample;
public class Thought {
public String thoughtText;
private String thoughtText;
public Thought(String txt){
thoughtText = txt;
this.thoughtText = txt;
}
public String getThought()
{
return this.thoughtText;
}
}
package sample;
import java.util.List;
import java.util.*;
public class ThoughtManager {
public List<Thought> thoughts;
private List<Thought> thoughts = new ArrayList<>();
public void makeList()
{
Thought t = new Thought();
t.thoughtText = "yeet";
Thought t2 = new Thought();
t2.thoughtText = "yeet1";
Thought t3 = new Thought();
t3.thoughtText = "yeet2";
Thought t4 = new Thought();
t4.thoughtText = "yeet3";
Thought t5 = new Thought();
t5.thoughtText = "yeet4";
Thought t = new Thought("yeet1");
Thought t2 = new Thought("yeet12");
Thought t3 = new Thought("yeet3");
Thought t4 = new Thought("yeet4");
Thought t5 = new Thought("yeet5");
this.thoughts.add(t);
this.thoughts.add(t2);
this.thoughts.add(t3);
......
......@@ -8,12 +8,12 @@
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="498.0" prefWidth="700.0" xmlns="http://javafx.com/javafx/11.0.1" fx:controller="sample.Controller" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Button id="submitButton" layoutX="100.0" layoutY="423.0" mnemonicParsing="false" onAction="#handleSubmit" prefHeight="35.0" prefWidth="129.0" text="Submit thought" />
<TextArea id="textBox" fx:id="textArea" layoutX="59.0" layoutY="299.0" prefHeight="106.0" prefWidth="307.0" promptText="Write your thought here..." />
<Text layoutX="65.0" layoutY="31.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Your thoughts" />
<ScrollPane layoutX="1.0" layoutY="40.0" prefHeight="258.0" prefWidth="700.0">
<Button id="submitButton" layoutX="100.0" layoutY="423.0" mnemonicParsing="false" prefHeight="35.0" prefWidth="129.0" text="Submit thought" />
<TextArea id="textBox" layoutX="59.0" layoutY="299.0" prefHeight="106.0" prefWidth="307.0" promptText="Write your thought here..." />
<Text id="thoughtField" layoutX="65.0" layoutY="31.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Your thoughts" />
<ScrollPane id="scrollyboi" layoutX="1.0" layoutY="40.0" prefHeight="258.0" prefWidth="700.0">
<content>
<Text id="thoughtId" strokeType="OUTSIDE" strokeWidth="0.0" text="Text" wrappingWidth="33.22460746765137" />
<Text id="thoughtId" strokeType="OUTSIDE" strokeWidth="20.0" wrappingWidth="33.22460746765137" text="Text" />
</content>
</ScrollPane>
</children>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment