Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

21
LINES

< > BotCompany Repo | #1034990 // uploadImageFileDialog

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (15921L/99K).

1  
svoid uploadImageFileDialog(File imageFile) {
2  
  if (!isFile(imageFile)) ret;
3  
  
4  
  JTextField tf = jTextField();
5  
  showFormTitled("Upload Image",
6  
    "Image file", new JFilePathLabel(imageFile),
7  
    "Image title (optional)", focusOnShow(tf), func {
8  
      disableSubmitButton(getFrame(tf));
9  
      thread "Upload Image" {
10  
        try {
11  
          S url = uploadImage(imageFile, loadImage2(imageFile), getTextTrim(tf));
12  
          disposeFrame(tf);
13  
          messageBox("Image uploaded as " + url);
14  
        } catch e {
15  
          enableSubmitButton(getFrame(tf));
16  
          messageBox(e);
17  
        }
18  
      }
19  
      false;
20  
    });
21  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034990
Snippet name: uploadImageFileDialog
Eternal ID of this version: #1034990/7
Text MD5: 056540fa873e83048b919b76da9b0401
Transpilation MD5: a868e64ffcbaea8f98f030cd139c15c4
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-22 20:30:06
Source code size: 642 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 170 / 242
Version history: 6 change(s)
Referenced in: [show references]