there are two examples which are seperated by"-------" sign to use them just put them through a java creator.post for comments

------
"A rational anachist believes that concepts such as 'state' and 'society' and 'government' have no existence save as physically exemplified in acts of self-responsible individuals.He believese that it is impossible to shift blame,share blame,distrubute blame.... as blame,guilt,responsibility are matters taking place inside human beings singly and nowhere else.But being rational,he knows that not all individuals hold his evaluations,so he tries to live perfectly in an imperfectworld...aware that his effort wil be less than perfect yet undismayed by self-knowledge of self-failure."
-Robert A. Heinlen:cool:
-----

import java.awt.*;
import java.awt.event.*;
public class tren{
public static void main(String args[]){
Pencere pen=new Pencere();
pen.setVisible(true);
}
} 
class Pencere extends Frame implements ItemListener{
Font f;
Choice tip,stil,boyut,renk;
public Pencere(){
setTitle("Ornek");
setSize(300,300);
 
tip=new Choice(); 
renk=new Choice();
stil=new Choice();
boyut=new Choice();
Panel p=new Panel();
GraphicsEnvironment ge=GraphicsEnvironment.getLocalGraphicsEnvironment();
String []fontlar=ge.getAvailableFontFamilyNames();
for (int i = 0; i<fontlar.length; i++) {
tip.addItem(fontlar[i]);
}
 
stil.addItem("Italik"); 
stil.addItem("Kalin");
stil.addItem("Normal");
stil.addItem("Kalin-Italik");
renk.addItem("ye&#351;il");
renk.addItem("k&#305;rm&#305;z&#305;");
renk.addItem("sar&#305;");
for (int i = 0; i<72; i+=3) {
boyut.addItem(i+"");
}
tip.addItemListener(this);
stil.addItemListener(this);
boyut.addItemListener(this);
renk.addItemListener(this);
p.add(tip);
p.add(stil);
p.add(boyut);
p.add(renk);
add(p,BorderLayout.NORTH);
}
Color []renkler={Color.GREEN,Color.red,Color.yellow};
public void paint(Graphics g){
g.setFont(f);
g.setColor(renkler[renk.getSelectedIndex()]);
g.drawString("Merhaba Dunya",150,150);
}
 
int []stiller={Font.ITALIC,Font.BOLD,Font.PLAIN,Font.BOLD+Font.ITALIC};
public void itemStateChanged(ItemEvent ie){
String yazitipi=tip.getSelectedItem();
int boy=Integer.parseInt(boyut.getSelectedItem());
int sti=stiller[stil.getSelectedIndex()];
 
f=new Font(yazitipi,sti,boy);
repaint();
}
}
-----------------------------------------------------------
import java.awt.*;
import java.awt.event.*;
public class tren{
public static void main(String args[]){
Pencere pen=new Pencere();
pen.setVisible(true);
}
} 
class Pencere extends Frame implements ItemListener{
Font f;
Choice tip,stil,boyut,renk;
public Pencere(){
setTitle("Ornek");
setSize(300,300);
f=new Font("Arial",Font.PLAIN,12);
tip=new Choice(); 
renk=new Choice();
stil=new Choice();
boyut=new Choice();
Panel p=new Panel();
GraphicsEnvironment ge=GraphicsEnvironment.getLocalGraphicsEnvironment();
String []fontlar=ge.getAvailableFontFamilyNames();
for (int i = 0; i<fontlar.length; i++) {
tip.addItem(fontlar[i]);
}
 
stil.addItem("Italik"); 
stil.addItem("Kalin");
stil.addItem("Normal");
stil.addItem("Kalin-Italik");
renk.addItem("ye&#351;il");
renk.addItem("k&#305;rm&#305;z&#305;");
renk.addItem("sar&#305;");
for (int i = 0; i<72; i+=3) {
boyut.addItem(i+"");
}
tip.addItemListener(this);
stil.addItemListener(this);
boyut.addItemListener(this);
renk.addItemListener(this);
p.add(tip);
p.add(stil);
p.add(boyut);
p.add(renk);
add(p,BorderLayout.NORTH);
}
Color []renkler={Color.GREEN,Color.red,Color.yellow};
public void paint(Graphics g){
g.setFont(f);
g.setColor(renkler[renk.getSelectedIndex()]);
g.drawString("Merhaba Dunya",150,150);
FontMetrics fm=g.getFontMetrics(f);
g.setFont(new Font("Arial",Font.PLAIN,12));
g.setColor(Color.black);
g.drawString("height: "+fm.getHeight(),50,180);
g.drawString("Leading: "+fm.getLeading(),50,210);
g.drawString("Ascent: "+fm.getAscent(),50,240);
g.drawString("Descent: "+fm.getDescent(),50,270);
g.drawString("Descent: "+fm.stringWidth("Merhaba Dunya"),50,300);
}
 
int []stiller={Font.ITALIC,Font.BOLD,Font.PLAIN,Font.BOLD+Font.ITALIC};
public void itemStateChanged(ItemEvent ie){
String yazitipi=tip.getSelectedItem();
int boy=Integer.parseInt(boyut.getSelectedItem());
int sti=stiller[stil.getSelectedIndex()];
 
f=new Font(yazitipi,sti,boy);
repaint();
}
}
------------------------------
public void paint(Graphics g){
g.setXORMode(Color.blue);
g.setColor(Color.red);
g.fillRect(50,50,200,200);
g.setColor(Color.green);
g.fillRect(150,150,200,200);
}

please use the code tag when posting code :cool:

I fixed it for him :D

sorry didn't know will do next time:rolleyes:

No worries. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.