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.
here is the second witch has a error that i cant figure out.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 ); } }
plz no flaming im here to learnCode: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 } }
-Thanks
-RebelCoder
Last edited by RebelCoder; 10-23-2011 at 05:01 PM.
but cause of this error it wont let me compileCode:warning 1: Build path specifies execution environment JavaSE-1.6. There are no JREs installed in the workspace that are strictly compatible with this environment. Learning Java Build path JRE System Library Problem
I would recommend using an IDE as opposed to performing command line compilation. This is much easier. Simple IDE's include Eclipse, or JCreator. A more advanced one is Netbeans. I would recommend using JCreator, as it requires you to learn correct syntax.
Download it here:
JCreator — Java IDE
I use Netbeans for everything...Regardless of size. xD
We use JCreator in school .
I believe that the first piece of code is one of the basic codes .
You're making sort of a window.
You can use something like this too :
class FirstProgram {
public static void main (String args[]) {
System.out.println("Hello World");
}
}
[IMG]https://i1114.photobucke*****m/albums/k538/ImminentJM/takari.png[/IMG]