JTextPane left indent contrast problem

Hi, I'm trying to get left indent to work in a JTextPane - I think it's known as 'hanging indent'.
I got the indent itself to work just fine, however for some reason the indent code changes the contrast of the first rows to much higher than for other rows.
The contrast change seems to happen when I pass a negative float to StyleConstants.setFirstLineIndent(MutableAttributeSet set, float i) and only when anti-aliasing is enabled.
I also tried to 'fix' the contrast by setting:
g2.setRenderingHint(RenderingHints.KEY_TEXT_LCD_CONTRAST, 250) for my JTextPane; 250 is lowest possible contrast value.
This seemed to make the first rows exactly normal, but as excpected, the other rows had way too little contrast now.
Here's a simple example that might demonstrate this 'effect'.
I also noted that when I select the text by dragging it with mouse, the contrast seems to become normal again (I've set the selection color to white in the example code to make this more apparent).
Anyone have ideas what's going on here or how to fix this? Thanks in advance.
I'm using Win XP and JDK 6.0 Update 1, Geforce 7600. My OS has anti-aliasing enabled and Java 6 uses the OS AA setting automatically, so I used -Dawt.useSystemAAFontSettings=false to disable anti-aliasing.
import javax.swing.*;
import javax.swing.text.Style;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
import javax.swing.text.BadLocationException;
import java.awt.*;
public class IndentTest {
     public static void main(String[] args) {
          JFrame f = new JFrame();
          f.setLocationByPlatform(true);
          f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          f.setSize(400,300);
          JTextPane p = new JTextPane();
          p.setSelectionColor(Color.WHITE);
          Style set = p.addStyle("default", null);
          float indent = 50.0f;
          StyleConstants.setFontFamily(set, "Lucida Sans Typewriter");
          StyleConstants.setLeftIndent(set, indent);
          StyleConstants.setFirstLineIndent(set, -indent);
          p.setLogicalStyle(set);
          StyledDocument doc = p.getStyledDocument();
          try {
               doc.insertString(
                    doc.getLength(),
                    "When the first line indent is set to a negative value, for some reason the text contrast of first rows will become much higher compared to the other rows.\n",
                         null);
               doc.insertString(
                    doc.getLength(),
                    "Here's another paragraph of text. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.",
                         null);
          catch (BadLocationException e) {
               e.printStackTrace();
          JScrollPane s = new JScrollPane();
          s.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
          s.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
          s.setViewportView(p);
          f.setContentPane(s);
          f.setVisible(true);
}

Follow-up question:
We have two writers using RH on two different computers. We
work on different FM/RH projects, but we need to use the same
styles. If we use RH's GUI to modify the fmstyles.css styles, do
both writers have to do this separately for their own projects or
is there some way to share the CSS modifications so only one person
has to do it?

Similar Messages

  • Indent here with left indent changes tab position

    I have a sheet set up with a left indent and then a bunch of tabs.
    e.g.: Course #, Course description, then a set of eight tabs with dates
    The course descriptions are twice as long this year and so I was using indent-to-here (because there are rules below, and shift-return pushes the rule below under the second line only). But the tabs don't line up. They are "looking" at the left indent and making an adjustment - if I increase the left indent then the tabs associated with the indent-to-here line move left (the bigger the left indent the further left they are from the tab position)
    Why?
    Why would anyone want that to be the default behavior?
    I can fix it with a second para style, but it breaks the association between the two lines of the description and now requires manual updating in the future, instead of a simple indent-to-here substitution.
    I'm just wondering why this happens, seems completely counter intuitive - tabs should always align!

    Will: As you can see by the screenshot it's easily "solved" with a second style, my reason for writing is why is this happening? - is this a bug that needs to be reported to Adobe? I don't understand why an Indent Here (given a left Indent), would change the primary attributes of tabs (i.e. lining-up!)
    Peter: Prefs trashed; happens on any/all docs; CS6 (8.0.2). [You are setting a left indent, and then using the Indent Here (Cmd\)??]
    Anyone else able to recreate?
    Appreciate the replies.
    Em

  • I am using the 30-day trial and have 4 days left.  My problem is twofold - 1) I cannot open or see my timeline and don't wish to start over again; it's 15 minutes long

    I am using the 30-day trial and have 4 days left.  My problem is threefold - 1) I cannot open or see my timeline and don't wish to start over again; it's 15 minutes long - video, photos and audio. 2) My timeline has disappeared, so can't edit further  3) Need best way to export to DVD or my MacBook Pro laptop - don't know which settings/items to choose.
    I would appreciate it very much if Apple Support would extend my 30-day trial.  I am working on this project for a Multimedia classroom project at Randolph Community Collge, and am also unemployed so can't afford to buy just yet.  PLEASE help!

    Ok, Tom, I completed the first three steps and everything went fine.  However, I still don't have a timeline, AND above is a screenprint of my timeline and what I presume is meant by the PROJECT.  There is no project.  Now, I can go up to the Event window and Export XML, but it doesn't give me a usable file.  So, first, am I correct re: terminology - the timeline/bottom section is also known as the project folder/manager??
    I've been reading other users strings as well and have tried their tricks as well.  For instance, Eric Martin re: his deleting preference files (6/6), and Norman Jayo's (4/25) lengthy discourse with the "here is the work around" w/ 7 steps.  Again, he mentions closing the PROJECT that is corrupted.  I'm not sure that mine is corrupt as I can play and see my 15-minute audio/view in the view module (upper right).
    So, back to the beginning...

  • How Can I write Script for Indesign set left indent

    I really need two scripts for indesign set left indent:
    1. If the left indent is: 8, 16, 24, 32, 40, 48, 56mm... set the first -8mm; if the left indent is 0, set the left indent 8mm, first -8mm.
    2. Whatever the first indent is, set the first 8mm.
    Can someone help me?

    Hi, Trevor
    I use change by list as below:
    grep {leftIndent:48mm} {leftIndent:56mm}
    grep {leftIndent:40mm} {leftIndent:48mm}
    grep {leftIndent:32mm} {leftIndent:40mm}
    grep {leftIndent:24mm} {leftIndent:32mm}
    grep {leftIndent:16mm} {leftIndent:24mm}
    grep {leftIndent:8mm} {leftIndent:16mm}
    grep {firstLineIndent:8mm, leftIndent:48mm} {firstLineIndent:8mm, leftIndent:56mm}
    grep {firstLineIndent:8mm, leftIndent:32mm} {firstLineIndent:8mm, leftIndent:48mm}
    grep {firstLineIndent:8mm, leftIndent:24mm} {firstLineIndent:8mm, leftIndent:32mm}
    grep {firstLineIndent:8mm, leftIndent:16mm} {firstLineIndent:8mm, leftIndent:24mm}
    grep {firstLineIndent:8mm, leftIndent:8mm} {firstLineIndent:8mm, leftIndent:16mm}
    grep {firstLineIndent:-8mm, leftIndent:48mm} {firstLineIndent:-8mm, leftIndent:56mm}
    grep {firstLineIndent:-8mm, leftIndent:32mm} {firstLineIndent:-8mm, leftIndent:48mm}
    grep {firstLineIndent:-8mm, leftIndent:24mm} {firstLineIndent:-8mm, leftIndent:32mm}
    grep {firstLineIndent:-8mm, leftIndent:16mm} {firstLineIndent:-8mm, leftIndent:24mm}
    grep {firstLineIndent:-8mm, leftIndent:8mm} {firstLineIndent:-8mm, leftIndent:16mm}
    but not that perfect,
    I want to useing jave "if{}" or "for{}" to write this script, but I don't kown the syntext.

  • How can I write a script for set left indent?

    In three cases as below:
    for example:
    left indent:8mm; first indent:0mm
    left indent:0mm; first indent:8mm
    left indent:8mm; first indent:-8mm
    How can I write a script to tell Indesign, wherever the text indent is, each time when I run the script once, the text can put just a step rightward, and “one step = 8mm”.
    Please!

    Hi, Trevor
    I use change by list as below:
    grep {leftIndent:48mm} {leftIndent:56mm}
    grep {leftIndent:40mm} {leftIndent:48mm}
    grep {leftIndent:32mm} {leftIndent:40mm}
    grep {leftIndent:24mm} {leftIndent:32mm}
    grep {leftIndent:16mm} {leftIndent:24mm}
    grep {leftIndent:8mm} {leftIndent:16mm}
    grep {firstLineIndent:8mm, leftIndent:48mm} {firstLineIndent:8mm, leftIndent:56mm}
    grep {firstLineIndent:8mm, leftIndent:32mm} {firstLineIndent:8mm, leftIndent:48mm}
    grep {firstLineIndent:8mm, leftIndent:24mm} {firstLineIndent:8mm, leftIndent:32mm}
    grep {firstLineIndent:8mm, leftIndent:16mm} {firstLineIndent:8mm, leftIndent:24mm}
    grep {firstLineIndent:8mm, leftIndent:8mm} {firstLineIndent:8mm, leftIndent:16mm}
    grep {firstLineIndent:-8mm, leftIndent:48mm} {firstLineIndent:-8mm, leftIndent:56mm}
    grep {firstLineIndent:-8mm, leftIndent:32mm} {firstLineIndent:-8mm, leftIndent:48mm}
    grep {firstLineIndent:-8mm, leftIndent:24mm} {firstLineIndent:-8mm, leftIndent:32mm}
    grep {firstLineIndent:-8mm, leftIndent:16mm} {firstLineIndent:-8mm, leftIndent:24mm}
    grep {firstLineIndent:-8mm, leftIndent:8mm} {firstLineIndent:-8mm, leftIndent:16mm}
    but not that perfect,
    I want to useing jave "if{}" or "for{}" to write this script, but I don't kown the syntext.

  • IPod 3G Contrast problem

    Hi,
    I have a Third generation iPod 15GB that I bought a year ago. Just in November, I get contrast problems. Somehow my iPod would change the contrast and would even show the iPod logo when I turn it on after charging it full on the dock. Anyone help me please? I am sick and tired of changing the contrast back to full contrast.

    I have to enter another network (do not choose default network, enter the network name and enter the password. It works!

  • Left outer join problem -- need feedback

    using crystal 2008
    haveing prolbems with a left outerjoin to get a blank field(null) to show up.
    basically i have some po line have have long descriptions or text fields that i want to include with the report. Below is my sql statement. I have written a formula with a join between 2 fields to get the report to work- this does but- it leave the polines off that do not have a long description.  I have tried left outer joins but seem to be having problems.  The long description field where the data is actually at is under my po.line table, although serveral area have long description fields -
    *one note i had to add a duplicate table to the field to get some items in my header to work properly - not sure if this is effecting the report or not.
    OK- when I set up the link to a LO join enforce from = to
    and dont add the ldtext.field to the report the left outjoin works(but no long description)and all my line items show up.
    1. when I keep the same join and add either just the ld.text field to  the report it comes back with a error saying invalid table
    2. when i use my formula that joins the ld.text and po.line and place it in the report with the same left outerjoin i get the same failure.
    3.  when i dont reference the ldtext(field) at all in the report it works fine w/ the lo join
    4. when i Dont use a left outer join and use my formula(see below)
    if not isnull(({LONGDESCRIPTION.LDTEXT }))
    then {POLINE.DESCRIPTION}+{LONGDESCRIPTION.LDTEXT}
    else {POLINE.DESCRIPTION}
    and link from poline.ld
    to ld.ldtext - my formula works and populates the po.line and the ld.text together - except that any po.line with no description will not show up. Like its not there.
    Not sure what to do?
    here is my current sql statement with the longdescription field in the select statement
    here is the error statement i am getting:
    Failed to retrieve data from the database:
    Details:42000[intersolv][odb sql base driver][sql base] 00906 itn invalid table name[database vendor code:906]
    sql statement:
    SELECT "PO"."PONUM", "PO"."STATUS", "PO"."VENDOR",
    "COMPANIES"."NAME", "COMPANIES"."ADDRESS1",
    "COMPANIES"."ADDRESS2", "COMPANIES"."ADDRESS3",
    "COMPANIES"."ADDRESS4", "COMPANIES"."PHONE",
    "COMPANIES"."FAX", "COMPANIES_1"."NAME",
    "COMPANIES_1"."ADDRESS1", "COMPANIES_1"."ADDRESS2",
    "COMPANIES_1"."ADDRESS3", "COMPANIES_1"."ADDRESS4",
    "COMPANIES_1"."CONTACT", "COMPANIES_1"."PHONE",
    "COMPANIES_1"."FAX", "PO"."PURCHASEAGENT",
    "PO"."ORDERDATE",
    "PO"."REQUIREDDATE", "PO"."PAYMENTTERMS",
    "PO"."SHIPVIA", "PO"."FREIGHTTERMS", "PO"."FOB",
    "POLINE"."DESCRIPTION", "POLINE"."ITEMNUM",
    "POLINE"."ORDERQTY", "POLINE"."UNITCOST",
    "POLINE"."LOADEDCOST", "POLINE"."POLINENUM",
    "PO"."SHIPTOATTN", "LONGDESCRIPTION"."LDTEXT"
    FROM   ("MAXIMO"."PO" "PO" LEFT OUTER JOIN
    "MAXIMO"."LONGDESCRIPTION" "LONGDESCRIPTION" ON "PO"."LDKEY"="LONGDESCRIPTION"."LDKEY"),
    "MAXIMO"."POLINE" "POLINE",
    "MAXIMO"."COMPANIES" "COMPANIES_1",
    "MAXIMO"."COMPANIES" "COMPANIES"
    WHERE  ("PO"."PONUM"="POLINE"."PONUM") AND ("PO"."VENDOR"="COMPANIES_1"."COMPANY") AND ("PO"."SHIPTO"="COMPANIES"."COMPANY") AND "PO"."PONUM"='3386-053'

    If you took the time to read this thanks.... turns out... and I just want to pull my hair out over this.  My connection had a  old odbc driver so somehow it would not allow a left outer join....go figure - weeks of agony over that..... thanks ....have to say love this forum.

  • Brightness/Contrast Problem in CS3 & CS2

    When I adjust (using legacy option) the sliders, then hit okay, the adjustments don't apply, and the image reverts to it's original state as if I hadn't adjusted the contrast or brightness at all. It did this in both CS3 & CS2. Has anyone else had this problem before?
    My workaround was to make a B/C adjustment layer and then merge visible to a new layer, but it did the exact same thing. The new merged layer didn't have the B/C applied to it. This is very strange.

    We should move on but calling someone rude because they misunderstood something and made a poor judgement is uncalled for.
    Moving on I think that the advice to use curve instead of B?C would offer better control
    As to why the adjustment layer you used did not have an effect as expected there may have been a small selection active when you invoked the layers adjustment everything seem to work but it is is only being applied to what might be a very small selection. Perhaps one you are accidentally creating. Check to see if you have a selection tool active and watch how you are moving the cursor.
    I hold the stylus in a funny way and sometimes make a selection and swear i am not touching the tablet with the stylus but on more careful observation or by just hitting escape or command D and then making the adjustment all is well.
    This might not be your problem but it is the only one I can think of at the moment.
    if this is the problem keep in mind this is not really a photoshop problem or solution and an unlikely scenario, even though it is a possible one.
    No one here would be expected to know this and of course it can be quite off base.

  • Left shift key problem help please

    My left shift key is shifting my open page up out of the way and bringing me to my desktop page. My right key works fine. Does anyone know how to fix this problem?

    Well, not sure about you new-fangled Snow Leopard users, but I'd check the Dashboard & Exposé preference pane in System Preferences and see if the Desktop shortcut is "Left Shift" instead of the normal F11.

  • Left convenience key problem

    No matter how many times I reset it the left convenience key only brings up the phone book. I want the default voice calling. I've tried setting it to several things to see if it was a problem with just the voice calling but no the phone book is all that key will bring up. The other side works fine. I reset it when I first got my 8110 for the alarm feature but recently decided to change back to default. It won't go back to alarm either.  TIA

    Hi!
    Go to: Options- Screen/Keyboard and roll down to your needed option..

  • JTextPane custom views keyboard problem

    Hi,
    I am trying to implement a custom view in the JTextPane. The view is appearing fine but the keyboard cursor movements are not working. The cursor no longer moves from line to line as it used to when using the arrow keys. However Iam able to move from the end of 1 line to the start of next line. This is when I override section view with my custom view.
    In another case, when I override paragraph view, then the cursor size is equal to the paragraph height and I get a tall cursor the size of the paragraph. I can no longer navigate the lines in the paragraph.
    Could someone tell me why this is happening.
    cheers,
    Hugo
    My views are setup as follows:
         class XmlViewFactory implements ViewFactory {
              // Creates the XML View.
              public View create(Element elem) {
                     String kind = elem.getName();
                if (kind.equals(AbstractDocument.ContentElementName)) {
                                 return new LabelView(elem);
                         else if (kind.equals(AbstractDocument.ParagraphElementName)) {                     
                                   return new ParagraphView(elem);
                         } else if (kind.equals(AbstractDocument.SectionElementName)) {
                              return new ResponseView(elem);                         //  <-------     my custom view
              //                return new BoxView(elem, View.Y_AXIS);
                         } else if (kind.equals(StyleConstants.ComponentElementName)) {
                             return new ComponentView(elem);
                         } else if (kind.equals(StyleConstants.IconElementName)) {
                             return new IconView(elem);
                    return new LabelView(elem);             

    Hi,
    Here's an update to my earlier question.
    The problem happend to be not with any custom views as earlier mentioned. The following usage doesn't work.
      if (kind.equals(AbstractDocument.ContentElementName)) {
                      return new LabelView(context, elem);
                  else
                  if (kind.equals(AbstractDocument.ParagraphElementName)) {
                            return new ParagraphView(elem);
                  } else if (kind.equals(AbstractDocument.SectionElementName)) {
                       return new BoxView(elem, View.Y_AXIS);
                  } else if (kind.equals(StyleConstants.ComponentElementName)) {
                      return new ComponentView(elem);
                  } else if (kind.equals(StyleConstants.IconElementName)) {
                      return new IconView(elem);
               return new LabelView( context, elem);even when no custom view is involved. I get a blank JTextPane.
    cheers
    OV

  • Cinema 23" contrast problem

    I have just noticed on my Cinema 23" that any pale tints below 9% are just not there they've completely disappeared. An obvious evidence of it is in photoshop when I go to the Color Picker the top left corner of the color select box has gone pure white for about 5mm.
    If I design a drop shadow/tint in Illustrator OR FreeHand on my G4 connected to my old 17" screen using any value below 9% and then open the file on my MacPro connected to my new 23" cinema the shadow/tint is invisible.
    I have tried calibrating several times (expert and basic) and adjusted brightness but to no avail.
    Has this happened to anyone else - am I missing something completely obvious?

    I have this issue too and am quite frustrated.
    The accesibilty panel doesnt have anything to do with my problem.
    I do pro level motion gfx and multimedia design and it is impossible to verify that alpha masks and soft graduations are showed perfect. The screen is useless for any design work.
    I made a website with a few tests for my local Apple tech service center
    check it out here:
    http://lab.desilence.net/cinemascreen_test/
    They said that my screen was perfect according to their internal test tools. But they could easily see the problem when i showed the tests on the web.
    The apple service center concluded that all their 23" screens had the same issue. And that it might be a problem with part of or the entire generation of the latest version of the 23"cinema screens
    If your cinemascreen is the latest model i will encourage you to check out the tests - and i will be happy to hear about the results.
    I will put photos and video of the issue up shortly
    Cheers,
    B) Søren

  • Google Chrome left or margin problem

    Hello adobe forum my name is Uğur, im web programming and desing student. Last days i am getting ready for a web desing content. i found Edge animate just new. I have a problem about
    google chrome. Here is the pictures about my problem
    in google chrome div is not fits to screen totaly. Im using Dreamweawer for desing website. I used position:absolute left: 0px; top: 0px; for fit div.
    İts working well in Moz Firefox.
    Moz Firefox
    sorry for my bad English.
    Best Regards
    Uğur Anlar

    Every browser has a default margin/padding for every element.
    To make browsers behave all the same, you need to reset the default values like this:
         Add the below css code in the .css file, or inlined-css block:
         html, body, div {
              padding: 0;
              margin: 0;
    This is a very simple css browser reset, but you have reset for any such css properties for any element like <p>, <audio>, <span> etc.
    hth,
    Vivekuma

  • CS5 contrast problem while printing

    I've got at problem with my color settings in Photoshop Cs 5.
    All pictures look completely normal on screen - this has been tested on different computers and monitors. The contrast and colors are also fine.
    But, when printing the picture, that means develloping that picture in our digital minilab (Noritsu QSS 3300) the picture looks completely different. The contrast is way too high - the picture seems to have a rought yellow blur - the color saturation is too high, and hue is a bit changed also. It doesnt look the way it was on screen.
    I do not know, what to do now. The only possibility to solve this problem is to open and simply save the picture in photoshop version (CS4) on another pc, without adjustments for color or saturation or whatever. After that the pictures again to the minilab - now they are completly normal! Just like they have been the whole time on screen. How can we solve that problem with CS5.
    Is there a wrong color managment setting.
    We compared the settings with our CS4 pc and there are no differences at all.
    What is the problem - and how can we solve it?
    Kind regards!
    Jananaj

    Hi Mylenium,
    our monitors are calibrated using the spider tool. We shoot all pictures using the Adobe RGB color profile. Our MiniLab prints with SRGB color profile. Our Photoshop are also set for the SRGB profile. I don't think that our problem is an improper calibration, but a wrong color profile in Photoshop CS5. This is because the pictures looks the same using Photoshop CS4 or CS5 on all of our monitors. But the pictures saved in CS5 having the mentioned problem, and the same pictures resaved in CS4 without adjustments have them not. Thurthermore, the pictures resaved in CS4 looks in all Viewers on all Computers the same as the original from CS5. Only the printer shows the difference. We think that the SRGB color profile from CS4 has been "optimized" by Adobe in CS5  but in a way that something doesn't work correctly for us. I can upload some pictures were the difference cannot be seen in a viewer but in our printings.

  • TV out low contrast problem with Tiger

    I just recently upgraded to Tiger and went straight from 10.3.9 to 10.4.5.
    My mini-DVI to TV adapter has always worked perfectly before, but now the display on my TV is very dim, with extremely low contrast and brightness. The TV is recognised correctly and all the settings, color profiles etc. are correct.
    I have verified that this is strictly a software issue as booting from 10.3.9 fixes the problem, and the output to TV is bright and beautiful once again.
    I've searched, but found no mention of this particular problem anywhere. I would love to find a solution as the TV out from the PowerBook is basically broke, and dragging the external FW drive to the TV to boot from 10.3.9 is not a practical option.
    PowerBook G4 12" 1 GHz   Mac OS X (10.4.5)   768 RAM

    Thought it wouldn't do any harm to run MacJanitor - but it didn't do any good, either.
    This continues through restarts. It is definitely local to this one machine as another Mac does not show it.
    EDIT If I go in via http://discussions.apple.com/category.jspa?categoryID=160 I get the same thing except the Recent Threads only show solved/question icons, no titles or anything else.
    M

Maybe you are looking for

  • Credit block of ship-to-party

    Hi thr, I have this strange problem where a credit block is coming up on Ship-to. This custoemr has account grp as 0002 which is an exclusive ship-to and when I use VA01 and try to create a sales order and first input ship-to it says order receipt/de

  • Calendar list view - default

    I'm so frustrated that I can't make my default view a list. The current default view does not show me the information I need at a glance. Meetings, appointments etc. The current view has everything compacted at the top, unreadable. When is this going

  • Sun GigaSwift Ethernet under Solaris 10

    Is it possible to use the Sun GigaSwift Ethernet NIC (aka X4150A-2) under a solaris 10 OS? I'am working with a SunFire V250 server and tried to install this but diddn't succeed. There seem to be just drivers vor 7,8 and 9 but not for 10. Very frustra

  • OOPS!! Reset Home Directory permissions

    I accidently reset my home permissions.  Now, I can't get into my home directory except as root.  What command can I do to make every file in my home to be read/write accesable ONLY to punkrockguy and root?

  • Vista SP1 took out my system

    Just over 3 weeks ago (I have been trying to get a solution ever since) I awoke to my new Lenovo 9868 A12, rebooting itself. and rebootin and rebooting...and so on and on. It received the Vista SP1 from Microsoft at 3AM, downloaded it and installed i