Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
import groovy.swing.SwingBuilder
import static javax.swing.JFrame.EXIT_ON_CLOSE as EXIT
import static java.text.NumberFormat.getNumberInstance as numberFormat
import static java.text.DateFormat.getDateInstance as dateFormat
import static java.text.DateFormat.FULL
def locales = [
    new Locale("en", "US"), new Locale("ja","JP"), new Locale("iw","IL"),
    new Locale("hi","IN"), new Locale("th","TH","TH"), new Locale("de", "DE"),
    new Locale("es", "ES"), new Locale("zh", "CN"), new Locale("it", "IT") ]
def swing = new SwingBuilder()
int row = 0
def d = new Date()
def frame = swing.frame(title:'Frame', size:[300,300],
        defaultCloseOperation:EXIT) {
    tableLayout {
        locales.each { loc ->
            tr {
                deftd nf{ = label(numberFormat(loc)
                def df = dateFormat(FULL, loc)
                td { label(nf.format(++row)) }
                td { label(loc.toString()) }
                td { label(loc.getDisplayLanguage(loc)) }
                td { label(dfdateFormat(FULL, loc).format(new Date(d))) }
            }
        }
    }
}
frame.pack()
frame.show()

...