Results 1 to 2 of 2
  1. #1
    Java_Jedi is offline Member
    Join Date
    Apr 2009
    Rep Power

    Default how to inherit a customised

    Dear all,

    I'm using NetBean IDE 6.5.1 to try out my very 1st Java lesson. I have created a new class from JFrame.

    Java Code:
    public class stdscreen extends JFrame implements ActionListener{}
     .. adding a exit button to serve as template for all child form in the future.

    Later, try to inherit this class "stdscreen" and this is where the problem comes in.

    Attempted Approach #1
    Save the class "stdscreen" as template and create a new class based on this template (shown in attachment).

    Result : The child class contains all the codes in the parent class. :mad:

    Attempted Approach #2
    Create the new child class by inherit the JFrame class and substitute the JFrame keyword to stdscreen.

    Result : I have a blank JFrame screen and my Exit button is not visible until i run the program.

    Question :
    1) How to make the class stdscreen as parent class while visually able to see its inherited objects during design mode so that i can expand things i need in the child class ?

    Thank you.
    Attached Thumbnails Attached Thumbnails how to inherit a customised-template.jpg  

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    You'll likely find that most of the Swing experts here (and some non-experts like me), don't use NetBeans-generated code to create their GUIs. If you don't get decent help here in a short period of time, you may want to ask this in a NetBeans forum where there are likely to be more netbeans experts. If you do this though, please place a link in both threads, one to the other. Good luck.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts