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).

svoid uploadImageFileDialog(File imageFile) {
  if (!isFile(imageFile)) ret;
  
  JTextField tf = jTextField();
  showFormTitled("Upload Image",
    "Image file", new JFilePathLabel(imageFile),
    "Image title (optional)", focusOnShow(tf), func {
      disableSubmitButton(getFrame(tf));
      thread "Upload Image" {
        try {
          S url = uploadImage(imageFile, loadImage2(imageFile), getTextTrim(tf));
          disposeFrame(tf);
          messageBox("Image uploaded as " + url);
        } catch e {
          enableSubmitButton(getFrame(tf));
          messageBox(e);
        }
      }
      false;
    });
}

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: 99 / 143
Version history: 6 change(s)
Referenced in: [show references]