3

I am developing a java application using SWT on mac.The application shows SWT as its title and i wanted to change it.I saw this SWT on OS X: change application name question and wanted to use Display.setAppName() but it should be used before i initialize any display as per the answer.Unfortunately i have declared my Display variable as static which will be initialized at the start of the app.How and where should i put this code so that it will be executed first before static variables are initialized.

Community
  • 1
  • 1
user3437315
  • 270
  • 4
  • 13

1 Answers1

2

You can put them in the static blocks which get executed first .

static{
Display.setAppName()
}

See In what order do static blocks and initialization blocks execute when using inheritance? to learn more

Community
  • 1
  • 1
Santhosh
  • 8,181
  • 4
  • 29
  • 56