Created
September 10, 2009 03:46
-
-
Save kellyrob99/184277 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jdesktop.swingx.JXTable | |
import javax.swing.* | |
@Grab(group='org.swinglabs', module='swingx', version='0.9.3') | |
@Grab(group='org.ccil.cowan.tagsoup', module='tagsoup', version='0.9.7') | |
def getHtml(url) { | |
def parser = new XmlParser(new org.ccil.cowan.tagsoup.Parser()) | |
parser.parse(url) | |
} | |
def data = [ ] | |
def my = groovy.swing.SwingBuilder.build { | |
frame = frame(title:'Groovy Grab Test', size:[800,500], show:true, pack:true, defaultCloseOperation: WindowConstants.DISPOSE_ON_CLOSE) { | |
actions(){ | |
action(name:'Fetch', id:'fetchAction') | |
{ | |
data.clear | |
getHtml(urlField.text).body.'**'[email protected]{ data << [url:it] } | |
frame.repaint() | |
} | |
} | |
boxLayout(axis: BoxLayout.Y_AXIS) | |
scrollPane() { | |
myTable = table(new JXTable(columnControlVisible:true)){ | |
tableModel(list:data){ | |
propertyColumn(header: 'URL', propertyName: 'url') | |
} | |
} | |
} | |
textField(id:'urlField') | |
button(fetchAction) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment