Online Hibernate Training just in Rs. 1000

One week online training in Hibernate ORM framework. Learn Hibernate Framework and enhance your skills. Best Online Hibernate training at 90% discount. Join Now!! Offer is valid Only for limited Period!!! Online Training Big Data and Hadoop Training Java Training  
 

illeagal character error....

Ads

 
 

Share on Google+Share on Google+

Pradyumna Sahoo
illeagal character error....
1 Answer(s)      5 years and 9 months ago
Posted in : Java Beginners

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

Ads
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
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
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
How to convert entity character to html character
How to convert entity character to html character  How to convert entity character to html character
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  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
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
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. This type error also comes when java file
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
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 string
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
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