illeagal character error....

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








##

  • List item

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();
                                        }

                                            }









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
How to convert entity character to html character
How to convert entity character to html character  How to convert entity character to html character
error
error  while iam compiling iam getting expected error
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  java.lang.unsupportedclassversionerror:bad major version at offset 6 how to solve this????   Hi, Please check the version of framework used and also the JDK version.ADS_TO_REPLACE_1 This type error also comes
error
error
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
Adding slash "\" character before quote "'" in a query
Adding slash "\" character before quote "'"...; Adding slash "\" character before quote "'"... the phrases like "What's your name?", database gives the error due
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
"+it); } } this is my program i am getting an error saying cannot find symbol class stringADS
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
replace character in php
replace character in php  PHP script that replace character
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
php remove last character
php remove last character  to remove the last character, i used the trim function which is not working
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
password validation with special character
password validation with special character  how to validate password with special character using java script
How to display string or character
How to display string or character  how to print character or a word without using array concept
Determining the type of Character
Determining the type of Character In this section, you will learn how to determine the type of a character. You can use the methods of Character class to determine the properties of a character. This class provides several methods
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> <
What is Character Functions
What is Character Functions  What is Character Functions   Hi, Here is the answer,ADS_TO_REPLACE_1 Character Functions are INITCAP, UPPER, LOWER, SUBSTR & LENGTH. Additional functions are GREATEST & LEAST
Character Directions in java
Character Directions in java  java 2,version 1.4 adds a method "getDirectionality();" , what is the use of this method ?   This method returns the Unicode directionality property for the given character. Character
Wrapper Character class.
Wrapper Character class.  How do the methods 'isIndentifierIgnorable(ch)' and 'isISOControl(ch)' work?? while workin with 'Character' wrapper class...: This method returns true if the character may be part of a Unicode identifier; false
J2ME count character into string
J2ME count character into string  i am new in J2ME, my problem is how to count character into number, i had been research google for almost 2 days... form which allow user to input character user input helloworld then press
Replace Character in String
Replace Character in String        This example replaces a character with a specified character in a given string. To replace a character with the given character in sting first
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
Removing character from a string in sql.
Removing character from a string in sql.  How to remove or replace character from a string
Find out last character of array
Find out last character of array  How we can find out the last character of array in java program
Setting the default Java character encoding?
Setting the default Java character encoding?  Setting the default Java character encoding
Count the character in java
Count the character in java  Write a java program to count the character ââ?¬Ë?aââ?¬â?¢ typed by the user in a paragraph by implementing thread.   Count characters by implementing thread import java.util.*; class
Character count by while loop
Character count by while loop  Write the program to count the number of characters entered until a full stop (.)is keyed-in. Anyone there pls help...]) flag=true; } if(!flag){ System.out.println("Character :"+ch+" occurs "+count
character counter - Java Beginners
character counter  how to show only first three characters of the entered(by user) name?  hy katy, import java.io.*; class counter...!!"); } else{ System.out.println("First Three Character is:"+c[0]+c[1]+c[2
Prinnt UNICODE character on swing component
Prinnt UNICODE character on swing component  Hello, I am trying to put unicode character n swing component. can anyone tell me how to do this? Thank you

Ads