JEditorPane with variable line height

Hi folks,
I'm trying to build a custom editor using the HTMLEditorKit. I want the user to be able to change font size and style.
How do I get the current line number the cursor is placed? That would be no problem if I used constant line height. But I don't.
I tried some stuff with getCaretPosition() and the other stuff I found in the forums but with no satisfying result.
Any ideas?
Thnx in advance,
AvonObi

If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)",
see http://homepage1.nifty.com/algafield/sscce.html,
that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
Don't forget to use the "Code Formatting Tags",
see http://forum.java.sun.com/help.jspa?sec=formatting,
so the posted code retains its original formatting.

Similar Messages

  • CSS validator having a problem with shorthand line-height

    Hi,
    Suddenly noticed a CSS error with a simple CSS:
    h1 { font: 20px/100% "Times New Roman", Times, serif; }
    "Value Error : font  / is not a font-family value :  20px / 100% "Times New Roman",Times,serif "
    That's the way I've always written "font." And Dreamweaver agrees. Is there a new standard here?
    http://www.wellesley-hotel.com/test2.html
    http://jigsaw.w3.org/css-validator/validator?profile=css21&warning=0&uri=http%3A%2F%2Fwww. wellesley-hotel.com%2Ftest2.html

    With CSS Shorthand on fonts, you should express ALL attributes.
    font: style | variant | weight | size/line-height | font-family "font name", "font name", font;
    If all attributes are not required, better to use font-size, line-height and font-family.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/

  • Resizing a JList with variable row heights, not updating the "picture"

    Firstly I would like to apologize for posting this Swing question here, but I was unable to find the Swing category, if someone could direct me to that I would be most grateful.
    Ok, so in abstract what I am trying to do is have a JList with resizable rows to act as a row header for a JTable (exactly like the row headers in OO Calc or MS Excel).
    What I have is a RowHeaderRenderer:
    public class RowHeaderRenderer extends JLabel implements ListCellRendererand it has a private member:
    private Vector<Integer>        _rowHeights            = new Vector<Integer>();which contains a list of all the variable row heights.
    Then there is my getListCellRendererComponent method:
        public Component getListCellRendererComponent(    JList         list,
                                                          Object        value,
                                                          int           index,
                                                          boolean       isSelected,
                                                          boolean       cellHasFocus)
            // Make sure the value is not null
            if(value == null)
                this.setText("");
            else
                this.setText(value.toString());
            // This is where height of the row is actually changed
            // This method is fed values from the _rowHeights vector
            this.setPreferredSize(new Dimension(this.getPreferredSize().width, _rowHeights.elementAt(index)));
            return this;
        }And then I have a row header:
    public class RowHeader extends JList implements TableModelListener, MouseListener, MouseMotionListenerand you may be interested in its constructor:
        public RowHeader(JTable table)
            _table = table;
            _rowHeaderRenderer = new RowHeaderRenderer(_table);
            this.setFixedCellWidth                        (50);
            this.setCellRenderer                        (_rowHeaderRenderer);
            // TODO: grab this value from the parent view table
            JScrollPane panel = new JScrollPane();
            this.setBackground(panel.getBackground());
            this.addMouseMotionListener                    (this);
            this.addMouseListener                        (this);
            this.setModel                                (new DefaultListModel());
            table.getModel().addTableModelListener        (this);
            this.tableChanged                            (new TableModelEvent(_table.getModel()));
        }and as you can see from my mouse dragged event:
        public void mouseDragged(MouseEvent e)
            if(_resizing == true)
                int resizingRowHeight = _rowHeaderRenderer.getRowHeight(_resizingRow);
                _rowHeaderRenderer.setRowHeight(_resizingRow, resizingRowHeight + (e.getPoint().y - _cursorPreviousY));
                _cursorPreviousY = e.getPoint().y;  
        }all I am doing is passing the rowHeaderRenderer the values the currently resizing row should be, which works fine. The values are being changed and are accurate.
    The issue I am having is that while this dragging is going on the row does not appear to be resizing. In other words the "picture" of the row remains unchanged even though I change the values in the renderer. I tried calling:
    this.validate();and
    this.repaint();at the end of that mousedDragged method, but to no avail, neither of them worked.
    Again, I verified that I am passing the correct data in the RowHeaderRenderer.
    So, anyone have any ideas how I should get the image of the RowHeader (JList) to update after calling my MouseDragged event?
    Thank you for your time,
    Brandon

    I was able to fix this some time ago. Here is the solution:
         public void mouseDragged(MouseEvent e)
              if(_resizing == true)
                   int newHeight = _previousHeight + (e.getPoint().y - _cursorPreviousY);
                   if(newHeight < _minRowHeight)
                        newHeight = _minRowHeight;
                   _rowHeaderRenderer.setRowHeight(_resizingRow, newHeight);
                   _table.setRowHeight(_resizingRow, newHeight);
              this.updateUI();
         }

  • Advice on creating Answers with different line heights

    Some of my answers have 1 line, some have 2, some even have 3 lines. Any recommendations on configuring my Quiz slide so that the boxes automatically resize?
    Currently, I have two problems:
    1) I need to manually page-layout every slide where one or more of the answers takes more than 1 line. This is taking a while.
    2) I can't use "shuffle answers", because sometimes the 3 line answer is it's original space, and sometimes it's on a a one-line high answer line.
    Any advice?

    I try to avoid long sentences in MCQ but if necessary to have multiple lines (you can also reduce the font size) and I want shuffling this is my work flow:
    select the answer caption with the greatest height
    co-select the other answer captions and in right-click menu choose Aligh, Resize to same height
    increase the height of the surrounding box (surrounds all the answer captions, this can also be done in the Quiz master slide, too bad there are no placeholders for the individual answer captions there)
    move the bottom answer caption as far as necessary (will always use shortcuts like SHIFT-DOWN, CTRL-DOWN, DOWN not to disturb the alignment)
    reselect all the answer captions, right-click menu, Align, Distribute vertically (or use the icons from the Align toolbar of course)
    It is a pity that you cannot apply those style changes to all the MCQ slides, no Apply button in format accordion, no save default style in the top part of the Properties panel of the Answer captions. This means that the process has indeed to be done manually, but at least you can shuffle.
    Lilybiri

  • Multiple small stories with variable line counts assigned to different editors

    I have a "best practice" question for you more experienced InCopy users about what workflow you recommend for my specific issue. I am experienced in InDesign, but am a InCopy newbie. I want to make sure I'm not missing a solution because my lack of experience with InCopy may be causing me not to see the forest for the trees.
    Short version: What is the best way to allow multiple editors access to each of multiple small stories separately (one story per editor), but to allow the line count of each story to be variable each week, while adjusting the rest of the stories along with it on the page (see image below)?
    Details: My publishing company's workflow is on CS6 with editors working in Word, and we're upgrading to CC2014 with InCopy. We have 7 in-house editors, and all files on an in-house server. We have quick deadlines (some are 15 minutes from editor writing copy to transmitting publication to subscribers). In the example below, we have 10 sections, and I have all seven editors writing different sections at the same time. A final editor has control over fitting the final page. My INDD files to test the new workflow use an assignment-based workflow. I understand I can place each of these sections as their own story, under the same assignment, so a different editor can have them checked out. However, each section does not have the same line count from week to week. Markets with more activity will get more lines.
    In our current workflow, we have multiple rough Word docs pulled into one master doc with a script, that the final editor edits to fit, so each section can be a different number of lines as long as the total is the same. Then production staff load it in. When we upgrade, we can use a hybrid workflow where the final editor just loads that final Word doc into one InCopy story and edits it to fit.
    It would be great if I just didn't understand how to make the text height variable for the story each editor is typing, and auto-adjust so the next story starts below where the story above it ends, and you all had an idea how I can do it!
    Thanks! Nancy

    I disagree to Seshu's answer to question 1.
    Correct answer of question 1 is C and <u><b>not A.</b></u>
    Sorry I didn't find time to check the rest.
    <u>To the examinee</u>
    I wouldn't assume all answers from SDN-ers are correct if my certification exam was knocking the door! I would rather try and find out the correct answers myself from the system instead of mugging these answers without any understanding of the technology involved! Find out the answers yourself from the system...that way it will help you to understand why the answer is 'C' and not 'A'...just knowing the answer is 'C' is not good enough...one has to understand "why" its 'C' and not 'A'. Hope you get my point! Good luck.

  • How to make a border around a frame with variable line weights?

    I want to draw lines in Muse. I understand that it can only be done with the help of rectangles. In a free Muse Theme that I have downloaded I have found a quite nice line, that I have saved as graphic style. When  I read the properties I find the following definition: 'border weight (bottom: 1 left: 0 right: 0 top: 0).' It gives you the possibility to have only one line at the bottom. I very much would like to know how you can apply these variable settings to a border. I looked everywhere but can't find a way to do it. Any help would be greatly appreciated.

    Hi Dimitri,
    Select the rectangle you wish to use from your Muse page.
    Click on the blue 'Stroke' and a box will pop up where you can set the border styles for all four borders individually.

  • Line height question

    Hi,
    I am using the boilerplate. There are sections of content individually assigned styles - for example, <p>, <dt>, <dd>.
    As these tag styles flow the same way and generally appear the same way on the page - if I want to increase the line height of the text for the entire page, instead of adding line-height to all 3 independent tag styles, is it best to set globally and define in the body tag?
    Just wondering what would be the best method here?
    Thanks!

    Now, we're fishing in the dark here because we cannot see your code because you have not given us a link with which to view it, so we're offering pretty generic suggestions here…
    There are two ways to call a text style in HTML. Either call it with the attribute for your text or call it as a <span> element.
    So like osgood suggested, you can have a class that will define a line height that is pleasing to you that can be applied to anything thusly:
    <ul>
         <li class="this">List item one</li>
         <li class="this">List item two</li>
         <li>This list item is not styled with the line height "this" because there is no class element.</li>
    </ul>
    <p class="this">This text will have osgood's line height, assuming you have added that class to your style sheet.</p>
    <p>This text will <em>not</em> have osgood's line hight because there is no class="this" after the paragraph element in the HTML</p>
    Or you can use the span element thusly:
    <p>this text has no line height attribute <span class="this">but this text does</span></p>
    (please understand that the line height adjustment in the above paragraph may be set entirely by the part with the line-height adjustment because that is the way web browsers work, applying line height for the entire line and not just the part that has the adjustment, so if there was a line break before your span element, there would be two different line heights.
    And you can set up multiple line heights to affect any of your HTML in your CSS either by calling the class in your HTML or by simply defining all of the elements in your HTML page with the combination in your style sheet thusly:
    p dt dd {
         line-height: 16px;
    Got it?
    -Mark

  • Tabular report with variable-height 2nd line?

    I have a simple tabular (Tablix) report.  The last field is a message (varchar(1000)) which I would like to place by itself on a second line (while still preserving the tabular format), with variable height.  
    The problem is, when I add a second row to the detail region, I can add the message field, but it is limited to the size of the field just above it.  I'm trying to allow that message field to take almost the entire width of the second detail line.  Can
    this be done?  
    Thanks.

    If you add a row inside the Details group, then select all cells inside the details group that are on the new row, you should be able to merge cells by right-clicking and choosing merge cells.
    You cannot merge cells across different scopes (row groups, column groups, etc) so be certain that you are not selecting cells that span different groups.
    "You will find a fortune, though it will not be the one you seek." -
    Blind Seer, O Brother Where Art Thou
    Please Mark posts as answers or helpful so that others may find the fortune they seek.

  • HT4642 ios numbers:how to make cell height variable with auto line brake setting ?

    ipad numbers; How to make cell height variable with auto line break setting?

    That's strange. I responded earlier and the whole message got trashed. Hence the test post before retyping the entire thing again.
    Thanks for the reply.
    The video clip is a single screen capture video clip. This is what I've found by playing around with this more.
    The original clip resolution is greater than 640x480. If I use QT Pro to convert the original clip to 640x480 and then use either Flip4Mac or PE7, then the resolution looks good.
    Just trying to figure out if should keep all workflow on the MacOS side. There are several different version of Flip4Mac. $49 gives me 640x480, but if I ever want to make it slightly larger then I would need to go with the $99 or HD version.
    I also tried to export to AVI with QT Pro and the import with Windows MovieMaker but it didn't work really good. I liked the simplicity (since PE7 hogs a lot of resources especially through VMWare).

  • Accordion with variable height

    Hi -
    I have a 2-panel accordion with variable heights, and spry
    data in both the top and bottom panels. Selections made in the top
    panel will load data into the bottom panel, and the page opens to
    the top panel by default. My problem is that the bottom panel will
    only display enough height to show the initial HTML markup, and not
    the spry data generated after the initial page load. Is there any
    way to use an observer to "refresh" the accordion to reset its
    height to accommodate the new data?
    Also, is there a way to require that at least one panel
    remain open when using variable heights?
    Thanks in advance,
    Rod

    Hi,
    We have a similar question on this
    post.
    To fit exactly with your request you should change the line:
    regionHeight =
    document.getElementById("myRegion").scrollHeight;
    with:
    document.getElementById("myRegion").style.height =
    document.getElementById("myRegion").scrollHeight + 'px';
    Diana

  • SQLPLUS: define variable with multiple lines

    Hi All,
    I need define a varaible with multiple lines as following:
    define schema_name = 'aaa',
    'bbb',
    'ccc';
    select * from tb_test where sName in &schema_name;
    However, it seems SQLPLUS dose not like the way I define the variable. What I want to do is to select * from tb_test where sName in ('aaa', 'bbb', 'ccc'). I would like to use multiple lines in the define.  Any suggestion?
    Thanks,

    Hi,
    If the substitution variable contains special characters, such as spaces or single-quotes, then enclosed the whole value in double-quotes, like this:
    DEFINE  schema_list = "'aaa', 'bbb', 'ccc'"
    If you really need linefeeds in the value, then you might have to use COLUMN ... NEW_VALUE (or OLD_VALUE) to set the value.  For example:
    COLUMN schema_list_col NEW_VALUE schema_list
    SELECT  '''aaa'', ' || CHR (10)
         || '''bbb'', ' || CHR (10)
         || '''ccc'''     AS schema_list_col
    FROM    dual;

  • TreeTable with variable tree row height

    Hello,
    I am trying to implement a treetable where the tree node height depends on the text. I am facing the following bugs in the code.
    1> The rows with multi line text are not rendered correctly even though the tooltip text is shown correctly.The screen shot for this bug : [http://i300.photobucket.com/albums/nn40/ranchugold/treeTable.jpg]
    2> The node "Group2" does not expand when I click on the "+". Instead the node will expand if the mouse is clicked one row above the "+". The screenshot for this bug: [http://i300.photobucket.com/albums/nn40/ranchugold/treetable2.jpg]
    The code for the treetable has been taken from the Sun examples and is available at [http://www.filefactory.com/file/b0h879g/n/treeTable.zip] .
    Any help will be appreciated.
    Thanks,
    Arun

    What the hey is an apps panel? Looking at your code, it seems you may be an internal oracle developer working in fusion apps, in which case you should be asking in some internal forum somewhere, since we the general public don't have access to the same goodies that you do
    John

  • Line-height not working with flash and css

    I'm using dynamic text in Flash with CSS, but line-height
    doesn't seem to be working with. Is it supported? If not, what is a
    work around to get my text to look they way I want?

    I believe this is due to a corrupt file in your profile. You can confirm this if you create a new temporary Firefox profile ([http://support.mozilla.com/en-US/kb/Managing+profiles managing profiles]) and if the problem disappears.
    To fix this problem (hopefully), do this:
    - access ''about:support'' in your location bar
    - click ''Open Containing Folder''
    - close Firefox
    - delete the file ''downloads.sqlite'' (send it to the recycle bin, if, for any reason, you want to get it back later)
    - start Firefox
    Now the problem should be solved. I believe it's simply a matter of this file having become corrupt. For whatever reason. It's really unfortunate, but I hope this fixes the issue.

  • Modify line height

    Hi all.
    We have a report to do invoices.
    In this report, we have LineType = LINE and TAX.
    On the LineType=LINE, we create variables that we print on LineType=TAX.
    The problem is that we have blank line, printed line, blank line, printed line and so on.
    My question is : how to do to put the line height of the blank lines to 0 ?
    Thanks
    Fred

    Hi Tim.
    I tried your solution but she doesn't work.
    I think I am not clear with what we want to do.
    We must read the LineType 'LINE' to memorize some data and we print them on the LineType 'TAX' but actually we see a blank line on the invoice for the LineType 'LINE' then we don't see this blank line.
    Do you see what we want ?
    Regards
    Fred

  • Error in Looping with variable

    Dear All,
    Please help me. i want to loop of record. i have two scheme. First, i make without variable and not error. Second, i make with variable and error occurs. as below my syntax:
    First:
    declare
    x varchar(50);
    begin
    --x:='select dummy from dual';
    for c1 in (select dummy from dual) loop
    dbms_output.put_line(c1.dummy);
    end loop;
    end;
    result:
    X
    Second:
    declare
    x varchar(50);
    begin
    x:='select dummy from dual';
    for c1 in (x) loop
    dbms_output.put_line(c1.dummy);
    end loop;
    end;
    result:
    Encountered the symbol 'LOOP' when expecting one...

    Billy  Verreynne  wrote:
    Why? For what purpose?
    A cursor fetch loop is not the ideal processing structure.
    It is slow. It requires data to travel from the buffer cache of the database into PL/SQL variables (in the PGA). It requires context switching between the PL/SQL and SQL engines.
    It does not scale. More rows means more data to travel that path from the SQL engine to the PL/SQL engine. More loop iterations in PL/SQL. If a single loop iteration (for processing a row) is 1ms, then a 100,000 rows will take a 100 seconds. 200,000 rows 200 seconds. Etc. This clearly does not scale with an increase in data volume.
    Also keep in mind that DBMS_OUTPUT does not write to screen or display anything. It is incapable of accessing a client device as it executes inside a server process. So each call to DBMS_OUTPUT stores that line of text in very expensive server memory. When the database call is done, the client (e.g. TOAD or SQL*Plus) can read those lines from the database and the client can display it.
    So if your loop is for a 1000 rows, it means writing a 1000 lines of text into very expensive server memory - and then expecting the client to read that afterwards and display it. Why? This is not a standard client-server method. It also does not scale. It can actually crash the server when this method is abused.
    The standard method would be to create a SQL cursor using PL/SQL code, and then return a reference handle (pointer) to the client. This allows the client the ability to fetch data directly from the cursor - in an optimal way that does not consume expensive server memory.I have to say it: I sincerely appreciate you taking the time to write this whenever it needs to be written rather than just giving up and letting people stumble along with bad design - it must take a lot of mental stamina to keep doing it. One day it will sink into my head also :-)

Maybe you are looking for