1

I am trying to create a screen like this one

enter image description here

Initially I was trying to port a console program to java. I have found things like jcurses and charva but there is almost no documentation on them and I really cant understand how to use them.

So I figured that I could create a console like screen that resembled the one above.

  1. what library / framwork would I be best using. Should I use swing as it if fully portable?

  2. what would be the best approach being that I need to be able to navigate and alter the 00 in the picture above?

Easily usable would be great but as long as it has good documentation that I can learn it from that would be fine.

Skeith
  • 2,512
  • 5
  • 35
  • 57

3 Answers3

1

(Answering as if you're looking for a hex editor.)

Played a bit with the fifesoft.com offering, kinda cool.

If you're not looking for a hex editor, can you be more specific? If you just want a cursor-addressable window you'll probably have to suck it up and figure out something like jcurses or libjcsi :)

Dave Newton
  • 158,873
  • 26
  • 254
  • 302
  • sorry I think I may have confused you. The program itself is a hex-editor for embedded software i just dont know how to display it. i have never done any visual work in java. – Skeith Oct 25 '11 at 10:14
  • @Skeith Still don't actually know what you want, but what I said still stands. If you don't care about jumping between bytes and just want to move a cursor around willy-nilly, just use a Swing or SWT editor component and a fixed-width font (if you want a fixed-width font, anyway). – Dave Newton Oct 25 '11 at 10:17
1

If you prefer to create a full fledged GUI with Java you could certainly use Swing. I would prefer SWT as a matter of personal taste, the widget library of Eclipse. You will find a lot of snippets and tutorials (same for Swing). Here is the Widget Library.

Here is a discussion about SWT versus Swing.

You could use the table layout manager to create the layout shown in your screenshot. If you rewrite the application from scretch, you should be able to handle the GUI events and update the widgets according to your application needs. You will easily find articles when you search for swt and table. If you would like to keep the code base and just exchange the GUI, I 'm not sure about the best approach. Maybe, the libs jcurses and charva are the way to go.

Community
  • 1
  • 1
remipod
  • 11,269
  • 1
  • 22
  • 25
1

Unless you are looking to run the app on a headless VM (where a console/tty is all you've got), I'd use Swing. Create a JTable with a custom TableModel (to provide the data) and custom renderers (to provide the hex formatting) and everything should just work. Consider deriving from the various DefaultXXX implementations to save a lot of work.

user268396
  • 11,576
  • 2
  • 31
  • 26
  • could you elaborate on the defaultXXX you mention ? – Skeith Oct 25 '11 at 11:06
  • Sure, see: http://download.oracle.com/javase/6/docs/api/javax/swing/table/DefaultTableCellRenderer.html and http://download.oracle.com/javase/1.4.2/docs/api/javax/swing/table/DefaultTableModel.html And for a JTable tutorial: http://download.oracle.com/javase/tutorial/uiswing/components/table.html – user268396 Oct 25 '11 at 11:43