Page 96 - Demo
P. 96
public MakinaLlogaritese2(){ windowContent= new JPanel(); p1 = new JPanel(); GridLayout gl =new GridLayout(4,3); p1.setLayout(gl); //Add window controls to the panel p1 tasti0=new JButton(“0”); tasti1=new JButton(“1”); tasti2=new JButton(“2”); tasti3=new JButton(“3”); tasti4=new JButton(“4”); tasti5=new JButton(“5”); tasti6=new JButton(“6”); tasti7=new JButton(“7”); tasti8=new JButton(“8”); tasti9=new JButton(“9”); pike=new JButton(“.”); barazim=new JButton(“=”); p1.add(tasti1); p1.add(tasti2); p1.add(tasti3); p1.add(tasti4); p1.add(tasti5); p1.add(tasti6); p1.add(tasti7); p1.add(tasti8); p1.add(tasti9); p1.add(pike); p1.add(barazim); windowContent.add(“Center”,p1); //krijimi i dritares dhe vendosje e panelit JFrame dritare = new JFrame(“Makina Llogaritese 2”); dritare.setContentPane(windowContent); dritare.pack(); // shfaqja e dritare dritare.setSize(400,200); dritare.setVisible(true); }• Përfundimisht, në klasën ku ndodhet funksioni Main shkruajmë:public class main{public static void main(String[] args){MakinaLlogaritese2 makinaIme = new MakinaLlogaritese2(); }}TEMATIKA 4 JAVA94

