Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Visual J# / July 2005

Tip: Looking for answers? Try searching our database.

how to instantiate the inner class.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
anoop - 16 Jul 2005 18:36 GMT
Hello,
        I created a .java  code file in Visual J#.Net and converted it into
the application by adding the "public static void main(String args[])"
function.
I have created the two classes one extends from Applet, and the other
extends from Frame. The class which I inherited from the Frame class becomes
the inner class of the class extended from the Applet. Now How do I
instantiate the class extended from Frame class. the outline code is

public class menu_show extends Applet
{

------init , paint action function---------
}

public class MenuBarFrame extends Frame
{
paint,action function for Menu
}

public  static void main(String args[])
{
applet class instance is created
instance of frame is created

MenuBarframe Instance  ? - How to create here? - : An explicit enclosing
instance of class 'menu_show' is needed to instantiate inner class
'MenuBarFrame'

Menu , MenuBar, MenuItem instance is created

}
David Anton - 16 Jul 2005 22:48 GMT
Replace "new Inner(..)" with "new Outer().new Inner(..) "
Weird syntax, but this works.

Signature

David Anton
www.tangiblesoftwaresolutions.com
Home of:
Instant C#: VB.NET to C# Converter
Instant VB: C# to VB.NET Converter
Instant J#: VB.NET to J# Converter

> Hello,
>          I created a .java  code file in Visual J#.Net and converted it into
[quoted text clipped - 28 lines]
>
> }
David Anton - 17 Jul 2005 00:17 GMT
Replace "new Inner(..)" with "new Outer().new Inner(..) "
Weird syntax, but this works.


anoop - 17 Jul 2005 09:16 GMT
Thanks for this syntax, it works, but again there is a problem, of calling
the function "public boolean action" of the inner class. How do I call this
function.
                                                                  Thanks in
advance
                                                                           
       

> Replace "new Inner(..)" with "new Outer().new Inner(..) "
> Weird syntax, but this works.
[quoted text clipped - 6 lines]
>
>  
David Anton - 17 Jul 2005 16:07 GMT
Once you have your new object (using the weird syntax...), just call the
method via the object.
e.g.,
InnerClassObject x = new Outer().new Inner();
x.Action();
etc.

Signature

David Anton
www.tangiblesoftwaresolutions.com
Home of:
Instant C#: VB.NET to C# Converter
Instant VB: C# to VB.NET Converter
Instant J#: VB.NET to J# Converter

> Thanks for this syntax, it works, but again there is a problem, of calling
> the function "public boolean action" of the inner class. How do I call this
[quoted text clipped - 14 lines]
> >
> >  
anoop - 17 Jul 2005 16:12 GMT
i tried it, but what should be the parameters inside the action method.
                                                                           
                       Thank you

> Once you have your new object (using the weird syntax...), just call the
> method via the object.
[quoted text clipped - 21 lines]
> > >
> > >  

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.