package greenfoot.guifx.images;
import bluej.Config;
import bluej.pkgmgr.Project;
import bluej.utility.javafx.FXCustomizedDialog;
import greenfoot.guifx.classes.LocalGClassNode;
import java.io.File;
import javafx.scene.control.ButtonType;
import javafx.stage.Stage;
import javafx.stage.Window;
| A (modal) dialog for selecting a class image. The image can be selected from either the
| project image library, or the greenfoot library, or an external location.
|
| @author Davin McCall
| @author Amjad Altadmri
|
public class SelectImageFrame extends FXCustomizedDialog<File>{
| Construct an SelectImageFrame for changing the image of an existing class.
|
| @param owner The parent frame
| @param classTarget The ClassView of the existing class
|
public SelectImageFrame(Window owner, Project project, LocalGClassNode classNode)
{
super(owner, Config.getString("imagelib.title") + " " + classNode.getDisplayName(), "image-lib");
ImageLibPane imageLibPane = new ImageLibPane(this.asWindow(), project, classNode);
setContentPane(imageLibPane);
final Window window = this.getDialogPane().getScene().getWindow();
Stage stage = (Stage) window;
stage.setMinWidth(600);
stage.setMinHeight(500);
getDialogPane().getButtonTypes().addAll(ButtonType.CANCEL, ButtonType.OK);
getDialogPane().lookupButton(ButtonType.OK).disableProperty().bind(imageLibPane.selectedImageProperty().isNull());
setResultConverter(bt -> bt == ButtonType.OK ? imageLibPane.selectedImageProperty().get() : null);
}
}
. SelectImageFrame
32 neLoCode
+ 7 LoComm