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
Post a Comment