Package net.xoetrope.samples.html

Source Code of net.xoetrope.samples.html.Sample

package net.xoetrope.samples.html;

import net.xoetrope.html.XApplet;
import net.xoetrope.html.XButton;
import net.xoetrope.html.XCheckbox;
import net.xoetrope.html.XComboBox;
import net.xoetrope.html.XEdit;
import net.xoetrope.html.XHtmlPage;
import net.xoetrope.html.XImage;
import net.xoetrope.html.XLabel;
import net.xoetrope.html.XList;
import net.xoetrope.html.XMessageBox;
import net.xoetrope.html.XPanel;
import net.xoetrope.html.XPassword;
import net.xoetrope.html.XRadioButton;
import net.xoetrope.html.XTable;
import net.xoetrope.html.XTextArea;
import netscape.javascript.JSObject;

/**
*
* @author Romain
*/
public class Sample extends XHtmlPage {
   
    /**
     * General components
     */
    protected JSObject obj = JSObject.getWindow( XApplet.getApplet() );
   
    /** Creates a new instance of Sample */
    public Sample() {
       
    }
   
    public void enable() {
        XCheckbox check1 = (XCheckbox)findComponent( obj, "check4" );
        XButton one = (XButton)findComponent( "one" );
        XButton two = (XButton)findComponent( "two" );
        XButton three = (XButton)findComponent( "three" );
        XRadioButton rad1 = (XRadioButton)findComponent( "radio1" );
        XRadioButton rad2 = (XRadioButton)findComponent( "radio2" );
        XRadioButton rad3 = (XRadioButton)findComponent( "radio3" );
        XRadioButton rad4 = (XRadioButton)findComponent( "radio4" );
        XRadioButton rad5 = (XRadioButton)findComponent( "radio5" );
        XRadioButton rad6 = (XRadioButton)findComponent( "radio6" );
        XLabel rad1_txt = (XLabel)findComponent( "radio1_txt" );
        XLabel rad2_txt = (XLabel)findComponent( "radio2_txt" );
        XLabel rad3_txt = (XLabel)findComponent( "radio3_txt" );
        XLabel rad4_txt = (XLabel)findComponent( "radio4_txt" );
        XLabel rad5_txt = (XLabel)findComponent( "radio5_txt" );
        XLabel rad6_txt = (XLabel)findComponent( "radio6_txt" );
        XLabel ch1_txt = (XLabel)findComponent( "check1_txt" );
        XLabel ch2_txt = (XLabel)findComponent( "check2_txt" );
        XLabel ch3_txt = (XLabel)findComponent( "check3_txt" );
        XCheckbox ch1 = (XCheckbox)findComponent( "check1" );
        XCheckbox ch2 = (XCheckbox)findComponent( "check2" );
        XCheckbox ch3 = (XCheckbox)findComponent( "check3" );
        if ( check1.isSelected() ) {
            one.setEnabled( false );
            two.setEnabled( false );
            three.setEnabled( false );
            rad1.setEnabled( false );
            rad2.setEnabled( false );
            rad3.setEnabled( false );
            rad4.setEnabled( false );
            rad5.setEnabled( false );
            rad6.setEnabled( false );
            ch1.setEnabled( false );
            ch2.setEnabled( false );
            ch3.setEnabled( false );
            rad1_txt.setFontColor( "#DDDDDD" );
            rad2_txt.setFontColor( "#DDDDDD" );
            rad3_txt.setFontColor( "#DDDDDD" );
            rad4_txt.setFontColor( "#DDDDDD" );
            rad5_txt.setFontColor( "#DDDDDD" );
            rad6_txt.setFontColor( "#DDDDDD" );
            ch1_txt.setFontColor( "#DDDDDD" );
            ch2_txt.setFontColor( "#DDDDDD" );
            ch3_txt.setFontColor( "#DDDDDD" );
        } else {
            one.setEnabled( true );
            two.setEnabled( true );
            three.setEnabled( true );
            rad1.setEnabled( true );
            rad2.setEnabled( true );
            rad3.setEnabled( true );
            rad4.setEnabled( true );
            rad5.setEnabled( true );
            rad6.setEnabled( true );
            ch1.setEnabled( true );
            ch2.setEnabled( true );
            ch3.setEnabled( true );
            rad1_txt.setFontColor( "" );
            rad2_txt.setFontColor( "" );
            rad3_txt.setFontColor( "" );
            rad4_txt.setFontColor( "" );
            rad5_txt.setFontColor( "" );
            rad6_txt.setFontColor( "" );
            ch1_txt.setFontColor( "" );
            ch2_txt.setFontColor( "" );
            ch3_txt.setFontColor( "" );
        }
    }
   
    public void enableEdit() {
        XCheckbox check1 = (XCheckbox)findComponent( obj, "check1" );
        XEdit edit1 = (XEdit)findComponent( "edit1" );
        XEdit edit2 = (XEdit)findComponent( "edit2" );
        XPassword pass = (XPassword)findComponent( "pass" );
        XTextArea text1 = (XTextArea)findComponent( "text1" );
        XTextArea text2 = (XTextArea)findComponent( "text2" );
        if ( check1.isSelected() ) {
            edit1.setEnabled( false );
            edit2.setEnabled( false );
            pass.setEnabled( false );
            text1.setEnabled( false );
            text2.setEnabled( false );
        } else {
            edit1.setEnabled( true );
            edit2.setEnabled( true );
            pass.setEnabled( true );
            text1.setEnabled( true );
            text2.setEnabled( true );
        }
    }
   
    public void enableCombo() {
        XCheckbox check1 = (XCheckbox)findComponent( obj, "check1" );
        XComboBox combo = (XComboBox)findComponent( "combo" );
        if ( check1.isSelected() ) {
            combo.setEnabled( false );
        } else {
            combo.setEnabled( true );
        }
    }
   
    public void visible() {
        XCheckbox check2 = (XCheckbox)findComponent( obj, "check5" );
        XButton one = (XButton)findComponent( "one" );
        XButton two = (XButton)findComponent( "two" );
        XButton three = (XButton)findComponent( "three" );
        XRadioButton rad1 = (XRadioButton)findComponent( "radio1" );
        XRadioButton rad2 = (XRadioButton)findComponent( "radio2" );
        XRadioButton rad3 = (XRadioButton)findComponent( "radio3" );
        XRadioButton rad4 = (XRadioButton)findComponent( "radio4" );
        XRadioButton rad5 = (XRadioButton)findComponent( "radio5" );
        XRadioButton rad6 = (XRadioButton)findComponent( "radio6" );
        XLabel rad1_txt = (XLabel)findComponent( "radio1_txt" );
        XLabel rad2_txt = (XLabel)findComponent( "radio2_txt" );
        XLabel rad3_txt = (XLabel)findComponent( "radio3_txt" );
        XLabel rad4_txt = (XLabel)findComponent( "radio4_txt" );
        XLabel rad5_txt = (XLabel)findComponent( "radio5_txt" );
        XLabel rad6_txt = (XLabel)findComponent( "radio6_txt" );
        XLabel ch1_txt = (XLabel)findComponent( "check1_txt" );
        XLabel ch2_txt = (XLabel)findComponent( "check2_txt" );
        XLabel ch3_txt = (XLabel)findComponent( "check3_txt" );
        XCheckbox ch1 = (XCheckbox)findComponent( "check1" );
        XCheckbox ch2 = (XCheckbox)findComponent( "check2" );
        XCheckbox ch3 = (XCheckbox)findComponent( "check3" );
        if ( check2.isSelected() ) {
            one.setVisible( false );
            two.setVisible( false );
            three.setVisible( false );
            rad1.setVisible( false );
            rad2.setVisible( false );
            rad3.setVisible( false );
            rad4.setVisible( false );
            rad5.setVisible( false );
            rad6.setVisible( false );
            ch1.setVisible( false );
            ch2.setVisible( false );
            ch3.setVisible( false );
            rad1_txt.setVisible( false );
            rad2_txt.setVisible( false );
            rad3_txt.setVisible( false );
            rad4_txt.setVisible( false );
            rad5_txt.setVisible( false );
            rad6_txt.setVisible( false );
            ch1_txt.setVisible( false );
            ch2_txt.setVisible( false );
            ch3_txt.setVisible( false );
        } else {
            one.setVisible( true );
            two.setVisible( true );
            three.setVisible( true );
            rad1.setVisible( true );
            rad2.setVisible( true );
            rad3.setVisible( true );
            rad4.setVisible( true );
            rad5.setVisible( true );
            rad6.setVisible( true );
            ch1.setVisible( true );
            ch2.setVisible( true );
            ch3.setVisible( true );
            rad1_txt.setVisible( true );
            rad2_txt.setVisible( true );
            rad3_txt.setVisible( true );
            rad4_txt.setVisible( true );
            rad5_txt.setVisible( true );
            rad6_txt.setVisible( true );
            ch1_txt.setVisible( true );
            ch2_txt.setVisible( true );
            ch3_txt.setVisible( true );
        }
    }
   
    public void visibleEdit() {
        XCheckbox check2 = (XCheckbox)findComponent( obj, "check2" );
        XEdit edit1 = (XEdit)findComponent( "edit1" );
        XEdit edit2 = (XEdit)findComponent( "edit2" );
        XPassword pass = (XPassword)findComponent( "pass" );
        XTextArea text1 = (XTextArea)findComponent( "text1" );
        XTextArea text2 = (XTextArea)findComponent( "text2" );
        if ( check2.isSelected() ) {
            edit1.setVisible( false );
            edit2.setVisible( false );
            pass.setVisible( false );
            text1.setVisible( false );
            text2.setVisible( false );
        } else {
            edit1.setVisible( true );
            edit2.setVisible( true );
            pass.setVisible( true );
            text1.setVisible( true );
            text2.setVisible( true );
        }
    }
   
    public void visibleCombo() {
        XCheckbox check2 = (XCheckbox)findComponent( obj, "check2" );
        XComboBox combo = (XComboBox)findComponent( "combo" );
        if ( check2.isSelected() ) {
            combo.setVisible( false );
        } else {
            combo.setVisible( true );
        }
    }
   
    public void visibleList() {
        XCheckbox check1 = (XCheckbox)findComponent( obj, "check1" );
        XList ordered = (XList)findComponent( "ordered" );
        XList unordered = (XList)findComponent( "unordered" );
        if ( check1.isSelected() ) {
            ordered.oSetVisible( false );
            unordered.uSetVisible( false );
        } else {
            ordered.oSetVisible( true );
            unordered.uSetVisible( true );
        }
    }
   
    public void visibleOther() {
        XCheckbox check1 = (XCheckbox)findComponent( obj, "check1" );
        XLabel lab1 = (XLabel)findComponent( "lab1" );
        XLabel lab2 = (XLabel)findComponent( "lab2" );
        XTable table = (XTable)findComponent( "table" );
        XImage img = (XImage)findComponent( "img" );
        if ( check1.isSelected() ) {
            lab1.setVisible( false );
            lab2.setVisible( false );
            table.setVisible( false );
            img.setVisible( false );
        } else {
            lab1.setVisible( true );
            lab2.setVisible( true );
            table.setVisible( true );
            img.setVisible( true );
        }
    }
   
    public void visiblePanel() {
        XCheckbox check1 = (XCheckbox)findComponent( obj, "check1" );
        XPanel panel = (XPanel)findComponent( "panel" );
        if ( check1.isSelected() ) {
            panel.setVisible( false );
        } else {
            panel.setVisible( true );
        }
    }
   
    public void changeColor() {
        XCheckbox check3 = (XCheckbox)findComponent( obj, "check6" );
        XButton one = (XButton)findComponent( "one" );
        XButton two = (XButton)findComponent( "two" );
        XButton three = (XButton)findComponent( "three" );
        if ( check3.isSelected() ) {
            one.setBackgroundColor( "#FF3333" );
            two.setBackgroundColor( "#FF3333" );
            three.setBackgroundColor( "#FF3333" );
        } else {
            one.setBackgroundColor( "" );
            two.setBackgroundColor( "" );
            three.setBackgroundColor( "" );
        }
    }
   
    public void changeColorEdit() {
        XCheckbox check3 = (XCheckbox)findComponent( obj, "check3" );
        XEdit edit1 = (XEdit)findComponent( "edit1" );
        XEdit edit2 = (XEdit)findComponent( "edit2" );
        XPassword pass = (XPassword)findComponent( "pass" );
        XTextArea text1 = (XTextArea)findComponent( "text1" );
        XTextArea text2 = (XTextArea)findComponent( "text2" );
        if ( check3.isSelected() ) {
            edit1.setBackgroundColor( "#FF3333" );
            edit2.setBackgroundColor( "#FF3333" );
            pass.setBackgroundColor( "#FF3333" );
            text1.setBackgroundColor( "#FF3333" );
            text2.setBackgroundColor( "#FF3333" );
        } else {
            edit1.setBackgroundColor( "" );
            edit2.setBackgroundColor( "" );
            pass.setBackgroundColor( "" );
            text1.setBackgroundColor( "" );
            text2.setBackgroundColor( "" );
        }
    }
   
    public void changeColorCombo() {
        XCheckbox check3 = (XCheckbox)findComponent( obj, "check3" );
        XComboBox combo = (XComboBox)findComponent( "combo" );
        if ( check3.isSelected() ) {
            combo.setBackgroundColor( "#FF3333" );
        } else {
            combo.setBackgroundColor( "" );
        }
    }
   
    public void changeColorPanel() {
        XCheckbox check2 = (XCheckbox)findComponent( obj, "check2" );
        XPanel panel = (XPanel)findComponent( "panel" );
        if ( check2.isSelected() ) {
            panel.setBackgroundColor( "#FF3333" );
        } else {
            panel.setBackgroundColor( "" );
        }
    }
   
    public void changeCellColor() {
        XCheckbox check3 = (XCheckbox)findComponent( obj, "check3" );
        XTable table = (XTable)findComponent( "table" );
        if ( check3.isSelected() ) {
            table.setBackgroundColorAt( 1, 3, "#FF3333" );
            table.setBackgroundColorAt( 2, 2, "#FFCCAA" );
            table.setBackgroundColorAt( 2, 5, "#ABCDEF" );
            table.setBackgroundColorAt( 3, 1, "#FEDCBA" );
        } else {
            table.setBackgroundColorAt( 1, 3, "" );
            table.setBackgroundColorAt( 2, 2, "" );
            table.setBackgroundColorAt( 2, 5, "" );
            table.setBackgroundColorAt( 3, 1, "" );
        }
    }
   
    public void changeFontColorEdit() {
        XCheckbox check4 = (XCheckbox)findComponent( obj, "check4" );
        XEdit edit1 = (XEdit)findComponent( "edit1" );
        XEdit edit2 = (XEdit)findComponent( "edit2" );
        XPassword pass = (XPassword)findComponent( "pass" );
        XTextArea text1 = (XTextArea)findComponent( "text1" );
        XTextArea text2 = (XTextArea)findComponent( "text2" );
        if ( check4.isSelected() ) {
            edit1.setFontColor( "#CCEEEE" );
            edit2.setFontColor( "#CCEEEE" );
            pass.setFontColor( "#CCEEEE" );
            text1.setFontColor( "#CCEEEE" );
            text2.setFontColor( "#CCEEEE" );
        } else {
            edit1.setFontColor( "" );
            edit2.setFontColor( "" );
            pass.setFontColor( "" );
            text1.setFontColor( "" );
            text2.setFontColor( "" );
        }
    }
   
    public void changeFontColorCombo() {
        XCheckbox check4 = (XCheckbox)findComponent( obj, "check4" );
        XComboBox combo = (XComboBox)findComponent( "combo" );
        if ( check4.isSelected() ) {
            combo.setFontColor( "#CCEEEE" );
        } else {
            combo.setFontColor( "" );
        }
    }
   
    public void changeFontColorList() {
        XCheckbox check2 = (XCheckbox)findComponent( obj, "check2" );
        XList ordered = (XList)findComponent( "ordered" );
        XList unordered = (XList)findComponent( "unordered" );
        if ( check2.isSelected() ) {
            ordered.oSetFontColor( "#FF3333" );
            unordered.uSetFontColor( "#FF3333" );
        } else {
            ordered.oSetFontColor( "" );
            unordered.uSetFontColor( "" );
        }
    }
   
    public void changeFontColorPanel() {
        XCheckbox check3 = (XCheckbox)findComponent( obj, "check3" );
        XPanel panel = (XPanel)findComponent( "panel" );
        if ( check3.isSelected() ) {
            panel.setFontColor( "#CCEEEE" );
        } else {
            panel.setFontColor( "" );
        }
    }
   
    public void changeFontColorOther() {
        XCheckbox check2 = (XCheckbox)findComponent( obj, "check2" );
        XLabel lab1 = (XLabel)findComponent( "lab1" );
        XLabel lab2 = (XLabel)findComponent( "lab2" );
        XTable table = (XTable)findComponent( "table" );
        if ( check2.isSelected() ) {
            lab1.setFontColor( "#FF3333" );
            lab2.setFontColor( "#FF3333" );
            table.setFontColor( "#CCEEEE" );
        } else {
            lab1.setFontColor( "" );
            lab2.setFontColor( "" );
            table.setFontColor( "" );
        }
    }
   
    public void changeStartNumber() {
        XCheckbox check3 = (XCheckbox)findComponent( obj, "check3" );
        XList ordered = (XList)findComponent( "ordered" );
        if ( check3.isSelected() ) {
            ordered.oSetStartPoint( 4 );
        } else {
            ordered.oSetStartPoint( 1 );
        }
    }
   
    public void changeNumberType() {
        XCheckbox check4 = (XCheckbox)findComponent( obj, "check4" );
        XList ordered = (XList)findComponent( "ordered" );
        if ( check4.isSelected() ) {
            ordered.oSetNumberType( "i" );
        } else {
            ordered.oSetNumberType( "1" );
        }
    }
   
    public void changeBulletType() {
        XCheckbox check5 = (XCheckbox)findComponent( obj, "check5" );
        XList unordered = (XList)findComponent( "unordered" );
        if ( check5.isSelected() ) {
            unordered.uSetBulletType( "square" );
        } else {
            unordered.uSetBulletType( "disc" );
        }
    }
   
    public void changeImage() {
        XCheckbox check4 = (XCheckbox)findComponent( obj, "check4" );       
        XImage img = (XImage)findComponent( "img" );
        if ( check4.isSelected() ) {
            img.setImageSrc( "../images/win.jpg" );
        } else {
            img.setImageSrc( "../images/tux.jpg" );
        }
    }
   
    public void font10() {
        XRadioButton radio1 = (XRadioButton)findComponent( obj, "radio7" );
        XButton one = (XButton)findComponent( "one" );
        XButton two = (XButton)findComponent( "two" );
        XButton three = (XButton)findComponent( "three" );
        XLabel rad1_txt = (XLabel)findComponent( "radio1_txt" );
        XLabel rad2_txt = (XLabel)findComponent( "radio2_txt" );
        XLabel rad3_txt = (XLabel)findComponent( "radio3_txt" );
        XLabel rad4_txt = (XLabel)findComponent( "radio4_txt" );
        XLabel rad5_txt = (XLabel)findComponent( "radio5_txt" );
        XLabel rad6_txt = (XLabel)findComponent( "radio6_txt" );
        XLabel ch1_txt = (XLabel)findComponent( "check1_txt" );
        XLabel ch2_txt = (XLabel)findComponent( "check2_txt" );
        XLabel ch3_txt = (XLabel)findComponent( "check3_txt" );
        if ( radio1.isSelected() ) {
            one.setFontSize( 10 );
            two.setFontSize( 10 );
            three.setFontSize( 10 );
            rad1_txt.setFontSize( 10 );
            rad2_txt.setFontSize( 10 );
            rad3_txt.setFontSize( 10 );
            rad4_txt.setFontSize( 10 );
            rad5_txt.setFontSize( 10 );
            rad6_txt.setFontSize( 10 );
            ch1_txt.setFontSize( 10 );
            ch2_txt.setFontSize( 10 );
            ch3_txt.setFontSize( 10 );
        }
    }
   
    public void font10Edit() {
        XRadioButton radio1 = (XRadioButton)findComponent( obj, "radio1" );
        XEdit edit1 = (XEdit)findComponent( "edit1" );
        XEdit edit2 = (XEdit)findComponent( "edit2" );
        XPassword pass = (XPassword)findComponent( "pass" );
        XTextArea text1 = (XTextArea)findComponent( "text1" );
        XTextArea text2 = (XTextArea)findComponent( "text2" );
        if ( radio1.isSelected() ) {
            edit1.setFontSize( 10 );
            edit2.setFontSize( 10 );
            pass.setFontSize( 10 );
            text1.setFontSize( 10 );
            text2.setFontSize( 10 );
        }
    }
   
    public void font10Combo() {
        XRadioButton radio1 = (XRadioButton)findComponent( obj, "radio1" );
        XComboBox combo = (XComboBox)findComponent( "combo" );
        if ( radio1.isSelected() ) {
            combo.setFontSize( 10 );
        }
    }
   
    public void font10List() {
        XRadioButton radio1 = (XRadioButton)findComponent( obj, "radio1" );
        XList ordered = (XList)findComponent( "ordered" );
        XList unordered = (XList)findComponent( "unordered" );
        if ( radio1.isSelected() ) {
            ordered.oSetFontSize( 10 );
            unordered.uSetFontSize( 10 );
        }
    }
   
    public void font10Panel() {
        XRadioButton radio1 = (XRadioButton)findComponent( obj, "radio1" );
        XPanel panel = (XPanel)findComponent( "panel" );
        if ( radio1.isSelected() ) {           
            panel.setFontSize( 10 );
        }
    }
   
    public void font10Other() {
        XRadioButton radio1 = (XRadioButton)findComponent( obj, "radio1" );
        XLabel lab1 = (XLabel)findComponent( "lab1" );
        XLabel lab2 = (XLabel)findComponent( "lab2" );
        XTable table = (XTable)findComponent( "table" );
        if ( radio1.isSelected() ) {
            lab1.setFontSize( 10 );
            lab2.setFontSize( 10 );
            table.setFontSize( 10 );
        }
    }
   
    public void font16() {
        XRadioButton radio2 = (XRadioButton)findComponent( obj, "radio8" );
        XButton one = (XButton)findComponent( "one" );
        XButton two = (XButton)findComponent( "two" );
        XButton three = (XButton)findComponent( "three" );
        XLabel rad1_txt = (XLabel)findComponent( "radio1_txt" );
        XLabel rad2_txt = (XLabel)findComponent( "radio2_txt" );
        XLabel rad3_txt = (XLabel)findComponent( "radio3_txt" );
        XLabel rad4_txt = (XLabel)findComponent( "radio4_txt" );
        XLabel rad5_txt = (XLabel)findComponent( "radio5_txt" );
        XLabel rad6_txt = (XLabel)findComponent( "radio6_txt" );
        XLabel ch1_txt = (XLabel)findComponent( "check1_txt" );
        XLabel ch2_txt = (XLabel)findComponent( "check2_txt" );
        XLabel ch3_txt = (XLabel)findComponent( "check3_txt" );
        if ( radio2.isSelected() ) {
            one.setFontSize( 16 );
            two.setFontSize( 16 );
            three.setFontSize( 16 );
            rad1_txt.setFontSize( 16 );
            rad2_txt.setFontSize( 16 );
            rad3_txt.setFontSize( 16 );
            rad4_txt.setFontSize( 16 );
            rad5_txt.setFontSize( 16 );
            rad6_txt.setFontSize( 16 );
            ch1_txt.setFontSize( 16 );
            ch2_txt.setFontSize( 16 );
            ch3_txt.setFontSize( 16 );
        }
    }
   
    public void font16Edit() {
        XRadioButton radio2 = (XRadioButton)findComponent( obj, "radio2" );
        XEdit edit1 = (XEdit)findComponent( "edit1" );
        XEdit edit2 = (XEdit)findComponent( "edit2" );
        XPassword pass = (XPassword)findComponent( "pass" );
        XTextArea text1 = (XTextArea)findComponent( "text1" );
        XTextArea text2 = (XTextArea)findComponent( "text2" );
        if ( radio2.isSelected() ) {
            edit1.setFontSize( 16 );
            edit2.setFontSize( 16 );
            pass.setFontSize( 16 );
            text1.setFontSize( 16 );
            text2.setFontSize( 16 );
        }
    }
   
    public void font16Combo() {
        XRadioButton radio2 = (XRadioButton)findComponent( obj, "radio2" );
        XComboBox combo = (XComboBox)findComponent( "combo" );
        if ( radio2.isSelected() ) {
            combo.setFontSize( 16 );
        }
    }
   
    public void font16List() {
        XRadioButton radio2 = (XRadioButton)findComponent( obj, "radio2" );
        XList ordered = (XList)findComponent( "ordered" );
        XList unordered = (XList)findComponent( "unordered" );
        if ( radio2.isSelected() ) {
            ordered.oSetFontSize( 16 );
            unordered.uSetFontSize( 16 );
        }
    }
   
    public void font16Panel() {
        XRadioButton radio2 = (XRadioButton)findComponent( obj, "radio2" );
        XPanel panel = (XPanel)findComponent( "panel" );
        if ( radio2.isSelected() ) {           
            panel.setFontSize( 16 );
        }
    }
   
    public void font16Other() {
        XRadioButton radio2 = (XRadioButton)findComponent( obj, "radio2" );
        XLabel lab1 = (XLabel)findComponent( "lab1" );
        XLabel lab2 = (XLabel)findComponent( "lab2" );
        XTable table = (XTable)findComponent( "table" );
        if ( radio2.isSelected() ) {
            lab1.setFontSize( 16 );
            lab2.setFontSize( 16 );
            table.setFontSize( 16 );
        }
    }
   
    public void font22() {
        XRadioButton radio3 = (XRadioButton)findComponent( obj, "radio9" );
        XButton one = (XButton)findComponent( "one" );
        XButton two = (XButton)findComponent( "two" );
        XButton three = (XButton)findComponent( "three" );
        XLabel rad1_txt = (XLabel)findComponent( "radio1_txt" );
        XLabel rad2_txt = (XLabel)findComponent( "radio2_txt" );
        XLabel rad3_txt = (XLabel)findComponent( "radio3_txt" );
        XLabel rad4_txt = (XLabel)findComponent( "radio4_txt" );
        XLabel rad5_txt = (XLabel)findComponent( "radio5_txt" );
        XLabel rad6_txt = (XLabel)findComponent( "radio6_txt" );
        XLabel ch1_txt = (XLabel)findComponent( "check1_txt" );
        XLabel ch2_txt = (XLabel)findComponent( "check2_txt" );
        XLabel ch3_txt = (XLabel)findComponent( "check3_txt" );
        if ( radio3.isSelected() ) {
            one.setFontSize( 22 );
            two.setFontSize( 22 );
            three.setFontSize( 22 );
            rad1_txt.setFontSize( 22 );
            rad2_txt.setFontSize( 22 );
            rad3_txt.setFontSize( 22 );
            rad4_txt.setFontSize( 22 );
            rad5_txt.setFontSize( 22 );
            rad6_txt.setFontSize( 22 );
            ch1_txt.setFontSize( 22 );
            ch2_txt.setFontSize( 22 );
            ch3_txt.setFontSize( 22 );
        }
    }
   
    public void font22Edit() {
        XRadioButton radio3 = (XRadioButton)findComponent( obj, "radio3" );
        XEdit edit1 = (XEdit)findComponent( "edit1" );
        XEdit edit2 = (XEdit)findComponent( "edit2" );
        XPassword pass = (XPassword)findComponent( "pass" );
        XTextArea text1 = (XTextArea)findComponent( "text1" );
        XTextArea text2 = (XTextArea)findComponent( "text2" );
        if ( radio3.isSelected() ) {
            edit1.setFontSize( 22 );
            edit2.setFontSize( 22 );
            pass.setFontSize( 22 );
            text1.setFontSize( 22 );
            text2.setFontSize( 22 );
        }
    }
   
    public void font22Combo() {
        XRadioButton radio3 = (XRadioButton)findComponent( obj, "radio3" );
        XComboBox combo = (XComboBox)findComponent( "combo" );
        if ( radio3.isSelected() ) {
            combo.setFontSize( 22 );
        }
    }
   
    public void font22List() {
        XRadioButton radio3 = (XRadioButton)findComponent( obj, "radio3" );
        XList ordered = (XList)findComponent( "ordered" );
        XList unordered = (XList)findComponent( "unordered" );
        if ( radio3.isSelected() ) {
            ordered.oSetFontSize( 22 );
            unordered.uSetFontSize( 22 );
        }
    }
   
    public void font22Panel() {
        XRadioButton radio3 = (XRadioButton)findComponent( obj, "radio3" );
        XPanel panel = (XPanel)findComponent( "panel" );
        if ( radio3.isSelected() ) {           
            panel.setFontSize( 22 );
        }
    }
   
     public void font22Other() {
        XRadioButton radio3 = (XRadioButton)findComponent( obj, "radio3" );
        XLabel lab1 = (XLabel)findComponent( "lab1" );
        XLabel lab2 = (XLabel)findComponent( "lab2" );
        XTable table = (XTable)findComponent( "table" );
        if ( radio3.isSelected() ) {
            lab1.setFontSize( 22 );
            lab2.setFontSize( 22 );
            table.setFontSize( 22 );
        }
    }
   
    public void transmitEdit() {
        XEdit edit1 = (XEdit)findComponent( obj, "edit1" );
        XEdit edit2 = (XEdit)findComponent( "edit2" );
        edit2.setText( edit1.getText() );
    }
   
    public void transmitText() {
        XTextArea text1 = (XTextArea)findComponent( obj, "text1" );
        XTextArea text2 = (XTextArea)findComponent( "text2" );
        text2.setText( text1.getText() );
    }
   
    public void transmitLabel() {
        XLabel lab1 = (XLabel)findComponent( obj, "lab1" );
        XLabel lab2 = (XLabel)findComponent( "lab2" );
        lab2.setText( lab1.getText() );
    }
   
    public void addItemCombo() {
        XEdit edit = (XEdit)findComponent( obj, "edit" );
        XComboBox combo = (XComboBox)findComponent( "combo" );
        combo.addElement( edit.getText() );
    }
   
    public void removeItemCombo() {
        XComboBox combo = (XComboBox)findComponent( obj, "combo" );
        combo.deleteElement( combo.getSelectedIndex() + 1 );
    }
   
    public void addItemOList() {      
        XEdit edit = (XEdit)findComponent( obj, "edit" );
        XEdit edit2 = (XEdit)findComponent( "edit2" );
        XList ordered = (XList)findComponent( "ordered" );
        if ( edit2.getText().equals( "" ) || edit2.getText().equals( "Item Index" ) ) {
            ordered.oAddElement( edit.getText() );
        } else {
            ordered.oInsertElement( edit.getText(), Integer.parseInt( edit2.getText() ) );
        }
    }
   
    public void removeItemOList() {               
        XList ordered = (XList)findComponent( obj, "ordered" )
        XEdit edit3 = (XEdit)findComponent( "edit3" );
        if ( edit3.getText().equals( "" ) || edit3.getText().equals( "Item Index" ) ) {
            ordered.oRemoveElement();
        } else {
            ordered.oRemoveElement( Integer.parseInt( edit3.getText() ) );           
        }
    }
   
    public void addItemUList() {       
        XEdit edit4 = (XEdit)findComponent( obj, "edit4" );
        XEdit edit5 = (XEdit)findComponent( "edit5" );
        XList unordered = (XList)findComponent( "unordered" );
        if ( edit5.getText().equals( "" ) || edit5.getText().equals( "Item Index" ) ) {
            unordered.uAddElement( edit4.getText() );
        } else {
            unordered.uInsertElement( edit4.getText(), Integer.parseInt( edit5.getText() ) );
        }
    }
   
    public void removeItemUList() {               
        XList unordered = (XList)findComponent( obj, "unordered" )
        XEdit edit6 = (XEdit)findComponent( "edit6" );
        if ( edit6.getText().equals( "" ) || edit6.getText().equals( "Item Index" ) ) {
            unordered.uRemoveElement();
        } else {
            unordered.uRemoveElement( Integer.parseInt( edit6.getText() ) );           
        }
    }    
   
    public void addCell() {
        XTable table = (XTable)findComponent( obj, "table" );
        XEdit edit = (XEdit)findComponent( "edit" );
        XEdit edit2 = (XEdit)findComponent( "edit2" );
        XEdit edit3 = (XEdit)findComponent( "edit3" );
        if ( edit2.getText().equals( "" ) || edit2.getText().equals( "Row Index" ) || edit3.getText().equals( "" ) || edit3.getText().equals( "Column Index" ) ) {
            XMessageBox alert = new XMessageBox( "You must enter a row number and a column number.");
        } else {
            if ( table.getCell( Integer.parseInt( edit2.getText() ), Integer.parseInt( edit3.getText() ) ) == null ) {
                table.insertCell( Integer.parseInt( edit2.getText() ), Integer.parseInt( edit3.getText() ) );
                table.setValue( Integer.parseInt( edit2.getText() ), Integer.parseInt( edit3.getText() ), edit.getText() );
            } else {
                table.setValue( Integer.parseInt( edit2.getText() ), Integer.parseInt( edit3.getText() ), edit.getText() );
            }
        }
    }
   
    public void addButton() {
        XPanel panel = (XPanel)findComponent( obj, "panel" );
        XButton button = new XButton( "New Button", "button" );
        panel.add( button.getHTMLElement() );
        button.addEvent( button.getHTMLElement().getId(), "alert", "click" );
    }       
   
    public void alert() {       
        XMessageBox alert = new XMessageBox( "Event added dynamically to this component." );
    }
       
    public void addRadio() {
        XPanel panel = (XPanel)findComponent( obj, "panel" );
        XRadioButton radio = new XRadioButton( "radio" );
        XLabel radio_txt = new XLabel( "New Radio Button", "radio_txt" );
        panel.add( radio.getHTMLElement() );
        panel.add( radio_txt.getHTMLElement() );
        radio.addEvent( radio.getHTMLElement().getId(), "alert", "ClICk");
    }
       
    public void addCheck() {
        XPanel panel = (XPanel)findComponent( obj, "panel" );
        XCheckbox check = new XCheckbox( "check" );
        XLabel check_txt = new XLabel( "New Check Box", "check_txt" );
        panel.add( check.getHTMLElement() );
        panel.add( check_txt.getHTMLElement() );
    }
   
    public void addEdit() {
        XPanel panel = (XPanel)findComponent( obj, "panel" );
        XEdit edit = new XEdit( "New Edit", "edit" );
        panel.add( edit.getHTMLElement() );
    }
   
    public void addText() {
        XPanel panel = (XPanel)findComponent( obj, "panel" );
        XTextArea text = new XTextArea( "New Text Area", "text" );
        panel.add( text.getHTMLElement() );
    }
   
    public void addCombo() {
        XPanel panel = (XPanel)findComponent( obj, "panel" );
        XComboBox combo = new XComboBox();
        combo.addElement( "Element 1" );
        combo.addElement( "Element 2" );
        combo.addElement( "Element 3" );
        panel.add( combo.getHTMLElement() );
    }
   
    public void addList() {
        XPanel panel = (XPanel)findComponent( obj, "panel" );
        XList list = new XList( true );
        list.oAddElement( "Item 1" );
        list.oAddElement( "Item 2" );
        list.oAddElement( "Item 3" );
        list.oAddElement( "Item 4" );
        panel.add( list.oGetHTMLElement() );
    }
   
    public void addImage() {
        XPanel panel = (XPanel)findComponent( obj, "panel" );
        XImage image = new XImage( "../images/tux.jpg", "image" );
        panel.add( image.getHTMLElement() );
    }
   
    public void addTable() {
        XPanel panel = (XPanel)findComponent( obj, "panel" );
        XTable table = new XTable();
        table.setValue( 1, 1, "Cell 1-1" );
        table.setValue( 1, 2, "Cell 1-2" );
        table.setValue( 1, 3, "Cell 1-3" );
        table.setValue( 1, 4, "Cell 1-4" );
        table.setValue( 2, 1, "Cell 2-1" );
        table.setValue( 2, 2, "Cell 2-2" );
        table.setValue( 2, 3, "Cell 2-3" );
        table.setValue( 2, 4, "Cell 2-4" );
        table.setValue( 3, 1, "Cell 3-1" );
        table.setValue( 3, 2, "Cell 3-2" );
        table.setValue( 3, 3, "Cell 3-3" );
        table.setValue( 3, 4, "Cell 3-4" );
        table.setBorder( 1 );
        panel.add( table.getHTMLElement() );
    }
       
}
TOP

Related Classes of net.xoetrope.samples.html.Sample

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.