October 28th, 2014
Input using a GUI:
import javax.swing.JFrame; import javax.swing.JOptionPane; public class PaneInput { public static void main(String[] args) { // Construct a frame and show it JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); JOptionPane.showMessageDialog(frame, "Click OK to continue"); } }
Exercise:
1. Write a GUI application, YI_MyFlag.java and its JFrame class to draw your favorite flag.
2. Write a GUI application, YI_Car.java and its JFrame class to draw a car like the one in the picture.
3. Write a GUI application, YI_BullEye.java and its JFrame class to draw the picture.
4. Write a GUI application, YI_OlympicRings.java and its JFrame class to draw famous rings.