home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / Share / Java / JDesignerPro / Jdp3_0.exe / data1.cab / Program_Files / JDPChoice.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-04-09  |  4.4 KB  |  246 lines

  1. import java.awt.BorderLayout;
  2. import java.awt.Color;
  3. import java.awt.Component;
  4. import java.awt.Container;
  5. import java.awt.Dimension;
  6. import java.awt.Event;
  7. import java.awt.Font;
  8. import java.awt.Panel;
  9.  
  10. public class JDPChoice extends Panel {
  11.    JDPComboBox thisChoice;
  12.    Font currentFont;
  13.    Color fgColor;
  14.    Color bgColor;
  15.  
  16.    public String getSelectedItem() {
  17.       return this.thisChoice.getSelectedItem();
  18.    }
  19.  
  20.    public int countItems() {
  21.       return this.thisChoice.getItemCount();
  22.    }
  23.  
  24.    public void sortItems() {
  25.       if (this.thisChoice != null) {
  26.          this.thisChoice.sortItems();
  27.       }
  28.  
  29.    }
  30.  
  31.    public void select(int var1) {
  32.       this.thisChoice.select(var1);
  33.    }
  34.  
  35.    public void select(String var1) {
  36.       this.thisChoice.select(var1);
  37.    }
  38.  
  39.    public int getItemCount() {
  40.       return this.thisChoice.getItemCount();
  41.    }
  42.  
  43.    public void enable() {
  44.       this.thisChoice.enable();
  45.    }
  46.  
  47.    public void disable() {
  48.       this.thisChoice.disable();
  49.    }
  50.  
  51.    public void setMinimumHeight(int var1) {
  52.       this.thisChoice.setMinimumHeight(var1);
  53.    }
  54.  
  55.    public void selectKey(String var1) {
  56.       this.thisChoice.selectKey(var1);
  57.    }
  58.  
  59.    public String getItemForKey(String var1) {
  60.       return this.thisChoice.getItemForKey(var1);
  61.    }
  62.  
  63.    public Dimension preferredSize() {
  64.       return this.thisChoice.preferredSize();
  65.    }
  66.  
  67.    public int getMinimumHeight() {
  68.       return this.thisChoice.getMinimumHeight();
  69.    }
  70.  
  71.    public void setMaximumWidth(int var1) {
  72.       this.thisChoice.setMaximumWidth(var1);
  73.    }
  74.  
  75.    public int getMaximumWidth() {
  76.       return this.thisChoice.getMaximumWidth();
  77.    }
  78.  
  79.    public void remove(int var1) {
  80.       this.thisChoice.remove(var1);
  81.    }
  82.  
  83.    public void remove(String var1) {
  84.       this.thisChoice.remove(var1);
  85.    }
  86.  
  87.    public JDPChoice() {
  88.       ((Container)this).setLayout(new BorderLayout());
  89.       this.thisChoice = new JDPComboBox((JDPUser)null, "", 10);
  90.       this.thisChoice.setEditable(false);
  91.       ((Container)this).add("North", this.thisChoice);
  92.    }
  93.  
  94.    public JDPChoice(JDPUser var1) {
  95.       ((Container)this).setLayout(new BorderLayout());
  96.       this.thisChoice = new JDPComboBox(var1, "", 10);
  97.       this.thisChoice.setEditable(false);
  98.       ((Container)this).add("North", this.thisChoice);
  99.    }
  100.  
  101.    public void loadChoice(JDPUser var1, JDPJagg var2, String var3, String var4, String var5, String var6) {
  102.       this.thisChoice.loadChoice(var1, var2, var3, var4, var5, var6);
  103.       this.select(0);
  104.    }
  105.  
  106.    public void loadChoice(String[] var1, String[] var2) {
  107.       this.thisChoice.loadChoice(var1, var2);
  108.       this.select(0);
  109.    }
  110.  
  111.    public void layoutChoice() {
  112.       if (((Component)this).getParent() != null) {
  113.          ((Component)this).getParent().layout();
  114.          ((Component)this).getParent().paintAll(((Component)this).getParent().getGraphics());
  115.       } else {
  116.          ((Container)this).layout();
  117.          ((Component)this).paintAll(((Component)this).getGraphics());
  118.       }
  119.    }
  120.  
  121.    public void setBackground(Color var1) {
  122.       this.bgColor = var1;
  123.       this.thisChoice.setBackground(var1);
  124.    }
  125.  
  126.    public Color getBackground() {
  127.       if (this.bgColor != null) {
  128.          return this.bgColor;
  129.       } else {
  130.          Container var1 = ((Component)this).getParent();
  131.          return var1 != null ? ((Component)var1).getBackground() : null;
  132.       }
  133.    }
  134.  
  135.    public String getItem(int var1) {
  136.       return this.thisChoice.getItem(var1);
  137.    }
  138.  
  139.    public int getItem(String var1) {
  140.       return this.thisChoice.getItem(var1);
  141.    }
  142.  
  143.    public Dimension minimumSize() {
  144.       return this.thisChoice.minimumSize();
  145.    }
  146.  
  147.    public String getItemKey(String var1) {
  148.       return this.thisChoice.getItemKey(var1);
  149.    }
  150.  
  151.    public void setFont(Font var1) {
  152.       this.currentFont = var1;
  153.       this.thisChoice.setFont(var1);
  154.    }
  155.  
  156.    public Font getFont() {
  157.       if (this.currentFont != null) {
  158.          return this.currentFont;
  159.       } else {
  160.          Container var1 = ((Component)this).getParent();
  161.          return var1 != null ? ((Component)var1).getFont() : null;
  162.       }
  163.    }
  164.  
  165.    public void addItem(String var1) {
  166.       this.thisChoice.addItem(var1);
  167.       if (this.getItemCount() == 1) {
  168.          this.select(0);
  169.       }
  170.  
  171.    }
  172.  
  173.    public void addItem(String var1, String var2) {
  174.       this.thisChoice.addItem(var1, var2);
  175.       if (this.getItemCount() == 1) {
  176.          this.select(0);
  177.       }
  178.  
  179.    }
  180.  
  181.    public void setMinimumWidth(int var1) {
  182.       this.thisChoice.setMinimumWidth(var1);
  183.    }
  184.  
  185.    public int getMinimumWidth() {
  186.       return this.thisChoice.getMinimumWidth();
  187.    }
  188.  
  189.    public int getSelectedIndex() {
  190.       return this.thisChoice.getSelectedIndex();
  191.    }
  192.  
  193.    public void setMaximumHeight(int var1) {
  194.       this.thisChoice.setMaximumHeight(var1);
  195.    }
  196.  
  197.    public void clear() {
  198.       this.thisChoice.clear();
  199.       this.thisChoice.setText("");
  200.    }
  201.  
  202.    public int getMaximumHeight() {
  203.       return this.thisChoice.getMaximumHeight();
  204.    }
  205.  
  206.    public String getSelectedKey() {
  207.       return this.thisChoice.getSelectedKey();
  208.    }
  209.  
  210.    public void setEnabled(boolean var1) {
  211.       this.thisChoice.setEnabled(var1);
  212.    }
  213.  
  214.    public boolean getEnabled() {
  215.       return this.thisChoice.getEnabled();
  216.    }
  217.  
  218.    public String[] getSelectedKeyValue() {
  219.       return this.thisChoice.getSelectedKeyValue();
  220.    }
  221.  
  222.    public void setForeground(Color var1) {
  223.       this.fgColor = var1;
  224.       this.thisChoice.setForeground(var1);
  225.    }
  226.  
  227.    public Color getForeground() {
  228.       if (this.fgColor != null) {
  229.          return this.fgColor;
  230.       } else {
  231.          Container var1 = ((Component)this).getParent();
  232.          return var1 != null ? ((Component)var1).getForeground() : null;
  233.       }
  234.    }
  235.  
  236.    public boolean handleEvent(Event var1) {
  237.       if (var1.target.equals(this.thisChoice)) {
  238.          Event var2 = new Event(this, var1.when, var1.id, var1.x, var1.y, var1.key, var1.modifiers);
  239.          ((Component)this).postEvent(var2);
  240.          return true;
  241.       } else {
  242.          return !var1.target.equals(this);
  243.       }
  244.    }
  245. }
  246.