Drawing

Why don't my calls to paint() and paintComponent() work properly?

If you want to draw a barcode onto a Graphics2D canvas then you should use the draw() method. The paintX() methods are used internally by Swing and should not be called by your code (even though they are public).

I have a Graphics object, but barbecue requires a Graphics2D. How do I get one?

It is safe to cast from a Graphics object directly to a Graphics2D.

I'm trying to print a barcode using a PrintJob from the default Toolkit, but I cannot cast the returned WPrintGraphicsWrapper to a Graphics2D. What should I do instead?

You should use the PrinterJob class instead. This will return a castable Graphics object.

When I try and generate a barcode on Solaris (or other unix variants inc. Linux) I get an InternalError about the X11 display not being available on 0:0. What is wrong?

There is a known issue with the Java runtime where a display is assumed to be present when accessing the graphics environment. More information is available at http://developer.java.sun.com/developer/bugParade/bugs/4281163.html, but the most common workaround is to run an X11 process purely to satisfy the needs of the JVM, even if the machine is headless.

When I try and generate a barcode I get a HeadlessException/UnsupportedOperationException. What is going wrong?

The machine generating the barcode is in Headless mode. The barcode servlet should automatically assume this mode, but you can force barbecue to do this at any time by calling EnvironmentFactory.setHeadlessMode() in your code. Alternatively, try explicitly setting the resolution on the barcode.

Getting Help

How do I get help? How can I get the fastest response?

If you want help with using Barbecue then post a question in the Help discussion forum on the SourceForge pages. Please look first to see if anyone else has already had the same problem and how it was fixed.
If you think you have found a bug, then check to see if there is an existing bug in the bug tracker and see if it is already fixed in the latest version of barbecue. If you have a new bug then please add it to the bug tracker on the SourceForge pages.

When adding bugs or asking for help, please, please, please include the following information:

  • The version of barbecue that you are using
  • The data that you are trying to encode
  • The barcode type that you are using
  • Whether you are using barbcue via the servlet, as a Swing component or an SVG generator
  • All other parameters that you are setting explicitly on the barcode or the servlet
  • All details of any error messages or exceptions that you have
If you do not provide this information then your help request or bug will be probably be rejected.

Why has my bug been rejected?

See the question above about getting help. The most likely explanation is that your bug report did not include enough information to diagnose/reproduce the bug.

Why has my help request been ignored?

See the question above about getting help. The most likely explanation is that your help request did not include enough information to diagnose/reproduce the problem that you are having.

Why is there no support for Barbecue?

It's an open source product. Limited support is provided from the user community and from the kindness of my heart. If you want professional technical support then I advise you to purchase one of the commercial alternatives to Barbecue. Or donate to the project.

I posted a help message asking for a new feature. Why hasn't it been implemented yet?

New features are added according to the development roadmap published on the web site. If you would like a feature added then the fastest way to get it done is to write the code yourself and submit a patch. The only alternative is to wait for the Barbecue release that will contain the feature that you want. Note that the roadmap evolves over time and new features are prioritised based on demand. Also note that a "zero-defect" policy is in effect on Barbecue development - this means that new features are deliberately delayed in favour of bug fixes.