LoginSignup
0
0

More than 5 years have passed since last update.

jsonを取得、表示するアプリケーション その2

Posted at

入力されたテキストをURLに変換してGETメソッドでデータを取得する
あとなんとなくLook&FeelをNimbusにする

この段階ではPOSTメソッドでデータを取得することはできない

json_client.groovy
import groovy.swing.SwingBuilder
import javax.swing.*
import java.awt.*

def txtUrl
def txtJson

new SwingBuilder().frame(title:'', defaultCloseOperation:JFrame.EXIT_ON_CLOSE, size: [800, 600], show:true) {
    lookAndFeel('nimbus')
    borderLayout()
    hbox(constraints: BorderLayout.NORTH) {
        txtUrl = textField()
        button(text:'送信', actionPerformed:{txtJson.text = txtUrl.text.toURL().text })
    }
    scrollPane(constraints: BorderLayout.CENTER) {
        txtJson = textArea(editable:false)
    }
}

qiita-002.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0