public final class Containers extends Object
Container
s.Modifier and Type | Field and Description |
---|---|
static String |
CREATED_FRAME_NAME
Name of the
JFrame s created by this class. |
Modifier and Type | Method and Description |
---|---|
static FrameFixture |
frameFixtureFor(Container contentPane)
Creates a new
JFrame and uses the given Container as its content pane. |
static FrameFixture |
frameFixtureFor(Robot robot,
Container contentPane)
Creates a new
JFrame and uses the given Container as its content pane. |
static JFrame |
frameFor(Container contentPane)
Creates a new
JFrame and uses the given Container as its content pane. |
static FrameFixture |
showInFrame(Container contentPane)
Creates a new
JFrame and uses the given Container as its content pane. |
static FrameFixture |
showInFrame(Robot robot,
Container contentPane)
Creates a new
JFrame and uses the given Container as its content pane. |
public static final String CREATED_FRAME_NAME
JFrame
s created by this class.@RunsInEDT @Nonnull public static FrameFixture showInFrame(@Nonnull Container contentPane)
JFrame
and uses the given Container
as its content pane. The created JFrame
is wrapped and displayed by a FrameFixture
.
Note:This method creates a new Robot
. When using this method, please do not create any
additional instances of Robot
. Only one instance of Robot
can exist per test class. If you've
created your own Robot
e.g. by extending the base test class, use #showInFrame(Robot, Container)
.
contentPane
- the Container
to use as content pane for the JFrame
to create.FrameFixture
.frameFor(Container)
@RunsInEDT @Nonnull public static FrameFixture showInFrame(@Nonnull Robot robot, @Nonnull Container contentPane)
JFrame
and uses the given Container
as its content pane. The created JFrame
is wrapped and displayed by a FrameFixture
. It uses the given Robot
, if you've created your own
Robot
this method is best for you, if not use #showInFrame(Container)
.robot
- performs user events on the given window and verifies expected output.contentPane
- the Container
to use as content pane for the JFrame
to create.FrameFixture
.frameFor(Container)
@RunsInEDT @Nonnull public static FrameFixture frameFixtureFor(@Nonnull Container contentPane)
JFrame
and uses the given Container
as its content pane. The created JFrame
is wrapped by a FrameFixture
. Unlike showInFrame(Container)
, this method does not
display the created JFrame
.
Note:This method creates a new Robot
. When using this method, please do not create any
additional instances of Robot
. Only one instance of Robot
can exist per test class. If you've
created your own Robot
e.g. by extending the base test class, use
#frameFixtureFor(Robot, Container)
.
contentPane
- the Container
to use as content pane for the JFrame
to create.FrameFixture
.frameFor(Container)
@RunsInEDT @Nonnull public static FrameFixture frameFixtureFor(@Nonnull Robot robot, @Nonnull Container contentPane)
JFrame
and uses the given Container
as its content pane. The created JFrame
is wrapped by a FrameFixture
. Unlike showInFrame(Container)
, this method does not
display the created JFrame
. It uses the given Robot
, if you've created your own Robot
this
method is best for you, if not use #frameFixtureFor(Container)
.robot
- performs user events on the given window and verifies expected output.contentPane
- the Container
to use as content pane for the JFrame
to create.FrameFixture
.frameFor(Container)
@RunsInEDT @Nonnull public static JFrame frameFor(@Nonnull Container contentPane)
JFrame
and uses the given Container
as its content pane. The created JFrame
has the name specified by CREATED_FRAME_NAME
. This method is executed in the Event Dispatch Thread (EDT).contentPane
- the Container
to use as content pane for the JFrame
to create.JFrame
.Copyright © 2014–2019 AssertJ. All rights reserved.