public void tweet() { String textAreaText = textArea.getText(); String textFieldText = textField.getText(); Thread t = new Thread( new Runnable() { @Override public void run() { StatusUpdate status; if (backgroundImagePath != null) { String path; if (!is16_9 && convert.isSelected()) path = getConverted16_9ImagePath(); else path = backgroundImagePath; clear(); status = new StatusUpdate(textAreaText + " " + textFieldText); status.media(new File(path)); } else { clear(); status = new StatusUpdate(textAreaText + " " + textFieldText); } try { twitter.updateStatus(status); } catch (TwitterException e) { JOptionPane.showMessageDialog(Captter.this, "ツイートできませんでした"); return; } } public void clear() { textArea.setText(""); textArea.requestFocus(); imageField.setText(""); imageField.setIcon(null); backgroundImagePath = null; backgroundImageName = null; } }); t.start(); }