• Post Reply Bookmark Topic Watch Topic
  • New Topic

I've lost my head?  RSS feed

 
Jim Venolia
Ranch Hand
Posts: 248
2
Chrome Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm calling createImage(x, y) to create a canvas to draw on. Works fine. Decided to add a UI to my little program. So I made a JFrame, put my JPanel with my image in it, and added the UI. Now createImage() returns null, digging shows isHeadless() is returning true.

So, uh, wot's the deal?

And do I have the right basic idea? Make a new container (JFrame), put the working JPanel into it, and add the UI as well? Or should I be doing something else?

While I'm at it, what's the difference between createImage() and createVolatileImage()? Quality google time indicates the latter is a newer version of the former, but I found nothing to either confirm or deny that guess.

How about a little bit of code. RunGUI is the class that does display related stuff, it runs in it's own thread. 'game' is the JPanel that used to work on it's own.


Feel free to critique this stuff, I'm a Java n00b. FUDGEX and FUDGEY tell me I'm doing something wrong.

/ I know what headless means
// 90% of what I write in the real world are for headless systems.
/// It's why I suck at UIs, I never have to write them.
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jim Venolia wrote:I know what headless means


It means that you can't have a GUI, doesn't it? At least that's what I always thought it meant. What's this headless environment you're trying to run your code in?
 
Jim Venolia
Ranch Hand
Posts: 248
2
Chrome Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Headless" generally means you don't have a keyboard, display, or mouse. You can hook a keyboard/mouse up via RS-232/USB/Ethernet/whatever, but that's for debugging.

My environment is not headless, it's a laptop. That's the problem.
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Headless" is an attribute of the software you're running, not the hardware. Mostly the operating system -- which is what, in your case?
 
Jim Venolia
Ranch Hand
Posts: 248
2
Chrome Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Win 8.1. Program ran fine 24 hours ago on the same hardware, I modified it to add a GUI, now it says I have no display/mouse/keyboard.
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Software environment?
 
Jim Venolia
Ranch Hand
Posts: 248
2
Chrome Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Win 8.1, I run javac/java from the command line.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!