Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-03-2008, 11:29 PM
Member
 
Join Date: Mar 2008
Posts: 24
Azndaddy is on a distinguished road
[SOLVED] Line number: ?
Hi, just having a problem at the moment with my code. its only part of the code from the class

PHP Code:
    public void execute()
    {
        
buffer = new Buffer();
        
System.out.print("Line number: ");
        
int pos Integer.parseInt(getInput());
        
buffer editor.getCurrentBuffer();
        
System.out.println(pos +": " +buffer.getLines().get(pos-1));
        
buffer.setPos(pos-1);
        
editor.setCurrentBuffer(buffer);
    } 
What im trying to do is, when i type in the command goto, it will print the line number in which i chose. example when i type goto, then press 3, it will print out line numbeer 3. but the problem im having is, when i type in goto, 0 which is the line number, it gives me an error.

how could i fix this so that when i type goto, 0 line, it print out the following
Line number: ?

Thanks
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-04-2008, 06:46 AM
Member
 
Join Date: Mar 2008
Posts: 24
Azndaddy is on a distinguished road
nvm

Fixed it

added the following line

PHP Code:
if(getCurrentBuffer().getPos() == 0)

else

System.out.println("Line Number: ?"); 
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Last line in JTextArea wont display Chris.Brown.SPE Advanced Java 5 04-11-2008 02:52 PM
[SOLVED] Delete Current line from file Azndaddy New To Java 1 03-28-2008 01:37 PM
line number kazitula New To Java 3 11-21-2007 11:27 PM
Reading in data from file line by line bluekswing New To Java 1 10-02-2007 01:19 AM
how to know the number of the line simon New To Java 3 08-01-2007 05:59 PM


All times are GMT +3. The time now is 01:05 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org