Question: Java -- IntelliJ TODO: Create circle, mandelbrot, and sierpinski panels in a scroll pane like the line above (3 new lines) TODO: Create cardLayout (field
Java -- IntelliJ TODO: Create circle, mandelbrot, and sierpinski panels in a scroll pane like the line above (3 new lines) TODO: Create cardLayout (field already declared above, just new it up) (1 line) TODO: Create fractalCards panel (field already declared above) and set its layout to cardLayout (1-2 lines)
These To-Do's are also in the script where the tasks lines are needed.
Class: FractalDriver
package fractal; import java.awt.*; import java.awt.event.*; import javax.swing.*; /** */ public class FractalDriver { private static final int WIDTH = 350; private static final int HEIGHT = 300; private static final String CANTOR = "Cantor"; private static final String CIRCLE = "Circle"; private static final String MANDELBROT = "Mandelbrot"; private static final String SIERPINSKI = "Sierpinski"; private static final String[] allFractals = {CANTOR, CIRCLE, MANDELBROT, SIERPINSKI}; private JFrame frame; private CardLayout cardLayout; private JPanel fractalCards; private JComboBox fractalChooser; /** * Create a FractalDriver */ public FractalDriver() { makeFrame(); } /** * Create the FractalDriver GUI */ private void makeFrame() { frame = new JFrame("Fractals!"); frame.setSize(WIDTH, HEIGHT); frame.setLayout(new BorderLayout()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); createContents(); frame.setVisible(true); } /** * Create the contents of the main window * A combo box at the top controls selection of which fractal panel is displayed */ private void createContents() { JScrollPane cantorPane = new JScrollPane(new CantorPanel(6)); // TODO: Create circle, mandelbrot, and sierpinski panels in a scroll pane like the line above (3 new lines) // TODO: Create cardLayout (field already declared above, just new it up) (1 line) // TODO: Create fractalCards panel (field already declared above) and set its layout to cardLayout (1-2 lines) frame.add(cantorPane, BorderLayout.CENTER); // TODO: Remove this line once the rest is set up } /** * Listen to the combo box and switch the displayed fractal when the selection changes */ private class ComboListener implements ActionListener { public void actionPerformed(ActionEvent e) { } } public static void main(String[] args) { new FractalDriver(); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
