It is not uncommon for fish to swim up and down the glass but may appear to be something to be concerned about. This is normally not something to worry about though. You will often find this is done in the corner of the aquarium and the reason why fish may be doing this is due to following their reflection or simply of boredom. Although we think of our tropical fish as fairly intelligent animals, a reflection is something which may confuse and excite them in to constant swimming up and down the glass.
This fish behavior is normally observed when a fish is first introduced to the aquarium whilst they are trying to find their feet and way around and will normally stop after some time, normally a week or so. It is also common to see fish fry and younger fish swimming up and down the glass playing with their reflection, they are still young though and learning the ropes as it were, again, nothing to worry about.
If there is little else in the tank then give the fish something to swim in and around so they can keep themselves entertained such as plants, wood and rocks (depending on the type of fish you keep).
The only time it may be worth looking further in to if your tropical fish swim up and down the glass and do not appear to be eating. As with most fish disease and issues, lack of feeding is always cause for concern although the swimming up and down the glass may just be something they would do anyway. It could be worth changing type of food if they are not eating and are a new introduction to the tank however immediate action may not be required, most tropical fish can go for weeks without food so closer observation is advised to see if there are any signs of other stress related diseases.
In summary, if your tropical fish is swimming up and down the glass constantly there is nothing to worry about, they will soon work out they cannot do anything with their reflection and settle in to the tank and environment.