SWING / CATATAN</>↗Swing18 Agt 2007
The JFormattedTextField allows us to create a text field that can accept a formatted input. In this code snippet we create two formatted text fields that accept a valid phone number and a date. package org.kodejava.swing; import javax.swing.JFormattedTextField; import javax.swing.JFrame; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; import javax.swing.text.DateFormatter; import javax.swing.text.MaskFormatter; import java.awt.Dimension; import java.awt...
JDBC / CATATAN</>↗JDBC14 Agt 2007
Using an updatable result set enables our program to update record in the database from the ResultSet object. The operation on the ResultSet object can be updated, inserted or deleted. With this mechanism, we can update a database without executing a query. In the example below we have a product table with the id, code, […]
SWING / CATATAN</>↗Swing13 Agt 2007
package org.kodejava.swing; import javax.swing.JFrame; import javax.swing.JTextArea; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; public class MouseClickEventDemo extends JFrame { public MouseClickEventDemo() { initComponents(); } public static void main(String[] args) { SwingUtilities.invokeLater(() -> new MouseClickEventDemo().setVisible(true)); } private void initComponents() {...
SWING / CATATAN</>↗Swing10 Agt 2007
package org.kodejava.swing; import javax.swing.JFrame; import javax.swing.JTextArea; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; import java.awt.event.MouseWheelEvent; public class MouseWheelListenerDemo extends JFrame { public MouseWheelListenerDemo() { initComponents(); } public static void main(String[] args) { SwingUtilities.invokeLater(() -> new MouseWheelListenerDemo().setVisible(true)); } private void initComponents() { setDefaultCloseOperati...
SWING / CATATAN</>↗Swing09 Agt 2007
package org.kodejava.swing; import javax.swing.JFrame; import javax.swing.JTextArea; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; public class MouseMotionListenerDemo extends JFrame { public MouseMotionListenerDemo() { initComponents(); } public static void main(String[] args) { SwingUtilities.invokeLater(() -> new MouseMotionListenerDemo().setVisible(true)); } private void i...
SWING / CATATAN</>↗Swing05 Agt 2007
package org.kodejava.swing; import javax.swing.JFrame; import javax.swing.JTextArea; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; public class MouseListenerDemo extends JFrame { public MouseListenerDemo() { initComponents(); } public static void main(String[] args) { SwingUtilities.invokeLater(() -> new MouseListenerDemo().setVisible(true)); } private void initComponents() { setDef...