|
|
Books:
Free:
Java PDF Book
Not Free:
Hard Copy
Another Hard Copy
eBook
Tutorials/Snippets:
Tuts For JAVA SE
Resources:
Tools by oracle
Programs Built For Coding Purposes:
Eclipse
IntelliJ
NetBeans
NotePad++
Java Programming Help Forums:
DreamInCode(DIC for Short)
Java Programming Forums
Some Basic Coding And Understanding:
(Using the 2 Class Method)
Class1.java
Code:import javax.swing.JFrame; public class Class1 { public static void main(String[] args) { Class2 mainframe = new Class2(); mainframe.setSize(420,315); mainframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); mainframe.setResizable(false); mainframe.setVisible(true); } }Spoiler for Explaining Class1.java:
Class2.java
Code:import java.awt.FlowLayout; import javax.swing.JFrame; public class Class2 extends JFrame { public Class2(){ super(""); setLayout( new FlowLayout()); } }Spoiler for Explaining Class2.java:
Assuming You have a basic knowledge Of Java, Lets Get to a little programming, In This Part of The tutorial i will be teaching you how to make a simple Calculator that the problem displays into a jframe.
Class1.java Will Stay The Same: Don't Edit it threw out this part of the tutorial
Class2.java
Code:import java.awt.FlowLayout; import java.util.*; import javax.swing.JFrame; import javax.swing.JLabel; public class Class2 extends JFrame { private JLabel sum2; Scanner input = new Scanner (System.in); int num1 = 0; int num2 = 0; int sum = num1 + num2; public Class2(){ super(""); setLayout( new FlowLayout()); System.out.printf("First Number:"); num1 = input.nextInt(); System.out.printf("Second Number:"); num2 = input.nextInt(); sum = num1 + num2; sum2 = new JLabel(""+num1+" + "+num2+" = "+sum); add(sum2); } }
Spoiler for Explaining Class2.java Update:
Class1.java
Code:import javax.swing.JFrame; public class Class1 { public static void main(String[] args) { Class2 mainframe = new Class2(); mainframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); mainframe.setSize(250,120); mainframe.setVisible(true); mainframe.setResizable(false); } }
Class2.java
Code:import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; public class Class2 extends JFrame { private JLabel username; private JTextField username2; private JLabel password; private JTextField password2; private JButton login; public Class2(){ super("Dashboard"); setLayout( new FlowLayout()); username = new JLabel ("Username: "); add(username); username2 = new JTextField("",12); add(username2); password = new JLabel ("Password: "); add(password); password2 = new JTextField("",12); add(password2); login = new JButton (" Login "); add(login, FlowLayout.TRAILING); login.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if(username2.getText().equals("Kevin") && password2.getText().equals("IDK")) System.out.println("Welcome Kevin!"); else if(username2.getText().equals("Rune-Server") && password2.getText().equals("Baws")) System.out.println("Well isnt that just Baws."); else{ System.out.println("Username or password incorrect."); } } }); } }
Hope you can learn something from this, If you have any questions: Reply Below or send me a Pm.Thanks.


JPasswordField (Java 2 Platform SE v1.4.2)
Also a lot of the indentation is horrible.
These can all be made local, however if you wanted to keep them all there I'd recommend making them private being that they aren't used outside of their own class (I assume, I didn't read the whole thread).Code:private JLabel sum2; Scanner input = new Scanner (System.in); int num1 = 0; int num2 = 0; int sum = num1 + num2;

Do you really think people who know nothing of java or any programming for that matter will understand this?
No.
Also, I wouldn't call swing the roots exactly.

good job.

You think learning Swing will help anyone here? The only people who don't know Swing and do Client edits are the ones who barely know how to change the IP address in a client. This will help nobody. /Constructive criticism
Service Thread
Rune-Server > Programming > Application Development > Tutorials
This has nothing to do with Runescape Private servers.
Rune-Server > Programming > Application Development > Tutorials > Java Programming: Learning the roots
What the fuck did you expect to find here a gold mine? Learn to read before posting rubbish on my thread.

To all the haters;
I don't care what you say about 'roots' if you don't know what roots are then gtfo my thread.
(Roots: The Basics)
Enough hate, I will not revisit this thread, Starting to act like Scum because i showed some basic programming, Grow the fuck up and act your age for a change. Sad, I have to deal with you kid Crying every time i login.


As Null said, Swing is obviously not "The roots" to Java Programming. Maybe you could have taught class structure or inheritance before jumping right into GUI. I believe the reason why everyone is giving your such poor feedback is because of your negligence to realize the obvious issue with the thread, THE TITLE.
Service Thread
| « [VB] How to make a web browser [VB] | ASM Bytecode Library » |
| Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |