If your exploring Java target, other interesting aspects is you can have
several swing application windows, and you can use a BorderLayout or
similar to arrange panels on the screen. Using Canvas one of the panels
can be an OpenGL context it's often common to use swing/awt with
creation of images for the OpenGL for instance can be used for font.
Here is the sort of approach to getting a gl context in a panel.
panel = new JPanel();
panel.setLayout(new BorderLayout());
canvas = new Canvas();
try{
Display.setParent(canvas);
Display.setDisplayMode(new DisplayMode(640, 480));
} catch ( e: LWJGLException ) {
e.printStackTrace();
Display.destroy();
Sys.exit(1);
}
panel.add( canvas, BorderLayout.CENTER );
panel.setVisible(true);
You need to do a first render of your screen to get layout of elements
etc working then you can start the gl stuff so call the paint on the Jpanel.
Then
try {
Display.create();
Display.setResizable(false);
} catch ( e: LWJGLException ) {
e.printStackTrace();
Display.destroy();
Sys.exit(1);
}
Then go on to setup your Gl11 stuff as usual and then the while loop so
you need to do stuff in the right order to get layouts to work properly
it's quite easy to not see the OpenGL window if you get this wrong.
Other stuff on the Java target that is interesting is you can just use
an editor some snipits of code to give you some ideas
import javax.swing.text.rtf.RTFEditorKit;
import javax.swing.text.html.HTMLEditorKit;
enum FileTypes {
html;
rtf;
}
public inline function getFileType( fileIn: String ): FileTypes {
return Type.createEnum( FileTypes, fileIn.split(".")[1] );
}
editor = new JEditorPane();
editor.setBackground(Color.white);
var scroller = new JScrollPane();
scroller.getViewport().add( editor );
panel.add( scroller, BorderLayout.PAGE_START );
public function loadFile( fileIn ) {
var fileType = getFileType( fileIn );
switch( fileType ){
case rtf:
var rtf = new RTFEditorKit();
editor.setEditorKit(rtf);
try{
var fi = new FileInputStream( fileIn );
rtf.read(fi, editor.getDocument(), 0);
}catch( e: Dynamic ){}
case html:
var kitHtml = new HTMLEditorKit();
editor.setEditorKit(kitHtml);
try{
var fi = new FileInputStream( fileIn );
editor.setContentType("text/html");
editor.setEditable(false);
kitHtml.read(fi, editor.getDocument(), 0);
}catch( e: Dynamic ){}
}
}
Sorry I do have some working code for both of these but needs tidying up
and maybe the info is a bit vague to be useful.