Guest User

Untitled

a guest
Feb 3rd, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.90 KB | None | 0 0
  1. Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: Image must be non-null
  2. at com.sun.prism.paint.ImagePattern.<init>(ImagePattern.java:44)
  3. at com.sun.javafx.tk.quantum.QuantumToolkit.createImagePatternPaint(QuantumToolkit.java:898)
  4. at com.sun.javafx.tk.Toolkit.getPaint(Toolkit.java:614)
  5. at javafx.scene.paint.ImagePattern.acc_getPlatformPaint(ImagePattern.java:291)
  6. at javafx.scene.paint.Paint$1.getPlatformPaint(Paint.java:51)
  7. at javafx.scene.shape.Shape.updatePGShape(Shape.java:916)
  8. at javafx.scene.shape.Shape.impl_updatePeer(Shape.java:965)
  9. at javafx.scene.shape.Circle.impl_updatePeer(Circle.java:333)
  10. at javafx.scene.Node.impl_syncPeer(Node.java:503)
  11. at javafx.scene.Scene$ScenePulseListener.syncAll(Scene.java:2304)
  12. at javafx.scene.Scene$ScenePulseListener.syncAll(Scene.java:2313)
  13. at javafx.scene.Scene$ScenePulseListener.synchronizeSceneNodes(Scene.java:2280)
  14. at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2419)
  15. at com.sun.javafx.tk.Toolkit.lambda$runPulse$30(Toolkit.java:355)
  16. at java.security.AccessController.doPrivileged(Native Method)
  17. at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:354)
  18. at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:381)
  19. at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:510)
  20. at com.sun.javafx.tk.quantum.PaintCollector.liveRepaintRenderJob(PaintCollector.java:320)
  21. at com.sun.javafx.tk.quantum.GlassViewEventHandler$ViewEventNotification.run(GlassViewEventHandler.java:831)
  22. at com.sun.javafx.tk.quantum.GlassViewEventHandler$ViewEventNotification.run(GlassViewEventHandler.java:792)
  23. at java.security.AccessController.doPrivileged(Native Method)
  24. at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleViewEvent$368(GlassViewEventHandler.java:871)
  25. at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
  26. at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleViewEvent(GlassViewEventHandler.java:870)
  27. at com.sun.glass.ui.View.handleViewEvent(View.java:539)
  28. at com.sun.glass.ui.View.notifyResize(View.java:875)
  29. at com.sun.glass.ui.win.WinWindow._setBounds(Native Method)
  30. at com.sun.glass.ui.Window.setBounds(Window.java:572)
  31. at com.sun.javafx.tk.quantum.WindowStage.setBounds(WindowStage.java:317)
  32. at javafx.stage.Window$TKBoundsConfigurator.apply(Window.java:1274)
  33. at javafx.stage.Window.applyBounds(Window.java:1164)
  34. at javafx.stage.Window.adjustSize(Window.java:253)
  35. at javafx.stage.Window.access$600(Window.java:77)
  36. at javafx.stage.Window$SceneModel.invalidated(Window.java:575)
  37. at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:111)
  38. at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:146)
  39. at javafx.stage.Window.setScene(Window.java:530)
  40. at javafx.stage.Stage.setScene(Stage.java:252)
  41. at LoginPage.FXMLFirstPageController$3.handle(FXMLFirstPageController.java:159)
  42. at LoginPage.FXMLFirstPageController$3.handle(FXMLFirstPageController.java:116)
  43. at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
  44. at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
  45. at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
  46. at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
  47. at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
  48. at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
  49. at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
  50. at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
  51. at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
  52. at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
  53. at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
  54. at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
  55. at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
  56. at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
  57. at javafx.event.Event.fireEvent(Event.java:198)
  58. at javafx.scene.Node.fireEvent(Node.java:8413)
  59. at javafx.scene.control.Button.fire(Button.java:185)
  60. at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
  61. at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
  62. at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
  63. at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
  64. at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
  65. at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
  66. at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
  67. at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
  68. at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
  69. at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
  70. at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
  71. at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
  72. at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
  73. at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
  74. at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
  75. at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
  76. at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
  77. at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
  78. at javafx.event.Event.fireEvent(Event.java:198)
  79. at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
  80. at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
  81. at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
  82. at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
  83. at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:381)
  84. at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
  85. at java.security.AccessController.doPrivileged(Native Method)
  86. at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$354(GlassViewEventHandler.java:417)
  87. at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
  88. at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:416)
  89. at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
  90. at com.sun.glass.ui.View.notifyMouse(View.java:937)
  91. at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
  92. at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
  93. at java.lang.Thread.run(Thread.java:745)
  94.  
  95. package Interfaces;
  96.  
  97. import java.io.File;
  98. import java.io.FileInputStream;
  99. import java.io.Serializable;
  100. import java.net.URI;
  101. import static javafx.scene.input.KeyCode.H;
  102.  
  103.  
  104. public class User implements Serializable {
  105.  
  106.  
  107.  
  108. private String Email,fName ,lName,password;
  109. private int id;
  110. private String userName,msg;
  111. private FileInputStream profileImage;
  112.  
  113. public User(String Email, String fName, String lName, String password, int
  114. id, String userName, FileInputStream profileImage) {
  115. this.Email = Email;
  116. this.fName = fName;
  117. this.lName = lName;
  118. this.password = password;
  119. this.id = id;
  120. this.userName = userName;
  121. this.profileImage = profileImage;
  122. }
  123.  
  124. public User(String Email, String fName, String lName, String password, int id, String userName, String msg, FileInputStream profileImage) {
  125. this.Email = Email;
  126. this.fName = fName;
  127. this.lName = lName;
  128. this.password = password;
  129. this.id += id;
  130. this.userName = userName;
  131. this.msg = msg;
  132. this.profileImage = profileImage;
  133. }
  134. public User(String name, String msg)
  135. {
  136. this.userName = name;
  137. this.msg = msg;
  138. }
  139. public User()
  140. {
  141.  
  142. }
  143.  
  144. public User(String name, String msg, FileInputStream profileImage) {
  145. this.userName = name;
  146. this.msg = msg;
  147. this.profileImage = profileImage;
  148. }
  149.  
  150. public FileInputStream getImageUrl() {
  151. return profileImage;
  152. }
  153.  
  154. public void setImageUrl(FileInputStream profileImage) {
  155. this.profileImage = profileImage;
  156. }
  157.  
  158. public String getName() {
  159. return userName;
  160. }
  161.  
  162. public void setName(String name) {
  163. this.userName = name;
  164. }
  165.  
  166. public String getMsg() {
  167. return msg;
  168. }
  169.  
  170. public void setMsg(String msg) {
  171. this.msg = msg;
  172. }
  173.  
  174. public String getEmail() {
  175. return Email;
  176. }
  177.  
  178. public void setEmail(String Email) {
  179. this.Email = Email;
  180. }
  181.  
  182. public String getfName() {
  183. return fName;
  184. }
  185.  
  186. public void setfName(String fName) {
  187. this.fName = fName;
  188. }
  189.  
  190. public String getlName() {
  191. return lName;
  192. }
  193.  
  194. public void setlName(String lName) {
  195. this.lName = lName;
  196. }
  197.  
  198. public String getPassword() {
  199. return password;
  200. }
  201.  
  202. public void setPassword(String password) {
  203. this.password = password;
  204. }
  205.  
  206. public int getId() {
  207. return id;
  208. }
  209.  
  210. public void setId(int id) {
  211. this.id = id;
  212. }
  213.  
  214. public String getUserName() {
  215. return userName;
  216. }
  217.  
  218. //Sign up Data
  219. public void setUserName(String userName) {
  220. this.userName = userName;
  221. }
  222.  
  223.  
  224.  
  225. }
  226.  
  227. public class FXMLFirstPageController implements Initializable , Serializable {
  228.  
  229. /**
  230. * Initializes the controller class.
  231. */
  232.  
  233. Stage stage;
  234. private double xOffset = 0;
  235. private double yOffset = 0;
  236. @FXML
  237. private Button btnCloseFirstForm;
  238. @FXML
  239. private Button btnMinFirstForm;
  240. @FXML
  241. private AnchorPane Anchor;
  242. @FXML
  243. public Button btnLogin;
  244. @FXML
  245. private TextField TextFieldUserName;
  246. @FXML
  247. private Circle CirclePicProfile;
  248. @FXML
  249. private Button btnChoosePic;
  250. @FXML
  251. private Button FirstPage_BtnSignUp;
  252.  
  253.  
  254. private static String userName;
  255. private static File file;
  256. private static FileInputStream fis;
  257.  
  258. public static FileInputStream getUrll() {
  259. return fis;
  260. }
  261.  
  262. public static String getUserName() {
  263. return userName;
  264. }
  265.  
  266. @Override
  267. public void initialize(URL url, ResourceBundle rb)
  268. {
  269. // TODO
  270. CirclePicProfile.setStroke(Color.SEAGREEN);
  271. Image im = new Image("file:/C:/Users/Hesham%20Kadry/Documents/NetBeansProjects/ChatDesign/pics/download.png",false);
  272. CirclePicProfile.setFill(new ImagePattern(im));
  273. CirclePicProfile.setEffect(new DropShadow(+15d, 0d, +2d, Color.DARKSEAGREEN));
  274.  
  275.  
  276. btnLogin.setOnAction(new EventHandler<ActionEvent>() {
  277. FXMLLoader loader;
  278. Parent root;
  279. @Override
  280. public void handle(ActionEvent event) {
  281. userName = TextFieldUserName.getText();
  282. if(userName.isEmpty())
  283. {
  284. Alert alert = new Alert(AlertType.WARNING);
  285. alert.setTitle("Warning Dialog");
  286. alert.setHeaderText("Wrong Data");
  287. alert.setContentText("Complete Data Please !!!!");
  288. alert.showAndWait();
  289.  
  290. }else{
  291. System.out.println(userName);
  292.  
  293. try {
  294. loader = new FXMLLoader();
  295. root = loader.load(getClass().getResource("/chatdesign/FXMLDocument.fxml").openStream());
  296.  
  297. stage = (Stage) Anchor.getScene().getWindow();
  298.  
  299.  
  300. root.setOnMousePressed(new EventHandler<MouseEvent>(){
  301. @Override
  302. public void handle(MouseEvent event) {
  303. xOffset = event.getSceneX();
  304. yOffset = event.getSceneY();
  305. }
  306. });
  307.  
  308. root.setOnMouseDragged(new EventHandler<MouseEvent>()
  309. {
  310. @Override
  311. public void handle(MouseEvent event) {
  312. stage.setX(event.getScreenX() - xOffset);
  313. stage.setY(event.getScreenY() - yOffset);
  314. }
  315. });
  316. Scene scene = new Scene(root);
  317. scene.getStylesheets().add(getClass().getResource("/chatdesign/style.css").toString());
  318. System.out.println("test1111111111");
  319. stage.setScene(scene);
  320. stage.show();
  321.  
  322. } catch (IOException ex) {
  323. Logger.getLogger(FXMLFirstPageController.class.getName()).log(Level.SEVERE, null, ex);
  324. }
  325.  
  326. }
  327.  
  328. }
  329. });
  330. btnChoosePic.setOnAction(new EventHandler<ActionEvent>()
  331. {
  332. @Override
  333. public void handle(ActionEvent event) {
  334. System.out.println("image button clicked");
  335. final FileChooser fileChooser = new FileChooser();
  336. file = fileChooser.showOpenDialog(stage);
  337. if (file != null)
  338. { try {
  339. /*
  340. try {
  341. //////////////////////////////////////////////////////////////////////
  342.  
  343. urll = new FileInputStream(file);
  344. System.out.println("fis in first page "+urll);
  345. } catch (FileNotFoundException ex) {
  346. Logger.getLogger(FXMLFirstPageController.class.getName()).log(Level.SEVERE, null, ex);
  347. }
  348. */
  349. //urll = file.toURI().toString();
  350. fis = new FileInputStream(file);
  351. } catch (FileNotFoundException ex) {
  352. Logger.getLogger(FXMLFirstPageController.class.getName()).log(Level.SEVERE, null, ex);
  353. }
  354. Image image1 = new Image(fis);
  355.  
  356.  
  357. CirclePicProfile.setStroke(Color.SEAGREEN);
  358. //Image im = new Image("file:/C:/Users/Hesham%20Kadry/Documents/NetBeansProjects/ChatDesign/pics/IMG_5279.jpg",false);
  359. CirclePicProfile.setFill(new ImagePattern(image1));
  360. CirclePicProfile.setEffect(new DropShadow(+15d, 0d, +2d, Color.DARKSEAGREEN));
  361. // what I tried to do
  362. // Image image1 = new Image(file);
  363. //ImageView ip = new ImageView(image1);
  364. //BackgroundSize backgroundSize = new BackgroundSize(100, 100, true, true, true, false);
  365. //BackgroundImage backgroundImage = new BackgroundImage(image1, BackgroundRepeat.REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER, backgroundSize);
  366. }
  367. }
  368. });
  369.  
  370.  
  371. }
  372.  
  373.  
  374. }
Add Comment
Please, Sign In to add comment