JTree customize lines position relative to node

Hi,I have a problem.I have a JTree with nodes that are composed of an Icon and a JTextArea.The horizontal line corresponding to the node positions itself at the middle of the node(that is in the middle of the text) and I want it to be positioned at the beginning of the node(that is to point to the Icon).Any suggestions?Any code?

Hello again,
I finally solved the problem.
For other users here´s one possible solution:
http://www.q-trax.net/blog/as/getbywithoutroot.htm
thanks anyway!
Best rgds!

Similar Messages

  • JTree Button, Line and Java look and feel ?

    Hi all,
    I have 3 small problem with my JTree ..
    1) The 'expand' button size ...
    I set a different Icon for each node in a getTreeCellRendererComponent method (from a class that extends DefaultTreeCellRenderer )...
    The icon are 32x32 pixels.. .and the RowHeight and the Font have been changed too. .
    How to change the size of the expand button (+/-) near the text node ? Because on my JTree, the expand/collapse buttons are really small compare to the icon & row height.
    2) No line appear between the node ...
    I try to set the line style property with -> putClientProperty("JTree.lineStyle", "Angled"); in the JTree constructor OR in the DefaultTreeCellRenderer constructor .. but it doesn't work :/
    3) How to set a Java look and feel for my JTree (actually, I have a Windows look and feel ..)
    I know .. I have grouped 3 question in the same topic ...
    If anyone can help me on one of these subjects. .. Thanks !
    Regards,
    Didier

    So, the Problem 1) is solved ..
    About the Problem 2)
    I put the code UIManager.setLookAndFeel(new javax.swing.plaf.metal.MetalLookAndFeel()) in the main method, like
      //Main method
      public static void main(String[] args) {
        try {
          UIManager.setLookAndFeel(new javax.swing.plaf.metal.MetalLookAndFeel());
        catch(Exception e) {
          e.printStackTrace();
        new MainApplication();
      }But it only set a Java L&F on the spliter, and on the toolbar contained in my application... Any idea why the title bar is not changed too ?
    (The title bar stay with a Window$ XP L&F ...)
    About the problem 3)
    When I set the L&F->UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); then the lines appear .. ??!! .. if I set again the previous value UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); .. then the lines desappear ..

  • [SQL QUERY] Select TCP Port Monitors and their related Watcher Node

    Hi everybody,
    I'm working on a SSRS report and SQL Query, I have no problem to find all my TCP Port Monitor (SCOM 2012 R2) based on the DisplayName, but I can't figure out how to get their related watcher nodes (in my case only 1 computer is a watcher node).
    I can't find which table, which field, contains this information..?
    Here is the query i started to write (i select * since i still searching for the right column):
    SELECT
    FROM StateView s
    INNER JOIN BaseManagedEntity me on me.BaseManagedEntityId=s.BaseManagedEntityId
    INNER JOIN MonitorView mv on mv.Id=s.MonitorId
    INNER JOIN ManagedTypeView mtv on mtv.Id=s.TargetManagedEntityType
    --where mv.DisplayName like 'Ping Target Status Check%'
    AND me.IsDeleted = '0'
    where mv.DisplayName like '%tcpmon%'
    and mv.LanguageCode = 'ENU'
    --and s.HealthState in (@state)
    ORDER BY s.Lastmodified DESC
    It would be great if someone can help me !
    Thanks,
    Julien

    Hi,
    After creating a TCP port monitor, we can find a table for this monitor under operationsmanager database :
    SELECT *
    FROM [OperationsManager].[dbo].[MT_TCPPortCheck_******WatcherComputersGroup]
    You will find the warcher computer group.
    Regards,
    Yan Li
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • Tooltip position relative to browser window

    Hi -
    I have a repeating region of left-floated divs that works
    like a horizontal looper for my data set - items repeat
    left-to-right, then start a new row. I have a tooltip on the div to
    pop up a large-scale image of the underlying repeating data.
    The problem is that on the rightmost column, the tooltip
    image runs off the right edge of the browser window (causing the
    horizontal scrollbar to appear). The bottom row does the same with
    the bottom edge of the window - you have to scroll town to see the
    entire tooltip, rather than the tooltip adjusting for the bottom of
    the window. Does the tooltip widget have a setting that will change
    its position relative to the mouse if you are up against the edges
    of the browser window?
    Thanks,
    Rod

    I have this same question. Can the tooltip flip horizontally
    when it touches the browser edge?

  • Line numbers related to order number

    hi,
    the requirement is , i have two parameters order number and line number.
    i want to display the line numbers related to that particular order number while
    submitting the request from srs window.
    so first i created table value set for order num.
    and for line number value set i mentioned oe_order_lines_all ool,
    oe_order_lines_all ool in table name field and ool.line number in column field
    and in where/order by field i had mentioned like
    where ool.header_id=ooh.header_id
    and ooh.order_number=:$FLEX$.order_num_value_set.
    value set is created but while submitting the request by clicking the line number
    field it is giving error.
    can u plz give any solution.

    .. or dense_rank() ? :
    SELECT line_id,
              line_number
           || '.'
           || DENSE_RANK () OVER (PARTITION BY header_id ORDER BY header_id)
                                                                      line_number
      FROM oe_order_lines_all
    WHERE header_id = 6250

  • Squiggly wrong word red line position not fix to center of text

    Hi,
    when use sguiggly spell checker in richtextEditor's richtext area which have a fix size and set in canvas and set spell checker on this then i get red line position on end of text and when i write and enter so scroll is enable and text height is enable so for each increate text size the redline position is decrease like one more pixel from text of line so like this after some time the red line position is bottom of text.
    I don't know how can i will solve this problem  , i need some direction or view how can i maintain red line position of center of text.

    Hi,
    Thanks for reply
    My code is given below in that richtexteditor is dynamic added in canvas as per condition.
    Please tell me when next update of squiggly will release.
                    // CODE OF RICHTEXT BOX WHEN ADDED DYNAMIC AS PER PREVIOUS CONDITION
                    var richtext:RichTextEditor = new RichTextEditor();
                    MgrCommon.instance.setSpellChecker(richtext); // set spell checker
                    richtext.fontFamilyArray = MgrFont.instance.fontList; // set font list
                    richtext.setStyle("fontFamily", "Arial");
                    richtext.setStyle("fontSize", 14);
                    Application.application.canvas_richtext.addChild(richtext); // add richtext to canvas
                    richtext.textArea.verticalScrollPolicy = ScrollPolicy.OFF;               
                    richtext.textArea.htmlText = item.voText.body; // set htmltext from value object.
                    var richTextField:TextField = richtext.textArea.mx_internal::getTextField();
                    richTextField.embedFonts = true;              
                    richtext.name = "richtexteditor";
                    richtext.data = new Object();
                    richtext.data['item'] = item;
                    richtext.textArea.verticalScrollPolicy = "off";
                    richtext.textArea.horizontalScrollPolicy = "off";
                    createStyleCombo(richtext); // FOR SET COMBO STYLE
                    var richtool:* = richtext.toolbar;
                    richtext.showToolTips = true;
                    richtext.textArea.addEventListener(ScrollEvent.SCROLL, setTextHeight); // set dynamic increase height when scroll position > 0                         
                    try
                        richtext.toolbar.width = 500;
                        richtext.linkTextInput.percentWidth = 100;
                        richtext.linkTextInput.addEventListener(FocusEvent.FOCUS_IN , focusInHandler);                   
                        richtext.fontFamilyCombo.width = 157;
                        Application.application.area_text.addChild(richtool);
                    }catch(e:*){    }
                    setRichTextStyle(richtext, item); // set richtext height and width
                    richtext.textArea.setFocus();
                    setTimeout(setRichTextFont, 100, richtext); // set richtext font combo
                    // CODE OF MANAGER WHICH USED FOR SPELL CHECKER
                    public function setSpellChecker(textFiled:*,isAddListner:Boolean = false):void
                        if(textFiled is RichTextEditor || isAddListner == true)
                            textFiled.addEventListener(FlexEvent.CREATION_COMPLETE,creationComplate,false,0,true);
                         else
                             SpellUI.enableSpelling(textFiled , 'en_US');               
                    private function creationComplate(event:FlexEvent):void
                        if(event.currentTarget != null)
                              var curObj:UIComponent = event.currentTarget as UIComponent;
                              if(curObj)
                                  curObj.addEventListener(Event.REMOVED_FROM_STAGE , removeFromStageHandler,false,0,true)
                                  SpellUI.enableSpelling(curObj , 'en_US');
                 private function removeFromStageHandler(event:Event):void
                     if(event.currentTarget!= null)
                         var curObj:UIComponent = event.currentTarget as UIComponent;
                         if(curObj)
                             curObj.removeEventListener(FlexEvent.CREATION_COMPLETE,creationComplate);
                             curObj.removeEventListener(Event.REMOVED_FROM_STAGE , removeFromStageHandler);
                             SpellUI.disableSpelling(curObj);   
                    curObj = null;
                    System.gc();   
    Thanks,
    Mohit.

  • "position:relative" in jsp

    I have a html file in which I have a scrolling table with a fixed header. I achieve this by CSS and adding the attribute "position:relative" for the table header. I open it in IE6 and I have my functionality with the table body scrolling and the header fixed.
    Now I have the same html code in my jsp and the whole table including the table header scrolls. it takes the value "overflow:auto" which allows scrolling, but it somehow doesnt take the value "position:relative" , which, results in my header to scroll.
    Why is my jsp not respecting the "position:relative" attribute?
    Raghav

    I have done this in my JSP. To freeze header you have to use the following code in your THEAD (css),
    top: expression(document.getElementById("mytable").scrollTop-1);
    z-index: 10;

  • Why Position:Relative from CSS doesn't work at Safari 5.03?

    If you watch my web page: http://clubdeleonesst.tk
    I designed a ComboBox and have some problems with position relative. I used jQuery to create it, you could watch the original example here:
    http://www.marghoobsuleman.com/jquery-image-dropdown
    And I have been watching that the transparency from Flash doesn't work too. I hope you can solve these bugs.
    Message was edited by: FANMixco
    Message was edited by: FANMixco

    The "disappearing" affect you describe is not normal. You may need to reinstall Safari.
    First, try removing the Apple cookies from your Safari Preferences>Security>Cookies panel. Also, go to your Safari Menu and Empty cache. Then try to log-on to Apple Discussions.
    Also, regarding the "disappearing" effect, try Safari from another User Account.
    Here is guidance from Apple on how to set up the account. You can ignore step 7 in the article.
    Also, on the system preference>Accounts panel, click on "log-in" options. There, select "fast user switching". This allows you to go back and forth between user accounts via an icon in your Menu Bar at the top of the computer screen.
    Log-on to the new account and start Safari. If Safari is stable in the new account, then your problem is specific to your regular user account. Otherwise, similar response means a system-wide problem.
    Post back with results.

  • Customize a control and property nodes

    I don't know if and how it is possible. Is it possible to customize a control, but having access to property nodes too? 
    I explain better: if I create a control and I customize it, the customized control is a file.ctl, which has only front panel, but not block diagram. So that I cannot customize it using property nodes. Is there a way to bypass it?

    You don't need to create a .ctl file to customize a control.  It is just there so you can save a control you have customized to a file.
    Yes you can customize a control using property nodes.  You just use property nodes that are implicitly linked to a specific control, or you explicitly link to a control by passing a reference to the control to the property node.
    If you want to programmatically save a customized control to a .ctl, or open a .ctl file and customize it further, I think you'll have to look into LabVIEW scripting.  But I wouldn't do anything like that if I were you until you get thoroughly comfortable with using regular property nodes, which I don't think you are otherwise you wouldn't have asked this question.

  • How to customize line chart series and symbols?

    Hello Forum,
    who can help me to customize line chart series and symbols color?
    I need to customize this in dynamic way.
    Thanks in advanced.

    See example 8-10 (Example 8-10 Changing Chart Symbol Color) from http://docs.oracle.com/javafx/2.0/charts/css-styles.htm#CIHGIAGE (reproduced here).
    The linked tutorial document contains a picture of how this example renders.
    .chart-series-line {   
        -fx-stroke-width: 2px;
        -fx-effect: null;
    .default-color0.chart-series-line { -fx-stroke: #e9967a; }
    .default-color1.chart-series-line { -fx-stroke: #f0e68c; }
    .default-color2.chart-series-line { -fx-stroke: #dda0dd; }
    .default-color0.chart-line-symbol { -fx-background-color: #e9967a, white; }
    .default-color1.chart-line-symbol { -fx-background-color: #f0e68c, white; }
    .default-color2.chart-line-symbol { -fx-background-color: #dda0dd, white; }Note the two comma separated colors listed for each -fx-background-color for the chart-line-symbol.
    The first color is the color or the outside of the symbol, the second is the inside of the symbol.
    In the sample css you provided you only supply a single background color for the chart-line-symbol, when two colors are required.

  • JTree doesn't refresh when adding node in a node

    Hello,
    I have a strange problem
    I have a JTree, with a root, and two nodes, which have nodes...
    I have one node that is expanded, and the other is collapsed.
    I made a method that enables me to add a sub node to the node selected by the mouse.
    If I select the collapsed node and use my "add" method, and then expand the node, the node is here. No problem.
    If I do the same thing on the expanded node, the tree doesn't seem to be willing to refresh. I can use some refresh(), expandPath()...and other methods to make it refreshed, but it doesn't care... is there some particular method that I must use, a listener that I must add to the tree....?
    Any help would be appreciated
    Thanks 4 help
    Philippe

    You need to call nodeStructureChanged(parentNode) on the model.

  • Customizations are disabled for the node "ProposedJobVO.xml"

    Hi,
    We are trying to add extensions to a fusion Application. When i have created an Application 'Fusion Customizations Application'.
    In the Role 'Oracle Fusion Applications Administratror Customizations', and in Customizable Archive, Some Business Components are Not customizable while some of them are Customizable.
    getting below error in Log file
    Customizations are disabled for the node "ProposedJobVO.xml" because it is not part of the project contentset.
    Does this mean we cannot modify this VO or we need to do anything else to get these components included in Project Content Set?
    Thanks
    Kaja

    "Customizations are disabled for the node xxxx because it is not part of the project contentset". This warning is logged if you try to open a node for customization in customizaion role IN FA environment from Application Resources->connections->customizable archive ,
    as this node is not a part of project. In order to add it to the project you will have to right click on the node and select customize this will add the node to the virtual content set of project.
    Now this node will be available under project and can be customized.

  • Setting line position when Reading a file

    pls. help.
    what class does it sets the line position when you read a specific line of the file?
    i used the LineNumberReader.setLinePosition(int) but it does not actually sets the file pointer to the specified line number...

    ok.
    can it also read as binary?
    all japanese characters also are read with dummy characters.
    like the LineNumberReader.readLine(), it reads exactly the same.
    i want the functionality of RandomAccessFile to set the file pointer and can read the characters with no exception on any language.

  • Drag and Drop in JTree / Show line between Nodes as DropTarget

    Hello folks,
    I am using the posted DnDTree.
    My problem is to show a line between two nodes when I am drgging another node over them.
    The idea is to have the posibility to sort nodes in the same level.
    Has anybody an idea how to solve that?
    Thanks and best reards,
    Florian

    "My problem is to show a line between two nodes when I am drgging another node over them."
    Try this dragOver method:
    public void dragOver(DropTargetDragEvent dtde) {
    Point p = dtde.getLocation();
    int closestRow = getClosestRowForLocation(p.x, p.y);
    Graphics g = getGraphics();
    try {
    if (closestRow != -1) {
    DnDNode node =(DnDNode)getPathForRow(closestRow).getLastPathComponent();
    Rectangle r = getRowBounds(closestRow);
    g.setXORMode(getBackground());     
    if (p.y >= r.y && p.y <= r.y + r.height) {
    dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);
    drawNewLine = false;
    drawNewRectangle = false;
    if (!node.getAllowsChildren() && ((r.x != x1 || r.y + r.height != y1) || rectangleDrawn)) {
    drawNewLine = true;
    parentNode = (DnDNode) node.getParent();
    index = parentNode.getIndex(node) + 1;                    
    } else if (node.getAllowsChildren()) {
    if ((isCollapsed(closestRow) || (isExpanded(closestRow) && node.getChildCount() == 0)) && (rectangleDrawn || (!lineDrawn && !rectangleDrawn)) && p.y > r.y + r.height - 5) {
    drawNewLine = true;
    parentNode = (DnDNode) node.getParent();
    index = parentNode.getIndex(node) + 1;
    } else if ((lineDrawn && p.y <= r.y + r.height - 5) || ((rectangleDrawn || (!lineDrawn && !rectangleDrawn)) && (r.x != x || r.y != y))) {
    drawNewRectangle = true;
    parentNode = node;
    index = 0;
    // Marks where the drop will occur
    if (drawNewLine || drawNewRectangle) {
    if (lineDrawn) {
    g.drawLine(x1, y1, x2, y2);
    lineDrawn = false;
    if (rectangleDrawn) {
    g.drawRect(x, y, w, h);
    rectangleDrawn = false;
    if (drawNewLine) {
    x1 = r.x;
    y1 = r.y + r.height;
    x2 = getWidth() - 5;
    y2 = r.y + r.height;
    g.drawLine(x1, y1, x2, y2);
    lineDrawn = true;
    if (drawNewRectangle) {
    x = r.x;
    y = r.y;
    w = getWidth() - r.x - 5;
    h = r.height - 1;     
    g.drawRect(x, y, w, h);
    rectangleDrawn = true;
    } else {
    dtde.rejectDrag();
    index = -1;
    if (lineDrawn) {
    g.drawLine(x1, y1, x2, y2);
    x1 = -1;
    y1 = -1;
    lineDrawn = false;
    if (rectangleDrawn) {
    g.drawRect(x, y, w, h);
    x = -1;
    y = -1;
    rectangleDrawn = false;
    } finally {
    g.dispose();
    Hope this works for you...
    Good luck
    /Tomas

  • JTree: HOW TO add a new node

    Hi everybody,
    Im going to try to be clear...
    My problem is the following: I am a beginner using JTree and what I want to do is to add a new node in a certain position in my JTree. I would be very grateful if apart from explanation, any of you could provide me with a piece of code.
    Let us think that my tree has the root and some first-level children called group 1, ..., group n. Every group has some children called rulemodule 1, ..., rulemodule m. And every rulemodule has some children called rule 1, ..., rule j.
    An example of the visual look of my jtree:
    root
    __ group 1
    ____ rulemodule 1.1
    ______ rule 1.1.1
    ____ rulemodule 1.2
    ______ rule 1.2.1
    ______ rule 1.2.2
    ______ rule 1.2.3
    __ group 2
    ____ rulemodule 2.1
    ______ rule 2.1.1
    ____ rulemodule 2.2
    ______ rule 2.2.1
    Then, let us say that what I want is to add a new rule in the position where it is in this moment rule 1.2.2 (so the rule that was 1.2.2 before would be now 1.2.3, and the one that was 1.2.3 would be now 1.2.4). So I know the name of the group, the name of the rulemodule and the position of the new rule. How could I do that?
    In order to build the JTree I have the following statements:
    TreeNode treeNode = fillTheTree(ruleModulePart.config.getRuleModules()); This function actually builds the tree.
    jTreeModel = new DefaultTreeModel(treeNode);
    jTree = new JTree(jTreeModel);
    Thanks a lot to everybody!
    Fran.

    Thanks a lot for your answer Maxideon,
    Well, I think that I did not explained it the problem very well...
    The example of the tree was just that, an example, but the tree does not look like that. I just wanted to show that the tree has 3 levels of depth.
    The declaration of the function would actually be like that:
    public void UpdateJTreeWithNewRule (String groupName, String ruleModuleName, String newRuleName, int positionOfNewRule) {
    }So I think that I would need to do first a search to find the position of the "group" which corresponds to that 'groupName' and after that the position of the "rulemodule" which corresponds to that 'ruleModuleName'. And then add the 'newRuleName' in the position 'positionOfNewRule' inside that "rulemodule".
    Thanks a lot again,
    Fran.

Maybe you are looking for

  • Revision / Batch number set in Sales Order

    I have a problem with the Rev/Batch # input in the item level in Sales Order. We create batch numbers in the background via MSC1N when Goods receive is done (MIGO). So when we create Sales Orders, in the item level we enter the Revision in the field

  • How to Use Edit - Cut  menu Command in my program

    Hi All, I want to call edit->cut menu action from my program, i have tried with textmodel->cut and also scrapsuite-> cut method, it works for normal text but i have a document with text from Word documents, when i cut the text from menu edit->cut it

  • Facing problem in connection with OWB client

    Dear All Greetings!!! Im new to Datawarehouse building. I have installed OWB R1 at my own pc.I am facing problems in connecting OWB client..What exactly to put in Host name and Oracle Service name. i am logging in with the same system/password with n

  • Run SAP with embedded username/password

    Is there any way to run the SAP client so it will automatically log in with particular credentials?  I'm trying to figure out a way to automatically have SAP start in the middle of the night (I need an add-on to start before a certain time).  I've fo

  • Propagation Tool - loses CM links

    Hi, We have a WLS 9.2 Portal. We have deployed to System Test and propagated in all the Visitor Entiltlments and Content Management (Content + Types) that our application requires. Only problem is, that if we deploy a new version of the application E