NullPointerException

Ads

 
 

Share on Google+Share on Google+

SakthiPrabhu.g
NullPointerException
1 Answer(s)      8 years ago
Posted in : Java Beginners
Ads
View Answers

December 19, 2008 at 5:47 AM


Hi friend,


Please implement following code.

import java.awt.*;
import java.awt.Color;
import java.awt.Container;
import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.*;

public class TryDemo extends JFrame {

Container con;
JPanel p;
ImageIcon img;
JLabel lb;
JRadioButton r1,r2;
ButtonGroup bg;

public TryDemo() {
System.out.println("welcome");

setLayout(null);
con = getContentPane();
setBounds(0,0,1024,70);
setDefaultCloseOperation(EXIT_ON_CLOSE);

img = new ImageIcon("");
p=new JPanel();
con.add(p);
p.setLayout(null);
p.setBounds(0,0,1024,70);
p.setVisible(true);
lb=new JLabel(img);
p.add(lb);
lb.setBounds(200,30,100,20);
r1=new JRadioButton();
p.add(r1);
r1.setBounds(300,30,100,20);
bg=new ButtonGroup();
bg.add(r1);
r2=new JRadioButton();
p.add(r2);
r2.setBounds(300,30,100,20);
bg.add(r2);

}

public static void main(String args[]) {
new TryDemo();
}
}

-------------------------------

Visit for more information.

http://www.roseindia.net/java/example/java/swing/

Thanks.

Ads









Related Tutorials/Questions & Answers:
nullpointerException
nullpointerException  sir i create the on login module in that mysql generate the nullpointerException? please send login mdule code in jsp and servlet using mvc model?   Please visit the following link: Jsp Servlet
Advertisements
NullPointerException - SQL
NullPointerException  Greeting Everyone. I got NullPointerException when try to run UPDATE query. Here's the code where JSP dies: String short...) with NullPointerException TOMCAT ERROR: root cause
JDK 1.4 the NullPointerException - Java Tutorials
NullPointerException In Java NullPointerException occurs when you perform an operation on a object or calling a method on the object.  The only way... charAt() function, the above code throw NullPointerException. Output
Java NullPointerException
Java NullPointerException       NullPointerException is a kind of unchecked exception... class. NullPointerException must bethrown when an application attempts
hi, Everyone ,i'm learning jdbc, i got an nullpointerexception when execute this program.
hi, Everyone ,i'm learning jdbc, i got an nullpointerexception when execute this program.   ConnectionProvider.java import java.util.*; import java.io.*; import java.sql.*; class ConnectionProvider { static Properties prop
Java exception
Java exception  What is NullPointerException and how to handle
SCJP Module-6 Question-30
Given below the sample code : 1 try { 2 // code 3 } catch (NullPointerException ne) { 4 System.out.print("NullPointerException "); 5 } catch... } finally { 8 System.out.print("END"); 9 } If NullPointerException
Java null pointer exception handling
pointer exception handling What is Java NullPointerException? In Java NullpointerException is a RuntimeException and occurs when it confronts a null variable where an object is required. Java nullpointerexception never provide details
Exception
Exception  what is NullPointerException?   Hi, I java NullPointerException java.lang.NullPointerException) is defined in the java.lang package. The NullPointerException is thrown by the Java program at the time
SCJP Module-6 Question-24
Exception"); } catch (NullPointerException npe) { System.out.println("...; Compilation error 2.  General Exception 3.  NullPointerException 4... for NullPointerException. It is already handled by the catch block
Httpservletresponse null pointer exception.
Httpservletresponse null pointer exception.  What is Httpservletresponse null pointer exception?   NullPointerException occurs when we try to implement an application without referencing the object and allocating
making use java image filters
making use java image filters  while making use any functions built in jerry's filter in java application i get a NullPointerException.. I dont know the reason for this.. please give me a solution
java
java  1.Create a class Errorhandle1. Write code that deliberately throws the following exceptions, without using the √Ę‚?¨Ň?throw√Ę‚?¨¬? keyword ClassCastException NullPointerException ArrayIndexOutOfBoundsException
exception
exception  1.Create a class Errorhandle1. `Write code that deliberately throws the following exceptions, without using the ‚??throw‚?? keyword : ClassCastException NullPointerException ArrayIndexOutOfBoundsException
SCJP Module-6 Question-2
exceptions ' ArrayIndexOfBoundException ' ,  ' NullPointerException... Function(Ingredient[] list) throws ArrayIndexOfBoundException, NullPointerException...;ArrayIndexOfBoundException or NullPointerException
SCJP Module-6 Question-20
Given below the sample code : try { // code } catch (NullPointerException npe) { System.out.print("hello"); } catch (RuntimeException rte) { System.out.print("brothers"); } finally { System.out.print("
Array in Java
; //right s[0].p1 = 1; //error NullPointerException..., why s[0].p1 = 1 is NullPointerException
java,eclipse - Swing AWT
// Stack: 1, Locals: 1 public NullPointerException(); 0 aload_0 1... NullPointerException(java.lang.String arg0); 0 aload_0 1 aload_1 2
Hibernate error in eclipse
by java.lang.NullPointerException))   NullPointerException is an exception that occurs when you
Null Pointer Exception
Null Pointer Exception  whis is the Null Pointer Exception in java? or define Null Pointer Exception with exp?   NullPointerException occurs, when you try to implement an application without referencing the object
Java: Some problems in given condition
||att.getdata2()==0) If I use this code in Java.I am facing NullPointerException
JSP jasper expection - JSP-Interview Questions
JSP jasper expection  What is JSP jasper expection?  Answer: JasperException is a subclass of Exception, you can use the usual Exception methods on it. But it's not a NullPointerException
SCJP Module-9 Question-12
. NullPointerException Answer (1) Explanation The 'null' reference key
Struts 2.1.8 Features
. Now is it fixed.   A new fix to NullPointerException is also added... to a NullPointerException is also added. The NullPointerException was coming
Exception handling in java
Index Out Of Bounds Exception. NullPointerException. Class Cast Exception.... NullPointerException. NullPointerException exception is displayed when we
Logging an Exception in Java
, blank array is under the NullPointerException, blank stack... and NullPointerException by Logger object. Program contains two method DivByZero... of NullPointerException that catch the error when the array is blank.  Description
Tutorials   
Java Spring Hibernate Struts Training What type of programming language is Java? How do beginners learn about Java? ClassNotFoundException HttpRequestInterceptor java.lang.noclassdeffounderror: org/apache/http/httprequest noclassdeffounderror: org/apache/http/client/methods/httpurirequest java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient How do I resolve this Java Class not found exception? httpclient java.lang.NoClassDefFoundError Apache Commons ioutils maven dependency Read/Convert an inputStream to a String What is the meaning of Java Platform? Why Java is a platform independent language? What is the benefits of learning Core Java? Which technology should I learn after Java? What is array in java with example? How to Convert ArrayList to Array? How to substring in Java? How to format number in Java? What is instance variable in Java? How to download MySQL JDBC driver? What is Calendar class in Java? Which is the best Java tutorials for beginners? How to rename a file in Java? How to delete file in Java code? How to get day from date in Java using Calendar? How to get day of week in Java? How to calculate Date Difference in Java? How to compare date in Java? How to declare array in Java? How to calculate average of array in Java? What is Array in Java? write a java program to find the summation of all the integers entered on command line Sum of two numbers using command line arguments in Java How to create and use Array in Java? How to pass command line arguments in Java? How to create Applet Hello World? Appending String efficiently in Java How to append String in Java? How to list even numbers between 1 and 100? How to add BigDecimal in Java? What is Abstraction In Java? Which is best Beginners Java Tutorial? What is java.util package? Create list from array in Java Filter collection in Java 8 What is the best way to filter a Java Collection? Easy way to transform Collection to Array? How to convert Collection to Array in Java? What are Basic Java Language Elements? Advanced Java Tutorials in 2017

Ads

 
Advertisement null

Ads