Update Controller.java

Fixed formatting
This commit is contained in:
Maxim 2016-11-07 02:12:36 -06:00 committed by GitHub
parent 95a280dd11
commit edb222dbca
1 changed files with 21 additions and 23 deletions

View File

@ -89,11 +89,11 @@ public class Controller {
thumbImgView.getChildren().clear(); // Clears children if any to setup for new images thumbImgView.getChildren().clear(); // Clears children if any to setup for new images
dirPathField.setText("" + directory); dirPathField.setText("" + directory);
for (int i=0; i<size; i++) { for (int i=0; i<size; i++) {
String path = "" + fileList[i]; String path = "" + fileList[i];
imgView.setFitWidth(535); imgView.setFitWidth(535);
imgView.setFitHeight(345); imgView.setFitHeight(345);
imgView.setLayoutY(posY); imgView.setLayoutY(posY);
// Video or image click actions // Video or image click actions
if (fileList[i].getName().contains(".mp4") || fileList[i].getName().contains(".mpeg") || if (fileList[i].getName().contains(".mp4") || fileList[i].getName().contains(".mpeg") ||
@ -109,37 +109,35 @@ public class Controller {
} catch(Throwable imgIOErr) { } catch(Throwable imgIOErr) {
System.out.println(imgIOErr); System.out.println(imgIOErr);
} }
imgView = new ImageView("file:///tmp/image.png"); imgView = new ImageView("file:///tmp/image.png");
thumbImgView.getChildren().add(imgView); thumbImgView.getChildren().add(imgView);
imgView.setOnMouseClicked(mouse -> { imgView.setOnMouseClicked(mouse -> {
if (mouse.getClickCount() == 2 && !mouse.isConsumed()) { if (mouse.getClickCount() == 2 && !mouse.isConsumed()) {
mouse.consume(); mouse.consume();
try { try {
pb = Runtime.getRuntime().exec(vExec); pb = Runtime.getRuntime().exec(vExec);
} catch(IOException vidIOErr) { } catch(IOException vidIOErr) {
throw new UncheckedIOException(vidIOErr); throw new UncheckedIOException(vidIOErr);
} }
} }
filePathField.setText(path); filePathField.setText(path);
}); });
} else if(fileList[i].getName().contains(".png") || fileList[i].getName().contains(".jpg")|| } else if(fileList[i].getName().contains(".png") || fileList[i].getName().contains(".jpg")||
fileList[i].getName().contains(".gif") || fileList[i].getName().contains(".jpeg")) { fileList[i].getName().contains(".gif") || fileList[i].getName().contains(".jpeg")) {
imgView = new ImageView("file://" + fileList[i]); imgView = new ImageView("file://" + fileList[i]);
thumbImgView.getChildren().add(imgView); thumbImgView.getChildren().add(imgView);
final ImageView imgViewPoped = new ImageView("file://" + fileList[i]); final ImageView imgViewPoped = new ImageView("file://" + fileList[i]);
imgView.setOnMouseClicked(mouse -> { imgView.setOnMouseClicked(mouse -> {
if (mouse.getClickCount() == 2 && !mouse.isConsumed()) { if (mouse.getClickCount() == 2 && !mouse.isConsumed()) {
mouse.consume(); mouse.consume();
displayImg(imgViewPoped, path); displayImg(imgViewPoped, path);
} }
filePathField.setText(path); filePathField.setText(path);
}); });
} else { } else {
System.out.println("Not a video or image file."); System.out.println("Not a video or image file.");
} }
posY = posY + 355.0; posY = posY + 355.0; }
}
} }
// View Image enlarged Note, sets up a seperate stage and scene with auto enlargment // View Image enlarged Note, sets up a seperate stage and scene with auto enlargment
public void displayImg(ImageView imgViewPoped, String path) { public void displayImg(ImageView imgViewPoped, String path) {