can anybody run this code in java and send me the screenshots please.
can anybody run this code in java and send me the screenshots please.
ATTACHMENT PREVIEW Download attachmentWeek 3 Programming AnswersProblem 1:importjava.awt.*;importjavax.swing.*;publicclassCalculatorextendsJFrame{JTextFielddisplay;JPanelbuttonPanel;JButtonbuttons[];Calculator(){super(“Calculator”);display=newJTextField();buttons=newJButton[16];buttons[0] =newJButton(“7”);buttons[1] =newJButton(“8”);buttons[2] =newJButton(“9”);buttons[3] =newJButton(“/”);buttons[4] =newJButton(“4”);buttons[5] =newJButton(“5”);buttons[6] =newJButton(“6”);buttons[7] =newJButton(“*”);buttons[8] =newJButton(“1”);buttons[9] =newJButton(“2”);buttons[10] =newJButton(“3”);buttons[11] =newJButton(“-“);buttons[12] =newJButton(“0”);buttons[13] =newJButton(“.”);buttons[14] =newJButton(“=”);buttons[15] =newJButton(“+”);buttonPanel=newJPanel();

View the AnswerbuttonPanel.setLayout(newGridLayout(4,4,5,5));for(inti = 0, j = 0; i < 16; i++){buttons[i].setFont(newFont(“SanSerif”, Font.BOLD,16));if(i % 4 == 0)j++;if(j++ % 2 == 0){buttons[i].setBackground(Color.BLACK);buttons[i].setForeground(Color.WHITE);}else{buttons[i].setBackground(Color.WHITE);buttons[i].setForeground(Color.BLACK);}buttonPanel.add(buttons[i]);}add(display, BorderLayout.NORTH);add(buttonPanel, BorderLayout.CENTER);setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);setSize(250, 250);setVisible(true);}publicstaticvoidmain(String[] args){Calculator calc=newCalculator();}}Problem 2:importjavax.swing.*;importjava.awt.*;publicclassAlignment{privateJFrameframe;privateJButtonokJButton;privateJButtoncancelJButton;privateJButtonhelpJButton;privateJTextFieldxJTextField;privateJTextFieldyJTextField;

Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"
