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.

System Tray class

Featured Replies

import java.awt.AWTException;
import java.awt.Image;
import java.awt.MenuItem;
import java.awt.PopupMenu;
import java.awt.SystemTray;
import java.awt.TrayIcon;
import java.awt.event.ActionListener;

public class Tray {
    
    private PopupMenu popup;
    private final TrayIcon tray;
    
    private final String scriptName;
    private boolean showing = false;
    
    public Tray(Image image, String scriptName) {
        this.tray = new TrayIcon(image, scriptName);
        this.scriptName = scriptName;
    }
    
    public void show() throws AWTException {
        if (SystemTray.isSupported()) {
            if (this.tray != null) {
                this.tray.setToolTip(this.scriptName);
                this.tray.setImageAutoSize(true);
                SystemTray.getSystemTray().add(this.tray);
                this.showing = true;
            }
        } else {
            throw new AWTException("System Tray is not supported!");
        }
    }
    
    public void hide() {
        if(this.showing == true && this.tray != null) {
            SystemTray.getSystemTray().remove(tray);
            this.showing = false;
        }
    }
    
    public void addMenuItem(MenuItem item, ActionListener listener) {
        item.addActionListener(listener);
        this.popup.add(item);
        if(this.tray != null)
            this.tray.setPopupMenu(popup);
    }
    
    public void sendDisplayMessage(String message, TrayIcon.MessageType type) {
        if(this.showing == true)
            this.tray.displayMessage(this.scriptName, message, type);
    }
}

Example usage...

        final Tray tray = new Tray(ImageIO.read(new URL("http://i.imgur.com/HGN98TQ.gif")), "Cool Script");
        tray.addMenuItem(new MenuItem("Hide"), new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                tray.hide();
            }
        });
        tray.show();
        tray.sendDisplayMessage("Cool Script initalized!", TrayIcon.MessageType.INFO);
Guest
This topic is now closed to further replies.

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.