Комментарии:
// ********************************************
public class Main {
public static void main(String[] args) {
LaunchPage launchPage = new LaunchPage();
}
}
// ********************************************
import java.awt.event.*;
import javax.swing.*;
public class LaunchPage implements ActionListener{
JFrame frame = new JFrame();
JButton myButton = new JButton("New Window");
LaunchPage(){
myButton.setBounds(100,160,200,40);
myButton.setFocusable(false);
myButton.addActionListener(this);
frame.add(myButton);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(420,420);
frame.setLayout(null);
frame.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource()==myButton) {
frame.dispose();
NewWindow myWindow = new NewWindow();
}
}
}
// ********************************************
import java.awt.*;
import javax.swing.*;
public class NewWindow {
JFrame frame = new JFrame();
JLabel label = new JLabel("Hello!");
NewWindow(){
label.setBounds(0,0,100,50);
label.setFont(new Font(null,Font.PLAIN,25));
frame.add(label);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(420,420);
frame.setLayout(null);
frame.setVisible(true);
}
}
Amazing video
Ответитьcan you plz sent another video to Java open a new GUI window with hiding first one
ОтветитьVery nice video, I like it very much. 40 degrees Celsius, drink beer 😃😃😃
ОтветитьThank you very much bro, you helped me out of a problem with this tutorial.
ОтветитьMy window in windowbulder is distorted and idk how to fix it
Ответить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
Ответитьwow that frame.setSize parameters must be really coincidence :P
ОтветитьA fine tutorial !!
ОтветитьThanks
ОтветитьI don't understand how myButton.addActionListener(this); works. Why do we pass in this?
Ответитьcomment
Ответитьmuchas gracias por tus videos. Aprendo varias cosas....
ОтветитьFinally at tutorial that explains what happens in the process
Ответитьi understand this part, but how does the package actually create the window?
ОтветитьSuscribing just because you set the size to (420,420) hahaha that's funny!
ОтветитьHey bro i know this is late but can you explain why you need 3 file instead of 2 only?
ОтветитьYou earned yourself a sub... thank you so much broski
ОтветитьYou’re a legend Bro
ОтветитьI have an assignment where the first window needs to be closed after pressing okay button on the second window, like the second window needs to have a button that makes the first window close after it being pressed, im going crazy
Ответитьi know im a little late but on the label I put the text "You are dead" and it cut it off and said "you ar.." how I fix
Ответить