ButtonUtility untuk membuat button dengan icon
parent
c9e707d594
commit
dbb4de50b7
@ -0,0 +1,32 @@
|
||||
package id.amigogroup.posterminal.util;
|
||||
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ronal
|
||||
*/
|
||||
public class ButtonUtility {
|
||||
public static final Image CLOSE_ICON = new Image("/assets/close.png");
|
||||
|
||||
public static Button generateButton(Image icon) {
|
||||
Button button = new Button();
|
||||
button.setPrefSize(90, button.prefHeight(0));
|
||||
ImageView imageView = new ImageView(icon);
|
||||
imageView.setFitWidth(20);
|
||||
imageView.setFitHeight(20);
|
||||
button.setGraphic(imageView);
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
public static void changeIcon(Button button,Image icon) {
|
||||
button.setPrefSize(90, button.prefHeight(0));
|
||||
ImageView imageView = new ImageView(icon);
|
||||
imageView.setFitWidth(20);
|
||||
imageView.setFitHeight(20);
|
||||
button.setGraphic(imageView);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 581 B |
Loading…
Reference in New Issue