atlas-java v0.0.0
Java version of the Atlas toolkit
A fast and easy way to add a graphical user interface to your Java programs.
With the Atlas toolkit, you obtain hybrid programs. Like desktop applications, the same code can handle both front and back ends, and, like web applications, the programs will be reachable from all over the internet.
Hello, World!
Here's how a Hello, World! type program made with the Atlas toolkit looks like:
git clone http://github.com/epeios-q37/atlas-java
cd atlas-java/Hello
- Windows:
java -cp .;../Atlas.jar Hello
- other platforms:
java -cp .:../Atlas.jar Hello
For a live demonstration: http://q37.info/runkit/Hello.
Source code:
import info.q37.atlas.*;
class Hello extends Atlas {
private static String body =
"<div style=\"display: table; margin: 50px auto auto auto;\">" +
" <fieldset>" +
" <input id=\"input\" maxlength=\"20\" placeholder=\"Enter a name here\"'" +
" type=\"text\" data-xdh-onevent=\"Submit\"/>" +
" <div style=\"display: flex; justify-content: space-around; margin: 5px auto auto auto;\">" +
" <button data-xdh-onevent=\"Submit\">Submit</button>" +
" <button data-xdh-onevent=\"Clear\">Clear</button>" +
" </div>" +
" </fieldset>" +
"</div>";
@Override
public void handle(String action, String id)
{
switch( action) {
case "": // Action label corresponding to a new session.
dom.setLayout("", body);
break;
case "Submit":
dom.alert("Hello, " + dom.getContent("input") + "!" );
break;
case "Clear":
if ( dom.confirm("Are you sure ?") )
dom.setContent("input", "");
break;
}
dom.focus("input");
}
public static void main(String[] args) throws Exception {
launch(() -> new Hello());
}
}
TodoMVC
And here's how the Atlas toolkit version of the TodoMVC application looks like:
For a live demonstration: http://q37.info/runkit/TodoMVC.
Content of the repository
The Atlas
directory contains the Java source code of the Atlas toolkit, which is not needed to run the examples.
Atlas.jar
is the file you have to reference in the classpath in order to use the Atlas toolkit in your own program.
All other directories are examples.
To run an example, go inside its directory (Blank
, Chatroom
…) and launch:
- under Windows :
java -cp .;../Atlas.jar <Name>
(with semi-colon as classpath separator), - under other platforms :
java -cp .:../Atlas.jar <Name>
(with colon as classpath separator).
where <Name>
is the name of the example (Blank
, Chatroom
…).
The Atlas toolkit is also available for:
- Node.js: http://github.com/epeios-q37/atlas-node
- Perl: http://github.com/epeios-q37/atlas-perl
- PHP: http://github.com/epeios-q37/atlas-php
- Python: http://github.com/epeios-q37/atlas-python
- Ruby: http://github.com/epeios-q37/atlas-ruby
For more information about the Atlas toolkit: http://atlastk.org/.
7 years ago