Japplet Setfont, Drawstring, Drawchar
Set font:
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import javax.swing.JApplet;
public class NewJApplet1 extends JApplet {
public void paint(Graphics g) {
Font t = new Font("Bradley Hand ITC", Font.TRUETYPE_FONT, 20);
Font r = new Font("Bodoni MT Poster Compressed", Font.BOLD, 20);
Font a = new Font("Algerian", Font.LAYOUT_NO_START_CONTEXT, 20);
Font b = new Font("Blackadder ITC", Font.PLAIN, 20);
Font z = new Font("Arabic Typesetting", Font.CENTER_BASELINE, 20);
Font o = new Font("Book Antiqua", Font.ITALIC, 20);
Font n = new Font("Book Antiqua", Font.TYPE1_FONT, 20);
for (int ts = 0; ts < 150; ts += 70) {
g.setColor(new Color(ts++));
g.setFont(t);
g.drawString("Trabzonspor", 15, 20);
g.setColor(Color.BLUE);
g.setFont(r);
g.drawString("Fenerbahçe", 15, 50);
g.setColor(Color.MAGENTA);
g.setFont(a);
g.drawString("Galatasaray", 15, 70);
g.setColor(Color.ORANGE);
g.setFont(b);
g.drawString("Besiktas", 15, 90);
g.setColor(Color.RED);
g.setFont(z);
g.drawString("Kayserispor", 15, 110);
g.setColor(Color.PINK);
g.setFont(o);
g.drawString("Ankaragücü", 15, 130);
g.setColor(Color.CYAN);
g.setFont(n);
g.drawString("GençlerBirliği", 15, 150);
setBackground(Color.YELLOW);
}
}
}
set font applet viever çıkışı:
html olarak görünümü:
JAVAAPPLET drawString:
import java.applet.Applet;
import java.awt.Graphics;
public class a extends Applet
{
@Override
public void init()
{
}
@Override
public void paint(Graphics g)
{
g.drawString("Selamın Aleyküm", 100, 100);
}
}
import java.awt.Graphics;
public class a extends Applet
{
@Override
public void init()
{
}
@Override
public void paint(Graphics g)
{
g.drawString("Selamın Aleyküm", 100, 100);
}
}
drawstiring applet çıkışı:
JAVAAPPLET drawString:
import java.awt.*;
import javax.swing.JApplet;
public class NewJApplet2 extends JApplet {
@Override
public void paint(Graphics g) {
int i;
int X=25;
for (i=20 ; i<=99;i++)
{
g.drawString("+", X ,X);
X +=10;
}
}}
import javax.swing.JApplet;
public class NewJApplet2 extends JApplet {
@Override
public void paint(Graphics g) {
int i;
int X=25;
for (i=20 ; i<=99;i++)
{
g.drawString("+", X ,X);
X +=10;
}
}}
drawstiring applet çıkışı:
JAVAAPPLET drawChar:
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import javax.swing.JApplet;
import javax.swing.JOptionPane;
public class a extends JApplet {
String Yazilacak;
int KacKarakter;
int KacinciKarakter;
char Yazilacak61[];
@Override
public void init() {
setSize(9011, 1000);
Yazilacak = JOptionPane.showInputDialog("Ne Yazmamı istiyorsun?");
KacKarakter = Integer.valueOf(JOptionPane.showInputDialog("Kaçıncı Karakterden Sonrassını Alıyım"));
KacinciKarakter = Integer.valueOf(JOptionPane.showInputDialog("yazdığınız kelime kaç karakterden oluşmaktadır"));
Yazilacak61 = Yazilacak.toCharArray();
}
@Override
public void paint(Graphics Ekran) {
for (int i = 0; i < 40; i++) {
int RastgeleSayi1 = (int) (Math.random() * 255);
int RastgeleSayi2 = (int) (Math.random() * 255);
int RastgeleSayi3 = (int) (Math.random() * 255);
Color Rengimiz = new Color(RastgeleSayi1, RastgeleSayi2, RastgeleSayi3);
Ekran.setColor(Rengimiz);
Font Fontumuz = new Font("Comic Sans", Font.LAYOUT_NO_LIMIT_CONTEXT, i + 20);
Ekran.setFont(Fontumuz);
Ekran.drawChars(Yazilacak61, KacKarakter, KacinciKarakter, 1, i + 100);
}
}
}
Javaappletdrawchars çıkışı:
Mükremin Topal
Yorumunuzu Ekleyin