hey guys i just started learning java due to hosting a rsps and no coder
so i have 2 codes that ive been studying out of a book i need to know if this code could relate to RSPS coding or rsbot scripting
here is the first code.
Code:
import javax.swing.*;
public class TheBasics {
public static void main( String[] args ){
JFrame frame = new JFrame( "Hello Basics!");
JLabel label = new JLabel("Hello, Basics!", JLabel.CENTER);
frame.add( label );
frame.setSize( 300, 300);
frame.setVisible( true );
}
}
here is the second witch has a error that i cant figure out.
Code:
import java.awt.*;
import javax.swing.*;
class HelloComponent extends JComponent {
public void paintComponent( Graphics g ) {
g.drawString( "Hello, Component!", 125, 95);
HelloComponent hello = new HelloComponent();
frame.add( hello ); // im pretty sure this is the error havnt double checked tho
}
}
plz no flaming im here to learn
-Thanks
-RebelCoder