Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / November 2005

Tip: Looking for answers? Try searching our database.

Help with BlueJ: editing and auto indenting all including {}'s

Thread view: 
bherbst65@hotmail.com - 09 Nov 2005 15:01 GMT
Hi All,

I have Win2k, BlueJ 2.0.5  and have BlueJTutorial.pdf.
When  I search the tutorial for "indenting" it shows nothing.

When I am in the mode of Edit there does not seem to be a "Select All".
When I do a "mouse over" to "select all" and use a F6  is there a way
to indent correctly to so that lines and { }'s  are in correct logical
format?

Bob
JS - 10 Nov 2005 19:10 GMT
The BlueJ editor should indent as you type but if you need to indent other
lines then you need to put your mouse cursor over the line that you want to
indent and use F6 (indent more) or F5(indent less) to do each line
indivudually. Its a pain but its how its made. go to www.BlueJ.org if you
have any suggestions
> Hi All,
>
[quoted text clipped - 7 lines]
>
> Bob
bherbst65@hotmail.com - 11 Nov 2005 02:33 GMT
Hi JS,
I deleted my original post thinking that no one was going to
look at it but....

Thanks for stopping by. Your reaction to the situation
"Its a pain...." makes me laugh. I have download
DrJava (Rice University) that has a very easy to use format the entire
page of programming (select all..... and then indent). I  would think
that they would get together and trade items.....  DrJava doesn't have
a jar maker that I can see but BlueJ does.

I did join the bluej-discuss@bluej.org mailing list
and ask them about the matter of a entire page indent.

So will wait an see what happens.
Thanks again.
Bob
JS - 11 Nov 2005 10:33 GMT
If I remember rightly www.bluej.org has a suggestions section on it, if it
doesnt send me your suggestions and I can forward them on to David Barnes
and Micheal Kolling who wrote BlueJ, they are lecturers at the university
I'm currently at.
James
> Hi JS,
> I deleted my original post thinking that no one was going to
[quoted text clipped - 13 lines]
> Thanks again.
> Bob
bherbst65@hotmail.com - 11 Nov 2005 16:20 GMT
James,

Since I get my posting in the digest form from
bluej-discuss-request@bluej.org
I am reacting to  (no later update as of
Nov 11 '05,  11 A.M. ET),

I did get one nibble from :

From: bluej-discuss-request@bluej.org
Reply-To: bluej-discuss@bluej.org
To: bluej-discuss@bluej.org
Subject: bluej-discuss Digest, Vol 29, Issue 5
Date: Fri, 11 Nov 2005 02:48:02 +0000

Message # 9
.............
Re: Select All and Indent (W.E.Taylor)
......start of snip ......
You can just select what you want to indent, one line or all lines, and
then select 'indent more'.
......end of snip ......

I am really at a loss to explain differently what it is I am looking
for.
I think that I am looking for programming feature in BlueJ that will
properly indent lines of code all at once using a click "select all"
then a second click "indent line(s)" according to that algorithm that
will take this model:
/*  original copied from:
*  http://users.tkk.fi/~t106216/english/miscellanea/style_guide.html
*  Revisions bob herbst Nov 11, 2005
*  updated using:
*  import java.io.InputStreamReader;
*  import java.io.BufferedReader;
*/
import java.io.InputStreamReader;
import java.io.BufferedReader;

public class WhichLarger { //reports which of the two input numbers is
larger

public static void main(String[] args) {
String xread,yread;
double x = 0.0;
double y = 0.0;
System.out.println ("Give two numbers!");
InputStreamReader keyboard = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(keyboard);
try{
xread = in.readLine();
x = Integer.parseInt(xread);
yread = in.readLine();
y = Integer.parseInt(yread);
//x = Read.getDouble();
//y = Read.getDouble();
} // end of try
catch (Exception e) {
e.printStackTrace();
}

if (x > y)
System.out.println("The first number is larger.");
else if (x < y)
System.out.println("The second number is larger.");
else
System.out.println("The numbers are equal.");
}

And  produces this:

/*  original copied from:
*  http://users.tkk.fi/~t106216/english/miscellanea/style_guide.html
*  Revisions bob herbst Nov 11, 2005
*  updated using:
*  import java.io.InputStreamReader;
*  import java.io.BufferedReader;
*/
import java.io.InputStreamReader;
import java.io.BufferedReader;

public class WhichLarger { //reports which of the two input numbers is
larger

 public static void main(String[] args) {
   String xread,yread;
   double x = 0.0;
   double y = 0.0;
   System.out.println ("Give two numbers!");
   InputStreamReader keyboard = new InputStreamReader(System.in);
   BufferedReader in = new BufferedReader(keyboard);
   try{
     xread = in.readLine();
     x = Integer.parseInt(xread);
     yread = in.readLine();
     y = Integer.parseInt(yread);
     //x = Read.getDouble();
     //y = Read.getDouble();
   } // end of try
   catch (Exception e) {
     e.printStackTrace();
   }

   if (x > y)
     System.out.println("The first number is larger.");
   else if (x < y)
     System.out.println("The second number is larger.");
   else
     System.out.println("The numbers are equal.");
 }
}

Bob
Steve Horsley - 11 Nov 2005 20:18 GMT
> James,
>
[quoted text clipped - 4 lines]
> then a second click "indent line(s)" according to that algorithm that
> will take this model:
<snip>

It's called a prettifier or beautifier.

I've never really felt the need because I tend to do the right
indentation as I go along. I don't have the mental capacity to
read badly indented code easily - even my own code what I just wrote.

Maybe they don't include one because they feel you should be
learning to indent as you go along and avoid learning bad/lazy
habits.

Steve
Michael Kölling - 11 Nov 2005 22:58 GMT
> Maybe they don't include one because they feel you should be
> learning to indent as you go along and avoid learning bad/lazy
> habits.

Exactly!

Michael
JS - 12 Nov 2005 10:08 GMT
Just the man Michael, on a totally different topic to this. My kentmail
address is down at the moment so not sure if you will get my email from a
home address. Can you give us some advice on CO531 Software Engineering
because we are still stuck on the sockets thing. You sent us some code of a
SimpleServer and a SimpleClient which worked like a dream. When we tried to
adapt it though we found that we could not send it out to many clients, only
the client who sent it originally, even with more than one Client connected
to the same server. how can we send out one message to many clients?
Thanks a lot and I'll email you through kentmail if it works. Im js220 by
the way.
Thanks in advance
JS
> > Maybe they don't include one because they feel you should be
> > learning to indent as you go along and avoid learning bad/lazy
[quoted text clipped - 3 lines]
>
> Michael
Roedy Green - 12 Nov 2005 03:46 GMT
On Fri, 11 Nov 2005 20:18:05 +0000, Steve Horsley
<steve.horsley@gmail.com> wrote, quoted or indirectly quoted someone
who said :

>It's called a prettifier or beautifier.
see http://mindprod.com/jgloss/beautifier.html
http://mindprod.com/jgloss/prettyprinter.html

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

bherbst65@hotmail.com - 12 Nov 2005 07:49 GMT
Students with "lazy" habits taking CS use BlueJ to counter lazy habits?
I can't imagine that. But if that gets an "Exactly" then that is the
way it is.

But then there is  this Google site to help them....
time to close it down so that they don't express their
feelings....."Its a pain but its how its made." (JS) and Roedy shows
that someone is charging hundreds of $'s for having inventing one
(beautifier) ......

A requirement years ago set by educators to counter laziness:
"Write it out by hand, use pen and paper, indent each paragraph...".

So in the end.... I have 2 IDE's on my desktop.... BlueJ and DrJava.
Together they get the job done "Exactly beautified". Download cost for
both .... "free".

Bob
bherbst65@hotmail.com - 12 Nov 2005 14:05 GMT
This error is not to beautify but testing the
sample program provided for correct input
.... by chance anyone really looks at it or really cares.

Since I edited  the original sample to be:

     xread = in.readLine();
     x = Integer.parseInt(xread);
     yread = in.readLine();
     y = Integer.parseInt(yread);this snip
........

should be replace with this:

     xread = in.readLine();
     x = Double.parseDouble(xread);
     yread = in.readLine();
     y = Double.parseDouble(yread);
........
Bob


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.