AWT Section Index | Page 7
The Batik Toolkit from Apache lets you do this. See http://xml.apache.org/batik/.
Maybe this isn't the "cleanest" solution, but it works. Assuming you'll have an AWT component visible (a Frame for instance) and you're using JDK 1.3: Handle the component keyPressed ev...more
To keep a frame from being resized by the user, simply invoque its setResizable(boolean) method with a false argument. import java.awt.*; import java.awt.event.*; public class MyFrame extends Fr...more
Setting the cursor over a JApplet is no different than an Applet. Just change the parent class from the Applet cursor changing FAQ. import java.awt.*; import java.applet.*; import javax.swing.*; ...more
You can use java.awt.Component's setCursor(java.awt.Cursor) method. Create a (system-looking) cursor with the java.awt.Cursor constructor and class constants (DEFAULT_CURSOR, HAND_CURSOR, WAIT_CUR...more
If I want a user to modify the font.properties file for an applet to display a non-standard font, what do I need to tell the user to do so they modify the Java runtime that comes with the browser (no Plugin)?
For Netscape users, the font.properties file is located in the NetscapeCommunicatorProgramjavaclasses directory. For IE users, running clspack -auto will put all your Java classes into a classes.z...more
How can I add depth to my AWT components to allow components to overlap each other when needed like JLayeredPane in Swing components?
You were always able to overlap AWT components. (You just needed to click your heels...) You can manage the overlapped components on the basis of 'layers' by adapting the code from JLayeredPane. ...more
Not directly. If all the five components are present with non-zero widths and heights you can deduce that information based on the return value of getBounds() method on each of them (i.e. x, y, wi...more
Can I use wildcards(like *) inside Runtime.exec() to execute grep command? Because its not working with : Process pr=Runtime.getRuntime().exec("grep -l 'string' *");
For smooth curves, use antialiasing (see http://www.jguru.com/jguru/faq/view.jsp?EID=79646). If you're not sure about drawing curves, use the drawArc() method of the Graphics class (see http://jav...more
If one of those keys is a meta-key (shift, ctrl, or alt) then use the getModifiers() method to determine which one is pressed. For example, to check for Ctrl+A write: public void keyPressed(KeyE...more
Is it possible to identify the numeric pad enter key has been pressed without using native mechanisms?
No. Check out http://java.sun.com/products/jdk/1.2/docs/api/java/awt/event/KeyEvent.html for what is supported.more
It is not directly supported by the AWT library. You can use Swing's JComboBox (if you don't have a restriction on using Swing). In AWT, you can use a combination of a TextField, Button and a Lis...more
If your Polygon Class inherits from java.awt.Shape, you can use the intersects() method to determine if the polygon intersects the rectangle. Something like this: if (myPolygon.interesects(myRe...more