Main class:
@Override public void start(Stage stage) throws Exception { controllerCreateNewBuildMods = new ControllerCreateNewBuildMods(); System.out.println(" Program start!"); System.out.println(""); storageVariables = new StorageVariables(); language=storageVariables.getLanguage(); while (aBoolean == true){ try{ icons.add(new Image(getClass().getResource("res//icons//" + i + ".png").toString())); i++; }catch(Exception e){ i--; System.err.println(" *ΠΠ°ΠΉΠ΄Π΅Π½ΠΎ " + i + " ΠΈΠΊΠΎΠ½ΠΊΠΈ"); amount = i; break; } } System.out.println(amount); controllerCreateNewBuildMods.setAmount(amount);//ΠΠ΄Π΅ΡΡ Π²Π°ΠΆΠ½ΠΎ fXMLLoader_MainMenu = new FXMLLoader(); fXMLLoader_MainMenu.setLocation(getClass().getResource("MainChoiceTheBuildMenu.fxml")); fXMLLoader_MainMenu.setResources(ResourceBundle.getBundle("sample.Properties.MainMenu", new Locale(language))); Parent panel = FXMLLoader.load(getClass().getResource("MainChoiceTheBuildMenu.fxml")); Scene scene=new Scene(panel,700,500); stageMainMenu=new Stage(); stageMainMenu.setScene(scene); stageMainMenu.setTitle(fXMLLoader_MainMenu.getResources().getString("key_MainMenu_Title")); //titleMainMenu stageMainMenu.show(); } Class ControllerCreateNewBuildMods:
@FXML ImageView imgCreateNewBuildModsIconBuildMods; private int amount; private int position = 1; private String stringLanguage; private Main main = new Main(); private StorageVariables storageVariables=new StorageVariables(); private Image img; public void setAmount(int amount){ this.amount = amount; System.out.println(amount);//ΠΠ΄Π΅ΡΡ Π²ΡΠ²ΠΎΠ΄ΠΈΡ 135(Π’Π°ΠΊ ΠΈ Π΄ΠΎΠ»ΠΆΠ½ΠΎ Π±ΡΡΡ) System.out.println(this.amount);//ΠΠ΄Π΅ΡΡ Π²ΡΠ²ΠΎΠ΄ΠΈΡ 135(Π’Π°ΠΊ ΠΈ Π΄ΠΎΠ»ΠΆΠ½ΠΎ Π±ΡΡΡ) } // ΠΠ½ΠΈΡΠΈΠ°Π»ΠΈΠ·Π°ΡΠΈΡ GUI ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½ΡΠΎΠ² ΠΊΠ»Π°ΡΡΠ° 'CreateNewBuildMods' ΠΏΠΎΠ΄ ΡΠ΅ΠΊΡΡΠΈΠΉ ΡΠ·ΡΠΊ @Override public void initialize(URL url, ResourceBundle resourceBundle) { amount = main.getAmount(); img = new Image(getClass().getResource("res//icons//"+position+".png").toString()); stringLanguage=storageVariables.getLanguage(); ResourceBundle lngBndl = ResourceBundle .getBundle("sample.Properties.MainMenu", new Locale(stringLanguage)); imgCreateNewBuildModsIconBuildMods.setImage(img); } /* ΠΠ΅ΡΠΎΠ΄Ρ - ΠΊΠΎΠ½ΡΡΠΎΠ»Π»Π΅ΡΡ Π΄Π»Ρ ΠΊΠ½ΠΎΠΏΠΊΠΈ 'btnBackImage' */ // ΠΡΠΎΡ ΠΌΠ΅ΡΠΎΠ΄ - ΠΊΠΎΠ½ΡΡΠΎΠ»Π»Π΅Ρ ΠΊΠ½ΠΎΠΏΠΊΠΈ 'btnBackImage' ΠΎΠ±ΡΠ°Π±Π°ΡΡΠ²Π°Π΅Ρ Π½Π°ΠΆΠ°ΡΠΈΠ΅ ΠΊΠ½ΠΎΠΏΠΊΠΈ public void inquiryQuestionBtnBackImage() { if(position == 1){ } position = amount; System.out.println(position); //ΠΠ΄Π΅ΡΡ Π²ΡΠ²ΠΎΠ΄ΠΈΡ 0, Ρ
ΠΎΡΡ Π΄ΠΎΠ»ΠΆΠ΅Π½ 135 img = new Image(getClass().getResource("res//icons//"+position+".png").toString());//ΠΠ΄Π΅ΡΡ Π²ΡΠ΄Π°Π΅Ρ ΠΎΡΠΈΠ±ΠΊΡ, ΡΠ°ΠΊ - ΠΊΠ°ΠΊ Π½Π΅Ρ ΡΠ°ΠΉΠ»Π° 0 imgCreateNewBuildModsIconBuildMods.setImage(img); } I do not understand why such garbage. Tell me please. I'm a newbie
public void initialize()method in which to describe initialization, including setting theamount, i.e. in the controller, writepublic void initialize() { amount = 135; }public void initialize() { amount = 135; }- Alexey Shimansky