This is the best Java tutorial for beginners, so you can learn Java and English in one hit. Please keep going! I vote for Java advance tutorial. Thanks a lot Bro
Thanks Bro. Yet again a simple but effective tutorial. Even better as I added this to the menu tutorial and, I will now search out your video on actually opening a file and include that in the menu tutorial. Top job, please produce more, more MORE Java vids!!!
I am developing an android Filemanager app. I used checkbox to select files and folders(files+subfolders) . I want to add feature to copy paste the selected files and folders(files+subfolders) at same time like google Filemanager . How can i add this copy paste feature in my java android file manager??? Advance Thanks..
im assuming u asked this cz u did that in the main method in that case, you need to construct an object of your class (idk how to say it sry my eng isnt good) Here is my code, i hope u will get it import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; public class abc implements ActionListener { public static void main(String[] args) { JFrame frame = new JFrame("Title"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(420,420); frame.setLayout(null); //Creating the Button JButton button = new JButton("I am a button :D"); button.setBounds(0, 0, 150,69); //creating an object of the class (idk how to say it lol sry but im sure yk of it) abc abcObject = new abc(); //Using the object instead of this keyword button.addActionListener(abcObject);
//There is also another way, i guess its called lambda expression //This has no relation to the previous button we created earlier JButton button2 = new JButton("2nd button"); button2.setBounds(69,69,100,69); button2.addActionListener(e -> System.out.println("This action was performed using lambda expression"));
//adding button and making frame visible frame.add(button); frame.add(button2); frame.setVisible(true);
} @Override public void actionPerformed(ActionEvent e) {
but i would recommend u doing the way he did in the tutorial. I think its simpler there are probably more ways to do it, this one is simplest, u just have to use 'this' and its done
Hey hope you are doing alright just I wanna say that GOD loved the world so much he sent his only begotten son Jesus to die a brutal death for us so that we can have eternal life and we can all accept this amazing gift this by simply trusting in Jesus, confessing that GOD raised him from the dead, turning away from your sins and forming a relationship with GOD.
public class Main{
public static void main(String[] args) {
// JFileChooser = A GUI mechanism that let's a user choose a file (helpful for opening or saving files)
new MyFrame();
}
}
import java.awt.FlowLayout;
import java.awt.event.*;
import java.io.File;
import javax.swing.*;
public class MyFrame extends JFrame implements ActionListener{
JButton button;
MyFrame(){
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setLayout(new FlowLayout());
button = new JButton("Select File");
button.addActionListener(this);
this.add(button);
this.pack();
this.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource()==button) {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setCurrentDirectory(new File(".")); //sets current directory
int response = fileChooser.showOpenDialog(null); //select file to open
//int response = fileChooser.showSaveDialog(null); //select file to save
if(response == JFileChooser.APPROVE_OPTION) {
File file = new File(fileChooser.getSelectedFile().getAbsolutePath());
System.out.println(file);
}
}
}
}
Practicing...
public class Main{
public static void main(String[]args){
new MyFrame();
}
}
*****************************
import java.awt.FlowLayout;
import java.awt.event.*;
import java.io.File;
import javax.swing.*;
public class MyFrame extends JFrame implements ActionListener{
JButton button;
MyFrame(){
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setLayout(new FlowLayout());
button = new JButton("Choose a file");
button.addActionListener(this);
this.add(button);
this.pack();
this.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e){
if(e.getSource()==button){
JFileChooser fileChooser = new JFileChooser();
// fileChooser.setCurrentDirectory(new File(""));
fileChooser.setCurrentDirectory(new File("C:\\Users\\Yaa\\Desktop"));
//System.out.println(fileChooser.showOpenDialog(null));
//int response = fileChooser.showOpenDialog(null);
int response = fileChooser.showSaveDialog(null);
if(response ==JFileChooser.APPROVE_OPTION){
File file = new File(fileChooser.getSelectedFile().getAbsolutePath());
System.out.println(file);
}
}
}
}
this channel has single handedly gotten me through all my JavaFX learning. Insane value.
bro this channel is so awesome. You have the most helpful vids, get straight to the point, and explain everything well. 10/10 major props to you
thanks for watching Alex
This is the best Java tutorial for beginners, so you can learn Java and English in one hit. Please keep going! I vote for Java advance tutorial. Thanks a lot Bro
Big ups BroCodez u dun know, i was bare scared my code aint gon work but you solved it u mad lad!
Love your content, keep up the good work! Really appreciate your tutorials. You have helped me out countless of times!
Thanks Bro.
Yet again a simple but effective tutorial.
Even better as I added this to the menu tutorial and, I will now search out your video on actually opening a file and include that in the menu tutorial.
Top job, please produce more, more MORE Java vids!!!
it's a really helpful tutorial, thanks
Nice video
Great vid! Please could you link me to the videos you have on saving and opening the files?
Keep it up bro
Excellent content
hi bro, i so love your video man!!! keep going like this!!🤟🤟🤟
You're the best teacher.
Thanks for the video mate, you're a real help
Good tutorial
Thanks for your great work! Please, maybe more explanation for each assignment.
nice
Great video!
good job Bro
Very helpful :) thanks bro
thank you bro keep forward
Thanks. Your video helped me a lot.
nice video, thanks.
Thanks, Brah!
Thanks!
thanks that helped me
4:26 "Nuclear launch codes" xD
Thanks dude that helps a lot
Thank you very much bro❤ you helped us a lot🎉
Excellent!
Is their a way to print it on a JTextArea when you open a file?
You are my Hero Bro.!
Love you bro! Thanks a lot for your vids, very helpful ! Comment done ehehehe enjoy and keep up! Best regards
Help ful
Thank you so mutch!!!!!!
thanks bro
thank you for the content
perfect
Very helpful.
bro, you're the best
super
Bro, 👍👌
thanks! it's what i need...
عاشت ايدك
Thanks bro.
Awesome, bro :)
thank you
Amazing!! :D
thnx dude, helped a lot
thanks man
Thank you brother. You earned a subscription from me.
how can you set this to open on action in a gui, for example i press a load file button and this comes up to choose a file etc...
Instead of printing the path I want to store it in a String to use for another function, how can I get a from this function?
I am developing an android Filemanager app. I used checkbox to select files and folders(files+subfolders) . I want to add feature to copy paste the selected files and folders(files+subfolders) at same time like google Filemanager . How can i add this copy paste feature in my java android file manager??? Advance Thanks..
thank you so much
Thanks from Brazil , how to save image path in mysql database
Is there a way to make a drag/drop interface for files?
I have a question, how can I copy the selected file?
could you add the implementation of DnD facilities for this button?
thanks
Perfecto
Pls how to u add file to read in Jframe ?
Need help.
Hi, I've been wondering, instead of "this", what else that I can put in the addActionListener(this) that will match the parameter?
You can given parent component where you implement ActionListener . actually he using same class that why he use (this)
I hope you understand
im assuming u asked this cz u did that in the main method
in that case,
you need to construct an object of your class (idk how to say it sry my eng isnt good)
Here is my code, i hope u will get it
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
public class abc implements ActionListener {
public static void main(String[] args) {
JFrame frame = new JFrame("Title");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(420,420);
frame.setLayout(null);
//Creating the Button
JButton button = new JButton("I am a button :D");
button.setBounds(0, 0, 150,69);
//creating an object of the class (idk how to say it lol sry but im sure yk of it)
abc abcObject = new abc();
//Using the object instead of this keyword
button.addActionListener(abcObject);
//There is also another way, i guess its called lambda expression
//This has no relation to the previous button we created earlier
JButton button2 = new JButton("2nd button");
button2.setBounds(69,69,100,69);
button2.addActionListener(e -> System.out.println("This action was performed using lambda expression"));
//adding button and making frame visible
frame.add(button);
frame.add(button2);
frame.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
System.out.println("69420 ");
}
}
but i would recommend u doing the way he did in the tutorial. I think its simpler
there are probably more ways to do it, this one is simplest, u just have to use 'this' and its done
8:34 Nuclear launch codes! :3
my uni project: stonks
hello
A comment down below
file selects you
bow down in front of bro
Hey hope you are doing alright just I wanna say that
GOD loved the world so much he sent his only begotten
son Jesus to die a brutal death for us so that we can have eternal life and we can all accept this amazing gift this by simply trusting in Jesus, confessing that GOD raised him from the dead, turning away from your sins and forming a relationship with GOD.
super
thank you