add buttons

This commit is contained in:
sirjonasxx 2018-09-26 13:35:57 +02:00
parent c34cdda954
commit 8f17207ddf
21 changed files with 52 additions and 18 deletions

View File

@ -7,6 +7,8 @@ import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent; import javafx.scene.input.MouseEvent;
import javafx.scene.layout.StackPane; import javafx.scene.layout.StackPane;
import java.io.File;
public class BoxButton extends StackPane { public class BoxButton extends StackPane {
private ImageView imageView; private ImageView imageView;
@ -15,9 +17,9 @@ public class BoxButton extends StackPane {
private boolean isVisible; private boolean isVisible;
//paths zijn relatief aan deze classpath //paths zijn relatief aan deze classpath
public BoxButton(String imagePath, String imageOnHoverPath) { public BoxButton(String imageName, String imageOnHoverName) {
this.image = new Image(getClass().getResourceAsStream(imagePath)); this.image = new Image(getClass().getResourceAsStream("files" + File.separator + imageName));
this.imageOnHover = new Image(getClass().getResourceAsStream(imageOnHoverPath)); this.imageOnHover = new Image(getClass().getResourceAsStream("files" + File.separator + imageOnHoverName));
this.imageView = new ImageView(); this.imageView = new ImageView();
setCursor(Cursor.DEFAULT); setCursor(Cursor.DEFAULT);

View File

@ -1,5 +1,9 @@
package main.ui.buttons; package main.ui.buttons;
import org.omg.CORBA.Environment;
import java.io.File;
public class DeleteButton extends BoxButton { public class DeleteButton extends BoxButton {
public DeleteButton() { public DeleteButton() {

View File

@ -0,0 +1,10 @@
package main.ui.buttons;
/**
* Created by Jonas on 26/09/18.
*/
public class ExitButton extends BoxButton {
public ExitButton() {
super("ButtonExit.png", "ButtonExitHover.png");
}
}

View File

@ -0,0 +1,10 @@
package main.ui.buttons;
/**
* Created by Jonas on 26/09/18.
*/
public class FireButton extends BoxButton {
public FireButton() {
super("ButtonFire.png", "ButtonFireHover.png");
}
}

View File

@ -8,6 +8,7 @@ import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent; import javafx.scene.input.MouseEvent;
import javafx.scene.layout.StackPane; import javafx.scene.layout.StackPane;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -31,10 +32,10 @@ public class PauseResumeButton extends StackPane{
public PauseResumeButton(boolean isPaused) { public PauseResumeButton(boolean isPaused) {
this.isPaused[0] = isPaused; this.isPaused[0] = isPaused;
this.imagePause = new Image(getClass().getResourceAsStream("ButtonPause.png")); this.imagePause = new Image(getClass().getResourceAsStream("files"+ File.separator+"ButtonPause.png"));
this.imagePauseOnHover = new Image(getClass().getResourceAsStream("ButtonPauseHover.png")); this.imagePauseOnHover = new Image(getClass().getResourceAsStream("files"+ File.separator+"ButtonPauseHover.png"));
this.imageResume = new Image(getClass().getResourceAsStream("ButtonResume.png")); this.imageResume = new Image(getClass().getResourceAsStream("files"+ File.separator+"ButtonResume.png"));
this.imageResumeOnHover = new Image(getClass().getResourceAsStream("ButtonResumeHover.png")); this.imageResumeOnHover = new Image(getClass().getResourceAsStream("files"+ File.separator+"ButtonResumeHover.png"));
this.imageView = new ImageView(); this.imageView = new ImageView();
setCursor(Cursor.DEFAULT); setCursor(Cursor.DEFAULT);

View File

@ -0,0 +1,9 @@
package main.ui.buttons;
/**
* Created by Jonas on 26/09/18.
*/
public class ReloadButton extends BoxButton {
public ReloadButton() {
super("ButtonReload.png", "ButtonReloadHover.png"); }
}

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 443 B

After

Width:  |  Height:  |  Size: 443 B

View File

Before

Width:  |  Height:  |  Size: 460 B

After

Width:  |  Height:  |  Size: 460 B

View File

Before

Width:  |  Height:  |  Size: 454 B

After

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 644 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 538 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 677 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 642 B

View File

Before

Width:  |  Height:  |  Size: 725 B

After

Width:  |  Height:  |  Size: 725 B

View File

Before

Width:  |  Height:  |  Size: 621 B

After

Width:  |  Height:  |  Size: 621 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 B

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 446 B

After

Width:  |  Height:  |  Size: 446 B

View File

@ -2,17 +2,15 @@ package main.ui.extensions;
import javafx.geometry.Insets; import javafx.geometry.Insets;
import javafx.geometry.Pos; import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane; import javafx.scene.control.ScrollPane;
import javafx.scene.control.Tooltip; import javafx.scene.control.Tooltip;
import javafx.scene.input.MouseEvent; import javafx.scene.input.MouseEvent;
import javafx.scene.layout.*; import javafx.scene.layout.*;
import javafx.scene.text.Font; import javafx.scene.text.Font;
import main.ui.buttons.SimpleClickButton; import main.ui.buttons.*;
import main.ui.scheduler.ScheduleItem; import main.ui.scheduler.ScheduleItem;
import main.ui.buttons.DeleteButton;
import main.ui.buttons.EditButton;
import main.ui.buttons.PauseResumeButton;
/** /**
* Created by Jonas on 19/07/18. * Created by Jonas on 19/07/18.
@ -66,22 +64,22 @@ public class ExtensionItemContainer extends GridPane {
DeleteButton deleteButton = new DeleteButton(); ExitButton exitButton = new ExitButton();
Tooltip delete = new Tooltip("Close connection with this extension"); Tooltip delete = new Tooltip("Close connection with this extension");
Tooltip.install(deleteButton,delete); Tooltip.install(exitButton,delete);
deleteButton.show(); exitButton.show();
deleteButton.addEventHandler(MouseEvent.MOUSE_CLICKED, event -> item.isRemoveClickTrigger()); exitButton.addEventHandler(MouseEvent.MOUSE_CLICKED, event -> item.isRemoveClickTrigger());
SimpleClickButton clickButton = new SimpleClickButton(); SimpleClickButton clickButton = new SimpleClickButton();
clickButton.addEventHandler(MouseEvent.MOUSE_CLICKED, event -> item.isClickTrigger()); clickButton.addEventHandler(MouseEvent.MOUSE_CLICKED, event -> item.isClickTrigger());
HBox buttonsBox = new HBox(clickButton, deleteButton); HBox buttonsBox = new HBox(clickButton, exitButton);
if (item.isFireButtonUsed()) { if (item.isFireButtonUsed()) {
clickButton.show(); clickButton.show();
} }
else { else {
HBox.setMargin(deleteButton, new Insets(0,0,0,26)); HBox.setMargin(exitButton, new Insets(0,0,0,24));
} }
buttonsBox.setSpacing(item.isFireButtonUsed() ? 10 : 0); buttonsBox.setSpacing(item.isFireButtonUsed() ? 8 : 0);
buttonsBox.setAlignment(Pos.CENTER); buttonsBox.setAlignment(Pos.CENTER);
GridPane.setMargin(buttonsBox, new Insets(0, 5, 0, 5)); GridPane.setMargin(buttonsBox, new Insets(0, 5, 0, 5));
add(buttonsBox, 4, 0); add(buttonsBox, 4, 0);