HomeDigital EditionSys-Con RadioSearch Java Cd
Advanced Java AWT Book Reviews/Excerpts Client Server Corba Editorials Embedded Java Enterprise Java IDE's Industry Watch Integration Interviews Java Applet Java & Databases Java & Web Services Java Fundamentals Java Native Interface Java Servlets Java Beans J2ME Libraries .NET Object Orientation Observations/IMHO Product Reviews Scalability & Performance Security Server Side Source Code Straight Talking Swing Threads Using Java with others Wireless XML
 

"Self-Contained Client Applets Using Swing"
Vol 5 Issue 6, p.116

	

Listing 1 

JFrame menuFrame = new JFrame("MONITOR MENU"); 
NotifyMenu mainMenu = new NotifyMenu(); 
JPanel pPanel = new JPanel(); 
JLabel lLabel = new JLabel("MONITOR MENU"); 
Font lFont = new Font("Serif",Font.BOLD|Font.ITALIC,24); 
lLabel.setFont(lFont); 
lLabel.setForeground(Color.white); 
pPanel.setBackground(Color.blue); 
pPanel.add(lLabel); 
menuFrame.setJMenuBar(mainMenu.getMenuBar()); 
menuFrame.getContentPane().add(pp); 
menuFrame.pack(); 
menuFrame.show();
 
Listing 2 

class ARenderer extends JLabel implements ListCellRenderer   { 
  static Font f = new Font("Helvetica",Font.BOLD,10); 
  static SoftBevelBorder sbb = new SoftBevelBorder(Soft- 
  BevelBorder.RAISED); 
  static CompoundBorder cb = new CompoundBorder(new Matte- 
  Border(2,2,2,2, 
  Color.green),new SoftBevelBorder(SoftBevelBorder.RAISED)); 

public ARenderer()  { 
  setOpaque(true); 
  setFont(f); 
  setForeground(Color.black); 
} 
public Component getListCellRendererComponent(JList l, 
  Object v, int i, boolean isSelected, boolean cellHasFocus)  { 
  LocalEvent a = (LocalEvent)v; 
  setToolTipText(a.description); 
  setText(a.symbol); 
  if (a.severity == 0) { 
    setBackground(Color.gray); 
  } else if (a.severity == 1) { 
    setBackground(Color.cyan); 
  } else { 
    setBackground(Color.white); 
} 
} 
// additional customization codeŠ 
return this; 
} 
} 




 

All Rights Reserved
Copyright ©  2004 SYS-CON Media, Inc.
  E-mail: [email protected]

Java and Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. SYS-CON Publications, Inc. is independent of Sun Microsystems, Inc.