Some reader favorites:
EJB fundamentals and session beans
Create a scrollable virtual desktop in Swing
More action with Struts 2
In a recent review of Struts 2 in Action, JW Blogger Oleg Mikheev notes that Struts 2 is "just a collection of extensions built upon WebWork, which is ultimately
the right thing to learn before starting a Struts 2 project." While Struts 2 has some architectural flaws, Oleg calls WebWork
well-designed, well-tested, and reliable. What are your experiences using Struts 2 and WebWork?
Also see "Hello World the WebWork way," a JavaWorld excerpt from WebWork in Action, by Patrick Lightbody and Jason Carreira.
| Memory Analysis in Eclipse |
| Enterprise AJAX - Transcend the Hype |
How do you change the steaming coffee cup icon that appears in the top left-hand corner of applets and frames?
In order to change the icon image on a frame -- whether in an applet or an application -- you must first create an Image object. There is more than one way to do this, but here we'll use the ImageIcon object, since it has a simple constructor that takes a file name.
ImageIcon image = new ImageIcon("C:/images/your_image.gif");
One you have the ImageIcon, you call its getImage() method and pass it to your Frame's setIconImage() method.
Frame.setIconImage(image.getImage());
It's worth mentioning that, since Swing's JFrame class inherits from the AWT Frame class, the setIconImage() method is also available in JFrame. A complete JFrame example is included below:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class AppIconFrame extends JFrame {
public AppIconFrame() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
initFrame();
}
//Frame initialization
private void initFrame(){
this.setSize(new Dimension(400, 300));
this.setTitle("Custom Icon");
ImageIcon image = new ImageIcon("c:\yourpath\yourfile.gif");
this.setIconImage(image.getImage());
}
//Overridden so we can exit on System Close
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if(e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}
public static void main(String[] args){
AppIconFrame frame = new AppIconFrame();
frame.setVisible(true);
}
}