java - Why does importing JFrame require inheritance but FlowLayout, JLabel, etc not? -


i started learning guis , watching tutorial "thenewboston" wrote this. don't understand why jframe import that's inherited? i'm not sure if 1 of cases has because java give error otherwise.

import java.awt.flowlayout; import javax.swing.jframe; import javax.swing.jlabel;  public class tuna extends jframe {      private jlabel item1;      public tuna(){         super("the title bar");         setlayout(new flowlayout());                     item1 = new jlabel("this sentence.");         item1.settooltiptext("this gonna show on hover");         add(item1);     } } 

jframe not require inheritance. in fact should not use inheritance.

look @ framedemo.java code swing tutorial on how make frames better design.

also, java class names should start upper case character. stick swing tutorials instead of current tutorials looking at.


Comments

Popular posts from this blog

php - Using str_replace to translate a MySQL Table in html -

asp.net mvc - Cannot display error message on Editor or EditorFor -

SQL Server - MyCTE query based on 24 hour period (next day) -