
Explanation of Solution
Program code:
//import the required header files
import java.awt.*;
import javax.swing.*;
import javax.swing.border.Border;
//define a class
public class PanelExample
{
//define a constructor
PanelExample()
{
//create a border
Border blackline = BorderFactory.createLineBorder(Color.BLUE, 2);
//creating JFrame
JFrame f= new JFrame("Panel Example");
//creating instance of panel
JPanel panel=new JPanel();
//setting the size
panel.setBounds(40,80,200,200);
//setting the border
panel.setBorder(blackline);
//add panel to the frame
f.add(panel);
//setting the size
f.setSize(400,400);
//set the layout
f...

Want to see the full answer?
Check out a sample textbook solution
Chapter 12 Solutions
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTNp Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:CengageNew Perspectives on HTML5, CSS3, and JavaScriptComputer ScienceISBN:9781305503922Author:Patrick M. CareyPublisher:Cengage Learning
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage


