Originally Posted by
Brandon
...
Try setting your Frame's dimensions to 800x600 and see if your applet displays. If it does, then you need to size properly:
Java Code:
//ClientApplet.java://applet = (Applet) loader.loadClass(...).newInstance()applet.
setStub(this);applet.
setPreferredSize(new Dimension(width, height
));applet.
setSize(width, height
);this.
add(applet,
BorderLayout.
CENTER);@Override
public void appletResize
(int width,
int height
) { applet.
setSize(width, height
);}
Not sure how you managed RS3 but can't do a private client or OSRS.. Weird..
Ah thank you, I'll try this out. I managed to do RS3, because your tutorial is just that good
Originally Posted by
jstemper
Can confirm this works...
Thank you for trying it out and confirming it works!
EDIT:
I tried this and got it to work! Thank you two.
I now did it another way without using the splash screen.
This is my displayFrame method:
Code:
private static void displayFrame(int width, int height) {
JFrame frame = new JFrame("Eos");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setResizable(false);
centerFrame(frame);
ClientApplet applet = new ClientApplet(width, height);
frame.add(applet);
applet.start();
frame.revalidate();
frame.pack();
centerFrame(frame);
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
frame.setVisible(false);
applet.stop();
frame.dispose();
super.windowClosed(e);
}
});
}
and this is my applet.start method:
Code:
public void start() {
if (applet != null) {
applet.init();
applet.start();
while(applet.getComponentCount() < 1 && Configuration.RUNESCAPE_CLIENT) {
try {
Thread.sleep(10);
} catch(Exception e) {
}
}
}
}
The only aesthetic problem I currently have is that there is first this small window being shown and after that it transforms to the 800x600 window
And for some reason I can't login to the server, because I get this error:
Code:
Exception in thread "Thread-3" java.lang.NullPointerException
at Client.openSocket(Client.java:869)
at Client.login(Client.java:8115)
at Client.processLoginScreenInput(Client.java:12871)
at Client.processGameLoop(Client.java:3407)
at RSApplet.run(RSApplet.java:197)
at Client.run(Client.java:5894)
at java.lang.Thread.run(Thread.java:745)
I hope someone could tell me why I get this error. When I use the original client.jar it just works fine.
It sometimes also gives this error:
Code:
Error:(97, 15) java: cannot find symbol
symbol: method addPaintListener(eos.listeners.PaintListener)
location: variable canvas of type java.awt.Canvas
That is on the second line of this code:
Code:
public static void notifyCanvasReady(Canvas canvas) {
canvas.addPaintListener((PaintListener) g -> {
g.setColor(Color.white);
g.drawString("HELLO WORLD", 50, 50);
});
}
While I got this code in my Canvas class (in my java.awt package):
Code:
public void addPaintListener(PaintListener listener) {
paintListener = (PaintListener)AWTEventMulticaster.addInternal(paintListener, listener);
}