• 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

Bold?

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, does anyone know how to print bold text on a drawing window?

This is how i'm printing the text

Text hello = new Text ("Hello", 140, 275);
hello.drawOn(d);

cheers
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is a "drawing window"? Or more specifically, what is this Text class you are using? This is not from the standard library, so we won't be much help without knowing what methods are available with this class. Also what is d? Can you please post the declaration for this variable?

Layne
[ December 13, 2005: Message edited by: Layne Lund ]
 
Graham Robinson
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you would import DrawingWindow. Pretty standard as far as i know.

// construct a drawing window object
DrawingWindow d = new DrawingWindow(290, 400);
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are a student at the Robert Gordon University at Aberdeen, yes? And perhaps you're using the book "Java Elements: Elements of Java for the Principled Programmer" as a text? This "DrawingWindow" of which you speak is part of the "elements" package distributed with that book; it's intended to allow you to do some drawing without actually learning the standard Java APIs (an educational philosphy with which I can't personally say I agree.) From the book:


Java is, at best, a difficult language to learn if one must dive head first. The package used with this text, the element package is responsible for insulating students from the difficulites of using the AWT (Abstract Windowing Toolkit) from day one. Still, the design of the package is such that students who learn Java by using the package will not be left high-and-dry once they must turn to direct use of the AWT.

The element package provides several items:

1. A class that supports a window for generic drawing.
2. A class that supports, in a consistent manner, a window for performing input and output.
3. A heirarchy of classes that support graphics in a drawing window.

The latter feature is supported with a small set of graphics primitives, including Point, Line, Circle, Rect, and others. Each implements an interface, Drawable, which may be implemented by the programmer to extend the features and capabilities of the element package itself. For example, the text spends some time discussing the implementation of a class to draw Triangles and Squares.



In any case, here is some documentation for the elements package. If it's not in there, then you can't do it. Of course it's possible in the standard Java API, but as you're not using that, this knowledge is of no use to you.
 
Graham Robinson
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was just using this,

http://www-users.cs.york.ac.uk/~bernat/ptc/element/doc/element/DrawingWindow.html

ah, so they use the same book, no i don't have that book.
[ December 13, 2005: Message edited by: Graham Robinson ]
reply
    Bookmark Topic Watch Topic
  • New Topic