Results 1 to 9 of 9
Like Tree1Likes
  • 1 Post By wsaryada

Thread: text components textbooks

  1. #1
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default text components textbooks

    Studying Swing components in a systematical manner,
    but having a hard time with text components...
    Read the java swing tutorial but the info there is rather limited,
    concerning text components (the rest is great)!
    Any suggestions about books manuals etc (online)?

    thanks

  2. #2
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    760
    Rep Power
    8

    Default Re: text components textbooks

    So you have read this tutorial: Using Text Components (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components). Instead of just telling that you having a hard time with the text components, can you be more technically specific on this? Tell us which part that you were stuck in.
    DarrylBurke likes this.

  3. #3
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default Re: text components textbooks

    "can you be more technically specific on this?"

    Ok, I did read all of that tutorial concerning each component such as button, slider etc. and did reductions directed on two levels:
    -first level 1) how to create eg a button; 2) how to make it appear; 3) how to lay the thing out; and 4) how to wire that component (register it and get the info of eg the actionListener).
    -second level: small code fragments that make it all happen.

    The tut. is really fine and very useful, until those chapters that speak of the text components, where the info gets very limited and confusing.

    So I turned to the O'Reilly Swing book and start reading at chapter 19 where the info becomes overwhelming and I do not know really where to begin, doing my small reductions, and where to get my focus. I believe the problem is --I am a music teacher-- that there are very little people in computer programming that can explain things in a systhematic way (Laura Lemay the co-author of the book "teach yourself java in 21 days" is on of those technical people with the gift of knowing how to explain things well).

    Probably you are right I should start to ask specific things, but the problem is: there are too many of them! EG from to O'Reilly book reading about how to make your own caret chapter 21 and studying the two program samples, I found the "protected synchronized void damage(Rectangle r)" method and was trying to find out what this Rectangle means; or more specific: Rectangle of what?
    Here is that code part:

    Java Code:
    protected synchronized void damage(Rectangle r) { 
       if (r == null) return; // Give values to x,y,width,height (inherited from java.awt.Rectangle). 
       x = r.x; 
       y = r.y + (r.height * 4 / 5 - 3); 
       width = 5; height = 5; 
       repaint( ); // Calls getComponent( ).repaint(x, y, width, height)
    }
    so x, y and width and height of what?


    So I turned to the Manning Swing book and started studying at chapter 19. Pages after pages, inner classes abstract classes and interfaces (e.g. AbstractDocument etc.) and methods after methods, without me understanding what each of them is doing......

    So finally I thought: maybe there is another good manual out there that might lay out things into a more understandable manner (another laura book but this time about swing text components)? Probably O'Reilly Swing is my best bet, right?

    But probably it is like a friend ones said: how do you eat an elephant? bite by bite, right?

    So I will try to be more specific asking my next questions, but it is a little fustrating all.....
    Last edited by willemjav; 01-31-2013 at 08:13 AM.

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,453
    Rep Power
    20

    Default Re: text components textbooks

    Quote Originally Posted by willemjav View Post
    so x, y and width and height of what?
    This question reveals that you are diving into advanced topics like GUIs and text components without a foundation in Java. I suggest you go through the Oracle Java tutorials from the very beginning, skimming over anything you're sure you understand and spending time to understand the rest -- for this particular question, specifically the section dealing with classes and objects; learn about class members, variables, fields, methods ... and when I say learn, I mean absorb the information so that when you get back to GUIS and more, it's all old hat that you don't even consciously think about as you apply the knowledge.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  5. #5
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default Re: text components textbooks

    db
    I did study basic stuff of java quite extensively some years ago, but there are some holes in my understanding.
    Text components are complicated for sure!
    I will direct some specific questions soon.
    For the moment I am studying the default caret class and have a question
    concerning the rectangle class Rectangle (Java 2 Platform SE v1.4.2)

    I do understand all constructors but this one:
    public Rectangle(Rectangle r)
    what means the r here (which loops back to rectangle again....)

    thanks for your reply

  6. #6
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default Re: text components textbooks

    I mean to say this:
    I understand that a rectangle needs a position (x/ y)
    and needs a size (width/ height)
    but what would be r.x r.y etc.

  7. #7
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default Re: text components textbooks

    You obviously haven't understood the Java basics, as Darryl has already told you. Go back and read up on objects, references and OO programming.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  8. #8
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,453
    Rep Power
    20

    Default Re: text components textbooks

    Quote Originally Posted by willemjav View Post
    but what would be r.x r.y etc.
    Fields. AKA instance variables.

    Go through the basic tutorials.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  9. #9
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default Re: text components textbooks

    db and phHein

    I did write code before and went over the basic tutorials also and read even several books,
    though coming from a procedural programming background (pascal c) it is probably so that I do not
    get the OOP stuff.

    So I honored your advice and started reading "Thinking Java" again....

    thanks again

    any better sugestions?

Similar Threads

  1. Replies: 0
    Last Post: 07-24-2012, 09:07 AM
  2. Replies: 8
    Last Post: 08-11-2011, 09:23 PM
  3. Replies: 8
    Last Post: 07-17-2011, 03:38 PM
  4. Replies: 0
    Last Post: 12-09-2010, 06:56 PM
  5. change text size in all GUI components
    By itaipee in forum AWT / Swing
    Replies: 2
    Last Post: 08-07-2009, 05:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •