Client-Side Development Section Index | Page 87
The key to solving this problem is to subclass TextArea and intercept any KeyEvent sent. You need to check to see if the typed key is a lower case character (be careful to keep this independent ...more
To ensure a specific row (or cell) is visible, you need to get the rectangle surrounding a specific row/column (cell) than make sure that is visible: Rectangle rect = table.getCellRect(row, c...more
The answer depends on the model you're using... If you've called setModel() for the JTable in question, you must examine the class of the actual model you're using to see how (and if) it allows r...more
There are two "types" of font names you can deal with in Java Logical Font Names System Font Names Logical font names are the names Java uses for platform independence. These are na...more
As long as you don't need the window manager adornments, you can use the RepaintManager to capture the image on any Swing component: RepaintManager manager = RepaintManager.currentManager(compone...more
I'm using the Java Plug-in and need to modify the policy file. Why isn't the Plug-in picking up my changes?
The Plug-in reads the policy file and key store only once at startup. If you need to modify either, you need to shutdown and restart the browser.
// Convert urlString into a BufferedReader URL url = new URL(urlString); URLConnection connection = url.openConnection(); InputStream is = connection.getInputStream(); InputStreamReader isr = new...more
You can either call the setLookAndFeel() method of the UIManager class or set the swing.defaultlaf property of your Java program before it starts. If you wish to change the look and feel of a runn...more
The AWT Toolkit object provides information about the user's runtime platform. To find out what size in pixels the users's screen is, use the getScreenSize() method. import java.awt.*; public cla...more
For AWT programs, you need to compare the modifiers of the event to the button masks of the INPUT_EVENT. Left InputEvent.BUTTON1_MASK Middle InputE...more
While technically possible to use the Swing components in any Java 1.1-based browser, realistically is another story. The JAR file of Swing classes is approximately 2 MB, which would be required t...more
In short, get the applet's context and tell it to show a different document: getAppletContext().showDocument(new URL("http://foo.com/whatever/blah.doc")). You can also provide a target f...more
All graphical applications require at least 256 colors. Console-based programs like servlets or the compiler are not limited by this capability.
How can I download a file (for instance, a Microsoft Word document) from a server using a servlet and an applet?
Try telling the applet to call getAppletContext().showDocument("http://foo.com/whatever/blah.doc"). That makes the browser responsible for fetching and saving the document (including pu...more
This is basically the same as talking to any web page. Check out: http://www.jguru.com/jguru/faq/view.jsp?EID=157 and http://www.jguru.com/jguru/faq/view.jsp?EID=14163more