![]() ![]() ![]() ![]() In Java 1.1, getFont() reports all the 1.0 font names. The set provided with Sun's JDK 1.0 (with Netscape Navigator and Internet Explorer, on platforms other than the Macintosh) contains TimesRoman, Dialog, Helvetica, Courier (the only fixed-width font), DialogInput, and ZapfDingbat. Normally, these fonts will be understood on all the Java platforms. The getFontList() method returns a String array of the set Java fonts available with this Toolkit. There are an additional 8 bits for the alpha component, for pixel-level transparency. The default ColorModel is the standard RGB model, with 8 bits for each of red, green, and blue. The getColorModel() method returns the current ColorModel used by the system. Public abstract ColorModel getColorModel () ![]() This permits you to create a whole new widget set, outside of Java, while maintaining the standard AWT API. You are more than welcome to try to replace the one provided with the JDK. Since this is a static method, you don't need to have a Toolkit object to call it just call Toolkit.getDefaultToolkit().Ĭurrently, only one Toolkit can be associated with an environment. Most browsers don't let you change the system property awt.toolkit. On the Macintosh platform, this is overridden by the environment to be. On the Windows NT/95 platforms, this is overridden by the Java environment to be (Java1.0) or (Java1.1). The default Toolkit is identified by the System property awt.toolkit, which defaults to an instance of the class. The getDefaultToolkit() method returns the system's default Toolkit object. Public static synchronized Toolkit getDefaultToolkit () When the actual Toolkit is created for the native environment, the awt package is loaded, the AWT-Win32 and AWT-Callback-Win32 or AWT-Motif and AWT-Input threads (or the appropriate threads for your environment) are created, and the threads go into infinite loops for screen maintenance and event handling. To get a Toolkit object, ask for your environment's default toolkit by calling the static method getDefaultToolkit() or call Component.getToolkit() to get the toolkit of a component. Public Toolkit()-cannot be called by userīecause Toolkit is an abstract class, it has no usable constructor. The other methods of Toolkit are called for you by the system. You might use the Toolkit object if you need to fetch an image in an application ( getImage()), get the font information provided with the Toolkit ( getFontList() or getFontMetrics()), get the color model ( getColorModel()), get the screen metrics ( getScreenResolution() or getScreenSize()), get the system clipboard ( getSystemClipboard()), get a print job ( getPrintJob()), or ring the bell ( beep()). When you need a Toolkit, you ask for it with the static method getDefaultToolkit() or the Component.getToolkit() method. Although the Toolkit is used frequently, both directly and behind the scenes, you would never create any of these objects directly. The Sun JDK provides a Toolkit for Windows NT/95 ( or ), Solaris/Motif ( ), and Macintosh ( ). Every platform that supports Java must provide a concrete class that extends the Toolkit class. The Toolkit object is an abstract class that provides an interface to platform-specific details like window size, available fonts, and printing. Unless you are porting Java to another platform, creating your own Toolkit, or adding any native component, you can ignore the peer interfaces. The most important advice I can give you about the peer interfaces is not to worry about them. It also describes the package of interfaces, along with how they fit in with the general scheme of things. This chapter describes the Toolkit class and the purposes it serves. ![]()
0 Comments
Leave a Reply. |