illeagal character error....
Here is my code:
import java.io.*;
import java.awt.*;
import java.util.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.border.*;
import javax.swing.filechooser.*;
import javax.imageio.*;
import java.awt.image.*;
class MainScreen{
JFrame screen;
JButton select;
JScroolPane jsp;
JLabel filename;
JPanel frontpanel;
ImagePanel impanel;
` Container container;
File imagefiel;
MainScreen(){
screen= new JFrame("Image viewer by P Sahoo");
select= new Button("Select a File");
select.addActionListener(new SelectHandler());
filename=JLabel("File :");
container=screen.getContentPane();
container.add(select,BorderLayout.NORTH);
container.add(filename,BorderLayout.SOUTH);
screen.setDefaultClosdeOperation(JFrame.EXIT_ON_CLOSE);
screen.setSize(400,400);
screen.setVisible(true);
}
class SelectHandler implements ActionListener{
public void actionPerformed(ActionEvent e){
JFileChooser chooser=new JFileChooser();
FileNameExtensionFilter filter=new FileNameExtensionFilter("JPG & Images","jpg","gif");
chooser.setFileFilter(filter);
int returnvalue=chooser.showOpenDialog(screen);
if(returnvalue==JFileChooser.APPROVE_OPTION)
imagefile=chooser.getSelectFile();
filename.setText("File :" +imagefile.getAbsolutePath());
try{
BufferedImage image=ImageIO.read(imagefile);
ImagePanel ip=new ImagePanel(image);
if(jsp!=null){
container.remove(jsp);
container.validate();
}
int VSB=ScrollPaneConstants.VERTICAL_SCROOLBAR_AS_NEEDED;
int HSB=ScroolPaneConstants.HORIZONTAL_SCROOLBAR_AS_NEEDED;
jsp=new JScrollPane(ip,VSB,HSB);
container.add(jsp);
} catch(IOException e1){
System.out.println(e1);
}
System.out.println(chooser.getSelectedFile().getName());
}
}
public static void main(String args[]){
new MainScreen();
}
}
class ImagePanel extends Jpanel{
BufferedImage image;
ImagePanel(){
}
ImagePanel(BufferedImage image){
this.image=image;
setPreferredSize(new Dimension(image.getWidth(),image.getHeight()));
setBorder(new EtchedBorder());
}
public void paint(Graphics g){
System.out.println("panel pained.."+image.getWidth());
g.drawImage(image,0,0,image.getWidth(),image.getHeight(),null);
}
}
error:
MainScreen.java:19: illegal character: \96
` Container container;
^
MainScreen.java:19: ';' expected
` Container container;
^
MainScreen.java:19: <identifier> expected
` Container container;
^
3 errors
##
View Answers
November 7, 2011 at 11:33 AM
import java.io.*;
import java.awt.*;
import java.util.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.border.*;
import javax.swing.filechooser.*;
import javax.imageio.*;
import java.awt.image.*;
class ImagePanel extends JPanel{
BufferedImage image;
ImagePanel(){
}
ImagePanel(BufferedImage image){
this.image=image;
setPreferredSize(new Dimension(image.getWidth(),image.getHeight()));
setBorder(new EtchedBorder());
}
public void paint(Graphics g){
System.out.println("panel pained.."+image.getWidth());
g.drawImage(image,0,0,image.getWidth(),image.getHeight(),null);
}
}
class MainScreen{
JFrame screen;
JButton select;
JScrollPane jsp;
JLabel filename;
JPanel frontpanel ;
File imagefile ;
MainScreen(){
screen= new JFrame("Image viewer by P Sahoo");
select= new JButton("Select a File");
select.addActionListener(new SelectHandler());
filename=new JLabel("File :");
screen.add(select,BorderLayout.NORTH);
screen.add(filename,BorderLayout.SOUTH);
screen.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
screen.setSize(400,400);
screen.setVisible(true);
}
class SelectHandler implements ActionListener{
public void actionPerformed(ActionEvent e){
JFileChooser chooser=new JFileChooser();
FileNameExtensionFilter filter=new FileNameExtensionFilter("JPG & Images","jpg","gif");
chooser.setFileFilter(filter);
int returnvalue=chooser.showOpenDialog(screen);
if(returnvalue==JFileChooser.APPROVE_OPTION)
imagefile=chooser.getSelectedFile();
filename.setText("File :" +imagefile.getAbsolutePath());
try{
BufferedImage image=ImageIO.read(imagefile);
ImagePanel ip=new ImagePanel(image);
if(jsp!=null){
screen.remove(jsp);
screen.validate();
}
int VSB=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int HSB=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
jsp=new JScrollPane(ip,VSB,HSB);
screen.add(jsp);
} catch(IOException e1){
System.out.println(e1);
}
System.out.println(chooser.getSelectedFile().getName());
}
}
public static void main(String args[]){
new MainScreen();
}
}
Ads
Related Tutorials/Questions & Answers:
illeagal character error....
illeagal character error.... Here is my code:
import java.io....);
}
}
error:
MainScreen.java:19: illegal
character: \96
` Container container
Character Class
Character Class
Character defines the forDigit();,digit()methods..how can these b used and wht is radix point signifies here...in the arguments of these two???..pls answer a code on this with radix .. are these methods also
Advertisements
underscore as character
underscore as character how can i consider _ as a
character instead of wildcard
character?
my problem is like this
i have 20 records as follows
manohar 1234455
manohar 453635
manohar 345454
manohar_1234455
now when i am
Character class
Character class
Character defines the forDigit();,digit()methods..how can these b used and wht does radix point signify here.i want to knw what basically radix is??here in the arguments of these two???because i tried runnin
Error-
Error- Hello, I would like to know about XSD file.
I try to print XML file but I am getting
error SAXException-- says
Content is not allowed in prolog.
Please help me
error
error i have 404
error in my program plz tell me yhe solution about
error
error i have 404
error in my program plz tell me yhe solution about
error
/ServletUserEnquiryForm.shtml
getting an
error given below
SQLException caught: [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax
error
please suggest
Error
Error I have created ajax with php for state and city. When I change state then city will not come in dropdown list and it give me
error as 'Unknown Runtime
Error'.
This
error come only in IE browser, but in other brower
error
error When I deploye the example I have this message
cannot Deploy HelloWorld
Deployment
Error for module: HelloWorld:
Error occurred during deployment: Exception while deploying the app [HelloWorld
error!!!!!!!!!
error!!!!!!!!! st=con.createStatement();
int a=Integer.parseInt(txttrno.getText());
String b=txttname.getText();
String c=txtfrom.getText();
String d=txtto.getText
error!!!!!!!!!
error!!!!!!!!! st=con.createStatement();
int a=Integer.parseInt(txttrno.getText());
String b=txttname.getText();
String c=txtfrom.getText();
String d=txtto.getText
error!!!!!!!!!
error!!!!!!!!! st=con.createStatement();
int a=Integer.parseInt(txttrno.getText());
String b=txttname.getText();
String c=txtfrom.getText();
String d=txtto.getText
Error
Error Hi. I am getting
error in the following code after the line I have commented as
ERROR. How to solve this. Thanks in advance.
package...;");
//
ERROR
out.println(" var pattern
Error
Error Hi. I am getting
error in the following code after the line I have commented as
ERROR. How to solve this. Thanks in advance.
package...;");
//
ERROR
out.println(" var pattern
Error
Error Hi. I am getting
error in the following code after the line I have commented as
ERROR. How to solve this. Thanks in advance.
package...;");
//
ERROR
out.println(" var pattern
Error
Error Hi. I am getting
error in the following code after the line I have commented as
ERROR. How to solve this. Thanks in advance.
package...;");
//
ERROR
out.println(" var pattern = /^\d{3,5
error
error whats the
error..............
import java.util.Scanner;
public class g {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
int d,x,y;
System.out.println("Enter the first number
How to convert entity character to html character
How to convert entity
character to html character Please help me to "convert entity
character to html
character" in java.
If possible please provide source code which take String as input and return as String
Unknown Character set: 'utf8mb4'.
Unknown
Character set: 'utf8mb4'. While working on eclipse on an application that uses MySQL as the back end for the database,
I was having
error..., it generates an
error:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorEx ception
character literal in octal format
;>>
EscapeSequence1.java:6:
error: unclosed
character literal
char...
^
EscapeSequence1.java:6:
error: unclosed
character literal
char ch2...
character literal in octal format class EscapeSequence1
{
public
Character Wrapper Class.
Character Wrapper Class. what are Mirrored Unicode Characters??
and whats the use of "isMirrored(ch);method ??.where ch is any
character argument.... There are special characters in UNICODE to achieve the RTL. Such
character is the Mirroring
character as command line arguments
character as command line arguments public class testing
{
public static void main(String args[])
{
char a;
a=args[0];
System.out.println("
character is:"+a);
}
}
what will be the above program output
find the first character is vowel or not
find the first
character is vowel or not hi friend, can u plz send me javascript code for find the wether the first
character is a vowel or not. 2) check wether the last
character is same as the first
character or not
3) check
Alphabet Character Case-Converter
Alphabet
Character Case-Converter
 ... a
character
(uppercase) into a lowercase
character. The java.lang package
provides the functionality to convert the uppercase
character into a lowercase
character
JavaScript regex validate Character
Character.
<html>
<head>
<title>
Character validation...
Character value : "+name);
return true;
}
alert("It is not valid
character !");
return false;
}
</script>
<
JavaScript regex validate Character
Character
<html>
<head>
<title>
Character validation...
Character value : "+name);
return true;
}
alert("It is not valid
character !");
return false;
}
</script>
<