Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4258988
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:43:23+00:00 2026-05-21T05:43:23+00:00

Greetings, I’m trying to get a JFrame drawing in a non screen device. The

  • 0

Greetings,

I’m trying to get a JFrame drawing in a non screen device. The JFrame constructor has a

 JFrame(GraphicsConfiguration) 

to seemingly allow this:

My First attempt was to create my own GraphicsConfiguration, who’s GraphicsDevice reported GraphicsDevice.TYPE_IMAGE_BUFFER when getType() was called.

However JFrame.init specifically looks for the type and throws an exception if the type isn’t TYPE_RASTER_SCREEN:

    if (graphicsConfig.getDevice().getType() !=
        GraphicsDevice.TYPE_RASTER_SCREEN) {
        throw new IllegalArgumentException("not a screen device");
    }

Next i tried to make the GraphicsDevice i returned report GraphicsDevice.TYPE_RASTER_SCREEN. This allowed the JFrame to be initialized correctly, but when it went to display it, I got

Exception in thread "main" java.lang.ClassCastException: TestGraphicsConfiguration cannot be cast to sun.awt.X11GraphicsConfig

So i’ve run out of ideas, on how to draw a JFrame that doesn’t show up on the screen, but is never the less fully layed out and functional.

Am going down a rabbit hole here, or can this be done?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T05:43:24+00:00Added an answer on May 21, 2026 at 5:43 am

    A Java top-level container such as JFrame requires access to a peer component native to the host platform, typically via JNI. Alternatively, you may be able to use a BufferedImage or java.awt.headless mode, as discussed here.

    Addendum:

    I wonder if “any human” can replace how peers are selected.

    I don’t know how to replace a particular peer component, but it’s possible to evoke platform-specific native components; Java Native Access (JNA) is one such avenue. As an extreme example, this 6502 JVM runs in 128K on an 8-bit processor running at 1 MHz. The demos, including source for the lower right screenshot, were compiled using javac.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Greetings, Can someone help me with this? I am trying to make a desktop
Greetings, I'm trying to find a way to 'unbind' a socket from a particular
Greetings, I'm trying to find either a free .NET library or a command-line executable
Greetings all, I'm trying to localize a .NET/C# project. I'm using string resource files
Greetings! I am trying to check directory write-permissions from within a Windows MFC/ATL program
Greetings, creating my first MVVM based WPF app and trying to figure out why
Greetings, this is my very first question and I just do programming as a
Greetings folks, The ASP.NET application I'm maintaining has a fairly long start up procedure.
Greetings all, I've been told by co-workers that the GET method is different in
Greetings, I am trying to code a solution for an order form pricing calculator

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.