Розмір відео: 1280 X 720853 X 480640 X 360
Показувати елементи керування програвачем
Автоматичне відтворення
Автоповтор
// ************** Controller.java **************package application;import java.time.LocalDate;import java.time.format.DateTimeFormatter;import javafx.event.ActionEvent;import javafx.fxml.FXML;import javafx.scene.control.DatePicker;import javafx.scene.control.Label;public class Controller { @FXML private DatePicker myDatePicker; @FXML private Label myLabel; public void getDate(ActionEvent event) { LocalDate myDate = myDatePicker.getValue(); String myFormattedDate = myDate.format(DateTimeFormatter.ofPattern("MMM-dd-yyyy")); myLabel.setText(myFormattedDate); }}
How do a text of DataPicker read only?
Your videos are my go-to source when learning about a new JavaFX-element. Thank you for your fantastic work!
En 4 minutos este señor me enseño lo que no hizo mi profe en 4 meses, ty man u saved me
i cant believe u even showed how to change the date format, ure awesome!!
Nice video, clear explanation, not to long. Said just what it needed to. You just got yourself a sub!
You've helped me A LOT with my OOP final project! keep it up bro!
da best
Loving the series Bro.Thanks a lot from Portugal ;-)
Thank you he is helped me alot.Great Video Keep Going
Are you going to teach us how we can export our javafx project so that we can run it without any start.bat file?P.S: Why are some of the javafx videos not listed?
omg it is amazing
Nice!
THIS IS COOL
Hey, Bro. I was just wondering if you could make a tutorlal for advanced c# windorms?
Bro, thanks for being such a bro!Thx for the explanations From a fellow bro :P
Thanks bro
Hey bro, could you make a video explaining how Github and Git works with Eclipse/Java?
Can you guide for some basic java project for Resume as a fresher The ping pong one seems to be too complicated for fresher 😅
Hi guys how know haw can work with time piccker
But only I code on cellphone, because I do not have Laptop, or Desktop.
comment for the algo :)
Prompt text didn't work i added the below to the controller:public void initialize() { myDatePicker.getEditor().setText("Select a date"); }
import javax.swing.*;import java.awt.*;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;public class DatePicker { int month = java.util.Calendar.getInstance().get(java.util.Calendar.MONTH); int year = java.util.Calendar.getInstance().get(java.util.Calendar.YEAR); JLabel l = new JLabel("", JLabel.RIGHT); String day = ""; JDialog d; JButton[] button = new JButton[49]; public DatePicker(JPanel parent) { d = new JDialog(); d.setModal(true); String[] header = { "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" }; float BTN_SIZE = 11f; JPanel p1 = new JPanel(new GridLayout(7, 7)); for (int x = 0; x < button.length; x++) { final int selection = x; button[x] = new JButton(); button[x].setFont(button[x].getFont().deriveFont(Font.BOLD, BTN_SIZE)); button[x].setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); button[x].setBackground(Color.WHITE); if (x > 6) { button[x].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { day = button[selection].getActionCommand(); d.dispose(); } }); } if (x < 7) { button[x].setText(header[x]); button[x].setForeground(Color.red); } p1.add(button[x]); } JPanel p2 = new JPanel(); p2.setBackground(Color.WHITE); // Last year button JButton lastYear = new JButton(""); nextYear.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); nextYear.setBackground(Color.WHITE); nextYear.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { year++; displayDate(); } }); p2.add(nextYear); d.add(p1, BorderLayout.CENTER); d.add(p2, BorderLayout.NORTH); d.pack(); d.setLocationRelativeTo(parent); displayDate(); d.setVisible(true); } public void displayDate() { for (int x = 7; x < button.length; x++) { button[x].setText(""); } java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("MMMM yyyy"); java.util.Calendar cal = java.util.Calendar.getInstance(); cal.set(year, month, 1); int dayOfWeek = cal.get(java.util.Calendar.DAY_OF_WEEK); int daysInMonth = cal.getActualMaximum(java.util.Calendar.DAY_OF_MONTH); for (int x = 6 + dayOfWeek, day = 1; day
// ************** Controller.java **************
package application;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.DatePicker;
import javafx.scene.control.Label;
public class Controller {
@FXML
private DatePicker myDatePicker;
@FXML
private Label myLabel;
public void getDate(ActionEvent event) {
LocalDate myDate = myDatePicker.getValue();
String myFormattedDate = myDate.format(DateTimeFormatter.ofPattern("MMM-dd-yyyy"));
myLabel.setText(myFormattedDate);
}
}
How do a text of DataPicker read only?
Your videos are my go-to source when learning about a new JavaFX-element. Thank you for your fantastic work!
En 4 minutos este señor me enseño lo que no hizo mi profe en 4 meses, ty man u saved me
i cant believe u even showed how to change the date format, ure awesome!!
Nice video, clear explanation, not to long. Said just what it needed to. You just got yourself a sub!
You've helped me A LOT with my OOP final project! keep it up bro!
da best
Loving the series Bro.
Thanks a lot from Portugal ;-)
Thank you he is helped me alot.
Great Video Keep Going
Are you going to teach us how we can export our javafx project so that we can run it without any start.bat file?
P.S: Why are some of the javafx videos not listed?
omg it is amazing
Nice!
THIS IS COOL
Hey, Bro. I was just wondering if you could make a tutorlal for advanced c# windorms?
Bro, thanks for being such a bro!
Thx for the explanations
From a fellow bro :P
Thanks bro
Hey bro, could you make a video explaining how Github and Git works with Eclipse/Java?
Can you guide for some basic java project for Resume as a fresher The ping pong one seems to be too complicated for fresher 😅
Hi guys how know haw can work with time piccker
But only I code on cellphone, because I do not have Laptop, or Desktop.
How do a text of DataPicker read only?
comment for the algo :)
Prompt text didn't work i added the below to the controller:
public void initialize() {
myDatePicker.getEditor().setText("Select a date");
}
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class DatePicker {
int month = java.util.Calendar.getInstance().get(java.util.Calendar.MONTH);
int year = java.util.Calendar.getInstance().get(java.util.Calendar.YEAR);
JLabel l = new JLabel("", JLabel.RIGHT);
String day = "";
JDialog d;
JButton[] button = new JButton[49];
public DatePicker(JPanel parent) {
d = new JDialog();
d.setModal(true);
String[] header = { "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" };
float BTN_SIZE = 11f;
JPanel p1 = new JPanel(new GridLayout(7, 7));
for (int x = 0; x < button.length; x++) {
final int selection = x;
button[x] = new JButton();
button[x].setFont(button[x].getFont().deriveFont(Font.BOLD, BTN_SIZE));
button[x].setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
button[x].setBackground(Color.WHITE);
if (x > 6) {
button[x].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
day = button[selection].getActionCommand();
d.dispose();
}
});
}
if (x < 7) {
button[x].setText(header[x]);
button[x].setForeground(Color.red);
}
p1.add(button[x]);
}
JPanel p2 = new JPanel();
p2.setBackground(Color.WHITE);
// Last year button
JButton lastYear = new JButton("");
nextYear.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
nextYear.setBackground(Color.WHITE);
nextYear.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
year++;
displayDate();
}
});
p2.add(nextYear);
d.add(p1, BorderLayout.CENTER);
d.add(p2, BorderLayout.NORTH);
d.pack();
d.setLocationRelativeTo(parent);
displayDate();
d.setVisible(true);
}
public void displayDate() {
for (int x = 7; x < button.length; x++) {
button[x].setText("");
}
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("MMMM yyyy");
java.util.Calendar cal = java.util.Calendar.getInstance();
cal.set(year, month, 1);
int dayOfWeek = cal.get(java.util.Calendar.DAY_OF_WEEK);
int daysInMonth = cal.getActualMaximum(java.util.Calendar.DAY_OF_MONTH);
for (int x = 6 + dayOfWeek, day = 1; day