I tried with this code  but i am getting probelm

try
Runtime rtime = Runtime.getRuntime();
     Process child = rtime.exec("/bin/bash");
          BufferedWriter outCommand = new BufferedWriter(new
          OutputStreamWriter(child.getOutputStream()));
          //outCommand.write("sh"+" "+"shellexam.sh");
          outCommand.write("shellexam");
          //outCommand.write("\n");
          outCommand.flush();
     //child.wait(30000);
          System.out.println("It is working1");
     //     child.waitFor();
System.out.println("It is working2");
int retCode =child.exitValue();
System.out.println("It is working3");
child.waitFor();
               catch(IOException io)
               System.out.println("Exception is"+io);
catch(InterruptedException ie)
     System.out.println("IntException is"+ie);
I can't get output

I have done a similar thing: try to make a mehotd that
return an output String.
String output = new String();
String cmd = /* all that you want */ "";
Process p = Runtime.getRuntime().exec(cmd);
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
while ((line = input.readLine()) != null) {
output += line + "\n";
returning the output variable

Similar Messages

  • How to  print pdf file by using java print API ? I am trying with this code

    import java.io.FileInputStream;
    import java.io.InputStream;
    import javax.print.Doc;
    import javax.print.DocFlavor;
    import javax.print.DocPrintJob;
    import javax.print.PrintException;
    import javax.print.PrintService;
    import javax.print.PrintServiceLookup;
    import javax.print.SimpleDoc;
    import javax.print.attribute.HashPrintRequestAttributeSet;
    import javax.print.attribute.PrintRequestAttributeSet;
    import javax.print.attribute.standard.Copies;
    import javax.print.attribute.standard.MediaSizeName;
    public class PDFPrint {
    static public void print(InputStream inputStream, PrintService printService) throws PrintException {
    Doc doc = new SimpleDoc(inputStream, DocFlavor.INPUT_STREAM.AUTOSENSE, null);
    PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
    attributes.add(MediaSizeName.ISO_A4);
    attributes.add(new Copies(1));
    print(doc, attributes, printService);
    }//print()
    static public void print(Doc doc, PrintRequestAttributeSet attributes, PrintService printService) throws PrintException {
    if (printService == null) {
    printService = PrintServiceLookup.lookupDefaultPrintService();
    System.out.println("The Printer Name is :"+printService.getName());
    DocPrintJob docPrintJob = printService.createPrintJob();
    System.out.println("Before Print Start()");
    docPrintJob.print(doc, attributes);
    }//print()
    public static void main(String args[])
    PrintService defaultPrintService = PrintServiceLookup.lookupDefaultPrintService();
    String file="c:/BackUp/file.pdf";
    FileInputStream fis=new FileInputStream(file);
    System.out.println("Before Print() called ..");
    print(fis,defaultPrintService);
    System.out.println("After Printing....");
    I am using this code to print pdf file. But when I try this one automatically the printer starting with print ascii codes with infinite loop.
    I am using jdk1.4,Acrobat 8.0, Windows environment.
    Can u help me in this regard'
    Thank u
    grani

    import java.io.FileInputStream;
    import java.io.InputStream;
    import javax.print.Doc;
    import javax.print.DocFlavor;
    import javax.print.DocPrintJob;
    import javax.print.PrintException;
    import javax.print.PrintService;
    import javax.print.PrintServiceLookup;
    import javax.print.SimpleDoc;
    import javax.print.attribute.HashPrintRequestAttributeSet;
    import javax.print.attribute.PrintRequestAttributeSet;
    import javax.print.attribute.standard.Copies;
    import javax.print.attribute.standard.MediaSizeName;
    public class PDFPrint {
    static public void print(InputStream inputStream, PrintService printService) throws PrintException {
    Doc doc = new SimpleDoc(inputStream, DocFlavor.INPUT_STREAM.AUTOSENSE, null);
    PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
    attributes.add(MediaSizeName.ISO_A4);
    attributes.add(new Copies(1));
    print(doc, attributes, printService);
    }//print()
    static public void print(Doc doc, PrintRequestAttributeSet attributes, PrintService printService) throws PrintException {
    if (printService == null) {
    printService = PrintServiceLookup.lookupDefaultPrintService();
    System.out.println("The Printer Name is :"+printService.getName());
    DocPrintJob docPrintJob = printService.createPrintJob();
    System.out.println("Before Print Start()");
    docPrintJob.print(doc, attributes);
    }//print()
    public static void main(String args[])
    PrintService defaultPrintService = PrintServiceLookup.lookupDefaultPrintService();
    String file="c:/BackUp/file.pdf";
    FileInputStream fis=new FileInputStream(file);
    System.out.println("Before Print() called ..");
    print(fis,defaultPrintService);
    System.out.println("After Printing....");
    I am using this code to print pdf file. But when I try this one automatically the printer starting with print ascii codes with infinite loop.
    I am using jdk1.4,Acrobat 8.0, Windows environment.
    Can u help me in this regard'
    Thank u
    grani

  • I have bought a 25Euro Itunes Card from Germany and i have a account which i made in Hong kong store, but everytime i try to redeem it a error comes up with "This code must be redeemed in the German storefront" What do i do?

    I have bought a 25Euro Itunes Card from Germany and i have a account which i made in Hong kong store, but everytime i try to redeem it, a error comes up with "This code must be redeemed in the German storefront" What do i do?

    Sell the German iTunes card to someone who can use it in the German
    AppStore and use the money to buy a card for the Hong Kong store.
    iTunes cards are only valid in the country of original purchase. You cannot
    use a German card in Hong Kong.

  • What is wrong with this code? on(release) gotoAndPlay("2")'{'

    Please could someone tell me what is wrong with this code - on(release)
    gotoAndPlay("2")'{'
    this is the error that comes up and i have tried changing it but it is not working
    **Error** Scene=Scene 1, layer=Layer 2, frame=1:Line 2: '{' expected
         gotoAndPlay("2")'{'
    Total ActionScript Errors: 1 Reported Errors: 1
    Thanks

    If you have a frame labelled "2" then it should be:
    on (release) {
        this._parent.gotoAndPlay("2");
    or other wise just the following to go to frame 2:
    on (release) {
         this._parent.gotoAndPlay(2);
    You just had a missing curly bracket...

  • I can't figure out what's wrong with this code

    First i want this program to allow me to enter a number with the EasyReader class and depending on the number entered it will show that specific line of this peom:
    One two buckle your shoe
    Three four shut the door
    Five six pick up sticks
    Seven eight lay them straight
    Nine ten this is the end.
    The error message i got was an illegal start of expression. I can't figure out why it is giving me this error because i have if (n = 1) || (n = 2) statements. My code is:
    public class PoemSeventeen
    public static void main(String[] args)
    EasyReader console = new EasyReader();
    System.out.println("Enter a number for the poem (0 to quit): ");
    int n = console.readInt();
    if (n = 1) || (n = 2)
    System.out.println("One, two, buckle your shoe");
    else if (n = 3) || (n = 4)
    System.out.println("Three, four, shut the door");
    else if (n = 5) || (n = 6)
    System.out.println("Five, six, pick up sticks");
    else if (n = 7) || (n = 8)
    System.out.println("Seven, eight, lay them straight");
    else if (n = 9) || (n = 10)
    System.out.println("Nine, ten, this is the end");
    else if (n = 0)
    System.out.println("You may exit now");
    else
    System.out.println("Put in a number between 0 and 10");
    I messed around with a few other thing because i had some weird errors before but now i have narrowed it down to just this 1 error.
    The EasyReader class code:
    // package com.skylit.io;
    import java.io.*;
    * @author Gary Litvin
    * @version 1.2, 5/30/02
    * Written as part of
    * <i>Java Methods: An Introduction to Object-Oriented Programming</i>
    * (Skylight Publishing 2001, ISBN 0-9654853-7-4)
    * and
    * <i>Java Methods AB: Data Structures</i>
    * (Skylight Publishing 2003, ISBN 0-9654853-1-5)
    * EasyReader provides simple methods for reading the console and
    * for opening and reading text files. All exceptions are handled
    * inside the class and are hidden from the user.
    * <xmp>
    * Example:
    * =======
    * EasyReader console = new EasyReader();
    * System.out.print("Enter input file name: ");
    * String fileName = console.readLine();
    * EasyReader inFile = new EasyReader(fileName);
    * if (inFile.bad())
    * System.err.println("Can't open " + fileName);
    * System.exit(1);
    * String firstLine = inFile.readLine();
    * if (!inFile.eof()) // or: if (firstLine != null)
    * System.out.println("The first line is : " + firstLine);
    * System.out.print("Enter the maximum number of integers to read: ");
    * int maxCount = console.readInt();
    * int k, count = 0;
    * while (count < maxCount && !inFile.eof())
    * k = inFile.readInt();
    * if (!inFile.eof())
    * // process or store this number
    * count++;
    * inFile.close(); // optional
    * System.out.println(count + " numbers read");
    * </xmp>
    public class EasyReader
    protected String myFileName;
    protected BufferedReader myInFile;
    protected int myErrorFlags = 0;
    protected static final int OPENERROR = 0x0001;
    protected static final int CLOSEERROR = 0x0002;
    protected static final int READERROR = 0x0004;
    protected static final int EOF = 0x0100;
    * Constructor. Prepares console (System.in) for reading
    public EasyReader()
    myFileName = null;
    myErrorFlags = 0;
    myInFile = new BufferedReader(
    new InputStreamReader(System.in), 128);
    * Constructor. opens a file for reading
    * @param fileName the name or pathname of the file
    public EasyReader(String fileName)
    myFileName = fileName;
    myErrorFlags = 0;
    try
    myInFile = new BufferedReader(new FileReader(fileName), 1024);
    catch (FileNotFoundException e)
    myErrorFlags |= OPENERROR;
    myFileName = null;
    * Closes the file
    public void close()
    if (myFileName == null)
    return;
    try
    myInFile.close();
    catch (IOException e)
    System.err.println("Error closing " + myFileName + "\n");
    myErrorFlags |= CLOSEERROR;
    * Checks the status of the file
    * @return true if en error occurred opening or reading the file,
    * false otherwise
    public boolean bad()
    return myErrorFlags != 0;
    * Checks the EOF status of the file
    * @return true if EOF was encountered in the previous read
    * operation, false otherwise
    public boolean eof()
    return (myErrorFlags & EOF) != 0;
    private boolean ready() throws IOException
    return myFileName == null || myInFile.ready();
    * Reads the next character from a file (any character including
    * a space or a newline character).
    * @return character read or <code>null</code> character
    * (Unicode 0) if trying to read beyond the EOF
    public char readChar()
    char ch = '\u0000';
    try
    if (ready())
    ch = (char)myInFile.read();
    catch (IOException e)
    if (myFileName != null)
    System.err.println("Error reading " + myFileName + "\n");
    myErrorFlags |= READERROR;
    if (ch == '\u0000')
    myErrorFlags |= EOF;
    return ch;
    * Reads from the current position in the file up to and including
    * the next newline character. The newline character is thrown away
    * @return the read string (excluding the newline character) or
    * null if trying to read beyond the EOF
    public String readLine()
    String s = null;
    try
    s = myInFile.readLine();
    catch (IOException e)
    if (myFileName != null)
    System.err.println("Error reading " + myFileName + "\n");
    myErrorFlags |= READERROR;
    if (s == null)
    myErrorFlags |= EOF;
    return s;
    * Skips whitespace and reads the next word (a string of consecutive
    * non-whitespace characters (up to but excluding the next space,
    * newline, etc.)
    * @return the read string or null if trying to read beyond the EOF
    public String readWord()
    StringBuffer buffer = new StringBuffer(128);
    char ch = ' ';
    int count = 0;
    String s = null;
    try
    while (ready() && Character.isWhitespace(ch))
    ch = (char)myInFile.read();
    while (ready() && !Character.isWhitespace(ch))
    count++;
    buffer.append(ch);
    myInFile.mark(1);
    ch = (char)myInFile.read();
    if (count > 0)
    myInFile.reset();
    s = buffer.toString();
    else
    myErrorFlags |= EOF;
    catch (IOException e)
    if (myFileName != null)
    System.err.println("Error reading " + myFileName + "\n");
    myErrorFlags |= READERROR;
    return s;
    * Reads the next integer (without validating its format)
    * @return the integer read or 0 if trying to read beyond the EOF
    public int readInt()
    String s = readWord();
    if (s != null)
    return Integer.parseInt(s);
    else
    return 0;
    * Reads the next double (without validating its format)
    * @return the number read or 0 if trying to read beyond the EOF
    public double readDouble()
    String s = readWord();
    if (s != null)
    return Double.parseDouble(s);
    // in Java 1, use: return Double.valueOf(s).doubleValue();
    else
    return 0.0;
    Can anybody please tell me what's wrong with this code? Thanks

    String[] message = {
        "One, two, buckle your shoe",
        "One, two, buckle your shoe",
        "Three, four, shut the door",
        "Three, four, shut the door",
        "Five, six, pick up sticks",
        "Five, six, pick up sticks",
        "Seven, eight, lay them straight",
        "Seven, eight, lay them straight",
        "Nine, ten, this is the end",
        "Nine, ten, this is the end"
    if(n>0)
        System.out.println(message[n]);
    else
        System.exit(0);

  • I have Mac OS X 10.6.8 and I need to update my iMovie, but it will not let me because I need version 10.7.4 or later. I tried downloading this version but it would not let me because I need 10.7. My question is how do I download this version?

    I have Mac OS X 10.6.8 and I need to update my iMovie, but it will not let me because I need version 10.7.4 or later. I tried downloading this version but it would not let me because I need 10.7. My question is how do I download 10.7 in order to update my iMovie?

    Lion should still be available if you call the online Apple Store. If the Apple Store still has it, they will ask for your Apple ID and credit card number and will then send you a code which you can redeem in the Mac App Store. The Lion installer will download and run automatically. 
    Confirm compatibility with your current applications and Lion before you upgrade; in particular you will not be able to run any appications that were written only for PowerPC Macs.
    Regards.

  • Can anyone help with this code

    i am trying to create a html5 video gallery for my website  I was wondering if anyone can help me with this code :  Am i missing something got this from the adobe widget browser i can get the button fuctions but i can not seem to get the video to play or work.. 

    This is the full page i am still working on it but the video code which i posted earlier is not working...    
    123456789101112131415
    Home
    Biography
    To Be Lead
    Gallery
    Videos
    Memorial Page
    Wallpaper
    Blog
    Forum
    Contact
    Randy Savage Bio
    Randy's Facts 101
    His Early Career
    Randy's Career in the WWF
    Randy's Career in WCW
    The Mega Powers  
    Mega powers Bio Mega Powers Facts 101 
    PM to fans and Elizabeth
    Randy's Radio interview
    His Death
    Elizabeth Hulette 
    Elizabeth Bio Elizabeth Facts 101 Her Career in the WWF Her Career in WCW Later Life Farewell to a Princess Elizabeth's Radio Interview Elizabeth Death 
    Sherri Martel
    Gorgeous George
    Team Madness
    Early Years
    ICW Gallery
    WWF Gallery
    WCW Gallery
    NWO Gallery
    Memorial Page for Randy
    Memorial Page for Elizabeth
                          Video of the Month    
    Site Disclaimer
    Macho-madness is in no way in contact with World Wrestling Entertainment. All photos are copyright to World Wrestling Entertainment or their respective owners and is being used under the fair copyright of Law 107.
    ©macho-madness.net All right's Reserved.  
            Affiliates
    Want to be an affiliate, elite, or partner site? Email: [email protected] with the list of things below.
    Place in the subject of email: “Randy Savage Online Affiliation”.
    Name: 
    Email: 
    Site Name: 
    Site URL: 
    When Will The Site Be Added?:
                        To see A List Click Here...
    ©macho-madness.net All right's Reserved.  
    Offical Links

  • Parallelport-whts wrong with this code?

    guys i need to know wht's wrong with this code.i sent the byte x=5 to the parallel port.and tried to read it back intoo another variable y..but the value of y is not returning.
    it showed the errors:
    1. printer port LPT1 :failed to write:IOException
    2.Exception
    java.io.IOException The device is not connected in writebyte
    i have no devices connected to the parallel port.
    my code is included:
    import javax.comm.*;
    import java.io.*;
    public class Parallelio {
    private static OutputStream outputStream;;
    private static ParallelPort parallelPort;
    private static CommPortIdentifier port;
    private static InputStream inputStream;
    // CONSTANT
    public static final String PARALLEL_PORT = "LPT1";
    public static void main(String[] args) {
    try {
         // get the parallel port connected to the printer
    port = CommPortIdentifier.getPortIdentifier(PARALLEL_PORT);
         // open the parallel port -- open(App name, timeout)
    parallelPort = (ParallelPort) port.open("CommTest", 50);
    outputStream = parallelPort.getOutputStream();
         byte x=5;     
         byte y;
         outputStream.write(x);
         inputStream=parallelPort.getInputStream();
         y=(byte)inputStream.read();
         System.out.println("The value read is:"+y);
         outputStream.flush();
         outputStream.close();     
    // inputStream.flush();
         inputStream.close();     
         } catch (NoSuchPortException nspe) {
    System.out.println("\nPrinter Port LPT1 not found : "
    + "NoSuchPortException.\nException:\n" + nspe + "\n");
    } catch (PortInUseException piue) {
    System.out.println("\nPrinter Port LPT1 is in use : "
    + "PortInUseException.\nException:\n" + piue + "\n");
         catch (IOException ioe) {
    System.out.println("\nPrinter Port LPT1 failed to write : "
    + "IOException.\nException:\n" + ioe + "\n");
    } catch (Exception e) {
    System.out
    .println("\nFailed to open Printer Port LPT1 with exeception : "
    + e + "\n");
    } finally {
    if (port != null && port.isCurrentlyOwned()) {
    parallelPort.close();
    System.out.println("Closed all resources.\n");
    regards
    arun
    Message was edited by:
    arun_koshy
    Message was edited by:
    arun_koshy
    Message was edited by:
    arun_koshy

    Hi
    I also need jwrapi package, could someone send me the binaries or the password?
    My email is
    [email protected]
    thank you.

  • What the he** is wrong with this code?

    Hi,
    I have 2 tables. Primary table "resease" and secondary table (containing the foreign key) "kunden".
    Selecting a release (dropdownlist), will show you the corresponding entry of kunden (datatable).
    I added buttons to the datatable for deleting certain rows. This all works fine so far.
    But as you are going to delte the last entry of table kunden, I want to delte the corresponding entry of the table release as well. And by trying to do so, I get an exception telling in line "dataTable1Model.commit();"
    "java.sql.SQLException: Lock time out; try later."
    The exception disappears by deleting the inner try-catch block.
    So what is wrong with this code?
    Thank,
    Mark.
    PS: If you need the database-schema or anything else, let me know....
    public String delete_action() {
            try {
             //returns -1, so I can't use it     
                int rowCount = dataTable1Model.getRowCount();          
             //get affected row     
                com.sun.jsfcl.data.DataCache.Row row =
                dataTable1Model.getDataCache().get(dataTable1Model.getRowIndex());
                row.setDeleted(true);
                try {
                    //New RowSet for getting FK of affected line
                    JdbcRowSetXImpl pkRowSet = new JdbcRowSetXImpl();
                    pkRowSet.setDataSourceName("java:comp/env/jdbc/AVT");
                    pkRowSet.setCommand("SELECT fk_idrelease FROM kunden " +
                    "where fk_idrelease = ?");
                    //Convert Row into string
                    String myRow = row.toString();
                    //Getting the index of the first "=" (it's before the FK)
                    int index = myRow.indexOf("=")+1;
                    //Getting the number (FK) out of the string an casting it to int
                    int fk = Integer.parseInt(myRow.substring(index,(index+1)));
                    //Saving the FK in SessionBean1, so I can use it a parameter of
              //the setObject(int, Object)-method
                    getSessionBean1().setFk(fk);
                    //this will give me a RowSet of all lines containing the FK of
              //the affected row
              pkRowSet.setObject(1, getSessionBean1().getFk());
                    pkRowSet.execute();
                    pkRowSet.last();
                    int numRow = pkRowSet.getRow();
              //If the numRow (numbers of rows) is 1, go to cascade_delte
              //and delte the entry with primary key as well
                    if (numRow == 1) {
                        cascade_delete(); //not implemented yet
                }catch (Exception ex) {
                    error("Error counting affected rows: " + ex);
                dataTable1Model.commit();
                dataTable1Model.execute();
                info("Deleting row OK!");
            }catch (Exception e) {
                log("Page 1: Row delete exception: ", e);
                error("Error during deleting: " + e);
            } // end try catch
          return null;
        }

    just a guess - perhaps call pkRowSet.close() at the end of your try/catch?
    v

  • I am trying to sync my itunes with my ipod, but when I get to step 3 of syncing, it stops. Also, I deleted all the songs on my ipod, and when I go to my music in my ipod the songs are all still there and in a grey color and I'm not able to select them.

    I am trying to sync my itunes with my ipod, but when I get to step 3 of syncing, it stops. Also, I deleted all the songs on my ipod, and when I go to my music in my ipod the songs are all still there and in a grey color and I'm not able to select them. How do I completely clear my ipod music, and how can I solve the syncing problem?

    Sync works the same way it always has, connect the device, select the content desired to sync and sync.
    All the media should be in iTunes already, iDevices are not and have never been backup devices.
    If this is a new computer, move the content from the old computer to the new computer.

  • I recently download a song with my IPOD Touch 4G.  The song appears in my iTunes music library but not on my IPOD.  I've tried syncing several times, but I cannot get it to transfer to the IPOD.  Any suggestions??

    I recently download a song with my IPOD Touch 4G.  The song appears in my iTunes music library but not on my IPOD.  I've tried syncing several times, but I cannot get it to transfer to the IPOD.  Any suggestions??  (This has never happened before to me)

    Use 3rd party software like:
    http://www.digidna.net/products/diskaid
    http://www.wideanglesoftware.com/touchcopy/index.php
    For items purchased (including apps) from iTunes:
    http://support.apple.com/kb/HT1848

  • Can anybody help me with this code?

    I am a beginner to J2ME. The following is a small program I wrote just for test.
    Theoretically, in my opinion, I shall see in the screen a number increase from 1 to 29999 rapidly after execute the code. But instead, it displays nothing but only displays 29999 after several seconds . Can some body point out what's wrong with this code? Thanks.
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    public class Test extends MIDlet{
    int x=1;
    String b="";
    private Display display;
    public Test() {
    display = Display.getDisplay(this);
    public void startApp() {
    MyCanvas mc = new MyCanvas() ;
    display.setCurrent(mc) ;
    while(x<30000){
    b=String.valueOf(x);
    mc.repaint();
    x++;
    public void pauseApp() {
    public void destroyApp(boolean unconditional) {
    class MyCanvas extends Canvas{
    public void paint(Graphics g){
    g.drawString(b,10,10,0);

    thanks, I have already got the answer. you are right, if repaint in a high speed the screen will show nothing. here is the code for it, thanks the expert of nokia forum.
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    //Counter
    //Need to know when a number has been painted and need to wait a for a fraction of a sec before
    //painting the next number. This wait also allows other events like "Exit" to be processed
    //Use double buffering to avoid flicker
    //Paint in a different thread to keep the UI responsive
    public class MyMIDlet extends MIDlet{
    int x=1;
    String b="";
    private Display display;
    Thread t = null;
    MyCanvas mc = null;
    public MyMIDlet() {
    display = Display.getDisplay(this);
    public void startApp() {
    mc = new MyCanvas();
    t = new Thread(mc) ;
    display.setCurrent(mc) ;
    b=String.valueOf(x);
    t.start();
    public void callbackPaintDone(){
    try{
    //provides the delay between every repaint and also time to react to Exit
    synchronized(this){
    wait(1);
    }catch(Exception e){}
    paintNextNumber();
    private void paintNextNumber(){
    if(x<30000){
    x++;
    b=String.valueOf(x);
    mc.doPaint = true; //signals that next number can be painted
    public void pauseApp() {
    public void destroyApp(boolean unconditional) {
    class MyCanvas extends Canvas implements Runnable{
    Image buf = null;
    Graphics bg = null;
    public boolean doPaint = true;
    public MyCanvas(){
    buf = Image.createImage(getWidth(),getHeight());
    bg = buf.getGraphics();
    public void paint(Graphics g){
    bg.setColor(255,255,255);
    bg.fillRect(0,0,getWidth(),getHeight());
    bg.setColor(0);
    bg.drawString(b,10,10,0);
    g.drawImage(buf,10,10,Graphics.TOP|Graphics.LEFT);
    // Callback for next number to be painted
    MyMIDlet.this.callbackPaintDone();
    public void run(){
    while(true){
    if(doPaint){ //only paints when a number has been painted, and next one is ready to be painted
    doPaint = false;
    repaint();
    serviceRepaints();

  • Can somebody help me with this code?

    Can anyone help me with this code? My problem is that i can't
    seem to position this form, i want to be able to center it
    vertically & horizontally in a div either using CSS or any
    other means.
    <div id="searchbar"><!--Search Bar -->
    <div id="searchcart">
    <div class="serchcartcont">
    <form action='
    http://www.romancart.com/search.asp'
    name="engine" target=searchwin id="engine">
    <input type=hidden value=????? name=storeid>
    <input type=text value='' name=searchterm>
    <input type=submit value='Go'> </form>
    </div>
    </div>
    <div class="searchcont">Search For
    Products:</div>
    </div><!-- End Search Bar -->
    Pleasssssseeeeeeee Help
    Thanks

    Hi,
    Your form is defined in a div named "serchcartcont", you can
    use attributes like position and align of the div to do what you
    want to do. But there are two more dives above this dive, you will
    have define the height width of these before you can center align
    the inner most div. If you are not defining the height & width
    then by default it decide it automatically to just fit the content
    in it.
    Hope this helps.
    Maneet
    LeXolution IT Services
    Web Development
    Company

  • My Ipod is stuck in recovery mode with the plug in to itunes thing on the screen I tryed to restore it but I keep getting a error 28 and I tryed to do the reset thing but it did not work what do I do?

    My Ipod is stuck in recovery mode with the plug in to itunes thing on the screen I tryed to restore it but I keep getting a error 28 and I tryed to do the reset thing but it did not work what do I do?

    Hi,
    You could see if this helps...
    DFU Mode / Unable to Update or Restore
    http://support.apple.com/kb/HT1808
    DFU Mode
    Open iTunes and Connect the iPod to your Mac
    Press and Hold the Sleep/Wake Button and the Home Button at the Same Time
    After 10 Seconds release the Sleep/Wake Button until iTunes tells you it has Detected an iPod in Recovery Mode...
    The Phone Screen will remain Black... Now Restore.
    Backing up, Updating and Restoring
    http://support.apple.com/kb/HT1414

  • Please tell me what is the problem with this code

    Hai,
    Iam new to Swings. can any one tell what is the problem with this code. I cant see those controls on the frame. please give me the suggestions.
    I got the frame ,but the controls are not.
    this is the code:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class ex2 extends JFrame
    JButton b1;
    JLabel l1,l2;
    JPanel p1,p2;
    JTextField tf1;
    JPasswordField tf2;
    public ex2()
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setTitle("Another example");
    setSize(500,500);
    setVisible(true);
    b1=new JButton(" ok ");
    p1=new JPanel();
    p1.setLayout(new GridLayout(2,2));
    p2=new JPanel();
    p2.setLayout(new BorderLayout());
    l1=new JLabel("Name :");
    l2=new JLabel("Password:");
    tf1=new JTextField(15);
    tf2=new JPasswordField(15);
    Container con=getContentPane();
    con.add(p1);
    con.add(p2);
    public static void createAndShowGUI()
    ex2.setDefaultLookAndFeelDecorated(true);
    public static void main(String ar[])
    createAndShowGUI();
    new ex2();
    }

    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class ex2 extends JFrame
        JButton b1;
        JLabel l1,l2;
        JPanel p1,p2;
        JTextField tf1;
        JPasswordField tf2;
        public ex2()
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            setTitle("Another example");
            b1=new JButton(" ok ");
            p1=new JPanel();
            p1.add(b1);
            p2=new JPanel();
            p2.setLayout(new GridLayout(2,2));
            l1=new JLabel("Name :");
            l2=new JLabel("Password:");
            tf1=new JTextField(15);
            tf2=new JPasswordField(15);
            p2.add(l1);
            p2.add(tf1);
            p2.add(l2);
            p2.add(tf2);
            Container con=getContentPane();
            con.add(p1, BorderLayout.NORTH);
            con.add(p2, BorderLayout.CENTER);
            pack();
            setVisible(true);
        public static void createAndShowGUI()
            ex2.setDefaultLookAndFeelDecorated(true);
        public static void main(String ar[])
            createAndShowGUI();
            new ex2();
    }

Maybe you are looking for