continuing

This commit is contained in:
_N0x 2021-02-07 02:47:02 +01:00
parent 82c157e879
commit 5ec0f50305
14 changed files with 101 additions and 285 deletions

4
.gitignore vendored
View File

@ -1,6 +1,6 @@
# Default ignored files
/shelf/
/.idea/workspace.xml
/.idea/*
# Compiled class file
*.class
@ -24,4 +24,4 @@
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
hs_err_pid*

View File

@ -1,15 +0,0 @@
<component name="ArtifactManager">
<artifact type="javafx" name="JavaFXApp">
<output-path>$PROJECT_DIR$/out/artifacts/JavaFXApp</output-path>
<properties id="javafx-properties">
<options>
<option name="appClass" value="sample.Main" />
</options>
</properties>
<root id="root">
<element id="archive" name="JavaFXApp.jar">
<element id="module-output" name="PhotoViewer" />
</element>
</root>
</artifact>
</component>

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>

View File

@ -1,2 +0,0 @@
<html>Simple <b>JavaFX 2.0</b> application that includes simple .fxml file with attached controller and Main class to quick start. Artifact to build JavaFX application is provided.
</html>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
</project>

View File

@ -1,16 +0,0 @@
<component name="libraryTable">
<library name="lib">
<CLASSES>
<root url="file://$USER_HOME$/Workspace/javafx-sdk-15.0.1/lib" />
</CLASSES>
<JAVADOC />
<NATIVE>
<root url="file://$USER_HOME$/Workspace/javafx-sdk-15.0.1/lib" />
</NATIVE>
<SOURCES>
<root url="file://$USER_HOME$/Workspace/javafx-sdk-15.0.1/lib" />
</SOURCES>
<jarDirectory url="file://$USER_HOME$/Workspace/javafx-sdk-15.0.1/lib" recursive="false" />
<jarDirectory url="file://$USER_HOME$/Workspace/javafx-sdk-15.0.1/lib" recursive="false" type="SOURCES" />
</library>
</component>

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectKey">
<option name="state" value="project://e79810c8-c5c8-43b1-b19c-90c1f4095425" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_15" default="true" project-jdk-name="15" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/PhotoViewer.iml" filepath="$PROJECT_DIR$/PhotoViewer.iml" />
</modules>
</component>
</project>

View File

@ -1,125 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -7,6 +7,6 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="lib" level="project" />
<orderEntry type="library" name="lib1" level="project" />
</component>
</module>

View File

@ -1,20 +1,18 @@
package de.thm.tlf.photoViewer;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.layout.*;
import javafx.stage.Stage;
import java.io.*;
/**
* Controller Class for Image-viewer.
* Holds controls for the GUI elements.
@ -23,11 +21,7 @@ import java.io.*;
*/
public class Controller extends Application {
private PicturePreview[] previews = new PicturePreview[]{
new PicturePreview("pic/image1.jpg"),
new PicturePreview("pic/image2.jpg"),
new PicturePreview("pic/image3.jpg")
};
private PictureHandler picHandler = new PictureHandler();
public static void main(String[] args) {
launch(args);
@ -37,15 +31,54 @@ public class Controller extends Application {
public void start(Stage primaryStage) {
/* ##############################
* #### MAIN PANE ####
* ##############################
*/
* #############################*/
BorderPane mainPane = new BorderPane();
// #### END MAIN PANE ####
/* ##############################
* #### BOTTOM PANEL ####
* #############################*/
BorderPane bottom = new BorderPane();
bottom.setPadding(new Insets(5,5,5,5));
// ZoomSlider -> Bottom Left
HBox bottomLeft = new HBox();
Slider zoomSlider = new Slider(0, 100, 15);
zoomSlider.setShowTickMarks(true);
// Open Button
Button openFilesButton = new Button("Open Pictures");
bottomLeft.getChildren().addAll(openFilesButton, zoomSlider);
bottom.setLeft(bottomLeft);
HBox bottomMid = new HBox();
bottomMid.setAlignment(Pos.CENTER);
bottomMid.setSpacing(5);
Button prevPicBtn = new Button("<-");
Button nextPicBtn = new Button("->");
Button diashowBtn = new Button("Diashow");
bottomMid.getChildren().addAll(prevPicBtn, diashowBtn, nextPicBtn);
bottom.setCenter(bottomMid);
HBox bottomRight = new HBox();
Button fullScreenBtn = new Button("Fullscreen");
bottomRight.getChildren().add(fullScreenBtn);
bottom.setRight(bottomRight);
//Button Actions
prevPicBtn.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent e) {
picHandler.nextPicture();
}
});
mainPane.setBottom(bottom);
// #### END BOTTOM PANEL ####
/* ##############################
* #### TOP PANEL ####
* ##############################
*/
* #############################*/
VBox menu = new VBox();
// File Menu
Menu fileMenu = new Menu("File");
@ -63,38 +96,13 @@ public class Controller extends Application {
menuBar.getMenus().addAll(fileMenu, aboutMenu);
// Adding Menus to Top Panel
menu.getChildren().addAll(menuBar);
// Adding Top Panel to Main Pane
mainPane.setTop(menu);
// #### END TOP PANEL ####
/* ##############################
* #### LEFT PANEL ####
* ##############################
*/
VBox selectionPane = new VBox();
selectionPane.setPadding(new Insets(5,5,5,5));
selectionPane.setSpacing(5);
// Add all previews to the
for(PicturePreview pp: previews){
ImageView iv = new ImageView(pp.getImage());
iv.setFitWidth(150);
iv.setSmooth(true);
iv.setPreserveRatio(true);
selectionPane.getChildren().add(iv);
}
ScrollPane pictureSelector = new ScrollPane();
pictureSelector.setContent(selectionPane);
mainPane.setLeft(pictureSelector);
// #### END LEFT PANEL ####
/* ##############################
* #### CENTER PANEL ####
* ##############################
*/
* #############################*/
Picture testPic = new Picture("pic/image3.jpg");
ScrollPane currentViewSP = new ScrollPane();
Image image = testPic.getImage();
@ -112,38 +120,31 @@ public class Controller extends Application {
/* ##############################
* #### BOTTOM PANEL ####
* ##############################
*/
BorderPane bottom = new BorderPane();
bottom.setPadding(new Insets(5,5,5,5));
* #### LEFT PANEL ####
* #############################*/
VBox leftPane = new VBox();
VBox selectionPane = new VBox();
selectionPane.setPadding(new Insets(5,5,5,5));
selectionPane.setSpacing(5);
HBox bottomLeft = new HBox();
Slider zoomSlider = new Slider(0, 100, 15);
zoomSlider.setShowTickMarks(true);
bottomLeft.getChildren().add(zoomSlider);
bottom.setLeft(bottomLeft);
// Add all previews to the
for(PicturePreview pp: picHandler.getPreviews()){
ImageView iv = new ImageView(pp.getImage());
iv.setFitWidth(150);
iv.setSmooth(true);
iv.setPreserveRatio(true);
selectionPane.getChildren().add(iv);
}
ScrollPane pictureSelector = new ScrollPane();
pictureSelector.setContent(selectionPane);
HBox bottomMid = new HBox();
bottomMid.setAlignment(Pos.CENTER);
bottomMid.setSpacing(5);
Button prevPicBtn = new Button("<-");
Button nextPicBtn = new Button("->");
Button diashowBtn = new Button("Diashow");
bottomMid.getChildren().addAll(prevPicBtn, diashowBtn, nextPicBtn);
bottom.setCenter(bottomMid);
HBox bottomRight = new HBox();
Button fullScreenBtn = new Button("Fullscreen");
bottomRight.getChildren().add(fullScreenBtn);
bottom.setRight(bottomRight);
mainPane.setBottom(bottom);
// #### END BOTTOM PANEL ####
leftPane.getChildren().addAll(pictureSelector);
mainPane.setLeft(leftPane);
// #### END LEFT PANEL ####
primaryStage.setTitle("Photo Viewer");
primaryStage.setScene(new Scene(mainPane, 1200, 600));
primaryStage.show();
}
}

View File

@ -0,0 +1,29 @@
package de.thm.tlf.photoViewer;
public class PictureHandler {
private PicturePreview[] previews = new PicturePreview[]{
new PicturePreview("pic/image1.jpg"),
new PicturePreview("pic/image2.jpg"),
new PicturePreview("pic/image3.jpg")
};
private int currentPictureID = 0;
public PicturePreview[] getPreviews(){
return previews;
}
public void loadPictures(){
}
public Picture nextPicture(){
return null;
}
public Picture prevPicture(){
return null;
}
}