Asssignment 5 code: app.java public class app { public static void main(String a
ID: 3670005 • Letter: A
Question
Asssignment 5 code:
app.java
public class app
{
public static void main(String args[])
{
myJFrame mjf = new myJFrame();
}
}
myJFrame.java
import java.awt.*;
import javax.swing.*;
public class myJFrame extends JFrame
{
public myJFrame ()
{
super ("My First Frame");
myJPanel mjp = new myJPanel();
getContentPane().add(mjp,"Center");
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize (800, 480);
setVisible(true);
}
}
myJPanel.java
import java.awt.*;
import javax.swing.*;
public class myJPanel extends JPanel
{
public myJPanel ()
{
super ();
GridLayout grid = new GridLayout(1,1);
setLayout(grid);
//try commenting the two lines above to run the lab without a layout
setBackground(Color.green);
PanelLeft left = new PanelLeft();
PanelRight right = new PanelRight();
add(left);
add(right);
}
}
PanelLeft.java
import java.awt.*;
import javax.swing.*;
public class PanelLeft extends JPanel
{
public PanelLeft ()
{
super ();
GridLayout grid = new GridLayout(1,1);
setLayout(grid);
//try commenting the two lines above to run the lab without a layout
setBackground(Color.pink);
JButton jb1 = new JButton("I belong to panel left");
add(jb1);
}
}
PanelRight.java
import java.awt.*;
import javax.swing.*;
public class PanelRight extends JPanel
{
public PanelRight ()
{
super ();
GridLayout grid = new GridLayout(3,1);
setLayout(grid);
//try commenting the two lines above to run the lab without a layout
setBackground(Color.red);
JButton jb1 = new JButton("I belong to panel right");
JButton jb2 = new JButton("Hi");
jb2.setBackground(Color.red);
JButton jb3 = new JButton("I am a JButton)");
add(jb1);
add(jb2);
add(jb3);
}
}
If you can complete the required assignment with out this code that will work. Thanks
UML Diagrams What will you learn and Use Case diagra Deliverables Class diagram for Assignment 5 Use Case diagram for Assignment 5 Format: PDF Based on your solution of Assignment 5, create a Class diagram Use Case diagramExplanation / Answer
I think ypou have not posted complete question here. There is no image or UML diagram.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.