Tabs y-axis offset on TabNavigator

Is there a property in the CSS that allows me to move upwards
and downwards the tabs when styling a TabNavigator in Flex Builder
3?
I am having a problem where the tabs of the TabNavigator do
not join with the body of the TabNavigator when skinning the them.
I need a way to adjust the tabs's y-axis offset of the tabs so that
they join with the body of the whole TabNavigator.
Thanks

Thanks, Peter.
Well, I am not too sure if it is a bug. I have taken a
screenshot of the problem.
http://img293.imageshack.us/img293/1830/tabproblemhc4.gif
The tabs do not align with the body of the TabNavigator. This
is the code in my CSS when skinning the component:
TabNavigator.contentTabNavigator
selectedTabTextStyleName: tabNavigatorSelectedTabText;
tabStyleName: tabNavigatorTab;
cornerRadius: 0;
borderSkin:
Embed(source="../images/skins/TabNavigator_borderSkin.png",scaleGridTop="26",scaleGridLef t="27",scaleGridRight="479",scaleGridBottom="467");
tabOffset: 5;
.tabNavigatorTab
upSkin:
Embed(source="../images/skins/TabNavigator_middleTabsSkin.png",scaleGridTop="34",scaleGri dLeft="16",scaleGridRight="122",scaleGridBottom="57");
themeColor: #6A6A6A;
cornerRadius: 15;
Is there anything wrong on my part?

Similar Messages

  • Axis offsets and padding problems

    I am having problems with getting my charts to draw as columns to the right of tick marks.  Here is what the chart should look like:
    But here is what mine looks like in Flex:
    Below  are snippets from my code to draw the chart in Actionscript.  As you can see, I am currently using the padding property on CartesianChart to keep the chart from clipping the columns.  Then I use offset on the columnSeries to get the columns off the labels.  But I am left with a big gap on the left...
    // code
         var genericChart:CartesianChart = new CartesianChart();
         var axisList:ArrayCollection = chart.getAxisList();
         var renderers:ArrayCollection = new ArrayCollection();
         var seriesArray:ArrayCollection = new ArrayCollection();
         var hAxis:LinearAxis = new LinearAxis();      
         hAxis.padding = 100;
        var ar:AxisRenderer = new AxisRenderer();
        ar.axis = hAxis;
        genericChart.horizontalAxisRenderers = [ar];
        genericChart.horizontalAxis = hAxis;
        var vAxis:LinearAxis = new LinearAxis();
        vAxis.baseAtZero = false;
        var axr:AxisRenderer = new AxisRenderer();
        axr.axis = vAxis;
        var columnSeries:ColumnSeries = new ColumnSeries();        
        columnSeries.columnWidthRatio = 90;
        columnSeries.offset = 50;
        columnSeries.verticalAxis = vAxis;
        seriesArray.addItem(columnSeries);
        renderers.addItem(axr);
        genericChart.series = seriesArray.toArray().reverse();
        genericChart.verticalAxisRenderers = renderers.toArray();

    This appears to be a common problem with Axis not specific to Sun ONE Web Server: http://www.google.com/search?q=org.apache.axis.client.Stub.extractAttachments
    You say you tried Axis 1.2, but the NullPointerException you point out appears to have been fixed in Axis 1.2: http://cvs.apache.org/viewcvs.cgi/ws-axis/java/src/org/apache/axis/client/Stub.java?rev=1.32&view=log#rev1.32
    Perhaps you're running into a different, unrelated problem with Axis 1.2?

  • How can I initialize all TabNavigator Tabs upon a state change?

    Here's the basic goal. I want to provide two views to the
    user that display the same panels. I configured each view as a
    separate state but I am having trouble initializing each of the tab
    views since they are only created by Flex when the user first
    selects it. I need them all created when the user changes to that
    state so that I can insert my view objects. Does that make sense?
    Ok, how about an example program. I define three view objects
    in ActionScript which will be used in two different states. I use
    AddChild to put them in the proper layout location. The problem is
    with the Tab state. The AddChild operation only works for the first
    tab because it is visible. The other two tabs don't get setup
    properly. Can anyone help me resolve this?
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="vertical"
    creationComplete="onCreationComplete()">
    <mx:Script>
    <![CDATA[
    import mx.containers.VBox;
    import mx.controls.Label;
    [Bindable] public var view1:VBox;
    [Bindable] public var view2:VBox;
    [Bindable] public var view3:VBox;
    private function onCreationComplete():void
    var label1:Label = new Label();
    var label2:Label = new Label();
    var label3:Label = new Label();
    label1.text = "This is view 1.";
    label2.text = "This is view 2.";
    label3.text = "This is view 3.";
    view1 = new VBox();
    view1.label = "View 1";
    view1.addChild(label1);
    view2 = new VBox();
    view2.label = "View 2";
    view2.addChild(label2);
    view3 = new VBox();
    view3.label = "View 3";
    view3.addChild(label3);
    currentState = "wizardState";
    private function changeState():void
    switch(stateBox.selectedItem.data)
    case 0: currentState = 'wizardState'; break;
    case 1: currentState = 'tabState'; break;
    ]]>
    </mx:Script>
    <mx:Panel id="mainPanel" title="Tab View Bug" width="400"
    height="320"/>
    <mx:ComboBox id="stateBox" change="changeState()">
    <mx:dataProvider>
    <mx:Object label="Wizard" data="0"/>
    <mx:Object label="Tabbed" data="1"/>
    </mx:dataProvider>
    </mx:ComboBox>
    <mx:states>
    <mx:State name="wizardState">
    <mx:AddChild relativeTo="{mainPanel}"
    position="lastChild">
    <mx:HBox width="100%" height="100%"
    verticalAlign="top">
    <mx:ToggleButtonBar id="wizardButtonBar" width="20%"
    direction="vertical"
    dataProvider="{wizardViewStack}"/>
    <mx:ViewStack id="wizardViewStack" width="80%"
    selectedIndex="{wizardButtonBar.selectedIndex}"/>
    </mx:HBox>
    </mx:AddChild>
    <mx:AddChild target="{view1}"
    relativeTo="{wizardViewStack}" position="lastChild"/>
    <mx:AddChild target="{view2}"
    relativeTo="{wizardViewStack}" position="lastChild"/>
    <mx:AddChild target="{view3}"
    relativeTo="{wizardViewStack}" position="lastChild"/>
    </mx:State>
    <mx:State name="tabState">
    <mx:AddChild relativeTo="{mainPanel}"
    position="lastChild">
    <mx:TabNavigator id="tabViewStack" width="100%"
    height="100%">
    <mx:VBox label="Tab 1" id="tab1"/>
    <mx:VBox label="Tab 2" id="tab2"/>
    <mx:VBox label="Tab 3" id="tab3"/>
    </mx:TabNavigator>
    </mx:AddChild>
    <mx:AddChild target="{view1}" relativeTo="{tab1}"
    position="lastChild"/>
    <mx:AddChild target="{view2}" relativeTo="{tab2}"
    position="lastChild"/>
    <mx:AddChild target="{view3}" relativeTo="{tab3}"
    position="lastChild"/>
    </mx:State>
    </mx:states>
    </mx:Application>

    Ok, here is an even simpler scenario. I take each view from
    the default state and put them in the new tab view when the state
    changes. If you compile and run this example, the only view that
    makes it into the tabview is the one that was active when the state
    changed. Why is that?
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="vertical">
    <mx:Script>
    <![CDATA[
    private function changeState():void
    switch(stateBox.selectedItem.data)
    case 0: currentState = ''; break;
    case 1: currentState = 'tabState'; break;
    ]]>
    </mx:Script>
    <mx:Panel id="mainPanel" title="Tab View Bug" width="400"
    height="320">
    <mx:HBox id="wizardView" width="100%" height="100%"
    verticalAlign="top">
    <mx:ToggleButtonBar id="wizardButtonBar" width="20%"
    direction="vertical"
    dataProvider="{wizardViewStack}"/>
    <mx:ViewStack id="wizardViewStack" width="80%"
    selectedIndex="{wizardButtonBar.selectedIndex}"
    creationPolicy="all">
    <mx:Canvas id="view1" label="Part 1" >
    <mx:TextInput text="This is view 1"/>
    </mx:Canvas>
    <mx:Canvas id="view2" label="Part 2">
    <mx:TextInput text="This is view 2"/>
    </mx:Canvas>
    <mx:Canvas id="view3" label="Part 3">
    <mx:TextInput text="This is view 3"/>
    </mx:Canvas>
    </mx:ViewStack>
    </mx:HBox>
    </mx:Panel>
    <mx:ComboBox id="stateBox" change="changeState()">
    <mx:dataProvider>
    <mx:Object label="Wizard" data="0"/>
    <mx:Object label="Tabbed" data="1"/>
    </mx:dataProvider>
    </mx:ComboBox>
    <mx:states>
    <mx:State name="tabState">
    <mx:AddChild relativeTo="{mainPanel}"
    position="lastChild">
    <mx:TabNavigator id="tabView" width="100%" height="100%"
    creationPolicy="all">
    <mx:Canvas label="Tab 1" id="tab1"/>
    <mx:Canvas label="Tab 2" id="tab2"/>
    <mx:Canvas label="Tab 3" id="tab3"/>
    </mx:TabNavigator>
    </mx:AddChild>
    <mx:RemoveChild target="{view1}"/>
    <mx:AddChild target="{view1}" relativeTo="{tab1}"/>
    <mx:RemoveChild target="{view2}"/>
    <mx:AddChild target="{view2}" relativeTo="{tab2}"/>
    <mx:RemoveChild target="{view3}"/>
    <mx:AddChild target="{view3}" relativeTo="{tab3}"/>
    <mx:RemoveChild target="{wizardView}"/>
    </mx:State>
    </mx:states>
    </mx:Application>

  • TabNavigator Child Control Problem on Programmatic SelectedIndex Change

    I've got a TabNavigator that contains another TabNavigator as
    a child control on its second page. On the child TabNavigator
    there's a ViewStack and a couple of Accordion controls. On my first
    parent tab I've got a Button that, when clicked, programmatically
    changes the selectedIndex of the parent TabNavigator to display the
    contents of the second tab (which contains the child TabNavigator).
    I'm finding that when the index of the TabNavigator is
    changed programmatically, all of the controls in the child
    TabNavigator are stacked on top of each other and overlapping as
    though the Flash player has no clue how to display these child
    controls. Once I click through each tab on the child TabNavigator,
    they appear intact. If I click the Button to change the tab again,
    all of the controls will be jumbled and stacked.
    This problem happens 100% of the time. I've changed every
    single control in my app to creationPolicy="all" to no avail.
    Anybody experienced this or know what to do?

    I've got a TabNavigator that contains another TabNavigator as
    a child control on its second page. On the child TabNavigator
    there's a ViewStack and a couple of Accordion controls. On my first
    parent tab I've got a Button that, when clicked, programmatically
    changes the selectedIndex of the parent TabNavigator to display the
    contents of the second tab (which contains the child TabNavigator).
    I'm finding that when the index of the TabNavigator is
    changed programmatically, all of the controls in the child
    TabNavigator are stacked on top of each other and overlapping as
    though the Flash player has no clue how to display these child
    controls. Once I click through each tab on the child TabNavigator,
    they appear intact. If I click the Button to change the tab again,
    all of the controls will be jumbled and stacked.
    This problem happens 100% of the time. I've changed every
    single control in my app to creationPolicy="all" to no avail.
    Anybody experienced this or know what to do?

  • How can I change the axis so I could see the four quadrant of my image?

    Hi!
    I Have been graphying a polinomial with the intensity graph, but I couldn't see the four quadrants of my image,I can only see the first one, how could I fixed?

    I no longer have LabVIEW 5.1 so I only attach a code image of my suggestion.
    Front panel:
    (1) Change the offset for x and y axis of the intensity graph to -100.
    (2) Do the same for the x-axis of the waveform graph.
    Block Diagram:
    (1) What is the reason for the second sequence? It seems to just repeat the same code. (I removed it).
    (2) I am currently graphing "W" instead of "I", because "I" only produces noise (probably because my input parameters are way off). I am sure that with better input values, "I" will make a nice graph.
    (3) subtract 100 (the axis offset) from each iteration terminal to get the input variables to go from -100 to 99 (If you want -100 to 100, you need to set the loop count to 201).
    (See attached i
    mages. Let me know if this is clear)
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    FP_2Dpoly.gif ‏49 KB
    BD_2DPoly.gif ‏24 KB

  • Graph vertical axis display

    Minor question, but my program (LabWindows/CVI 8.1 in Windows XP) has a virtual o'scope display that displays data from an A/D card. I'm using the graph indicator, and as with a real o'scope there is a knob that moves the displayed trace left and right on the screen to get the bits that are off of the screen if the magnification is too narrow to see it all. With the graph indicator, the left Y axis, of course, stays at the 0 point on the X axis and will go off of the screen with X=0. I'd like to have a vertical axis that stays in the center of the graph at all times (like a real o'scope reticule) no matter what the actual graph is doing. Any suggestions would be greatly appreciated. (The X-Axis offset parameter doesn't do the trick).

    Another possibility is to use a second graph with transparent background, no X-axis grid and labels, no Y-axis grid; place it on top of the main graph like in the attached UIR file (you will need to adapt vertical size of the second graph since it has no X-axis. labels).
    (Note: I created the UIR in CVI 8.5 and saved for previous version: if you do not succeed in opening it tell me and I will repost it in TUI format for you to load).
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?
    Attachments:
    CentralYaxis.zip ‏2 KB

  • Crvs 2010 beta - Numeric axis grids & scales dialog box for charts

    Hello,
    The dialog box was in crvs2008, but I don't see it in crvs2010 beta. Has it been removed or just moved and I can't find it?
    It was off the chart shortcut menu (when you right-click on a chart in design view) under the Chart Options menu option.
    Thank you
    Tracy

    Hi Don,
    I am not referring to the Chart Expert.
    If you open a report that has a bar chart in crvs 2008 and follow the info below, you should see it.
    In crvs 2008, when you right-clicked on a chart, the shortcut menu has an option called "grid".
    When you select the grid option, the numeric axis grids & scales dialog box opened.
    It has the following tabs across the top - general, scales, labels, numbers and grids.
    On the left it has 2 tabs: data axis and group axis.
    Thank you
    Tracy

  • How to generate a matrix from 3 column data

    I am wanting to generate a matrix using the attached data so that x is row 1 and y is column 1. I tried splitting the array and using build array however It didn't work. I've checked the forums but no luck. any insight would be appreciated
    Solved!
    Go to Solution.
    Attachments:
    wafermap.xlsx ‏12 KB
    wafermap.zip ‏10 KB

    matthewk wrote:
    I am wanting to generate a matrix using the attached data so that x is row 1 and y is column 1. I tried splitting the array and using build array however It didn't work. I've checked the forums but no luck. any insight would be appreciated
    I assume that you probably meant: Column 1 is x, Column 2 is y, and column 3 is the value at cell x,y.
    All you need is initialize an array of the proper size, keep it in a shift register, and then replace values in order. Here's a quick draft. You can easily swap rows and columns if needed.
    Of course negative indices are not allowed, so you need to create a proper offset such that the lowest index is zero. You could display it in an intensity graph and set the axis offsets accordingly.
    I simply pasted the excel data into a text diagram constant. You can save the excel file as tab delimited text, then use "read from spreadsheet file".
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    wafermapsnippet.png ‏91 KB

  • Why is this .vi slow ?

    I use this rather uncomplicated .vi for an one hour continuously monitoring displayed digitized signals thru the GPIB output of my Tektronix DSA 602 ( Digitizing Signal Analyzer, sampling up to 2 Gs/Sec ).
    If I tweak the Signal Analyzing Scope at its fastest, its own screen update rate is about 14 mS/screen update ( ~ 70 screens/Sec ).
    However in LabView 7 - as per attached .vi - I get only 140 mS/screen ( ~ 7 screens / Sec ).
    This is about according to what I see in LabView\Tools\Advanced\Profile .vi's.
    I configured the ( Tektronix ) Instruments GPIB Interface at its maximum regular transfer rate, switching off the delaying bells & whistles.
    Question : why is the execution speed of this .vi only 7 screens/S ( ~140 mS/screen update ) ?
    The regular GPIB interface speed is 1 Mby/S ( in hi speed mode 7 Mby/S ).
    The Instuments internal digitizing speed - for this test - is 6 mS/acq.
    The Instuments screen update rate is abt 15 mS/update : 9 mS is needed - in this test - for processing after one digitizing acquisition.
    II run my ATE sytems on a separate dedicated computer with 1024 Kby Ram, a 3 Ghz processor and 240 GBy/7 mS HDD's, Windows 2000 Prof, wit NTFS for short files and FAT32 for the long ones.
    The hardware config can impossibly be the bottleneck.
    I also use a recent PCI NI GPIB 488.2 Interface Board.
    For this test I detached all other GPIB gear and cables, so no other GPIB device can slow down the Tektronix' transfer rate.
    The transferred data - in this test - contain only 512 horizontal points er acquisition.
    Thru the Tektronix Programmers Ref I calculated the number of tranferred bytes per acquisition/update at only 1034 bytes.
    My HP(IB) System Bus Analyzer confirms this.
    So, this is ultimate peanuts for the GPIB Bus.
    In this test the data are fetched from the Instrument to the LabView GPIB interface on a sequential acquisition basis.
    So, in this test I wanted to learn the execution speed of the .vi itself for one loop.
    I deliberately did not let the Instrument send contiguous data to LabView ( in an auto indexed array for non real time display ).
    What could be the reason for the slow .vi execution ?
    Or is this not abnormal ?
    Is LV's processing the bottleneck ?
    If so, why does it take 140 mS to execute one loop with this hardware ?
    This disappoints me.
    Any explanation would be gratefully welcomed.
    Peter van Daalen.
    Attachments:
    Tek_DSA_600_Window_Cont._Display.vi ‏29 KB

    I have no experience with the reading of the waveform, but there are a few other thing that could contribute to the slowdown. Maybe you could do a few tests to see what helps (Some suggestions are more cosmetic in nature and probably won't make a big speed difference).
    (1) Avoid overlapping controls, they slow down the redrawing of the front panel. Your counter is currently placed on top of the graph!
    (2) Change the counter indicator to I32.
    (3) Try to limit updating the graph to maybe a few times/second. Do you really need to graph it every iteration? (See attached code image). The human eye cannot see 70 screen updates/second!
    (4) If possible, disable autoscaling for x and y.
    (5) How often does the x-axis (offset, multiplier) actually change?
    Maybe you can set these values using an attribute node only once whenever they change and just feed the plain data array to the waveform graph, avoiding the bundling.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    tek.gif ‏5 KB

  • Center text in a JTextArea

    How can i get center the JTextArea text?

    Here's some code I found on the forum for a JTextPane:
    import javax.swing.*;
    import javax.swing.text.*;
    import java.awt.*;
    public class TextPaneCenter
        JTextPane edit = new JTextPane();
        public TextPaneCenter()
             JFrame frame=new JFrame();
             frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             frame.getContentPane().add(new JScrollPane(edit));
            try
                 edit.setEditorKit(new MyEditorKit());
                 SimpleAttributeSet attrs=new SimpleAttributeSet();
                 StyleConstants.setAlignment(attrs,StyleConstants.ALIGN_CENTER);
                 StyledDocument doc=(StyledDocument)edit.getDocument();
                 doc.insertString(0,"111\n2222222\n33333333333333",attrs);
                 doc.setParagraphAttributes(0,doc.getLength()-1,attrs,false);
             catch (Exception ex)
                 ex.printStackTrace();
             frame.setSize(300,300);
             frame.setLocationRelativeTo(null);
             frame.show();
        public static void main(String[] args) throws Exception
             new TextPaneCenter();
        class MyEditorKit extends StyledEditorKit
             public ViewFactory getViewFactory()
                  return new StyledViewFactory();
            static class StyledViewFactory implements ViewFactory
                 public View create(Element elem)
                      String kind = elem.getName();
                      if (kind != null)
                           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 CenteredBoxView(elem, View.Y_AXIS);
                           else if (kind.equals(StyleConstants.ComponentElementName))
                                return new ComponentView(elem);
                           else if (kind.equals(StyleConstants.IconElementName))
                                return new IconView(elem);
                 // default to text display
                 return new LabelView(elem);
            } // class StyledViewFactory
          } // class MyEditorKit
        class CenteredBoxView extends BoxView
             public CenteredBoxView(Element elem, int axis)
                  super(elem,axis);
             protected void layoutMajorAxis(int targetSpan, int axis, int[] offsets, int[] spans)
                  super.layoutMajorAxis(targetSpan,axis,offsets,spans);
                  int textBlockHeight = 0;
                  int offset = 0;
                  for (int i = 0; i < spans.length; i++)
                       textBlockHeight += spans[ i ];
                  offset = (targetSpan - textBlockHeight) / 2;
    //              offset = (targetSpan - textBlockHeight);
                  for (int i = 0; i < offsets.length; i++)
                       offsets[ i ] += offset;
         }

  • Chart scale error

    I am coding a logging system in labview 7.1
    On the front panel I have several charts. If I try to change the x-scale by typing new end of scale value while running - labview crashes (LV7.1 has encountered an error, please tell Microsoft...)
    If I change the x-scale when the program is not running - labview sometimes crashes.
    The graphs are indicators OWGraph, Wave Height, Temperatures, Flow and in the lower loop, pressure difference.
    The data comes from on demand aquiring from a pci6120 card which runs in one loop - the displaying is handled in another loop (on top in posted code image) except from one chart which needs quicker updates.
    Attachments:
    code1.gif ‏158 KB
    code2.gif ‏51 KB

    I found the sinner, it cant handle the offset. I use an offset of the number of seconds since 1904... to display the current time on the x-axis. If I plot two or more plots in the chart and use property node-> x-axis.offset it crashes every time I try to manually change the x-axis. I used most of the day figuring this out and the rest of the day to find a workaround. Since I dont use the date - I ended up calculating the smallest number of seconds to put into offset so that the time got right. Because if you wire a constant (any size) into the property node it is no problem - if you wire a time stamp converted to double - it crashes. When I use a probe on the value, it displays it in scientific mode (3,2 e+9) I wouldnt think this is any different than a constant written 3200000000 - but it is the only explanation I have right now - and I am not using one more second to find out - cause my workaround works...
    In the code attached - the timestamp is input to a chart with a single plot, that however causes no problems...
    Attachments:
    code3.gif ‏19 KB

  • How to display spectral lines in color band

    I want to display a line spectrum in color band format.  What I have are two arrays: wavelength and intensity. I can plot the graph like the bottom one and I want to convert it to the top color band. The considerations are:
    1. the color must agree with the wavelength.  For instant, the 650 nm corresponds to the red color and the 490 matches the blue
    2. the line intensity is indicated by the line width of the color line.  For instant, the 650 nm line is a strong one and its red line in the color band is the widest.   The 435 nm line is a weak one so it is barely see (but still visible) in the color band.
    I would like to know if labview has any built-in function to assist me with this job.  If not, any idea of implementing this?
    Thanks in advance for any suggesting.

    I am thinking of an alternative way to implement this, but not sure if LabView can handle:
    1. First, set a standard color spectrum as background:
    2. Then, make the spectral line image as 2D, and put it in front of the color spectrum with the wavelength aligned.  The picture below has the y-axis offset a bit to show my concept:
    For the 2D spectral line image, I have the max intensity set as white and the min set at black.  WHAT IF I can set the min as "opaque" and max as "100% transparent"?  Is it possible?
    I started my labview programming last year so sometime I may think labview can "fly".  If this concept is too crazy (a.k.a. impossible) , just let me know.  Thanks!

  • MultiColumn text in JEditorPane.

    I'd like to represent solution for the multi column text. It may be used in JEditorPane and JTextPane.
    Opinions?
    regards,
    Stas
    import javax.swing.*;
    import javax.swing.text.*;
    import view.*;
    public class Application extends JFrame {
        JEditorPane edit=new JEditorPane();
        public Application() {
            super("Multicolumn text example");
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            edit.setEditorKit(new MultiColumnEditorKit());
            this.getContentPane().add(new JScrollPane(edit));
            this.setSize(200,200);
        public static void main(String[] args) {
            Application application1 = new Application();
            application1.show();
    class MultiColumnEditorKit extends StyledEditorKit {
        ViewFactory defaultFactory=new MultiColumnFactory();
        public ViewFactory getViewFactory() {
            return defaultFactory;
    class MultiColumnFactory implements ViewFactory {
        public View create(Element elem) {
            String kind = elem.getName();
            if (kind != null) {
                if (kind.equals(AbstractDocument.ContentElementName)) {
                    return new LabelView(elem);
                } else if (kind.equals(AbstractDocument.ParagraphElementName)) {
                    return new MultiColumnParagraphView(elem);
                } else if (kind.equals(AbstractDocument.SectionElementName)) {
                    return new MultiColumnView(elem, View.Y_AXIS);
                } else if (kind.equals(StyleConstants.ComponentElementName)) {
                    return new ComponentView(elem);
                } else if (kind.equals(StyleConstants.IconElementName)) {
                    return new IconView(elem);
            // default to text display
            return new LabelView(elem);
    // root (section) view class
    import java.awt.*;
    import javax.swing.text.*;
    public class MultiColumnView extends BoxView {
        int columnWidth=100;
        int columnHeight=100;
        int majorTargetSpan=0;
        int[] majorOffsets=null;
        int[] majorSpans=null;
        int minorTargetSpan=0;
        int[] minorOffsets=null;
        int[] minorSpans=null;
        Point[] starts;
        int columnCount=1;
        public MultiColumnView(Element elem, int axis) {
            super(elem, axis);
        protected void layout(int width, int height) {
            columnHeight=height;
            super.layout(columnWidth,height);
        protected void layoutMajorAxis(int targetSpan, int axis, int[] offsets, int[] spans) {
            super.layoutMajorAxis(targetSpan,axis,offsets,spans);
            majorTargetSpan=targetSpan;
            majorOffsets=offsets;
            majorSpans=spans;
            performMultiColumnLayout();
            for (int i=0; i<offsets.length; i++) {
                spans=columnHeight;
    offsets[i]=0;
    protected void layoutMinorAxis(int targetSpan, int axis, int[] offsets, int[] spans) {
    super.layoutMinorAxis(targetSpan,axis,offsets,spans);
    minorTargetSpan=targetSpan;
    minorOffsets=offsets;
    minorSpans=spans;
    performMultiColumnLayout();
    for (int i=0; i<offsets.length; i++) {
    View v=getView(i);
    if (v instanceof MultiColumnParagraphView) {
    MultiColumnParagraphView par=(MultiColumnParagraphView)v;
    spans[i] = par.columnCount*columnWidth;
    offsets[i]=par.columnNumber*columnWidth;
    protected void performMultiColumnLayout() {
    if (majorOffsets==null || minorOffsets==null || minorOffsets.length!=majorOffsets.length) {
    return;
    int childCount=majorOffsets.length;
    int verticalStartOffset=0;
    int columnNumber=0;
    starts=new Point[childCount];
    for (int i=0; i<childCount; i++) {
    View v=getView(i);
    starts[i]=new Point();
    if (v instanceof MultiColumnParagraphView) {
    MultiColumnParagraphView par=(MultiColumnParagraphView)v;
    par.verticalStartOffset=verticalStartOffset;
    par.columnWidth=columnWidth;
    par.columnHeight=columnHeight;
    par.columnNumber=columnNumber;
    par.performMultiColumnLayout();
    starts[i].y=verticalStartOffset;
    starts[i].x=columnNumber*columnWidth;
    verticalStartOffset=columnHeight-par.restHeight;
    columnNumber+=par.columnCount-1;
    columnCount = columnNumber + 1;
    public float getPreferredSpan(int axis) {
    if (axis==View.Y_AXIS) {
    return columnHeight;
    else {
    return columnWidth*columnCount;
    public float getMinimumSpan(int axis) {
    if (axis==View.Y_AXIS) {
    return columnHeight;
    else {
    return columnWidth*columnCount;
    public float getMaximumSpan(int axis) {
    if (axis==View.Y_AXIS) {
    return columnHeight;
    else {
    return columnWidth*columnCount;
    public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) {
    //define child container
    if (starts!=null) {
    for (int i=starts.length-1; i>0; i--) {
    if ((starts[i].x<x && starts[i].y<y)
    || (starts[i].x+columnWidth<x)
    return getView(i).viewToModel(x,y,a,bias);
    return getView(0).viewToModel(x,y,a,bias);
    public void paint(Graphics g, Shape a) {
    super.paint(g,a);
    Rectangle r=a.getBounds();
    int shift=columnWidth;
    g.setColor(new Color(240,240,240));
    while (shift<r.width) {
    g.drawLine(r.x+shift,r.y,r.x+shift,r.y+r.height);
    shift+=columnWidth;
    //paragraph view class
    import java.awt.*;
    import javax.swing.text.*;
    public class MultiColumnParagraphView extends ParagraphView {
    protected int verticalStartOffset=0;
    protected int columnCount=1;
    protected int columnNumber=0;
    protected int restHeight=0;
    int[] majorOffsets=null;
    int[] majorSpans=null;
    int[] minorOffsets=null;
    int[] minorSpans=null;
    protected int columnWidth=100;
    protected int columnHeight=100;
    Point[] starts;
    public MultiColumnParagraphView(Element elem) {
    super(elem);
    protected void layout(int width, int height) {
    super.layout(columnWidth,0);
    protected void layoutMajorAxis(int targetSpan, int axis, int[] offsets, int[] spans) {
    super.layoutMajorAxis(targetSpan,axis,offsets,spans);
    majorOffsets=offsets;
    majorSpans=spans;
    performMultiColumnLayout();
    offsets=majorOffsets;
    protected void layoutMinorAxis(int targetSpan, int axis, int[] offsets, int[] spans) {
    super.layoutMinorAxis(targetSpan,axis,offsets,spans);
    minorOffsets=offsets;
    minorSpans=spans;
    performMultiColumnLayout();
    offsets=minorOffsets;
    protected void performMultiColumnLayout() {
    if (majorOffsets==null || minorOffsets==null || minorOffsets.length!=majorOffsets.length) {
    return;
    int childCount=majorOffsets.length;
    int vo=verticalStartOffset;
    int cc=1;
    starts=new Point[childCount];
    for (int i=0; i<childCount; i++) {
    starts[i]=new Point();
    if (vo+majorSpans[i]>columnHeight) {
    cc++;
    vo=0;
    starts[i].y=vo;
    starts[i].x=(columnNumber+cc-1)*columnWidth;
    majorOffsets[i]=vo;
    vo+=majorSpans[i];
    restHeight=columnHeight-vo;
    minorOffsets[i]=(cc-1)*columnWidth;
    if (columnCount!=cc) {
    columnCount = cc;
    preferenceChanged(getView(0),true,true);
    public float getPreferredSpan(int axis) {
    if (axis==View.Y_AXIS) {
    return columnHeight;
    else {
    return columnWidth*columnCount;
    public float getMinimumSpan(int axis) {
    if (axis==View.Y_AXIS) {
    return columnHeight;
    else {
    return columnWidth*columnCount;
    public float getMaximumSpan(int axis) {
    if (axis==View.Y_AXIS) {
    return columnHeight;
    else {
    return columnWidth*columnCount;
    public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) {
    int ind=getViewIndexAtPoint((int)x,(int)y,a.getBounds());
    View v=getViewAtPoint((int)x,(int)y,a.getBounds());
    Shape childAlloc=getChildAllocation(ind,a);
    return v.viewToModel(x,y,childAlloc,bias);
    protected int getViewIndexAtPoint(int x, int y, Rectangle alloc) {
    if (starts!=null) {
    for (int i=starts.length-1; i>0; i--) {
    if ((starts[i].x<x && starts[i].y<y)
    || (starts[i].x+columnWidth<x)){
    return i;
    return 0;
    protected View getViewAtPoint(int x, int y, Rectangle alloc) {
    if (starts!=null) {
    for (int i=starts.length-1; i>0; i--) {
    if ((starts[i].x<x && starts[i].y<y)
    || (starts[i].x+columnWidth<x)){
    return getView(i);
    return getView(0);
    public Shape getChildAllocation(int index, Shape a) {
    Rectangle r=super.getChildAllocation(index,a).getBounds();
    r.x=starts[index].x+3;
    r.y=starts[index].y+3;
    return r;

    If you want to replace the existing text then just use:
    setText(DAT);

  • Difference in using the same component made in mxml or action-script

    Hi,
    I made a sample project to show a kind of bug in the SuperTabNavigator component of FlexLib
    In this sample you can see that using the same component (made in both mxml or action-script) can make a difference
    I'm just wondering why ?
    Thanks
    Here is what i've posted :
    What steps will reproduce the problem?
    1. Create a button to dynamically add new tab with icon on a SuperTabNavigator
    2. Click on this button to add new tabs
    What is the expected output?
    - The expected output is tabs added without abnormal behavior
    What do you see instead?
    - Every time a new tab is created the one who had the focus has its content
    (icon + label) moving from the top-left of the tab to its original position
    Please provide any additional information below.
    Configuration:
    - Flex Builder 3 in Eclipse
    - FlexLib 2.3
    Sample:
    (see attached file)
    There is two type of tab, one in action-script and one in mxml
    They both are equal
    - Adding a new action-script tab to SuperTabNavigator works fine
    - Adding the same tab but an mxml one doesn't
    - Adding a new action-script or mxml tab to TabNavigator works fine
    -> meanings that the issue comes with SuperTabNavigator
    - Adding a new mxml tab to both SuperTabNavigator and TabNavigator at the
    same time makes TabNavigator to get the same bad behavior
    Remarks:
    - Tried everything but i'm really stuck
    - Weirdly, removing the PopUpButton correct the issue
    - In the same way if you keep adding action-script tab it automatically scroll to the
    last tab. And if you do the same with mxml tab then it add the tab at the end and
    scroll to the first one.
    => what could be the difference between using action-script or mxml object ?

    Here is one possible solution:
    You can use the ExternalInterface (
    http://livedocs.macromedia.com/flex/2/langref/flash/external/ExternalInterface.html)
    class to communicate with JavaScript. JavaScript can then popup the
    media player very easily like this:
    http://www.webreference.com/programming/javascript/jf/column5/index.html
    The documentation on the ExternalInterface class has a nice
    example (in the bottom of the page) on how to communicate with
    JavaScript in a browser. Hope this helps,
    -george

  • Numbers '09 :  How do I split a label in a graph

    How do I split a label in a graph into 2 lines of text. Right now, in the inspector, Axis tab, Category Axis Y, the label is "Asset Value" and shows on 1 line, I want it on 2 lines but there is nothing I can do.
    Is there some sort of code within the label that I have to put?
    Thanks!

    Is this what you want ?
    If it's that, just insert a line break in the header thru option + return.
    Yvan KOENIG (VALLAURIS, France) vendredi 21 janvier 2011 21:02:48

Maybe you are looking for

  • Satellite U300 & Windows XP Pro SP2

    Hi, I've installed Windows XP Pro SP2 on U300, I've downloaded all drivers and utilities, everything works fine but I have one device in the Device Manager with Yellow Bang (!) and it's: "PCI Memory Controller". Where can I get the driver fir it? Tha

  • SC-PO-Confirmation

    Dear Expert, Anyone know how to link SC-PO-Confirmation using table?? Thanks and Regards, Yusup

  • Datatype mapping problem

    Hi I've have a table with column with int4[] as data type. I have a problem with setting the type of corresponding entity bean field. I still have a message about not proper datatypes - byte array instead of integer[]. To be precise, message is: java

  • TS3694 I have unknown error (-42110). What does this mean and what can I do about it?

    Everytime when I start iTunes I get the message about an unknown error -42110. It has probably to do something with importing music, because I add some new music, but can't find it in my library. When I search I found it, but can't play it or click o

  • Problem with color management

    I try to print from the print module using custom profiles. When I select the corresponding profile for the print and proceed I should be able to disable colormanagement from the print dialog. Problem is that when custom profile is selected in Lightr