Wiki

Clone wiki

ExperimentTool / C4 Adding an image to Brownie

How to add an image on Brownie?

There are two different ways to add an image into your Brownie experiment:

The first option is to do this on WindowBuilder's design mode. You can set this using the "icon" attribute of a JButton/JLabel, or any swing component that you wish to add the image to, as follows:

Add image.png

P.S.: You might find helpful to watch a tutorial about "Installing Java WindowBuilder (Gui Designer Plugin ) on Eclipse" if you haven't installed it yet: https://www.youtube.com/watch?v=oeswfZz4IW0

An alternative way:

a) Place the image in your experiment's subfolder: for example:

edu.kit.exp.impl.trustgame.client.resources\ user_male.png

b) On windowbuilder, create a JLabel , and then use the following code to point to the image.

private JLabel lblLogo = new JLabel(); lblLogo.setIcon(new ImageIcon(TrustGameResult.class.getResource("/edu/kit/exp/impl/trustgame/client/resources/user_male.png")));

c) All file formats supported by swing are supported. Other multimedia may be embedded similarly.

Updated