Witam
Chce stworzyć pewne komponenty na bazie JLabel tzn. w klasie test05 dziedziczone po JLabel. Wrzucę na to pewnie jakieś JTextField itp. a później w całości chce to wyrzucić na JFrame w applecie mógł by mi ktoś z tym pomóc?
import java.awt.Color;
import javax.swing.JLabel;
public class test05 extends JLabel {
public JLabel okno4 = new JLabel();
public void init(){
setSize(10,10);
setLocation(10,10);
setBackground(Color.red);
setVisible(true);
setOpaque(true);
this.setBackground(Color.red);
this.setLocation(10,10);
this.setSize(10,10);
this.setVisible(true);
this.setOpaque(true);
okno4.setBounds(0, 0, 30, 30);
okno4.setVisible(true);
okno4.setBackground(new Color(51,122,141));
okno4.setOpaque(true);
add(okno4);
}
}
import javax.swing.JApplet;
import javax.swing.JFrame;
public class test04 extends JApplet {
public test05 test = new test05();
public JFrame okno = new JFrame();
@Override public void init(){
okno.setBounds(0, 0, 200,200); okno.setTitle("test"); okno.setLayout(null); okno.setVisible(true);
okno.add(test);
}
}