I have blogged the installation of OpenOffice 3.0 on Ubuntu 8.10 a few months ago.
OpenOffice 3.1 or a newer version are not in the Ubuntu 9.04 repository. You will get it with Ubuntu 9.10.
You can install Version 3.1 in the same way you installed 3.0 on Ubuntu 8.10.
Add the following source to your software sources as Third-Party-Software sources:
System > Administration > Software Sources, Third Party Software tab, click „Add„
deb http://ppa.launchpad.net/openoffice-pkgs/ubuntu jaunty main deb-src http://ppa.launchpad.net/openoffice-pkgs/ppa/ubuntu jaunty main
Note: Or you add it to „/etc/apt/sources.list“ by hand.
Now you have to add the key for the new software repository:
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 60D11217247D1CFF
On the launchpad page you can get a detailed description about keys and how to add them to your system.
Now you can upgrade to OpenOffice 3.1:
aptitude update aptitude upgrade
Note: You will get the new OpenOffice version over the default update manager, too.