Machanla Plz loku udawwak ona,
Java walin kohomada Graphical User interfaces hadaddi text sinhalen display karanne unicode pawichi karala?
Ex: Button ekeka caption eke sinhalen display karanne?
Pleeeeeeeeeeeese danna aya kiyala denna. GODAK PIN.
//K D Sameera Pulasthi
import java.awt.Frame;
import java.awt.Button;
import java.awt.BorderLayout;
import java.awt.Panel;
import java.awt.TextField;
import java.awt.GridLayout;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.*;
import javax.swing.*;
class Cal extends Frame implements MouseListener{
TextField tf;
Cal () {
setSize(450,325);
setTitle("Sciencetifical Calcuator_K D Sameera Pulasthi | 2011©All rights reserved");
BorderLayout bl=new BorderLayout();
Panel p1=new Panel();
add(p1,bl.NORTH);
Panel p2=new Panel();
p2.setBackground(new Color(240,240,209));
add(p2,bl.CENTER);
Panel p4=new Panel();
tf=new TextField(57);
tf.setText("Type Your Text Here");
p1.add(tf);
GridLayout gl=new GridLayout(4,4,10,10);
p2.setLayout(null);
JRadioButton rb1=new JRadioButton("Hex");
rb1.setBackground(new Color(240,250,210));
rb1.setBounds(10,10,50,25);
p2.add(rb1);
JRadioButton rb2=new JRadioButton("Dec");
rb2.setBackground(new Color(240,250,210));
rb2.setBounds(60,10,50,25);
p2.add(rb2);
JRadioButton rb3=new JRadioButton("Oct");
rb3.setBackground(new Color(240,250,210));
rb3.setBounds(110,10,50,25);
p2.add(rb3);
JRadioButton rb4=new JRadioButton("Bin");
rb4.setBackground(new Color(240,250,210));
rb4.setBounds(160,10,50,25);
p2.add(rb4);
JRadioButton rb5=new JRadioButton("Degrees");
rb5.setBackground(new Color(240,250,210));
rb5.setBounds(215,10,75,25);
p2.add(rb5);
JRadioButton rb6=new JRadioButton("Radians");
rb6.setBackground(new Color(240,250,210));
rb6.setBounds(290,10,72,25);
p2.add(rb6);
JRadioButton rb7=new JRadioButton("Grads");
rb7.setBackground(new Color(240,250,210));
rb7.setBounds(360,10,60,25);
p2.add(rb7);
Checkbox cb=new Checkbox("Inv");
cb.setBounds(10,40,35,20);
cb.setForeground(Color.black);
cb.setBackground(new Color(240,250,210));;
p2.add(cb);
Checkbox cb1=new Checkbox("Hyp");
cb1.setBackground(new Color(240,250,210));
cb1.setBounds(60,40,40,20);
p2.add(cb1);
Button b1 = new Button("Sta");
b1.setBounds(10,70,30,30);
b1.setBackground(new Color(255,250,255));
b1.setForeground(Color.blue);
p2.add(b1);
Button b2=new Button("F-E");
b2.setBounds((int)55, 70, 30,30);
b2.setBackground(new Color(255,250,255));
b2.setForeground(Color.magenta);
p2.add(b2);
Button b3=new Button("(");
b3.setBounds(90, 70, 30,30);
b3.setBackground(new Color(255,250,255));
b3.setForeground(Color.magenta);
p2.add(b3);
Button b4=new Button(")");
b4.setBounds(125, 70, 30,30);
b4.setBackground(new Color(255,250,255));
p2.add(b4);
Button b5=new Button("MC");
b5.setBounds(170, 70, 30,30);
b5.setBackground(new Color(255,250,255));
b5.setForeground(Color.red);
p2.add(b5);
Button b6=new Button("Sum");
b6.setBounds(10, 140, 30,30);
b6.setBackground(new Color(240,250,210));
b6.setForeground(new Color(200,200,210));
p2.add(b6);
Button b7=new Button("sin");
b7.setBounds(55, 140, 30,30);
b7.setBackground(new Color(255,250,255));
b7.setForeground(Color.magenta);
p2.add(b7);
Button b8=new Button(" ");
b8.setBounds(130, 40, 26,23);
b8.setBackground(new Color(240,250,210));
p2.add(b8);
Button b9=new Button("Ave");
b9.setBounds(10, 105, 30,30);
b9.setBackground(new Color(240,250,210));
b9.setForeground(new Color(200,200,210));
p2.add(b9);
Button b10=new Button("dms");
b10.setBounds(55, 105, 30,30);
b10.setBackground(new Color(255,250,251));
b10.setForeground(Color.magenta);
p2.add(b10);
Button b11=new Button("Exp");
b11.setBounds(90, 105, 30,30);
b11.setBackground(new Color(255,250,255));
b11.setForeground(Color.magenta);
p2.add(b11);
Button b12=new Button("In");
b12.setBounds(125, 105, 30,30);
b12.setBackground(new Color(255,250,255));
b12.setForeground(Color.magenta);
p2.add(b12);
Button b13=new Button("MR");
b13.setBounds(170, 105,30,30);
b13.setBackground(new Color(255,250,255));
p2.add(b13);
b13.setForeground(Color.red);
Button b14=new Button("4");
b14.setBounds(215, 105, 30,30);
b14.setBackground(new Color(255,250,255));
p2.add(b14);
Button b15=new Button("s");
b15.setBounds(10, 175, 30,30);
b15.setBackground(new Color(240,250,210));
b15.setForeground(new Color(200,200,210));
p2.add(b15);
Button b16=new Button("x^y");
b16.setBounds(90, 140, 30,30);
b16.setBackground(new Color(255,250,255));
b16.setForeground(Color.magenta);
p2.add(b16);
Button b17=new Button("Dat");
b17.setBounds(10, 210, 30,30);
b17.setBackground(new Color(240,250,210));
b17.setForeground(new Color(200,200,210));
p2.add(b17);
Button b18=new Button(" ");
b18.setBounds(175,40,26,23);
b18.setBackground(new Color(240,250,210));
p2.add(b18);
Button b19=new Button("cos");
b19.setBounds(55, 175, 30,30);
b19.setBackground(new Color(255,250,255));
b19.setForeground(Color.magenta);
p2.add(b19);
Button b20=new Button("tan");
b20.setBounds(55, 210, 30,30);
b20.setBackground(new Color(255,250,255));
b20.setForeground(Color.magenta);
p2.add(b20);
Button b21=new Button("x^3");
b21.setBounds(90, 175, 30,30);
b21.setBackground(new Color(255,250,255));
b21.setForeground(Color.magenta);
p2.add(b21);
Button b22=new Button("x^2");
b22.setBounds(90, 210, 30,30);
b22.setBackground(new Color(255,250,255));
b22.setForeground(Color.magenta);
p2.add(b22);
Button b23=new Button("log");
b23.setBounds(125, 140, 30,30);
b23.setBackground(new Color(255,250,255));
b23.setForeground(Color.magenta);
p2.add(b23);
Button b24=new Button("n!");
b24.setBounds(125, 175, 30,30);
b24.setBackground(new Color(255,250,255));
b23.setForeground(Color.magenta);
p2.add(b24);
Button b25=new Button("1/x");
b25.setBounds(125, 210, 30,30);
b25.setBackground(new Color(255,250,255));
b25.setForeground(Color.magenta);
p2.add(b25);
Button b26=new Button("MS");
b26.setBounds(170, 140, 30,30);
b26.setBackground(new Color(255,250,255));
b26.setForeground(Color.red);
p2.add(b26);
Button b27=new Button("M+");
b27.setBounds(170, 175, 30,30);
b27.setBackground(new Color(255,250,255));
b27.setForeground(Color.red);
p2.add(b27);
Button b28=new Button("pi");
b28.setBounds(170, 210, 30,30);
b28.setBackground(new Color(255,250,255));
b28.setForeground(Color.blue);
p2.add(b28);
Button b30=new Button("1");
b30.setBounds(215, 140, 30,30);
b30.setBackground(new Color(255,250,255));
b30.setForeground(Color.blue);
p2.add(b30);
Button b31=new Button("0");
b31.setBounds(215, 175, 30,30);
b31.setBackground(new Color(255,250,255));
b31.setForeground(Color.blue);
p2.add(b31);
Button b32=new Button("A");
b32.setBounds(215, 210, 30,30);
b32.setBackground(new Color(240,250,210));
b32.setForeground(new Color(200,200,210));
p2.add(b32);
Button b33=new Button("5");
b33.setBounds(250, 105, 30,30);
b33.setBackground(new Color(255,250,255));
b33.setForeground(Color.blue);
p2.add(b33);
Button b34=new Button("2");
b34.setBounds(250, 140, 30,30);
b34.setBackground(new Color(255,250,255));
b34.setForeground(Color.blue);
p2.add(b34);
Button b35=new Button("+/-");
b35.setBounds(250, 175, 30,30);
b35.setBackground(new Color(255,250,255));
b35.setForeground(Color.blue);
p2.add(b35);
Button b36=new Button("B");
b36.setBounds(250, 210, 30,30);
b36.setBackground(new Color(240,250,210));
b36.setForeground(new Color(200,200,210));
p2.add(b36);
Button b37=new Button("7");
b37.setBounds(215, 70, 30,30);
b37.setBackground(new Color(255,250,255));
b37.setForeground(Color.blue);
p2.add(b37);
Button b38=new Button("8");
b38.setBounds(250, 70, 30,30);
b38.setBackground(new Color(255,250,255));
b38.setForeground(Color.blue);
p2.add(b38);
Button b39=new Button("9");
b39.setBounds(285, 70, 30,30);
b39.setBackground(new Color(255,250,255));
p2.add(b39);
b39.setForeground(Color.blue);
p2.add(b39);
Button b40=new Button("6");
b40.setBounds(285, 105, 30,30);
b40.setBackground(new Color(255,250,255));
b40.setForeground(Color.blue);
p2.add(b40);
Button b41=new Button("3");
b41.setBounds(285, 140, 30,30);
b41.setBackground(new Color(255,250,255));
b41.setForeground(Color.blue);
p2.add(b41);
Button b42=new Button(".");
b42.setBounds(285, 175, 30,30);
b42.setBackground(new Color(255,250,255));
b42.setForeground(Color.blue);
p2.add(b42);
Button b43=new Button("C");
b43.setBounds(285, 210, 30,30);
b43.setBackground(new Color(240,250,210));
b43.setForeground(new Color(200,200,210));
p2.add(b43);
Button b44=new Button("/");
b44.setBounds(320, 70, 30,30);
b44.setBackground(new Color(255,250,255));
b44.setForeground(Color.red);
p2.add(b44);
Button b45=new Button("*");
b45.setBounds(320, 105, 30,30);
b45.setBackground(new Color(255,250,255));
b45.setForeground(Color.red);
p2.add(b45);
Button b46=new Button("-");
b46.setBounds(320, 140, 30,30);
b46.setBackground(new Color(255,250,255));
b46.setForeground(Color.red);
p2.add(b46);
Button b47=new Button("+");
b47.setBounds(320, 175, 30,30);
b47.setBackground(new Color(255,250,255));
b47.setForeground(Color.red);
p2.add(b47);
Button b48=new Button("D");
b48.setBounds(320, 210, 30,30);
b48.setBackground(new Color(240,250,210));
b48.setForeground(new Color(200,200,210));
p2.add(b48);
Button b49=new Button("Mod");
b49.setBounds(355, 70, 30,30);
b49.setBackground(new Color(255,250,255));
b49.setForeground(Color.red);
p2.add(b49);
Button b50=new Button("Or");
b50.setBounds(355, 105, 30,30);
b50.setBackground(new Color(255,250,255));
b50.setForeground(Color.red);
p2.add(b50);
Button b51=new Button("lsh");
b51.setBounds(355, 140, 30,30);
b51.setBackground(new Color(255,250,255));
b51.setForeground(Color.red);
p2.add(b51);
Button b52=new Button("=");
b52.setBounds(355, 175, 30,30);
b52.setBackground(new Color(255,250,255));
b52.setForeground(Color.red);
p2.add(b52);
Button b53=new Button("E");
b53.setBounds(355, 210, 30,30);
b53.setBackground(new Color(240,250,210));
b53.setForeground(new Color(200,200,210));
p2.add(b53);
Button b54=new Button("Ad");
b54.setBounds(390, 70, 30,30);
b54.setBackground(new Color(255,250,255));
b54.setForeground(Color.red);
p2.add(b54);
Button b55=new Button("Xor");
b55.setBounds(390, 105, 30,30);
b55.setBackground(new Color(255,250,255));
b55.setForeground(Color.red);
p2.add(b55);
Button b56=new Button("Not");
b56.setBounds(390, 140, 30,30);
b56.setBackground(new Color(255,250,255));
b56.setForeground(Color.red);
p2.add(b56);
Button b57=new Button("Int");
b57.setBounds(390, 175, 30,30);
b57.setBackground(new Color(255,250,255));
b57.setForeground(Color.red);
p2.add(b57);
Button b58=new Button("F");
b58.setBounds(390, 210, 30,30);
b58.setBackground(new Color(240,250,210));
b58.setForeground(new Color(200,200,210));
p2.add(b58);
Button b59=new Button("Backspace");
b59.setBounds(275, 40, 70,30);
b59.setBackground(new Color(255,250,255));
b59.setForeground(Color.red);
p2.add(b59);
Button b60=new Button("C");
b60.setBounds(350, 40, 70,30);
b60.setBackground(new Color(255,250,255));
b60.setForeground(Color.red);
p2.add(b60);
tf.addMouseListener(this);
}
public void mouseClicked(MouseEvent e){
tf.setText("");
}
public void mousePressed(MouseEvent e){
}
public void mouseReleased(MouseEvent e){
}
public void mouseEntered(MouseEvent e){
}
public void mouseExited(MouseEvent e){
}
}
class Sam{
public static void main(String args[]){
Cal c = new Cal();
c.setVisible(true);
}
}