Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners illegal start of expression
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Deepak
illegal start of expression
1 Answer(s)      5 years and 4 months ago
Posted in : Java Beginners



Advertisement
View Answers

September 5, 2009 at 10:54 AM


Hi Friend,

Try the following code:

import java.io.*;
import java.awt.*;
import java.awt.image.*;
import javax.imageio.*;
import javax.swing.*;

public class Image extends JFrame{

static BufferedImage image;
JLabel label;
JTextField text;

static JPanel panel=new JPanel(){
protected void paintComponent(Graphics g){
super.paintComponent(g);
if (image != null){
g.drawImage(image, 0, 0, this);
}
}
};
Image(){
try{
image = ImageIO.read(new File("C:\\image.jpg"));
Dimension imageSize = new Dimension(image.getWidth(), image.getHeight());
panel.setPreferredSize(imageSize);
label=new JLabel("Enter name");
text=new JTextField(10);
panel.add(label);
panel.add(text);
}
catch (Exception e){}
}
public static void main(String[] args){
Image im=new Image();
im.add(panel);
im.setVisible(true);
im.setSize(300,100);
}
}

Thanks


Related Tutorials/Questions & Answers:
illegal start of expression in servlet error..
illegal start of expression in servlet error..  hello Sir, here is my servlet code and i am getting illegal start of expression error in declaring the method named " public Boolean ModificarUsuario(int IdUsuario
illegal start of expression - Java Beginners
illegal start of expression  here i attach my program.. which shows illgal start of expression.. plz aynone will silve this particular problem.. and correct this particular program.. plz help me
Advertisements
i got illegal start of expression error , plese tell me the mistake where i did...
i got illegal start of expression error , plese tell me the mistake where i did...   import org.springframework.context.*; import java.util.*; public class MyListener implements ApplicationListener { public static void main
illegal start type, HELP!
illegal start type, HELP!  import java.util.Scanner; public class... is " + shipping + " dollars."); } } } Illegal start type error? help?   ... shipping = total *0.3 please insert semicolon after the expression import
illegal start of type
illegal start of type  Hi, This is my code i m getting illegal start of type as error when i m compiling it,can anyone pls help me to correct this error. public class WriteByteArrayToFile { public static void main(String
Illegal Start of Type
Illegal Start of Type  Hello! I'm very new to writing java. And I keep getting the "Illegal Start of Type" error. I've tried everything to fix it. can anyone help me? import java.awt.Dimens; import java.awt.*; import
illegal start of type
illegal start of type  Hello! I'm very new to writing java. And I keep getting the "Illegal Start of Type" error. I've tried everything to fix it. can anyone help me? import java.awt.Dimens import java.awt.*; import javax.swing.
Java error illegal start of type
Java error illegal start of type       The Java error illegal start of type...;} } On Compilation the code show an illegal start of type error. Output
Finding start and end index of string using Regular expression
Finding start and end index of string using Regular expression... the way for finding start and end index of the string using regular expression... "Russian" will be retrieve. String regex="R\\w*":-This is the expression to search
I'm getting an illgal start of expression error in my code for the public static boolean portion at the bottom... any ideas?
I'm getting an illgal start of expression error in my code for the public static boolean portion at the bottom... any ideas?  heres my code import java.util.Scanner; import java.util.Random; public class numberGame
Class Cast & illegal state Exception in blackberry
Class Cast & illegal state Exception in blackberry  tell me please i m facing class cast exception. when i click on Maps & iGoogle in Google Homepage on my emulator then it gives class cast & Illegal State exception
Expression tag
Expression tag  Defined Expression tag in JSP ?   Expression tag is used to display output of any data on the generated page. The data placed in Expression tag prints on the output stream and automatically converts
start and deploy
start and deploy  how to deployee java web application in glassfish by using netbeans6.7
Regular expression
Regular expression  how i write a regular expression for a pattern which present in between
obj_start()
obj_start()  hii, What is the use of obj_start()?   hello, Its initializing the object buffer, so that the whole page will be first parsed and stored in output buffer so that after complete page is executed
Regular expression
Regular expression  I have the regular expression : var x=/(^\d+$)/ which allows only numbers. It does not accept character, decimals. However it accepts zero. I want an expression that takes numbers(no decimals)except zero
start pyramid
start pyramid  how to make program use loop to make the output become like this; * ** ** *   import java.lang.*; class Star { public static void main(String args[]) { int k,i,j,p=4; for(i=1;i<5;i
Hibernate Expression
In this section we will discuss Hibernate Expression
A regular expression contains another regular expression - PHP
A regular expression contains another regular expression   Please explain how it works in PHP... RegEX1 = "a.*b"; RegEx2 = "a1.*b"; Thanks
regular expression for special characters
regular expression for special characters  How to find out regular expression for special characters
arithmetic expression tree
arithmetic expression tree  how to create the java code randomly for arithmetic expression tree
java util date - Time Zone throwing illegal argument exception
java util date - Time Zone throwing illegal argument exception  Sample Code String timestamp1 = "Wed Mar 02 00:00:54 PST 2011"; Date d = new Date... is throwing an Illegal Argument Exception Why is the second SOP always throwing
javascript regular expression
javascript regular expression  i need a regular expression code for JavaScript
Expression Language execution in notepad
Expression Language execution in notepad  how to execute expression language in notepad for java i am using apache tomcat server4.0.
Cron Expression for Cron Triggers
Cron Expression for Cron Triggers  Need a cron expression that should trigger after or before n days(will be changing) of first saturday of every month
Start MySQL on Linux
Start MySQL on Linux  hii, How can i start MySQL on Linux? is there any cmd for starting MySQL on linux?   hi, yeah , By typing this cmd you can start MySQL service mysqld start
regular expression for phone number
regular expression for phone number  Hi, i need the regular expression code for phone number in PHP. Thanks.   PHP - regular expression code for phone number \+?([0-9]{2})-?([0-9]{3})-?([0-9]{6,7
split string with regular expression
split string with regular expression  How to split string with regular expression in Java
could not start server. - EJB
could not start server.  Dear All I have installed netbeans 5.5.1 and sun java Application server 9.2 to run ejb program. But when I start... comes ---sun java server could not start. so what should I do to start this server
using regular expression
using regular expression  How can we extract string 'abc.com ' from a string http://info@abc.com using regular expression of php
java regular expression
java regular expression  hi i need java expression which allows all characters with minimum 2 characters and maximum 20 characters in answers field after selecting security questions
Advertisements
 

 

 

DMCA.com