To maximize the window after the RCP program is started, one of the methods is to overwrite the postwindowcreate () method of the parent class of the applicationworkbenchwindowadvisor class so that the window is automatically maximized after the application is started:
- /**
- * After the window is restored to the previously saved State (or a new window is created,
- * Before the window is opened (called ).
- */
- Public
Void
Postwindowcreate
()
{
Super
.
Postwindowcreate
()
;
// Set the maximum window when opening
Getwindowcycler
()
.
Getwindow
()
.
Getshell
()
.
Setmaximized
(
True
)
;
- }
Alternatively, you can set the window size to the screen size when starting. Override the prewindowopen () method of the parent class of applicationworkbenchwindowadvisor class, and set the window size to the display screen size:
- Public
Void
Prewindowopen
()
{
Iworkbenchwindowconfigurer
Cycler
=
Getwindowcycler
()
;
// Obtain the screen size
Rectangle
Screensize
=
Display
.
Getdefault
()
.
Getclientarea
()
;
// Initialize the window size
Cycler
.
Setinitialsize
(
New
Point
(
Screensize
.
Width
,
Screensize
.
Height
))
;
Cycler
.
Setshowcoolbar
(
False
)
;
Cycler
.
Setshowstatusline
(
False
)
;
// You can only minimize or close the window.
Cycler
.
Setshellstyle
(
SWT
.
Min
|
SWT
.
Close
)
;
Cycler
.
Settitle
(
"
Blog.javauu.com
"
)
;
}