JTextPane HTMLDocument to string missing lines \n and paragraphs

I have a JTexpane using an HTMLDocument and I use this function to save the content into a String
    protected String saveToBuffer(HTMLDocument lpd){
     HTMLEditorKit  html  = new HTMLEditorKit();
     try{
               OutputStream out = new ByteArrayOutputStream()  ;
               html.write(out, lpd, 0, lpd.getLength());
                     String ret = out.toString();
                     return (ret)
     }catch (Exception ex) {
          System.out.println(ex.toString());
          return ("");
    }It works ok with the formats, but the newlines (\n) ar leave as \n
so when I set it again to de JTexpeane al the text turns into a single line
    protected void LoadFromBuffer(HTMLDocument lpd,String cadena,boolean clean){     
     HTMLEditorKit  html  = new HTMLEditorKit();
     if (clean){
          try{
               lpd.remove(0, lpd.getLength());
          }catch (BadLocationException ex) {}
     try{
          html.read(new StringReader(cadena) , lpd, lpd.getLength());
     }catch (Exception ex) {
          System.out.println(ex.toString());
    }Edit:
I have a "simple solution" Straiting the body from the String "ret" and changing \n for <br>
but there must be a better way ...
Edited by: Harl on Dec 12, 2007 9:56 AM
Edited by: Harl on Dec 12, 2007 9:58 AM

That return the same thing.
Now I have "good" solution:
     protected void OnKeyPressed(KeyEvent e){
          if (e.getKeyCode()==KeyEvent.VK_ENTER){
               try{
                    int pos = comen.getCaretPosition();
                    kit.insertHTML(styledDoc,pos,"<BR>",0,0,HTML.Tag.BR);
                    e.consume();
                    comen.setCaretPosition(pos+1);
               }catch (Exception ex) {}
     }So when enter is pressed the Tag.BR is inserted and the \n is removed (If not two new lines appears)
But I really don't understand why this isn't the default behaviour when HTMLDocument and HTMLEditorKit are set in the JTextPane

Similar Messages

  • Forced Line Break and Paragraph Return

    Hi.. It´s maybe a simple question but I cannot see diferences.
    What´s the difference between Forced Line Break and Paragraph Return ?
    Thank's for the answer

    A force line break is still the same paragraph. You won't see a difference unless there is some text change with each new paragraph, such as a style change or the addition of space before or after a paragraph. The forced line break can also be used as a trigger in a nested style to make the first line or lines formatting for a paragraph different from the following lines.
    Peter

  • Missing Line Items and '?' Symbols in some Reports

    I have upgraded the patch level of my production server and patch level
    list is given below
    SAP_BASIS 640 0022 SAPKB64022
    SAP_ABA 640 0022 SAPKA64022
    ST-PI 003C_640 0001 SAPKITLPS1
    PI_BASIS 2006_1_6400006 SAPKIPYL06
    SAP_BW 350 0021 SAPKW35021
    SAP_HR 500 0017 SAPKE50017
    SAP_APPL 500 0019 SAPKH50019
    PI 2004_1_5000004 SAPKIPZI64
    problem is that whenever I run SAP FICO standard reports FL3N, FBL5N,
    KB01, F.08 etc it generates the report correctly but when i am taking
    print out of these reports it misses some line items and total value as
    well screen shots are attached for information.
    my second problem is that there are some garbage entries with
    symbol '?' in SAP Menu and toolbars of some Reports. Screen shot is
    also attached for your information.
    i am facing lots of problem in executing my daily operations due to
    these errors.
    regards,
    Majid Khan

    Dear Subramanian,
    I am facing the same problem in Development and Quality Assurance Server
    Regards,
    Majid Khan

  • Enter Text in Multi Line TextBox and New Lines

    Hi Guys,
    I have a form that takes a users input and saves to an access
    database.
    The data is in turn drawn by a recordset and displayed on an
    ASP page using VBS.
    The form that takes the info has 1 textbox thats multi line
    and I want it to be a simple input box except when the user adds a
    line break by hitting return I want this to be reflected when the
    record is drawn to the detais page..
    Just now no matter how many times I hit return key when
    typing in the multi line text box and add paragraphs or simple
    sentances they all come out with no line breaks on the page when
    shown???
    Do I have to make my own rich text box editor? or is there
    something Im missing?
    Thanks in advance for any thoughts.
    Tag

    Tag2007 wrote:
    > Thanks Im on the site now and dont see the lite
    version?? Do you have a link to it please..
    InterAKT was acquired by Adobe in September and most of its
    products
    were discontinued. The full version of KTML is now part of
    the
    Kollection suite.
    The solution to your problem is very simple, though. I'm
    sorry I can't
    give you the exact coding, because I haven't used ASP for
    many years.
    However, all that you need to do is to create a function that
    searches a
    string for new line characters and replaces them with
    <br> (or <br />
    for XHTML).
    PHP has a built-in function (nl2br()) to do this, but in ASP
    you need to
    search for the new line character code.
    David Powers, Adobe Community Expert
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • How to move Line, Grid and X Ticks together?

    The code below plots a XYLineChart: by left mouse click and drag the plotted line can be translated left/right.
    package javafxapplication3;
    import javafx.application.Application;
    import javafx.beans.property.SimpleDoubleProperty;
    import javafx.event.EventHandler; 
    import javafx.scene.chart.NumberAxis;
    import javafx.scene.chart.XYChart;
    import javafx.stage.Stage;
    import javafx.scene.Scene;
    import javafx.scene.chart.LineChart;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.layout.BorderPane;
    public class GridMove extends Application {
    BorderPane pane;
    XYChart.Series series1 = new XYChart.Series();
    SimpleDoubleProperty rectinitX = new SimpleDoubleProperty();
    SimpleDoubleProperty rectX = new SimpleDoubleProperty();
    SimpleDoubleProperty rectY = new SimpleDoubleProperty();
    @Override
    public void start(Stage stage) {
    final NumberAxis xAxis = new NumberAxis(1, 12, 1);
    final NumberAxis yAxis = new NumberAxis(0.53000, 0.53910, 0.0005);
    xAxis.setAnimated(false);
    yAxis.setAnimated(false);
    yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis) {
        @Override
        public String toString(Number object) {
            return String.format("%7.5f", object);
    final LineChart<Number, Number> lineChart = new LineChart<Number, Number>(xAxis, yAxis);
    lineChart.setCreateSymbols(false);
    lineChart.setAlternativeRowFillVisible(false);
    lineChart.setAnimated(false);
    lineChart.setLegendVisible(false);
    series1.getData().add(new XYChart.Data(1, 0.53185));
    series1.getData().add(new XYChart.Data(2, 0.532235));
    series1.getData().add(new XYChart.Data(3, 0.53234));
    series1.getData().add(new XYChart.Data(4, 0.538765));
    series1.getData().add(new XYChart.Data(5, 0.53442));
    series1.getData().add(new XYChart.Data(6, 0.534658));
    series1.getData().add(new XYChart.Data(7, 0.53023));
    series1.getData().add(new XYChart.Data(8, 0.53001));
    series1.getData().add(new XYChart.Data(9, 0.53589));
    series1.getData().add(new XYChart.Data(10, 0.53476));
    pane = new BorderPane();
    pane.setCenter(lineChart);
    Scene scene = new Scene(pane, 800, 600);
    lineChart.getData().addAll(series1);
    stage.setScene(scene);        
    scene.setOnMouseClicked(mouseHandler);
    scene.setOnMouseDragged(mouseHandler);
    scene.setOnMouseEntered(mouseHandler);
    scene.setOnMouseExited(mouseHandler);
    scene.setOnMouseMoved(mouseHandler);
    scene.setOnMousePressed(mouseHandler);
    scene.setOnMouseReleased(mouseHandler);
    stage.show();
    EventHandler<MouseEvent> mouseHandler = new EventHandler<MouseEvent>() {
    @Override
    public void handle(MouseEvent mouseEvent) {
        if (mouseEvent.getEventType() == MouseEvent.MOUSE_PRESSED) {            
            rectinitX.set(mouseEvent.getX());
        else if (mouseEvent.getEventType() == MouseEvent.MOUSE_DRAGGED || mouseEvent.getEventType() == MouseEvent.MOUSE_MOVED) {
            LineChart<Number, Number> lineChart = (LineChart<Number, Number>) pane.getCenter();
            NumberAxis xAxis = (NumberAxis) lineChart.getXAxis();
            double Tgap = xAxis.getWidth()/(xAxis.getUpperBound() - xAxis.getLowerBound());
            double newXlower=xAxis.getLowerBound(), newXupper=xAxis.getUpperBound();            
            double Delta=0.3;
            if(mouseEvent.getEventType() == MouseEvent.MOUSE_DRAGGED){
            if(rectinitX.get() < mouseEvent.getX()){   
                newXlower=xAxis.getLowerBound()-Delta;
                newXupper=xAxis.getUpperBound()-Delta;
        else if(rectinitX.get() > mouseEvent.getX()){   
                newXlower=xAxis.getLowerBound()+Delta;
                newXupper=xAxis.getUpperBound()+Delta;
            xAxis.setLowerBound( newXlower );
            xAxis.setUpperBound( newXupper );                       
            rectinitX.set(mouseEvent.getX());                                
        public static void main(String[] args) {
            launch(args);
    }My question is: now by moving the Line left/right, Grid and X Ticks does not move: so, how to translate Line, Grid and X Ticks together?
    Any help really appreciated!
    Thanks
    Edit: nobody willing to help?
    Edited by: 932518 on 30-ott-2012 1.31
    Edited by: 932518 on 31-ott-2012 8.49

    Some code improvements, now grid and line moves together. It only remains to move X axis ticks along with line and grid, and vertical grid lines are missing outside line range values
    import javafx.application.Application;
    import javafx.beans.property.DoubleProperty;
    import javafx.beans.property.SimpleDoubleProperty;
    import javafx.collections.ObservableList;
    import javafx.event.EventHandler; 
    import javafx.scene.chart.Axis;
    import javafx.scene.chart.NumberAxis;
    import javafx.scene.chart.XYChart;
    import javafx.scene.chart.XYChart.Series;
    import javafx.stage.Stage;
    import javafx.scene.Node;
    import javafx.scene.Scene;
    import javafx.scene.chart.LineChart;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.layout.BorderPane;
    import javafx.scene.shape.LineTo;
    import javafx.scene.shape.MoveTo;
    import javafx.scene.shape.Path;
    public class GridMove extends Application {
    BorderPane pane;
    XYChart.Series series1 = new XYChart.Series();
    SimpleDoubleProperty rectinitX = new SimpleDoubleProperty();
    SimpleDoubleProperty rectX = new SimpleDoubleProperty();
    SimpleDoubleProperty rectY = new SimpleDoubleProperty();
    LineChart<Number, Number> lineChart;
    @Override
    public void start(Stage stage) {
        final NumberAxis xAxis = new NumberAxis(1, 12, 1);
        final NumberAxis yAxis = new NumberAxis(0.53000, 0.53910, 0.0005);
        xAxis.setAnimated(false);
        yAxis.setAnimated(false);
        yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis) {
            @Override
            public String toString(Number object) {
                return String.format("%7.5f", object);
        lineChart = new LineChart<Number, Number>(xAxis, yAxis);
        lineChart.setCreateSymbols(false);
        lineChart.setAlternativeRowFillVisible(false);
        lineChart.setAnimated(false);
        lineChart.setLegendVisible(false);
        series1.getData().add(new XYChart.Data(1, 0.53185));
        series1.getData().add(new XYChart.Data(2, 0.532235));
        series1.getData().add(new XYChart.Data(3, 0.53234));
        series1.getData().add(new XYChart.Data(4, 0.538765));
        series1.getData().add(new XYChart.Data(5, 0.53442));
        series1.getData().add(new XYChart.Data(6, 0.534658));
        series1.getData().add(new XYChart.Data(7, 0.53023));
        series1.getData().add(new XYChart.Data(8, 0.53001));
        series1.getData().add(new XYChart.Data(9, 0.53589));
        series1.getData().add(new XYChart.Data(10, 0.53476));
        pane = new BorderPane();
        pane.setCenter(lineChart);
        Scene scene = new Scene(pane, 800, 600);
        lineChart.getData().addAll(series1);           
        stage.setScene(scene);
        scene.setOnMouseClicked(mouseHandler);
        scene.setOnMouseDragged(mouseHandler);
        scene.setOnMouseEntered(mouseHandler);
        scene.setOnMouseExited(mouseHandler);
        scene.setOnMouseMoved(mouseHandler);
        scene.setOnMousePressed(mouseHandler);
        scene.setOnMouseReleased(mouseHandler);
        stage.show();     
    EventHandler<MouseEvent> mouseHandler = new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent mouseEvent) {
              if (mouseEvent.getEventType() == MouseEvent.MOUSE_PRESSED) {
                rectinitX.set(mouseEvent.getX());
            } else if (mouseEvent.getEventType() == MouseEvent.MOUSE_DRAGGED || mouseEvent.getEventType() == MouseEvent.MOUSE_MOVED) {
                LineChart<Number, Number> lineChart = (LineChart<Number, Number>) pane.getCenter();
                NumberAxis xAxis = (NumberAxis) lineChart.getXAxis();
                double newXlower = xAxis.getLowerBound(), newXupper = xAxis.getUpperBound();
                double Delta = 0.3;
                if (mouseEvent.getEventType() == MouseEvent.MOUSE_DRAGGED) {
                    if (rectinitX.get() < mouseEvent.getX()) {
                        Delta *= -1;                   
                    newXlower = xAxis.getLowerBound() + Delta;
                    newXupper = xAxis.getUpperBound() + Delta;
                    xAxis.setLowerBound(newXlower);
                    xAxis.setUpperBound(newXupper);
                    DoubleProperty p1 = xAxis.scaleXProperty();
                    DoubleProperty p2 = xAxis.translateXProperty();
                    double horizontalValueRange = xAxis.getUpperBound() - xAxis.getLowerBound();
                    double horizontalWidthPixels = xAxis.getWidth();
                    //pixels per unit
                    double xScale = horizontalWidthPixels / horizontalValueRange;
                    Set<Node> nodes = lineChart.lookupAll(".chart-vertical-grid-lines");
                    for (Node n: nodes) {
                        Path p = (Path) n;
                        double currLayoutX = p.getLayoutX();
                        p.setLayoutX(currLayoutX + (Delta*-1) * xScale);
                    double lox = xAxis.getLayoutX();                                     
                rectinitX.set(mouseEvent.getX());
    public static void main(String[] args) {
        launch(args);
    }Any help very much appreciated!

  • How to delete string or line from unix file(dataset) of application server

    Hi  All,
    After transfer workarea information or all records into dataset(unix file). When I see the file in application server automatically the last line is shown a blank line. I am not passing any blank line.
    I have tried for single record than also the file generates the last line(2nd line) also a blank line.
    When I m reading the dataset, it is not reading the last blank line but why it is showing the last blank line?
    How to delete string or line from unix file(dataset) of application server?
    Please give your comments to resolve this.
    Thanks
    Tirumula Rao Chinni

    Hi Rio,
    I faced similar kind of issue working with files on UNIX platform.
    The line is a line feed to remove it use
    DATA : lv_carr_linefd TYPE abap_cr_lf VALUE cl_abap_char_utilities=>cr_lf. 
      DATA : lv_carr_return TYPE char1,                                   
             lv_line_feed   TYPE char1.                                          
      lv_line_feed   = lv_carr_linefd(1).
      lv_carr_return = lv_carr_linefd+1(1).
    Note: IMP: The character in ' ' is not space but is a special
    character set by pressing ALT and +255 simultaneosly
      REPLACE ALL OCCURRENCES OF lv_line_feed IN l_string WITH ' '.
      REPLACE ALL OCCURRENCES OF lv_carr_return IN l_string WITH ' '.

  • Missing Line items for CO-PA "BAPi_ACC_DOCUMENT_POST"

    Hi Every one,
    I am facing a problem while posting the documents using the standard "BAPI_ACC_DOCUMENT_POST". Problem is, if I have a multiple line items to be posted, BAPI is posting only a part of them and throwing the other documents into error with an error message "Missing Line items for CO-PA" or "inconsistency between a document field and prof. segment number" .
    Program is handling the errors in another internal table and displaying them on output report.
    When we re-run the program with same parameters, it is posting the some part of the residue and throwing some documents into error. So to clear out all the documents I need to run the Program for multiple times.
    Any one can help me out in solving this Problem.

    Hello Prashanth ,
    there are 2 structures I think you should fill
    CRITERIA (ref structure BAPIACKEC9 )
    VALUEFIELD( ref STRUCTURE  BAPIACKEV9) in  BAPi_ACC_DOCUMENT_POST
    hope this helps...

  • 2LIS_11_VAITM delta extraction missing line items

    Group,
    I'm having a bit of troubles with the 2LIS_11_VAITM extractor. We've been using this extractor for some time now to do daily delta loads and it seems to work fine 99% of the time, but recently we noticed a few orders here and there from the last 7 months that were missing line items. If a full repair load is done now on these orders, we are able to extract the missing line items. This seems to suggest that for some reason the R3 delta job is not processing these line items or not picking up changes to these line items when they occur. I've found a few notes that seem to apply, but wanted to know if anyone else had this problem before.
    This extractor feeds into a custom ODS, but no records should be dropped since there are only straight mappings in the update rules and transfer rules and no start routines used.
    Thanks for any help offered!

    Hi,
    I feel it would be better to check first for these records in PSA table. If the records are there in PSA but not there in ODS . Check the value for the field 0STORNO(ROCANCEL) in all those records.
    IF the field ROCANCEL does not has value R or D , then you can think about REPAIR request.
    For few more information on REPAIR search the forum.
    With rgds,
    Anil Kumar Sharma .P

  • New line break and extra blank space characters disappear after submit form?

    Hello,
    I have a PDF form with a Submit button that is dynamically created in my code to send the form data to the server in HTML format.
    After the form data is received on the server side, all strings with new line break and extra blank spaces are gone.
    For example, if I enter string in a text field as shown below on the form:
    Hello   ,  
    this is  
        just a
    test
    After the form data is sent to the server, this string would become:
    Hello , this is just a test
    New line breaks are gone. Also, if there is more than 1 blank space character between 2 characters, the extra blank space characters would be removed as well.
    It does not only happen to multi-line text field, even with single-line text field. If I have a string like this in a single-line text field:
    Hello         this is just              a         test
    After the form data is sent to the server, it would become:
    Hello this is just a test
    The form is created in OpenOffice then converted to PDF. The Submit button is created in my program using iText.  I have no idea it is iText that trims my string or PDF itself does it.
    Can anyone give me any possible explanation? Thanks.

    That is not what I get. Since it's URL-encoded, spaces are represented by the "+" character and carriage returns are represented by the "%0d%0a" (cr/lf) sequence.
    Are you looking at the actual data that getting sent to the server or the output from the server after it processes it?

  • Boxes missing lines

    Hi there
    Today, all boxes I try and draw are missing lines.  I must have accidentally clicked on something for this too happen, but I have no idea how to fix it.
    Can someone please tell me how to make it so that there are all four borders on my boxes?
    Thanks!

    Thanks, Jim for your quick and helpful response - that was it!

  • JTextPane and Paragraphs

    Hello
    I'm using JTextPane with an instance of DefaultStyledDocument. Now I have to add Paragraphes with code (not user input) but I haven't found any way to do it. Can anyone help?
    Thanxs
    Leander Eyer

    Try using this method
    protected void insertUpdate(AbstractDocument.DefaultDocumentEvent chng,
                                AttributeSet attr)Updates document structure as a result of text insertion. This will happen within a write lock. This implementation simply parses the inserted content for line breaks and builds up a set of instructions for the element buffer.

  • Line wrapping and font styles?

    Hi,
    If I have a piece of text which I would like to see line wrapped, and font styled, how should I do that?
    javax.swing.JTextArea has the capabilities to set line wrapping to on.
    javax.swing.JTextPane has the capabilities to set font styles like bold, italic and so on.
    But what if you have a piece of text you don't know the (possible) length of (so you would like to have line wrapping), AND to which you want to apply font styles to. JTextArea and JTextPane are siblings, not ancestors. So I can't use it. I have looked in the code to see if I could use pieces of code in my own program. But not luck.
    Do you have a suggestion for me?
    TIA,
    Abel

    camickr wrote:
    JTextPane wraps by default. I'm not sure what your problem is.I did not know that JTextPane did wrap. And I could not find it in the documentation.
    But thanks for the information!

  • Plot line, bar and pie chart

    Anyone can let me know where can i learn or tutorial on how to plot line, bar and pie chart by using java2D... (no third-party software)....
    thanks in advance.

    Here's a pie chart app I made for an earlier question:
    import java.awt.*;
    import java.awt.font.*;
    import java.awt.geom.*;
    import javax.swing.*;
    public class PieChart {
      public static void main(String[] args) {
        int[] data = {
          18, 95, 102, 87
        PieCharter pie = new PieCharter();
        pie.enterData(data);
        JFrame f = new JFrame("Pie Chart");
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.getContentPane().add(pie);
        f.setSize(400,300);
        f.setLocation(300,300);
        f.setVisible(true);
    class PieCharter extends JPanel {
      int[] data, percents;
      int dataTotal;
      final int
        PAD = 25,
        R_PAD = 5;
      public PieCharter() {
        setBackground(Color.white);
      public void paintComponent(Graphics g) {
        super.paintComponent(g);
        Graphics2D g2 = (Graphics2D)g;
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                            RenderingHints.VALUE_ANTIALIAS_ON);
        Font font = new Font("lucida sans unicode", Font.PLAIN, 16);
        g2.setFont(font);
        FontRenderContext frc = g2.getFontRenderContext();
        int width = getWidth();
        int height = getHeight();
        int cx = width/2;
        int cy = height/2;
        int dia = (int)Math.min(width, height) - 2*PAD;
        g2.draw(new Ellipse2D.Double((width - dia)/2, (height - dia)/2, dia, dia));
        // draw zero datum
        double radians = 0;
        int x = cx + (int)((dia/2) * Math.cos(radians));
        int y = cy - (int)((dia/2) * Math.sin(radians));
        g2.draw(new Line2D.Double(cx, cy, x, y));
        String s;
        int dataWidth, dataHeight, deltaR, rXInc, rYInc;
        for(int i = 0; i < data.length; i++) {
          radians += 2*Math.PI * data/dataTotal;
    x = cx + (int)((dia/2) * Math.cos(radians));
    y = cy - (int)((dia/2) * Math.sin(radians));
    g2.draw(new Line2D.Double(cx, cy, x, y));
    s = String.valueOf(percents[i]) + "%";
    dataWidth = (int)font.getStringBounds(s, frc).getWidth();
    dataHeight = (int)font.getLineMetrics(s, frc).getAscent();
    deltaR = (int)Math.sqrt(dataWidth*dataWidth + dataHeight*dataHeight)/2 + R_PAD;
    rXInc = (int)(deltaR * Math.cos(radians));
    rYInc = (int)(deltaR * Math.sin(radians));
    x += rXInc;
    y -= rYInc;
    x -= dataWidth/2;
    y += dataHeight/2;
    g2.drawString(s, x, y);
    s = String.valueOf(data[i]);
    dataWidth = (int)font.getStringBounds(s, frc).getWidth();
    dataHeight = (int)font.getLineMetrics(s, frc).getAscent();
    x = cx + (int)((dia/4) * Math.cos(radians - 2*Math.PI * data[i]/(2*dataTotal)));
    y = cy - (int)((dia/4) * Math.sin(radians - 2*Math.PI * data[i]/(2*dataTotal)));
    x -= dataWidth/2;
    y += dataHeight/2;
    g2.drawString(s, x, y);
    private void prepareData() {
    for(int i = 0; i < data.length; i++)
    dataTotal += data[i];
    percents = new int[data.length];
    int dataPlus = 0;
    for(int i = 0; i < data.length; i++) {
    dataPlus += data[i];
    percents[i] = Math.round(100 * dataPlus/dataTotal);
    public void enterData(int[] data) {
    this.data = data;
    prepareData();
    repaint();

  • Connect missing lines in image trace

    I am teaching myself Illustrator and I came across the image trace feature in CS6. I am able to to copy my drawing and do the image trace feature, but I am having trouble connecting missing lines to do a color fill without selecting the background area.
    Now, I may sound dumb, so please forgive me, but is there a way to connect missing lines using the image trace, or pen feature, that will allow me to select a specific area and do a color fill with selecting the background as well?

    To upload an image, click on the camera icon in the toolbar for this forum.
    The direct selection tool will select all points if you click on the object. But you can click on a single point, shift select other points or drag select. If there is another object below the object you want to edit, use the move tool and double click on the object to put in isolation mode. In that mode only that object is editable.(click the gray bar above to get out of isolation mode or press escape key)
    When using the direct selection tool make sure there is not a plus side of the cursor, if there is that's the wrong tool. (just press the lowercase a on keyboard)
    To join to end points(they must be end points and only two points are allowed at a time)
    Use the direct selection tool (lowercase a)
    Select one point
    Hold shift and select second point
    Object>Path>Join (ctrl-j on windows and cmd-j on mac) or if you have a two button mouse you can right click and choose join from the menu.

  • OR ('|') in regular expressions (e.g. split a String into lines)

    Which match gets used when you use OR ('|') to specify multiple possible matches in a regex, and there are multiple matches among the supplied patterns? The first one (in the order written) which matches? Or the one which matches the most characters?
    To make this concrete, suppose that you want to split a String into lines, where the line delimiters are the same as the [line terminators used by Java regex|http://java.sun.com/javase/6/docs/api/java/util/regex/Pattern.html#lt] :
         A newline (line feed) character ('\n'),
         A carriage-return character followed immediately by a newline character ("\r\n"),
         A standalone carriage-return character ('\r'),
         A next-line character ('\u0085'),
         A line-separator character ('\u2028'), or
         A paragraph-separator character ('\u2029)
    This problem has [been considered before|http://forums.sun.com/thread.jspa?forumID=4&threadID=464846] .
    If we ignore the idiotic microsoft two char \r\n sequence, then no problem; the Java code would be:
    String[] lines = s.split("[\\n\\r\\u0085\\u2028\\u2029]");How do we add support for \r\n? If we try
    String[] lines = s.split("[\\n\\r\\u0085\\u2028\\u2029]|\\r\\n");which pattern of the compound (OR) regex gets used if both match? The
    [\\n\\r\\u0085\\u2028\\u2029]or the
    \\r\\n?
    For instance, if the above code is called when
    s = "a\r\nb";and if the first pattern
    [\\n\\r\\u0085\\u2028\\u2029]is used for the match when the \r is encountered, then the tokens will be
    "a", "", "b"
    because there is an empty String between the \r and following \n. On the other hand, if the rule is use the pattern which matches the most characters, then the
    \\r\\n
    pattern will match that entire \r\n and the tokens will be
    "a", "b"
    which is what you want.
    On my particular box, using jdk 1.6.0_17, if I run this code
    String s = "a\r\nb";
    String[] lines = s.split("[\\n\\r\\u0085\\u2028\\u2029]|\\r\\n");
    System.out.print(lines.length + " lines: ");
    for (String line : lines) System.out.print(" \"" + line + "\"");
    System.out.println();
    if (true) return;the answer that I get is
    3 lines:  "a" "" "b"So it seems like the first listed pattern is used, if it matches.
    Therefore, to get the desired behavior, it seems like I should use
    "\\r\\n|[\\n\\r\\u0085\\u2028\\u2029]"instead as the pattern, since that will ensure that the 2 char sequence is first tried for matches. Indeed, if change the above code to use this pattern, it generates the desired output
    2 lines:  "a" "b"But what has me worried is that I cannot find any documentation concerning this "first pattern of an OR" rule. This means that maybe the Java regex engine could change in the future, which is worrisome.
    The only bulletproof way that I know of to do line splitting is the complicated regex
    "(?:(?<=\\r)\\n)" + "|" + "(?:\\r(?!\\n))" + "|" + "(?:\\r\\n)" + "|" + "\\u0085" + "|" + "\\u2028" + "|" + "\\u2029"Here, I use negative lookbehind and lookahead in the first two patterns to guarantee that they never match on the end or start of a \r\n, but only on isolated \n and \r chars. Thus, no matter which order the patterns above are applied by the regex engine, it will work correctly. I also used non-capturing groups
    (?:X)
    to avoid memory wastage (since I am only interested in grouping, and not capturing).
    Is the above complicated regex the only reliable way to do line splitting?

    bbatman wrote:
    Which match gets used when you use OR ('|') to specify multiple possible matches in a regex, and there are multiple matches among the supplied patterns? The first one (in the order written) which matches? Or the one which matches the most characters?
    The longest match wins, normally. Except for alternation (or) as can be read from the innocent sentence
    The Pattern engine performs traditional NFA-based matching with ordered alternation as occurs in Perl 5.
    in the javadocs. More information can be found in Friedl's book, the relevant page of which google books shows at
    [http://books.google.de/books?id=GX3w_18-JegC&pg=PA175&lpg=PA175&dq=regular+expression+%22ordered+alternation%22&source=bl&ots=PHqgNmlnM-&sig=OcDjANZKl0VpJY0igVxkQ3LXplg&hl=de&ei=Dcg7S43NIcSi_AbX-83EDQ&sa=X&oi=book_result&ct=result&resnum=1&ved=0CA0Q6AEwAA#v=onepage&q=&f=false|http://books.google.de/books?id=GX3w_18-JegC&pg=PA175&lpg=PA175&dq=regular+expression+%22ordered+alternation%22&source=bl&ots=PHqgNmlnM-&sig=OcDjANZKl0VpJY0igVxkQ3LXplg&hl=de&ei=Dcg7S43NIcSi_AbX-83EDQ&sa=X&oi=book_result&ct=result&resnum=1&ved=0CA0Q6AEwAA#v=onepage&q=&f=false]
    If this link does not survive, search google for
    regular expression "ordered alternation"
    My first hit went right into Friedl's book.
    Harald.

Maybe you are looking for

  • .ts-files with multiple audio tracks / Premiere Elements 12

    Hello forum, once more I need a little help please. I've created successfully a few DVD's, and by now I'm a master in creating my own menue templates , but now I have again some problems. I imported a .ts file which I recorded on my Sat Receiver. Thi

  • Converting eps to pdf in Preview

    I have a large quantity of eps files that I would prefer to be in a much more useful and accessible format. In tests that I have made, I have found that Preview is not only very fast at converting the eps files to pdfs, it also crops them to their bo

  • New Nano, Old Computer

    So wife just bought a ipod nano but itunes won't recognize it, even though the computer itself does see it. Any workarounds to make itunes 9 see it and work with it? Can I reformat the nano into something that my OS (10.4.11) recognizes?

  • Traffic Other than ICMP does not Get Policy NATed

    Hi Folks,             I have applied policy based NAT on one ASA firewall. Assume that Source Inside Network is 192.168.1.0 and destination (Outside) network is 192.168.2.0. Now using Policy NAT i am translating source Subnet 192.168.1.0 to a global

  • MobileDeviceService has stopped working.

    Up until about an hour ago, my iTunes (10.4) worked fine with my iPhone 3Gs (iOS 4.3.5). However now, it won't let my iPhone appear in my iTunes and so the message (from the discussion title) appears. I don't know what to do and am stuck, I have howe