home *** CD-ROM | disk | FTP | other *** search
/ Borland JBuilder 6 / jbuilder6.iso / IBM VisualAge for Java Enterprise v4.0 Retail / ivj40 / setup / IDE.Cab / F77368_VAJavaStatusLineUI.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-04-25  |  2.2 KB  |  64 lines

  1. package com.ibm.ivb.jface.vajava;
  2.  
  3. import com.ibm.ivb.jface.parts.CellLayout;
  4. import com.ibm.ivb.jface.parts.StatusLine;
  5. import com.ibm.ivb.jface.plaf.StatusLineUI;
  6. import java.awt.Color;
  7. import java.awt.Component;
  8. import java.awt.Container;
  9. import java.awt.Dimension;
  10. import java.awt.Graphics;
  11. import java.util.Vector;
  12. import javax.swing.JComponent;
  13. import javax.swing.JLabel;
  14. import javax.swing.border.EmptyBorder;
  15. import javax.swing.plaf.ComponentUI;
  16.  
  17. public class VAJavaStatusLineUI extends StatusLineUI {
  18.    private static final String kCBIBMCopyright = "(c) Copyright IBM Corporation 1998";
  19.    JLabel message;
  20.    Color savedBg;
  21.  
  22.    public static ComponentUI createUI(JComponent var0) {
  23.       return new VAJavaStatusLineUI();
  24.    }
  25.  
  26.    public void installUI(JComponent var1) {
  27.       StatusLine var2 = (StatusLine)var1;
  28.       CellLayout var3 = new CellLayout(var2);
  29.       this.savedBg = ((Component)var2).getBackground();
  30.       ((JComponent)var2).setBackground(VAJavaLookAndFeel.getCommonBackground());
  31.       ((Container)var2).removeAll();
  32.       this.message = new JLabel("test line");
  33.       this.message.setBorder(new EmptyBorder(4, 5, 3, 5));
  34.       var3.setFill(1);
  35.       var3.setWeight(1, 1);
  36.       var3.addToCell(this.message, 0, 0);
  37.       Vector var4 = var2.getUserComponents();
  38.       if (var4 != null) {
  39.          var3.setFill(1);
  40.          var3.setWeight(0, 1);
  41.  
  42.          for(int var5 = 0; var5 < var4.size(); ++var5) {
  43.             var3.addToCell((Component)var4.elementAt(var5), var5 + 1, 0);
  44.          }
  45.       }
  46.  
  47.    }
  48.  
  49.    public void paint(Graphics var1, JComponent var2) {
  50.       Dimension var3 = ((Component)var2).getSize();
  51.       var1.setColor(((Component)var2).getBackground());
  52.       var1.fillRect(0, 0, var3.width, var3.height);
  53.    }
  54.  
  55.    public void uninstallUI(JComponent var1) {
  56.       StatusLine var2 = (StatusLine)var1;
  57.       ((JComponent)var2).setBackground(this.savedBg);
  58.    }
  59.  
  60.    public void updateMessage(StatusLine var1) {
  61.       this.message.setText(var1.getMessage());
  62.    }
  63. }
  64.