Skip to main content

Changing Title

1 reply [Last post]
Joined: 2008-01-23

Hello -

I'm trying to figure out how to change the title in my project. I'm still fairly new to BD-J and I'm still having to feel my way around to get things to work correctly, so please bear with me. :)

The following code comes from the HDCookbook (I stripped out the debug lines) -

public synchronized void selectTitle(Title title)
if (this.titleContext == null) {
try {
ServiceContextFactory scf = ServiceContextFactory.getInstance();
this.titleContext = ((TitleContext)scf.getServiceContext(this.xletContext));
catch (ServiceContextException ignored) {

this.titleContext.start(title, false);

At this point, I've got this method in my project, but I can't figure out how to run it. I'm confused by the 'title' param - what needs to get passed into selectTitle() for it to run?

I'm grateful for any help!

- Aaron

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2007-06-25

As shown here :

//--If you have your TitleContext instance (titleContext )
TitleContext tc = (TitleContext)factory.getServiceContext(xtc);
SIManager manager = SIManager.createInstance();
//-- her et is the id. of your Title
BDLocator loc = new BDLocator(null, t, -1);
//-- You get the "Title" entity by :
Title title = (Title)manager.getService(loc);

This is what you should pass to selectTitle().