illegal start of expression

illegal start of expression

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... we want to describe a code that helps you in understanding the coedeof Illegal
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...*":-This is the expression to search words starting with letter "R". Pattern p = Pattern.compile(regex
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
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
Regular expression
Regular expression  how i write a regular expression for a pattern which present in between
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 and deploy
start and deploy  how to deployee java web application in glassfish by using netbeans6.7
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
Hibernate Expression
In this section we will discuss Hibernate Expression
obj_start()
obj_start()  hii, What is the use of obj_start()?   hello,ADS_TO_REPLACE_1 Its initializing the object buffer, so that the whole page will be first parsed and stored in output buffer so that after complete page
start pyramid
start pyramid  how to make program use loop to make the output become like this; * ** ** *   import java.lang.*;ADS_TO_REPLACE_1 class Star { public static void main(String args[]) { int k,i,j,p=4; for(i=1
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
arithmetic expression tree
arithmetic expression tree  how to create the java code randomly for arithmetic expression tree
regular expression for special characters
regular expression for special characters  How to find out regular expression for special characters
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
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
using regular expression
using regular expression  How can we extract string 'abc.com ' from a string http://[email protected] using regular expression of php
spring-expression maven dependency
spring-expression maven dependency  Hi, What is maven dependency of latest version of spring-expression? What code should i add to get spring-expression maven dependency in my project? Thanks   Hi, The Spring
ModuleNotFoundError: No module named 'start'
ModuleNotFoundError: No module named 'start'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'start' How to remove the ModuleNotFoundError: No module named 'start'
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? ADS_TO_REPLACE_1   hi, yeah , By typing this cmd you can start MySQLADS_TO_REPLACE_2 service mysqld start
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
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
expression language array
expression language array  var test='${abc.myarray}'; //myarray is string array in bean //abc How to get the length of myarray? I tried test.length which does not work
Regular expression contains character - PHP
Regular expression contains character  A PHP script that can check if the regular expression contains character
Regular expression in c++{MFC}
Regular expression in c++{MFC}  Hi ALL, I want to build a regular expression in c++{MFC} which validates the URL. The regular expression must... of %5C & %2F character. How can we develop a generic Regular Expression
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
PHP Expression
PHP Expressions: In every language expression plays a vital role, in PHP whatever you write is an expression (almost anything). Anything has a value is an expression and this is the easiest way to define and understand expression
cron expression - JSP-Servlet
cron expression  Hi, I need to create cron expression dynamically in java when the user gives the specifications like frequency, delay, daily , monthly etc.. from a jsp page. Please help me out ASAP. Regards, Pavani
where to start - Java Beginners
where to start  Myself being a java beginner want to know wat is that I shall start practicing from the day one to make myself get the knowledge... on.   Hi, Thanks for using RoseIndia.net You can start learning java
error : not an sql expression statement
error : not an sql expression statement  hii I am gettin followin error in connecting to database SQLserver 2005 in Jdeveloper,i m usin struts and jsp my pogram: import java.sql.*; public class TaskBO { public TaskBO
Is it too late to start coding?
Is it too late to start coding?  Hi, I am beginner in Data Science...: Is it too late to start coding? Try to provide me good examples or tutorials links so that I can learn the topic "Is it too late to start coding?". Also
How to start learning MySQL?
How to start learning MySQL?  Hello developers, I am total beginner in programming and learned little bit to Java. Now I want to learn MySQL... and want to learn MySQL. How to start learning MySQL? Which are good tutorials
ModuleNotFoundError: No module named 'expression-parser'
ModuleNotFoundError: No module named 'expression-parser'  Hi, My... named 'expression-parser' How to remove the ModuleNotFoundError: No module named 'expression-parser' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'expression-parser'
ModuleNotFoundError: No module named 'expression-parser'  Hi, My... named 'expression-parser' How to remove the ModuleNotFoundError: No module named 'expression-parser' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'expression-parser'
ModuleNotFoundError: No module named 'expression-parser'  Hi, My... named 'expression-parser' How to remove the ModuleNotFoundError: No module named 'expression-parser' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'license-expression'
ModuleNotFoundError: No module named 'license-expression'  Hi, My... named 'license-expression' How to remove the ModuleNotFoundError: No module named 'license-expression' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'calculate-expression'
ModuleNotFoundError: No module named 'calculate-expression'  Hi...: No module named 'calculate-expression' How to remove the ModuleNotFoundError: No module named 'calculate-expression' error? Thanks   Hi
ModuleNotFoundError: No module named 'expression-parser'
ModuleNotFoundError: No module named 'expression-parser'  Hi, My... named 'expression-parser' How to remove the ModuleNotFoundError: No module named 'expression-parser' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'genomon-expression'
ModuleNotFoundError: No module named 'genomon-expression'  Hi, My... named 'genomon-expression' How to remove the ModuleNotFoundError: No module named 'genomon-expression' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'import-expression'
ModuleNotFoundError: No module named 'import-expression'  Hi, My... named 'import-expression' How to remove the ModuleNotFoundError: No module named 'import-expression' error? Thanks   Hi, In your

Ads