Tech Overload Blog

Java JLabel setBorder() Method Example 0

Java JLabel setBorder () Method Example

Below code shows how to use Java JLabel setBorder ()  Method Example import java.awt.Color; import java.awt.FlowLayout; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JLabel; /** * * @author acer */ public class JLabelExample { JLabelExample(){ JFrame frame=new JFrame();...

Jlabel-getText-method 0

Java JLabel getText and JTextField setText methods

Below code shows how to use JLabel getText method and JTextField setText method. import java.awt.FlowLayout; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; public class JLabelExample extends JFrame { JLabelExample() { super(“JLabel Example”); setLayout(new FlowLayout()); JLabel label=new...

How to create a simple JLabel with Text 0

How to create a simple JLabel with Text

Below code shows how to create a simple JLabel with Text.   import java.awt.FlowLayout; import javax.swing.JFrame; import javax.swing.JLabel; public class JLabelExample extends JFrame { JLabelExample() { super(“JLabel Example”); JLabel label=new JLabel(“JLabel with Text”); add(label);...

Adding two panels in vaadin Window using Horizontal Layout 0

Adding two panels in vaadin Window using Horizontal Layout

Below code creates two vaadin panels and adds the to a Window using Horizontal Layout import com.vaadin.Application; import com.vaadin.terminal.Sizeable; import com.vaadin.ui.*; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; import com.vaadin.*; /** * Main application class. */ public...

jframe-dispose-method 0

JFrame dispose method

JFrame.dispose() is used to  destroy JFrame window and clean it up from the operating system.Read also more about System.exit(0) import javax.swing.JFrame; import javax.swing.JButton; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class JFrameMethods { public JFrame frame;...

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver java error 0

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver java error

After executing below code i get java.lang.ClassNotFoundException: com.mysql.jdbc.Driver error.How do i go about solving this mysql server connection error with java. Code import java.sql.DriverManager; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import javax.swing.JOptionPane; public class DbConnection...

How to create a simple Java JTree menu 0

How to create a simple Java JTree menu

Below code shows how to create a simple system menu using java JTree which is a swing component.JTree swing component has to be placed inside a JFrame window import javax.swing.JFrame; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.JTree;...

JTextField-setEnabled-method 0

JTextField setEnabled Method

Below code shows how to enable or disable JTextField added in a JFrame window.JTextField inherits its methods from the class swing.Note the differences between the two fields /** * * @author Eric * site:www.techoverload.net...

How to create Read Only JTextField 0

How to create Read Only JTextField

Below code creates a read-only JTextField .   /** * * @author Eric * site:www.techoverload.net */ import javax.swing.JFrame; import javax.swing.JTextField; import javax.swing.JLabel; public class JTextFieldExample extends JFrame{ JTextFieldExample() { super(“JFrame Example”); JTextField userField=new JTextField();...