hello there and thank you i got this error message when trying your code java.lang.IllegalArgumentException - Cannot add component to BorderLayout Container without constraint parameter
Le mar. 11 mai 2021 à 14:58, Hannah R <[email protected]> a écrit : > Maybe try to reformat your code to the following style, maybe it will help: > > browse.addActionListener((evt) -> { > ActionListener callback = e -> { > if (e != null && e.getSource() != null) { > String filePath = (String) e.getSource(); > //System.out.println("FILEPATH TO THE IMAGE " +filePath); > try { > Image img = Image.createImage(filePath); > ImageViewer iv = new ImageViewer(img); > > add(iv); > revalidate(); > > } catch (IOException ex) { > > } > } > }; > Display.getInstance().openGallery(callback, Display.GALLERY_IMAGE); > }); > > On Tuesday, May 11, 2021 at 5:08:43 AM UTC-4 [email protected] > wrote: > >> Thank you so much for your fast reply sir ! >> I will see right away this and hopefully get to a good output ! >> And what about the imageview ? What is missing in my code ? I want it to >> show the image one i clicked on the "parcourir" button, but nothing is >> showed >> >> Le mar. 11 mai 2021 à 04:09, Shai Almog <[email protected]> a écrit : >> >>> You can use the standard multipart upload. It works like a standard HTML >>> form with file field so should be pretty easy to process on the server side: >>> >>> https://www.codenameone.com/javadoc/com/codename1/io/MultipartRequest.html >>> >>> On Tuesday, May 11, 2021 at 5:29:10 AM UTC+3 [email protected] >>> wrote: >>> >>>> >>>> browse.addActionListener((evt) -> { >>>> Display.getInstance().openGallery(new ActionListener() { >>>> public void actionPerformed(ActionEvent ev) { >>>> if (ev != null && ev.getSource() != null) { >>>> String chemin = (String) ev.getSource(); >>>> >>>> int index = chemin.lastIndexOf('/'); >>>> if (index > 0) { >>>> filename = chemin.substring(index + 1); >>>> System.out.println(filename); >>>> try { >>>> Image img = Image.createImage(chemin); >>>> ImageViewer a = new ImageViewer(img); >>>> content.add(a); >>>> >>>> } catch (IOException ex) { >>>> } >>>> } >>>> } >>>> } >>>> }, Display.GALLERY_IMAGE); >>>> }); >>>> >>>> here's the code i'm having >>>> Le mardi 11 mai 2021 à 03:27:34 UTC+1, Mohamed Melek CHTOUROU a écrit : >>>> >>>>> Hi everyone, i'm a begginer and i'm trying to openGallery to select an >>>>> image, then show it in a ImageViewer, then send it through php to my >>>>> localhost >>>>> So far i opened the gallery and selected the image ... but i have no >>>>> clue on how to show it and send it, any kind help ? >>>>> >>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "CodenameOne Discussions" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/codenameone-discussions/3d8cbf45-2db6-4488-b33f-2898fcc026e2n%40googlegroups.com >>> <https://groups.google.com/d/msgid/codenameone-discussions/3d8cbf45-2db6-4488-b33f-2898fcc026e2n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- > You received this message because you are subscribed to the Google Groups > "CodenameOne Discussions" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/codenameone-discussions/a18af1ee-e95f-40da-8f93-cf2407d7ffc8n%40googlegroups.com > <https://groups.google.com/d/msgid/codenameone-discussions/a18af1ee-e95f-40da-8f93-cf2407d7ffc8n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/CAB--koVpO9qV9AYkS19cwWZZgNWHhF7uDwR8jQtA7d0xTqMAxA%40mail.gmail.com.
