<< Chapter < Page
  Digital signal processing - dsp     Page 16 / 27
Chapter >> Page >
Listing 16. Make all pages invisible.
Page tempPage = null; for(int cnt = 0;cnt<(pageLinks.size()); cnt++){tempPage = pageLinks.get(cnt); tempPage.setVisible(false);}//end for loop

Make the pages visible in reverse order

The code in Listing 17 iterates on the ArrayList object again, accessing the references to the Page objects in reverse order and setting the value of the visible property for each Page object to true. This results in page 0 (the page with the earliest data) being on the top of the stack.

Listing 17. Make the pages visible in reverse order.
for(int cnt = pageLinks.size() - 1;cnt>= 0; cnt--){tempPage = pageLinks.get(cnt); tempPage.setLocation(xCoor,yCoor);tempPage.setVisible(true); }//end for loop}//end plotData(int xCoor,int yCoor)

Set the location of the stack

In addition, the code in Listing 17 sets the location property of each Page object to the coordinate values received as incoming parameters to the plotData method. This causes the stack of Page objects to appear in the specified location on the screen.

The other overloaded version of the plotData method

The other overloaded version of the plotData method is shown in its entirety in Listing 18 .

Listing 18. The other overloaded version of the plotData method.
void plotData(){ plotData(0,0);//call overloaded version}//end plotData()

This version receives no incoming parameters. The body of the method simply calls the first overloaded version discussed above, passing coordinate values as0,0 as parameters. As explained earlier, this causes the stack of Page objects to appear in the upper left corner of the screen.

The Page class

The Page class is a member class of the class named PlotALot01 . As such, methods belonging to objects of the Page class have direct access to all of the other members of the enclosing PlotALot01 object, including instance variables belonging to the PlotALot01 object.

(If you are unfamiliar with member classes, see the module titled The Essence of OOP using Java, Member Classes .)

Potentially many page objects...

A PlotALot01 object may own as many Page objects as are required to plot all of the data values that are fed to it.

(The reference to each Page object is stored in an ArrayList object belonging to the PlotALot01 object.)

The Page class, which extends the Frame class begins, in Listing 19 . The constructor for the Page class also begins in Listing 19 .

Listing 19. Beginning of the class named Page.
class Page extends Frame{ MyCanvas canvas;int sampleCounter; Page(String title){//constructorcanvas = new MyCanvas(); add(canvas);setSize(frameWidth,frameHeight); setTitle(title + " Page: " + pageCounter);setVisible(true);

The Page class begins by declaring two instance variables. The instance variable named canvas will hold a reference to an object of the MyCanvas class upon which the data will actually be plotted.

The other instance variable will hold the value of a sample counter.

The constructor for the page class

The constructor that begins in Listing 19 instantiates an object of a member class named MyCanvas and stores its reference in the reference variable named canvas . Then it adds the MyCanvas object to the default center location of the Page ( Frame ) .

Questions & Answers

if three forces F1.f2 .f3 act at a point on a Cartesian plane in the daigram .....so if the question says write down the x and y components ..... I really don't understand
Syamthanda Reply
hey , can you please explain oxidation reaction & redox ?
Boitumelo Reply
hey , can you please explain oxidation reaction and redox ?
Boitumelo
for grade 12 or grade 11?
Sibulele
the value of V1 and V2
Tumelo Reply
advantages of electrons in a circuit
Rethabile Reply
we're do you find electromagnetism past papers
Ntombifuthi
what a normal force
Tholulwazi Reply
it is the force or component of the force that the surface exert on an object incontact with it and which acts perpendicular to the surface
Sihle
what is physics?
Petrus Reply
what is the half reaction of Potassium and chlorine
Anna Reply
how to calculate coefficient of static friction
Lisa Reply
how to calculate static friction
Lisa
How to calculate a current
Tumelo
how to calculate the magnitude of horizontal component of the applied force
Mogano
How to calculate force
Monambi
a structure of a thermocouple used to measure inner temperature
Anna Reply
a fixed gas of a mass is held at standard pressure temperature of 15 degrees Celsius .Calculate the temperature of the gas in Celsius if the pressure is changed to 2×10 to the power 4
Amahle Reply
How is energy being used in bonding?
Raymond Reply
what is acceleration
Syamthanda Reply
a rate of change in velocity of an object whith respect to time
Khuthadzo
how can we find the moment of torque of a circular object
Kidist
Acceleration is a rate of change in velocity.
Justice
t =r×f
Khuthadzo
how to calculate tension by substitution
Precious Reply
hi
Shongi
hi
Leago
use fnet method. how many obects are being calculated ?
Khuthadzo
khuthadzo hii
Hulisani
how to calculate acceleration and tension force
Lungile Reply
you use Fnet equals ma , newtoms second law formula
Masego
please help me with vectors in two dimensions
Mulaudzi Reply
how to calculate normal force
Mulaudzi
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Digital signal processing - dsp. OpenStax CNX. Jan 06, 2016 Download for free at https://legacy.cnx.org/content/col11642/1.38
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Digital signal processing - dsp' conversation and receive update notifications?

Ask