Saturday, March 14, 2015

Gradle: add source dirs vs replace source dirs

http://stackoverflow.com/questions/10570795/can-gradle-handle-builds-for-legacy-projects-without-having-to-restructure-direc?rq=1

Gradle uses convention over configuration which allows you to provide minimal information to build your project if you follow the standard project layout. That said everything is still configurable using a declarative style:
sourceSets {
main {
    java {
        srcDir 'src/java'
    }
    resources {
        srcDir 'src/resources'
    }
}
}
Because you have a real programming language you can do almost anything.


Note that this adds source directories rather than replacing them. The syntax for replacing is srcDirs = ['src/java'] and srcDirs = ['src/resources'].

Saturday, March 7, 2015

Autocomplete JTextField

http://stackabuse.com/article/example-code/example-adding-autocomplete-to-jtextfield

Autocomplete can be very useful in just about any application, but its not trivial to implement. So here is a quick example of how you might do it in Java's Swing framework with JTextField (it should also work with JTextArea with only a few modifications). This example is a modified version of Oracle's example.