Can anyone help me debug this Java program? Below is a section of the program th
ID: 3853394 • Letter: C
Question
Can anyone help me debug this Java program?
Below is a section of the program that does not need debugging - but wasn't sure if you needed to see it.
The section below shows no errors but should show the JFrame which it does not.
code to copy
public class SomeRandomFrameTest
{
public static void main( String[] args )
{
SomeRandomFrame typingT utorFrame = new SomeRandomFrame();
typingT utorFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
typingT utorFrame.setSize( 600, 400 );
}
}
(remove spaces in T utor)
ITCS-2590 Debugging Execise Chapter 14- NetBeans IDE 8.2 File Edit View Navigate Source Refactor Run Debug Profile Teem Tools Window Help Search (Ct1+) Projects X 93b · TCS-2590 Debugging Exercise 1013 Source History private JLabel bullaevetabel 21 1TC5-2990 Debugging Exercise public SomeRandomFrame ) Source Packages 23 24 25 26 27 28 29 super ( Some Random Frame") setLayout (new BorderLayout O) bulseye.jpg Test Packages someSil1yNORTHLabel - new JLabel ("Hello, from Some Random Label NORTH!" somesi1lyNORTHLabel.setHorizontalAlignment (SwingConstants.CENTER) add (someSillyNORTHLabel, BorderLayoutNORT): · «default package> Lbraries Test Libraries 31 somesil1ySOUTHLablnew JLabel ("Hello, Erom Some Random Label SOUTH!) aomesi11ySOUTHLabel.setHorizontalAl1gnment (SwingConstants. CENTER): add (someSillysOUTHLabel, BorderLayout SOUTH): ITCS-2590 Debugging Exercse dao 32 34 35 36 37 someSillyEASTLabel-new JLabel ("EAS >>>>"); somesi1lyEASTLabel.aetHorizontalAlignment (SwingConatants. CENTER) add (someSillyEASTLabe, BorderLayout. EAST) 39 40 41 42 43 someSillyNESTLabel-new JLabel (WEST" somesi1lyNESTLabel.aetHorizontalAlignment (SwingConatants. CENTER) add(someSillyNESTLabel, BorderLayout-REST); bullseye- new ImageIcon (getclass getResource ("bullseye-jpg")) bu11aeyeLabe! = new JLabel("", bul 1a eye, Swingconstants. CE,NTER); add (bullseyeLabel, BorderLayout.CENTER): 45 46 Test Results X Output ITCS-2590 Debugging Exercise Chapter 14 (run)X INS 10:22 AM Type here to search 7/1/2017 2Explanation / Answer
You need to make two changes
1. extends JFrame in SomeRandomFrame class and import JFrame
import javax.swing.JFrame;
public class SomeRandomFrame extends JFrame{
//all your code here
}
2. import JFame and setVisibility of frame to true, in SomeRandomFrameTest class
import javax.swing.JFrame;
public class SomeRandomFrameTest
{
public static void main( String[] args )
{
SomeRandomFrame typingFrame = new SomeRandomFrame();
typingFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
typingFrame.setSize( 600, 400 );
typingFrame.setVisible(true);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.