Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

GUI Image problem

Featured Replies

Hey everyone, 

 

It's me again with another question..

 

So i've given my GUI a new style. I like it but i want to add an image.

I have searched everywhere on the internetz but i cant find anything that works with OSBOT.

 

I'm pretty much clueless at the moment.

 

If someone can help me and give me a little hint. I don't need all the code but just a little so i can go on my way.

 

Thanks in advance,

 

Sebastian.

 

8Qy3lyd.png

Hey everyone, 

 

It's me again with another question..

 

So i've given my GUI a new style. I like it but i want to add an image.

I have searched everywhere on the internetz but i cant find anything that works with OSBOT.

 

I'm pretty much clueless at the moment.

 

If someone can help me and give me a little hint. I don't need all the code but just a little so i can go on my way.

 

Thanks in advance,

 

Sebastian.

 

8Qy3lyd.png

 

You could add a JLabel with an icon set like so:

JLabel jLabel = new JLabel();
try {
    Image image = ImageIO.read(YourClass.class.getResourceAsStream("/resources/image.png"));
    ImageIcon imageIcon = new ImageIcon(image);
    jLabel.setIcon(imageIcon);
} catch (IOException e) {
    e.printStackTrace();
}

Or you could add a custom JPanel with its paintComponent method overriden:

public final class ImagePanel extends JPanel {

    private final BufferedImage image;

    public ImagePanel(final String imagePath) {
        image = ImageIO.read(ImagePanel.class.getResourceAsStream(imagePath));
    }

    @[member=Override]
    public final void paintComponent(final Graphics g) {
        super.paintComponent(g);
        g.drawImage(image, 0, 0, image.getWidth(), image.getHeight(), null);
    }
}
  • Author

 

You could add a JLabel with an icon set like so:

JLabel jLabel = new JLabel();
try {
    Image image = ImageIO.read(YourClass.class.getResourceAsStream("/resources/image.png"));
    ImageIcon imageIcon = new ImageIcon(image);
    jLabel.setIcon(imageIcon);
} catch (IOException e) {
    e.printStackTrace();
}

Or you could add a custom JPanel with its paintComponent method overriden:

public final class ImagePanel extends JPanel {

    private final BufferedImage image;

    public ImagePanel(final String imagePath) {
        image = ImageIO.read(ImagePanel.class.getResourceAsStream(imagePath));
    }

    @[member='Override']
    public final void paintComponent(final Graphics g) {
        super.paintComponent(g);
        g.drawImage(image, 0, 0, image.getWidth(), image.getHeight(), null);
    }
}

 

Thank you, kind sir!

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.