You can do that by using a reference to the Menu instance in the checker
form.
Here is an example I have written. In this example I'm setting a reference
to the Menu ("this") instance in the Checker instance. From now on I can
reach the Menu instance from the Checker instance and do the set_Opacity
call on the Menu instance from the Checker instance.
_____________________________________
Menu.jsl file:
import System.Drawing.*;
import System.Collections.*;
import System.ComponentModel.*;
import System.Windows.Forms.*;
import System.Data.*;
public class Menu extends System.Windows.Forms.Form
{
private Checker che = null;
private System.Windows.Forms.Button button1;
private System.ComponentModel.Container components = null;
public Menu()
{
InitializeComponent();
}
protected void Dispose(boolean disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
super.Dispose(disposing);
}
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
this.button1.set_Location(new System.Drawing.Point(96, 104));
this.button1.set_Name("button1");
this.button1.set_TabIndex(0);
this.button1.set_Text("Checker");
this.button1.add_Click( new System.EventHandler(this.button1_Click) );
this.set_AutoScaleBaseSize(new System.Drawing.Size(5, 13));
this.set_ClientSize(new System.Drawing.Size(292, 266));
this.get_Controls().Add(this.button1);
this.set_Name("Form1");
this.set_Text("Form1");
this.ResumeLayout(false);
}
/** @attribute System.STAThread() */
public static void main(String[] args)
{
Application.Run(new Menu());
}
private void button1_Click (Object sender, System.EventArgs e)
{
this.che = new Checker();
this.che.parentForm = this;
this.che.Show();
this.set_Opacity( .50 );
}
}
_____________________________________
Checker.jsl file:
import System.Drawing.*;
import System.Collections.*;
import System.ComponentModel.*;
import System.Windows.Forms.*;
public class Checker extends System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
public Menu parentForm = null;
private System.ComponentModel.Container components = null;
public Checker()
{
InitializeComponent();
}
protected void Dispose(boolean disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
super.Dispose(disposing);
}
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
this.button1.set_Location(new System.Drawing.Point(72, 56));
this.button1.set_Name("button1");
this.button1.set_TabIndex(0);
this.button1.set_Text("Close");
this.button1.add_Click( new System.EventHandler(this.button1_Click) );
this.set_AutoScaleBaseSize(new System.Drawing.Size(5, 13));
this.set_ClientSize(new System.Drawing.Size(292, 266));
this.get_Controls().Add(this.button1);
this.set_Name("Checker");
this.set_Text("Checker");
this.ResumeLayout(false);
}
private void button1_Click (Object sender, System.EventArgs e)
{
this.parentForm.set_Opacity( 1 );
this.Close();
}
}
Regards,
Lars-Inge Tønnessen
http://www.larsinge.com