Java ??? ????? ???, ??? ?? ? ??? ???? ? ???? ?????.
1. ???
???? ????? ??? ?? ??? ??? ?? ??? ????? java.util.EventObject ????? ?????.
import java.util.EventObject; /** * 事件類,用于封裝事件源及一些與事件相關(guān)的參數(shù). */ public class CusEvent extends EventObject { private static final long serialVersionUID = 1L; private Object source;//事件源 public CusEvent(Object source){ super(source); this.source = source; } public Object getSource() { return source; } public void setSource(Object source) { this.source = source; } }
2. ??? ??
??? ??? ??? ??? ???? ?? ??(?: BUTTON ??, TEXTBOX ? ?? ?)?? ?? ?????. .) ????. ?, ?? ??? ??? ?????. ??? ???? ??? ??? ????? ??? ??? ?? ????? ???? ??? ????(List, Set ?)? ??? ???.
/** * 事件源. */ public class EventSourceObject { private String name; //監(jiān)聽器容器 private Set<CusEventListener> listener; public EventSourceObject(){ this.listener = new HashSet<CusEventListener>(); this.name = "defaultname"; } //給事件源注冊監(jiān)聽器 public void addCusListener(CusEventListener cel){ this.listener.add(cel); } //當事件發(fā)生時,通知注冊在該事件源上的所有監(jiān)聽器做出相應(yīng)的反應(yīng)(調(diào)用回調(diào)方法) protected void notifies(){ CusEventListener cel = null; Iterator<CusEventListener> iterator = this.listener.iterator(); while(iterator.hasNext()){ cel = iterator.next(); cel.fireCusEvent(new CusEvent(this)); } } public String getName() { return name; } //模擬事件觸發(fā)器,當成員變量name的值發(fā)生變化時,觸發(fā)事件。 public void setName(String name) { if(!this.name.equals(name)){ this.name = name; notifies(); } } }
3. ??? ???
??? ???? java.util.EventListener ?????? ???? ??? ??? ????, ??? ??? ???? ??? ???? ?? ???? ???? ?? ?????. ???? ?????.
import java.util.EventListener; /** * 事件監(jiān)聽器,實現(xiàn)java.util.EventListener接口。定義回調(diào)方法,將你想要做的事 * 放到這個方法下,因為事件源發(fā)生相應(yīng)的事件時會調(diào)用這個方法。 */ public class CusEventListener implements EventListener { //事件發(fā)生后的回調(diào)方法 public void fireCusEvent(CusEvent e){ EventSourceObjecteObject = (EventSourceObject)e.getSource(); System.out.println("My name has been changed!"); System.out.println("I got a new name,named \""+eObject.getName()+"\""); } }
??? ???
public class MainTest { public static void main(String[] args) { EventSourceObject object = new EventSourceObject(); //注冊監(jiān)聽器 object.addCusListener(new CusEventListener(){ @Override public void fireCusEvent(CusEvent e) { super.fireCusEvent(e); } }); //觸發(fā)事件 object.setName("AiLu"); } }
4. ???, ??? ?? ? ??? ?? ??
??? ??-----??---->???------> ; ??? ???------>??? ?? ?? ??
import java.awt.Frame; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; public class DemoAction extends Frame {//窗口就是事件源 public DemoAction() { this.setTitle("窗口關(guān)閉"); this.setLocation(400, 200); this.setSize(360, 280); //給窗口綁定一個事件監(jiān)聽器 this.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) {//事件WindowEvent System.exit(0);//關(guān)閉窗口事件, 那么退出jvm } }); this.setVisible(true); } public static void main(String[] args) { new DemoAction(); } }
5. ??? ??? ?? ??:
(1) ??? ??
(2) ??? ?? ? ??
(3) ???? ??? ?????? ???? ???? ????? ??? ??? ?????.
(4) ???? ?? ???? ???? ???? ?????.
?? ?:
public class LoginListener implements ActionListener{ String text; public void actionPerformed(ActionEvent e){ if("willow".equals(text)){ system.out.println("登錄成功!\n"); } } } public class Login(){ public void showFrame(){ //創(chuàng)建窗體 JFrame LFrame = new JFrame(); LFrame.setSize(1000,800); LFrame.setLocationRelativeTo(null); LFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); LFrame.setLayout(new FlowLayout()); //創(chuàng)建監(jiān)聽器對象 LoginListener lg = new LoginListener(); //給窗體添加按鈕組件 JTextField tf = new JTextField(); LFrame.add(tf); //給輸入框添加監(jiān)聽器 tf.addActionLisener(lg); tf.text=tf.getText(); } };
?? java ?? ???, ?? PHP ??? ????? ????. ??? ??? ?? ?? ?????!
? ??? ?? ???? ???? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

JDBC ????? ???? ????? ?? ?? ?? ??? ?? ?? ??? ?? ? ?? ??? ?? ?? ?? ??? ???????. 1. ????? ????? Conn.SetAutoCommit (False)?? ??????. 2. ??? ? ????? ?? ?? SQL ??? ?????. 3. ?? ??? ??? ?? Conn.commit ()?? ???? ??? ???? ???? ?? ??? ???? Conn.Rollback ()?? ??????. ???, ? ??? ???? ????, ??? ???? ????, ?? ??? ??? ?? ??? ??? ???? ? ???????. ?? ?? ?? ???? ????? ??? ???? ?? ?? ???? ???? ??? ????? ?? ??? ??? ? ?? ???? ?? ????.

?? ?? ? ?? ???? ???? ?? Java.Time ???? ???? ??????. 2. LocalDate, LocalDateTime ? LocalTime? ?? ?? ??? ??? ?????. 3. () ???? ???? ?? ??? ??? ????. 4. ???/???? ??? ???? ??? ????? ??? ??????. 5. ZonedDateTime ? Zoneid? ???? ???? ??????. 6. DateTimeFormatter? ?? ?? ? ?? ?? ?? ???; 7. ??? ?? ?? ?? ??? ????? ?? ??????. ?? Java? ?? ??? ???? ??? ??? ???? Java.Timeapi ??? ?? ??? ???????.

Pre-FormancetArtUptimeMoryUsage, Quarkusandmicronautleadduetocompile-timeprocessingandgraalvsupport, withquarkusoftenperforminglightbetterine serverless sinarios.2.thyvelopecosyste,

NetworkPortSandfirewallsworkTogetToenableCommunication whileensuringsecurity.1.networkportSarevirtualendpointsnumbered0–65535, Withwell-nownports like80 (http), 443 (https), 22 (ssh) ? 25 (smtp) ?? (specservices

Java 's Garbage Collection (GC)? ???? ???? ???? ??????, ?? ? ??? ??? ? ??? ??? ??? ??? ????. 1.GC? ?? ?? (? : ?? ??, ?? ???, ?? ?? ?)?? ??? ???? ????, ?? ? ??? ??? ???? ?????. 2. ?? ???? ????? ????, ?? ?? ??? ??? ???? ?? ??? ??????. 3. ?? ?? ?? ?? : ??? ?? (Eden, S0, S1)? ?? ????? ?????. ??? ??? ?? ? MajorGC? ???? ? ??? ? ????. Metaspace? ??? ?? ???? ?????. 4. JVM? ??? GC ??? ?????. SerialGC? ??? ?? ????? ?????. ParallelGC? ???? ??????. CMS? ?? ???

??? htmlinput ??? ???? ??? ???? ????? ??? ??? ?? ??? ???? ???? ? ????. 1. ???, ???, ??, ?? ? ??? ?? ??? ??? ?? ?? ?? ??? ???? ???? ??? ? ???? ??? ? ????. 2. HTML5? ?????? ??? ? ?? ?? ??? ?? ? ??? URL, ??, ?? ? ??? ?? ??? ??? ??????. 3. ?? ?? ? ? ??? ??? ???? ?? ??? ???? ???? ?? ???? ?? ???? ???? ?? ? ? ??? ?? ???????.

GradleisBetTerChoiceFormostNewProjectSduetoitssuperiorflexible, Performance, and ModernToolingsupport.1.Gradle'Sgroovy/kotlindslismoreConcisENDEXPRESSIVETHANMAVEN'SVOSEXML.2.GradleOutsMaveninbuildweedweedweedweedweedweedweedweedweedweedweedweedweedweede

DEFER? ??? ???? ?? ??? ??? ???? ? ?????. ?? ??? ?? ? ? ?? ????, ??? ??? ? ?? ?? (LIFO)? ??? ?????. 1. ?? ??? ??? ? ??? ?????. 2. ?? ??? ?? ??? ??? ????? ?????. 3. ?? ? ?? ?? ??? ? ????. 4. ??? ?????? ??? ??? ???? ?????. 5. ?? ??? ???? ?? ??? ?? ??? ?????. ??? ??? ?? ?? ? ???? ???? ? ????.
