Sale!

25 1 Complete case for problem 1 in paint method to draw the following shape based on current

Original price was: $10.00.Current price is: $5.00.

-50%

Download button will appear immediately after successful payment.

Full support will be provided with necessary files installation.

Get impeccable customized solution within 24 hours, hassle-free.

(6 customer reviews)

Free worldwide shipping on all orders over $50

  • 30 days easy returns
  • Order yours before 2.30pm for same day dispatch
Guaranteed Safe Checkout

Java, Please help with my code, Need my draw lines to be exact like in pictureimport java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.JOptionPane; public class Homework2 extends Frame implements ActionListener { String command = ""; public static void main(String[] args) { Frame frame = new Homework2(); frame.setResizable(true); frame.setSize(900,800); frame.setVisible(true); } public Homework2() { setTitle("Homework2 - CSC 229 - Seyed"); // Create Menu MenuBar mb = new MenuBar(); setMenuBar(mb); Menu fileMenu = new Menu("File"); mb.add(fileMenu); MenuItem miAbout = new MenuItem("About"); miAbout.addActionListener(this); fileMenu.add(miAbout); MenuItem miExit = new MenuItem("Exit"); miExit.addActionListener(this); fileMenu.add(miExit); Menu actionMenu = new Menu("Shapes"); mb.add(actionMenu); MenuItem miP1 = new MenuItem("Problem 1"); miP1.addActionListener(this); actionMenu.add(miP1); MenuItem miP2 = new MenuItem("Problem 2"); miP2.addActionListener(this); actionMenu.add(miP2); // End program when window is closed WindowListener l = new WindowAdapter() { public void windowClosing(WindowEvent ev) { System.exit(0); } public void windowActivated(WindowEvent ev) { repaint(); } public void windowStateChanged(WindowEvent ev) { repaint(); } }; ComponentListener k = new ComponentAdapter() { public void componentResized(ComponentEvent e) { repaint(); } }; // register listeners this.addWindowListener(l); this.addComponentListener(k); } //****************************************************************************** // called by windows manager whenever the application window performs an action // (select a menu item, close, resize, .... //****************************************************************************** public void actionPerformed (ActionEvent ev) { // figure out which command was issued command = ev.getActionCommand(); // take action accordingly switch(command) { case "About": { repaint(); break; } case "Exit": { System.exit(0); } case "Problem 1": { repaint(); break; } case "Problem 2": { repaint(); break; } } } //******************************************************** // called by repaint() to redraw the screen //******************************************************** public void paint(Graphics g) { int ww = (int) this.getWidth(); // current width of the window int wh = (int) this.getHeight(); // current height of the window int s = 40; // Check Command issued, take action accordingly switch(command) { case "About": { break; } case "Exit": { System.exit(0); } case "Problem 1": { break; } case "Problem 2": { break; } } } }
25 1 Complete case for problem 1 in paint method to draw the following shape based on current
$10.00 Original price was: $10.00.$5.00Current price is: $5.00.

Java, Please help with my code, Need my draw lines to be exact like in pictureimport java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import javax.swing.JOptionPane;

public class Homework2 extends Frame implements ActionListener

{

String command = “”;

public static void main(String[] args)

{

Frame frame = new Homework2();

frame.setResizable(true);

frame.setSize(900,800);

frame.setVisible(true);

}

public Homework2()

{

setTitle(“Homework2 – CSC 229 – Seyed”);

// Create Menu

MenuBar mb = new MenuBar();

setMenuBar(mb);

Menu fileMenu = new Menu(“File”);

mb.add(fileMenu);

MenuItem miAbout = new MenuItem(“About”);

miAbout.addActionListener(this);

fileMenu.add(miAbout);

MenuItem miExit = new MenuItem(“Exit”);

miExit.addActionListener(this);

fileMenu.add(miExit);

Menu actionMenu = new Menu(“Shapes”);

mb.add(actionMenu);

MenuItem miP1 = new MenuItem(“Problem 1”);

miP1.addActionListener(this);

actionMenu.add(miP1);

MenuItem miP2 = new MenuItem(“Problem 2”);

miP2.addActionListener(this);

actionMenu.add(miP2);

// End program when window is closed

WindowListener l = new WindowAdapter()

{

public void windowClosing(WindowEvent ev)

{

System.exit(0);

}

public void windowActivated(WindowEvent ev)

{

repaint();

}

public void windowStateChanged(WindowEvent ev)

{

repaint();

}

};

ComponentListener k = new ComponentAdapter()

{

public void componentResized(ComponentEvent e)

{

repaint();

}

};

// register listeners

this.addWindowListener(l);

this.addComponentListener(k);

}

//******************************************************************************

// called by windows manager whenever the application window performs an action

// (select a menu item, close, resize, ….

//******************************************************************************

public void actionPerformed (ActionEvent ev)

{

// figure out which command was issued

command = ev.getActionCommand();

// take action accordingly

switch(command)

{

case “About”:

{

repaint();

break;

}

case “Exit”:

{

System.exit(0);

}

case “Problem 1”:

{

repaint();

break;

}

case “Problem 2”:

{

repaint();

break;

}

}

}

//********************************************************

// called by repaint() to redraw the screen

//********************************************************

public void paint(Graphics g)

{

int ww = (int) this.getWidth(); // current width of the window

int wh = (int) this.getHeight(); // current height of the window

int s = 40;

// Check Command issued, take action accordingly

switch(command)

{

case “About”:

{

break;

}

case “Exit”:

{

System.exit(0);

}

case “Problem 1”:

{

break;

}

case “Problem 2”:

{

break;

}

}

}

}