Results 1 to 10 of 10
  1. #1
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,234
    Rep Power
    7

    Default Formatted Code Area is too big

    When a posting uses the "Code tags" to post code the code is displayed in a separate text area. When the code reaches a certain number of lines scrollbars appear. However, I believe the maximum height of this code area is too big. For an example of what I mean see these two postings:

    Need help adding an actionListener
    http://www.java-forums.org/database/...-database.html

    The height of the code area will display about 150 lines of code. After this the scrollbars appear. In my case I find this verry difficult to use. First I need to scroll the web page down to the bottom of the code area to see the visible code. However, I can't scroll the code down because the bottom of the scrollbar is not visible, so I have to scroll the web page up a lttle to grab the scrollbar and then scroll the code.

    I think the the height of the "code area" should be limited to about 45 lines of code so that this area is completely visible without scrolling the entire page. If the user wants to look at the code in more detail, then they can use the scrollbar to see the code.

    I use 1024 X 768 resolution, so I understand the number of lines that are visible can vary for different resolutions, so maybe the max height of the code area can vary by resolution? Or maybe this can be a user setting?
    Last edited by camickr; 06-12-2011 at 05:48 PM.

  2. #2
    JavaForums's Avatar
    JavaForums is offline Administrator
    Join Date
    Dec 2006
    Posts
    854
    Rep Power
    10

    Default

    Hi camickr,

    I can change the height of the code box but i would like to get other people's input before doing it.
    I had changed the the height of the code box myself years ago...

    It looks like your resolution is too low.
    We need a plugin to change it based on resolution but there is no such plugin as far as i know.

    For source codes, i believe it is better to have larger area of the code visible so you dont need to go up and down to see what was defined and used before.
    It looks like we need to decide on an optimal size for everybody. Can you attach a screenshot to help us visualize your problem for 1024x768 resolution?

  3. #3
    mine0926 is offline Senior Member
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    580
    Rep Power
    5

    Default

    I agree with camickr, code area is too big to fit, I try 1366x768 resolution but still the area is too long

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,193
    Rep Power
    19

    Default

    1600 X 900 and the code box in http://www.java-forums.org/database/...-database.html is about 2 screens high. I get 60 lines of code in one screen.

    I feel that camickr's suggestion of 45 lines is good. Alternatively, if the code area doesn't have its own scrollbars, there's no problem in scrolling the whole page. It's the dual scroll bars that make reading difficult.

    db

  5. #5
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,234
    Rep Power
    7

    Default

    i believe it is better to have larger area of the code visible...
    agreed.

    It's the dual scroll bars that make reading difficult.
    Yes, this is the main problem.

    We need a plugin to change it based on resolution but there is no such plugin as far as i know.
    Which is why I suggested this could maybe be a user setting. The setting could allow you to see all lines in the text area so there is never a scrollbar or a maximum number of lines after which a scrollbar would appear.

    I attached an image of my screen.
    Last edited by camickr; 06-13-2011 at 04:50 PM.

  6. #6
    JavaForums's Avatar
    JavaForums is offline Administrator
    Join Date
    Dec 2006
    Posts
    854
    Rep Power
    10

    Default

    I attached an image of my screen.
    I can not see the image.

    Here is the description for that setting.

    Code is displayed as pre-formatted text which does not wrap when it reaches the edges of the table. By placing the code within a scroll box we avoid the situation where the pre-formatted text stretches the forum layout. This setting allows you to specify the maximum height of the scroll box before a scroll bar is displayed.
    There is one setting related to this: Maximum [CODE] Lines

    When a user posts a block of [CODE], [PHP] or [HTML] in one of their messages, the system will place it in a box, which expands to contain their message.

    This value controls the number of lines at which the box stops adding height and inserts a scrollbar.
    I set it to to 100000 to disable it but it looks like there is still a scrollbar around codes.

    Let me know what you think.

  7. #7
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,234
    Rep Power
    7

    Default

    I set it to to 100000 to disable it but it looks like there is still a scrollbar around codes.
    Strange, one of the postings has scrollbars and the other doesn't. Its better with this change. Now you don't have to worry about the two scrollbars.

    I still think the best solution is one that allows each user to choose the numbers of lines to display before the scrollbars appear. However, I understand this is a much larger change that would require a change to the database that maintains user preferences, so I'm happy to live with your current solution. Maybe adding a user preference can be kept in the back of your mind for future upgrades.

    Thanks.

  8. #8
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,193
    Rep Power
    19

    Default

    Quote Originally Posted by camickr View Post
    Strange, one of the postings has scrollbars and the other doesn't.
    More strange. I get only a disabled vertical scrollbar in the code area of both those posts. Tested in Opera and FireFox.

    db

  9. #9
    JavaForums's Avatar
    JavaForums is offline Administrator
    Join Date
    Dec 2006
    Posts
    854
    Rep Power
    10

    Default

    Quote Originally Posted by camickr View Post
    Strange, one of the postings has scrollbars and the other doesn't. Its better with this change. Now you don't have to worry about the two scrollbars..
    Is it the scrollbar around the post or code (note i am not refering to the scrollbar for the whole page)? Because i see scrollbars around posts time to time (i guess this happened after the upgrade).

    Quote Originally Posted by camickr View Post
    I still think the best solution is one that allows each user to choose the numbers of lines to display before the scrollbars appear. However, I understand this is a much larger change that would require a change to the database that maintains user preferences, so I'm happy to live with your current solution. Maybe adding a user preference can be kept in the back of your mind for future upgrades.

    Thanks.
    I agree about the best solution. But it requires modification to the forum software or adding a plugin to do that. And both of them is not possible at the moment. I will keep this in mind.

    Actually i am totally dissatisfied with the code tag. It does not highlight Java properly. I am planning to develop a Java service in a near future for proper code formatting. Once it is developed, i will use it on Java forums too. Hopefully, you will see many many new features implemented like this in a near future but i have to finish my thesis (which always prevented me to realize my ideas/plans so far ) in next few months..

  10. #10
    JavaForums's Avatar
    JavaForums is offline Administrator
    Join Date
    Dec 2006
    Posts
    854
    Rep Power
    10

    Default

    Quote Originally Posted by DarrylBurke View Post
    More strange. I get only a disabled vertical scrollbar in the code area of both those posts. Tested in Opera and FireFox.
    Please look at quote from the forum software i have posted. I think the scrollbar is there mainly to prevent weird looks due to preformatted code with large widths. It can not be removed easily.

Similar Threads

  1. Properly formatted code
    By Bgreen7887 in forum New To Java
    Replies: 1
    Last Post: 11-22-2010, 04:28 PM
  2. Inner glow on Area (source code)
    By happy_hippie in forum Java 2D
    Replies: 0
    Last Post: 04-22-2010, 06:48 AM
  3. Replies: 0
    Last Post: 03-25-2010, 11:50 AM
  4. displaying a formatted output on a jTextField
    By techbossmb in forum AWT / Swing
    Replies: 1
    Last Post: 09-24-2009, 04:56 PM

Posting Permissions

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