BEANS / CATATAN</>↗Beans05 Apr 2008
In the previous example you can see how to convert a bean into an XML persistence. Now we’ll do the opposite, converting the XML back to a bean. For the BeanToXML class use in this example please refer to How do I convert a bean to XML persistence? example. package org.kodejava.bean; import java.beans.XMLDecoder; import java.io.BufferedInputStream; […]
BEANS / CATATAN</>↗Beans03 Apr 2008
package org.kodejava.bean; import java.beans.XMLEncoder; import java.io.BufferedOutputStream; import java.io.FileOutputStream; import java.io.FileNotFoundException; public class BeanToXML { private Long id; private String itemName; private String itemColour; private Integer itemQuantities; public static void main(String[] args) { BeanToXML bean = new BeanToXML(); bean.setId(1L); bean.setItemName("T-Shirt"); bean.setItemColour("Dark Red"); bean.setItemQuantities(100); try { XM...
SWING / CATATAN</>↗Swing03 Apr 2008
package org.kodejava.swing; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.WindowConstants; import java.awt.FlowLayout; public class MultilineToolTip { public static void main(String[] args) { JFrame frame = new JFrame("Tool Tip Demo"); frame.setSize(500, 500); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); JLabel label = new JLabel("Hover on me!"); // Setting tool tip for our Swing JLabel component using an html // formatted string s...
SWING / CATATAN</>↗Swing30 Mar 2008
package org.kodejava.swing; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.SwingUtilities; import javax.swing.ToolTipManager; import javax.swing.WindowConstants; import java.awt.FlowLayout; import java.awt.HeadlessException; public class DisableToolTip extends JFrame { public DisableToolTip() throws HeadlessException { initComponent(); } public static void main(String[] args) { SwingUtilities.invokeLater(() -> new DisableToolTip().setVisible(true));...
SWING / CATATAN</>↗Swing28 Mar 2008
package org.kodejava.swing; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.WindowConstants; import java.awt.FlowLayout; public class ToolTipExample { public static void main(String[] args) { JFrame frame = new JFrame("Tool Tip Demo"); frame.setSize(500, 500); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); JLabel label = new JLabel("Hover on me!"); // Setting tool tip for our Swing JLabel component label.setToolTipText("My JLabel Tool...
SWING / CATATAN</>↗Swing27 Mar 2008
This code give you an example of how to create a frame without the title bar, and the frame icons such as maximize, minimize and close. package org.kodejava.swing; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import java.awt.BorderLayout; import java.awt.Point; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; public class UndecoratedFrame { private static Point point = new Poin...