<< 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

what is biology
Hajah Reply
the study of living organisms and their interactions with one another and their environments
AI-Robot
what is biology
Victoria Reply
HOW CAN MAN ORGAN FUNCTION
Alfred Reply
the diagram of the digestive system
Assiatu Reply
allimentary cannel
Ogenrwot
How does twins formed
William Reply
They formed in two ways first when one sperm and one egg are splited by mitosis or two sperm and two eggs join together
Oluwatobi
what is genetics
Josephine Reply
Genetics is the study of heredity
Misack
how does twins formed?
Misack
What is manual
Hassan Reply
discuss biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles
Joseph Reply
what is biology
Yousuf Reply
the study of living organisms and their interactions with one another and their environment.
Wine
discuss the biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles in an essay form
Joseph Reply
what is the blood cells
Shaker Reply
list any five characteristics of the blood cells
Shaker
lack electricity and its more savely than electronic microscope because its naturally by using of light
Abdullahi Reply
advantage of electronic microscope is easily and clearly while disadvantage is dangerous because its electronic. advantage of light microscope is savely and naturally by sun while disadvantage is not easily,means its not sharp and not clear
Abdullahi
cell theory state that every organisms composed of one or more cell,cell is the basic unit of life
Abdullahi
is like gone fail us
DENG
cells is the basic structure and functions of all living things
Ramadan
What is classification
ISCONT Reply
is organisms that are similar into groups called tara
Yamosa
in what situation (s) would be the use of a scanning electron microscope be ideal and why?
Kenna Reply
A scanning electron microscope (SEM) is ideal for situations requiring high-resolution imaging of surfaces. It is commonly used in materials science, biology, and geology to examine the topography and composition of samples at a nanoscale level. SEM is particularly useful for studying fine details,
Hilary
cell is the building block of life.
Condoleezza Reply
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