Java Applet Label Eklemek
Label Örneği:
import java.awt.FlowLayout;
import java.awt.Label;
import javax.swing.JApplet;
public class LabelOrnegi extends JApplet {
Label Metin1=new Label("Merhaba");
Label Metin2=new Label();
public void init() {
setLayout(new FlowLayout());
add(Metin1);
add(Metin2);
Metin2.setText("Java Swing Kütüphanesi");
}
}
import java.awt.Label;
import javax.swing.JApplet;
public class LabelOrnegi extends JApplet {
Label Metin1=new Label("Merhaba");
Label Metin2=new Label();
public void init() {
setLayout(new FlowLayout());
add(Metin1);
add(Metin2);
Metin2.setText("Java Swing Kütüphanesi");
}
}
İkonlu Label Örneği
import java.awt.FlowLayout;
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JApplet;
import javax.swing.JLabel;
public class IconOrnegi extends JApplet {
JLabel Metin1=new JLabel();
ImageIcon KucukResim=new ImageIcon();
Image Resim;
public void init() {
setLayout(new FlowLayout());
/*
Resim=getImage(getDocumentBase(), "animals.gif");
KucukResim.setImage(Resim);
Metin1.setIcon(KucukResim);
*/
Metin1.setIcon(new ImageIcon(getImage(getDocumentBase(), "bird.gif")));
Metin1.setVerticalTextPosition(JLabel.BOTTOM);
Metin1.setHorizontalTextPosition(JLabel.CENTER);
Metin1.setText("Google Firmasi");
ImageIcon Ikon=new ImageIcon(getImage(getDocumentBase(), "bird2.gif"));
JLabel Metin2=new JLabel("Dijital Ders", Ikon, JLabel.CENTER);
add(Metin1);
add(Metin2);
}
}
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JApplet;
import javax.swing.JLabel;
public class IconOrnegi extends JApplet {
JLabel Metin1=new JLabel();
ImageIcon KucukResim=new ImageIcon();
Image Resim;
public void init() {
setLayout(new FlowLayout());
/*
Resim=getImage(getDocumentBase(), "animals.gif");
KucukResim.setImage(Resim);
Metin1.setIcon(KucukResim);
*/
Metin1.setIcon(new ImageIcon(getImage(getDocumentBase(), "bird.gif")));
Metin1.setVerticalTextPosition(JLabel.BOTTOM);
Metin1.setHorizontalTextPosition(JLabel.CENTER);
Metin1.setText("Google Firmasi");
ImageIcon Ikon=new ImageIcon(getImage(getDocumentBase(), "bird2.gif"));
JLabel Metin2=new JLabel("Dijital Ders", Ikon, JLabel.CENTER);
add(Metin1);
add(Metin2);
}
}
Yorumunuzu Ekleyin