• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

I've lost my head?

 
Ranch Hand
Posts: 574
VI Editor Chrome Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 574
VI Editor Chrome Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 574
VI Editor Chrome Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Software environment?
 
Jim Venolia
Ranch Hand
Posts: 574
VI Editor Chrome Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Win 8.1, I run javac/java from the command line.
 
reply
    Bookmark Topic Watch Topic
  • New Topic