Beginning of the constructor

The constructor for the class named Prob08Runner begins in Listing 2.

The only thing that is new in Listing 2

Listing 2. Beginning of the constructor.
  public Prob08Runner(){//constructor
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    slider.setMajorTickSpacing(10);
    slider.setMinorTickSpacing(5);
    slider.setPaintTicks(true);
    slider.setPaintLabels(true);

    mainPanel.setLayout(new BorderLayout());
    titlePanel.add(new JLabel(
                      "Edge Detection Threshold"));
    mainPanel.add(titlePanel,BorderLayout.NORTH);
    mainPanel.add(slider,BorderLayout.CENTER);

    getContentPane().add(mainPanel);
    
    setSize(butterflyWidth + 7,97);
    setLocation(0,butterflyHeight + 25);
    setVisible(true);

    //Produce the initial display with a threshold
    // value of 50, which matches the initial
    // position of the pointer on the slider.
    display = edgeDetector(butterfly,50);

    display.show();
File: bc.htm [Next] [Prev]