String display in  a component.

Hai,
I need to help to display a string in a component.
eg: I need to display "Year" in JLabel like
Y
E
A
R
How can i do this...? Can anyone help me...
Regards,
Ciya.

1) Use html for the label text and break at every character
2) Use a JTextArea that does character wrapping
3) Create a panel with a GridLayout and add 4 labels with a single character each.
4) Search the forum. Maybe keywords like "vertical text" will find other suggestions.

Similar Messages

  • Is it possible to use the value of a string to reference a component in the

    I'm fairly new to Java so this may be a stupid question!
    Is it possible to use the value of a string to reference a component in the code? For example in the code below, Wall is a class holding 3 different arrays. The Robot class has an array called finishBricks. When the buildWall method is run it receives the integers width and height which are used to construct the dimensions string. I want to use this string to then load the appropriate Wall array into the finishBricks array.
    I hope this makes sense! Any help would be greatly appreciated!
    class Robot {
    public double[][] finishBricks;
    public void buildWall(int width, int height) {
    Wall w = new Wall();
    String dimensions = "Wall" width "x" +height;
    this.finishBricks = w.xxxx; // where xxxx is replaced by whatever the String dimensions is
    class Wall {
         public double[][] Wall4x2 = {
              {-30.00,-01.60,27.45},
              {-30.00,-06.75,27.45},
              {-30.00,-13.55,27.45},
              {-30.00,-20.35,27.45},
              {-30.00,-22.00,28.65},
              {-30.00,-16.85,28.65},
              {-30.00,-10.05,28.65},
              {-30.00,-03.25,28.65}
         public double[][] Wall3x3 = {
              {-30.00,-01.60,27.45},
              {-30.00,-06.75,27.45},
              {-30.00,-13.55,27.45},
              {-30.00,-15.20,28.65},
              {-30.00,-10.05,28.65},
              {-30.00,-03.25,28.65},
              {-30.00,-01.60,29.85},
              {-30.00,-06.75,29.85},
              {-30.00,-13.55,29.85},
         public double[][] Wall2x4 = {
              {-30.00,-01.60,27.45},
              {-30.00,-06.75,27.45},
              {-30.00,-08.40,28.65},
              {-30.00,-03.25,28.65},
              {-30.00,-01.60,29.85},
              {-30.00,-06.75,29.85},
              {-30.00,-08.40,31.05},
              {-30.00,-03.25,31.05},

    Map walls = new HashMap ();
    walls.put ("2x2", new double[][] {
        new double[] {
            1,
            0
        new double[] {
            0,
            1
    double[][] wall = (double[][]) walls.get ("2x2");

  • Display of inclined component using swings

    I have a requirement to display components using swings.
    Now I am using Gridbaglayout manager to display a rectangle component.
    If the component is circle or slightly inclined rectangle where I have given inclined angle (say x degree) and orientation(+/-), how will I display the components?
    For this case, I need a way where I can splitup the tilted object into parts and drag some other components(say JTextField) on to it.
    Using AffineTransform class where the dragging of components over the tilted is not possible.
    Is there any other way to make both tilting and drag of components on to it?

    Multi-post: http://forum.java.sun.com/thread.jspa?threadID=5140630

  • You are not authorized to display the case component, when using copy

    I copied the standard UDM_SPS_CASE_RECORD and created a Z version with no changes, in addition also copied the standard Case Record model with no changes. I have entered my new case record model into my new element and tied both the to case type. When trying to create a case get a message "You are not authorized to display the case component"
    SU53 looks good, and BASIS did a Trace and did not see anything.
    When I change the configuration back to use the standard no issues and case is created. Anybody know what the issue might be?
    Thanks

    dear friend,
    when you get this error on screen type /NSU53 , hit Enter and get a new screenshot
    if you see the message ""The last  authorization check was successful" that means nothing to do with Basis team, it could be a custom message - talk to abaper ;
    but if you see some objects there (Authorization check failed) - please pass to security or basis guys
    ask / try another user which hasn'rt such error and comare the roles you and he/she has - try to find out the difference
    good luck!

  • JPanel won't display my custome component

    Hi,
    I made a custome component class that in its paint method at this stage is suppose to paint a white rectangle on screen. However the when I add this custome component to my JPanel it doesn't show up. Does anybody have a solution for this?
    My code for the custome component is,
    public spaceMediaDisplayObject(mediaObject mo){
         x = mo.getSpaceX();
         y = mo.getSpaceY();
         height = mo.getHeight();
         width = mo.getWidth();
         name = mo.getName();
         System.out.println("Constructor");
         this.repaint();
    public void paint(Graphics g){
         System.out.println("Draw");
         g.setColor(Color.white);
         g.drawRect(x, y, height, width);
    And the fragment of code I am using to try and display in on the panel is as follows,
    spaceMediaDisplayObject smdo = new spaceMediaDisplayObject(toDisplay);
         spaceBodyPanel.add(smdo);
    Please help if able.

    If it's null then you need to set the size of each component explicitly:
    JPanel panel = new JPanel(null);
    Component customComponent = new CustomComponent();
    panel.add(customComponent);
    customComponent.setBounds(0, 0, 100, 100); // For exampleA simple layout manager could be used to make the component fill the panel, for example:
    JPanel panel = new JPanel(new GridLayout(1, 1));
    panel.add(new CustomComponent());Hope this helps.

  • In report layout, can format a long string display as Column mode?

    Hi,
    Just want to check in report builder any way can format a long string into a column mode?
    Example: I have a field to hold 8000 character, and would like to print
    30 character in each line, when reach 50 line, then print in column i/o to print next page?
    Any idea ? Thanks a lot if you can share your experience with me.
    best Regards,
    Klnghau

    hi let say your field name is x
    then if your want it word wrap then it's simple just get one field and make it's vertical
    elasticity variable. and asign the field to it..
    but if you want your field to be displayed as
    first colunm and then beside continuation of that column but in 2nd one...
    then create 2 formula columns make your field legth been distributed half in each.
    so cf_1 is:
    decalre
    t varchar2(1510);
    begin
    if length(:x) > 1500
    t := substr(x, 1, 1500); -- as 30 x 50 = 1500
    else
    t := :x;
    end if;
    return t;
    so cf_2 is:
    decalre
    t varchar2(1510);
    begin
    if length(:x) > 1500
    t := substr(x, 1500, length(:x)-1500); -- as 30 x 50 = 1500
    else
    t := '';
    end if;
    return t;
    and then in design view
    field1 field2
    for field1 source is cf_1 and
    for field2 source is cf_2
    that's all
    Enjoy Oracle...

  • Trying to display a visual component.

    I am using a JSP to run the application. And I used some freeware code to generate a panel component that I want to display on the JSP, yet I have no idea what I need to do, for I am very new to using the visual capabilities of Java. Thank you.

    I am using a JSP to run the application. And I used
    some freeware code to generate a panel component that
    I want to display on the JSPWhat exactly is your "panel component"? Is it a Java object (JPanel or similar?).
    JSPs are used to generate web pages (typically by writing HTML or XML on the fly) Once they are written, there is nothing "special" about these pages - they are just HTML pages displayed by a regular ol' browser (or they could be WAP etc, but let's keep it simple ;-)
    - so basically you can't directly display a java panel component with a JSP. If, on the other hand, your freeware generates HTML code which would show some kind of "panel component" in a browser window, then you're good to go!

  • String Display Format Specifiers?

    I am aware that numerics have display format specifiers (as shown in picture), but I'm wondering if there's a similar function for getting the display formats of strings?
    I have shown what I want the output to be (although that output was clearly not generated by the code!). So, can I replace the ???'s with some valid format specifiers? 
    a.lia-user-name-link[href="/t5/user/viewprofilepage/user-id/88938"] {color: black;} a.lia-user-name-link[href="/t5/user/viewprofilepage/user-id/88938"]:after {content: '';} .jrd-sig {height: 80px; overflow: visible;} .jrd-sig-deploy {float:left; opacity:0.2;} .jrd-sig-img {float:right; opacity:0.2;} .jrd-sig-img:hover {opacity:0.8;} .jrd-sig-deploy:hover {opacity:0.8;}

    Thanks for the reply! Well, yes, I'm aware of one "bad" way this can be accomplished, by using the "Text.Text" property of some dummy string indicators:
    Instead, I'm wanting some cleaner syntax. Needing to introduce a dummy indicator just to hijack a property of that object is a bit messy.
    Looking at my example, one might argue "Well you only need one dummy string in a For Loop of 4 iterations, setting the Display Style from 0-3. That way you don't need four dummies." Right, but the principle remains... I'm interested in a Format Specifier (or potentially a VI hidden in vi.lib?) that eliminates the need for a dummy indicator.
    a.lia-user-name-link[href="/t5/user/viewprofilepage/user-id/88938"] {color: black;} a.lia-user-name-link[href="/t5/user/viewprofilepage/user-id/88938"]:after {content: '';} .jrd-sig {height: 80px; overflow: visible;} .jrd-sig-deploy {float:left; opacity:0.2;} .jrd-sig-img {float:right; opacity:0.2;} .jrd-sig-img:hover {opacity:0.8;} .jrd-sig-deploy:hover {opacity:0.8;}

  • String Display Format

    Hai Friends
    In my program i have a String like this 1997-12-25
    I Just want to display this string is like 19971225
    In my program for i have to use it as String not as Date.
    I just want to exclude "-" from my string
    please tell me how can i display like 19971225
    Thanks in advance
    Yours
    Rajesh

    Hi rajeshkumar77!
    String class don't have "delete" method so you must to build a new string resulting from concatenation of tokens, here the numbers.
    eg:
    String source = "1997-12-25";
    int first = source.indexOf('-');
    int last = source.lastIndexOf('-');
    String result = source.substring(0, first) + source.substring(first+1, last) + source.substring(last);
    Note: don't try using replace method, ie: source.replace('-','').
    Best Regards and Success.

  • Retain data in String Display untill new data is delivered in RS-232

    I am using Labview 8.6 on Windows XP OS and acquiring signal from RS-232 through COM1 port to which I have connected non NI instrument. My instrument sends data for flash of second and it displayed into String Indicator for flash of second. How to hold this data untill I get new data from instrument. I have tried to select "re-initialise to default value" and "make current value default" but none of them getting selected. I want data to be retained untill new data comes. I have enclosed VI as well as Picture file. Pl advice. 
    Attachments:
    HPLC Flow Meter 3.vi ‏32 KB
    HPLC FLow 3.JPG ‏123 KB

    -Looks you are sending or running the while loop every 5ms, are you sure you want this fast? This is the reason the data comes in flash(i think 5ms)
    -I use shift register to store something from previous iterations generally.
    -You need to keep case structure to check when new data comes and when it does, replace the value in that string.
    -else pass previous value to string.
    Thanks
    uday,
    Please Mark the solution as accepted if your problem is solved and help author by clicking on kudoes
    Certified LabVIEW Associate Developer (CLAD) Using LV13

  • String Display using DraxText

    Hi,
    I have one problem in displaying text in Canvas using DrawText function.
    My couple of strings are larger then 2 to 3 lines. And in DrawText '\n' is not supported.
    Is there any way or any function in which i just put my string and it will dispaly in well manner if it is two long.
    Means it will atomatically create a new line for the string when ever it finds that string is big enough to come in to emulator display.
    Thanks in advance

    Here is the sample code for text drawing on a Canvas, It will be great if you guys can share your code.
    String formattedStrings[] = wrapString(txt, font, width);
    if (formattedStrings != null) {
         g.setFont(font);
         for (int i = 0; i < formattedStrings.length; i++) {
              g.drawString(formattedStrings, cursorX, cursorY + height, Graphics.TOP     | Graphics.LEFT);
              height += font.getHeight();
         * Format a given text acording to the font and width of the screen
         * @param txt
         * @param font
         * @param width
         * @return the formatted sets of string
         public String[] wrapString(String txt, Font font, int width) {
              String formattedStrings[] = null;
              if (txt != null && txt.length() > 0) {
                   Vector strings = new Vector(2);
                   int start = 0;
                   int pos = 0;
                   while ((pos = nextWrapPosition(txt, font, width, pos)) != -1) {
                        // the next() method returns -1 when the text is finished
                        strings.addElement(txt.substring(start, pos));
                        start = pos; // set to start of next line
                   formattedStrings = new String[strings.size()];
                   for (int i = 0; i < strings.size(); i++) {
                        formattedStrings[i] = (String) strings.elementAt(i);
              return formattedStrings;
         * Get the next wrapping position to substring the text
         * @param txt
         * @param font
         * @param width
         * @param pos
         * @return the position of the next substring
         private int nextWrapPosition(String txt, Font font, int width, int pos) {
              int i = pos;
              int len = txt.length();
              if (pos >= len)
                   return -1;
              int start = pos;
              while (true) {
                   while (i < len && txt.charAt(i) > ' ')
                        i++;
                   int w = font.stringWidth(txt.substring(start, i));
                   if (pos == start) {
                        if (w > width) {
                             while (font.stringWidth(txt.substring(start, --i)) > width) {
                             pos = i;
                             break;
                   if (w <= width)
                        pos = i;
                   if (w > width || i >= len || txt.charAt(i) == '\n')
                        break;
                   i++;
              return pos >= len ? pos : ++pos;

  • Normal string display to Hex string display

    Hi all
    i like to convert a normal strijng display which contains alphanumeric strings to hex format
    String length will be of 25 characters which will be read through bar code reader
    Could someone help me in solving this
    Thanks
    Bala

    Hi smercurio_fc
    Thanks for the vi. i tried the method which you have sent me.
    So i cant transfer 'S' through serial port?
    Is there any other way to transmit this through Serial port.
    Also i need another clarification
    A sub vi is running inside my main vi and i need to stop/pause the sub vi from the main vi front panel. how could i can stop the sub vi?
    Thanks and regards
    Bala

  • Changing hex string display format

    When a string control is in hex display format any data typed is displayed in groups of 2 bytes like AABB CCDD.
    Is there any way to display them in separate group of single bytes like AA BB CC DD?

    Try keeping the discussion in the original thread.

  • Problem during string display.

    Hello Experts,
    I have one application which accepts long text(text editor control) and save it to the Ztable by dividing into char255. It stores into Ztable in the form of stream, as the control have that method to read & write long text as stream.
    Now for reporting purpose. When I want to display the data it displays '##' wherever  'ENTER' or 'NEW-LINE' has been written.
    I wanted to replace that ## with new line.
    I tried using
    REPLACE ALL OCCURANCES OF '##' IN p_str WITH cl_abap_char_utilities=>newline.
    but its not working for me.
    Please suggest how to replace this ## with newline character in string. Or is there any FM available to convert stream to string directly?
    << Removed >>
    I appriciate your time and Thanks in advance.
    Regards,
    bh_hir
    Edited by: Rob Burbank on Oct 1, 2010 1:32 PM

    Hi Maen / Raul,
    the hex value for ## is : 0D0A in my string!
    I have tried using
    REPLACE ALL OCCURRENCES OF REGEX '\Q#\E' in p_line
                                    WITH cl_abap_char_utilities=>newline
    but its not working for me! am I doing anything wrong here? Plz suggest..
    Example:  
    This is Descr text   .##hello 1234##this is tesing##
    I want this string to be displayed as below.
    This is Descr text   .
    hello 1234
    this is tesing
    Thanks & Regards,
    bh_hir
    Edited by: bh_hir on Oct 4, 2010 3:42 PM

  • Table Sorter for String displaying Numbers

    Hi All.
    I have a table whose one of the columns display numbers with data type string. This is becuase :
    1. RFC gives me as String.
    2. I have to display blank in case no value or zero is present (since int, long etc default to Zero, hence  
        not used).
    I have to sort this column as a number.Since the datatype is string, it sorts the numbers as string
    for example : if we have  values like : 2, 4, 3, 10, 19, 15, 20, 22
    currently as String it sorts as follows : 10, 15, 19, 2, 20, 22, 3, 4.
    but i want as follows : 2, 3, 4, 10, 15, 19, 20, 22.
    Useful answers will appreciated.
    Thanks and regards,
    Aditya Deshpande.

    In order to sort the node with attribute of type string; please use the following code..
    Here use the node where you store the string value..
    wdContext.nodeTest().sortElements(
                new Comparator() {
                   public int compare(Object o1, Object o2) {
                        // TODO Auto-generated method stub
                   IPrivateExperimentView.ITestElement ele1 = (IPrivateExperimentView.ITestElement)o1;
                   IPrivateExperimentView.ITestElement ele2 = (IPrivateExperimentView.ITestElement)o2;
                        return Integer.parseInt( ele1.getNumStr()) > Integer.parseInt( ele2.getNumStr()) ? 1 : -1;
    input :  "2", "4", "3", "10", "19", "15", "20", "22"
    result : "2", "3", "4", "10", "15", "19", "20", "22"
    vinod

Maybe you are looking for

  • How do I use itunes from an external HDD on a new laptop?

    This really does seem to be an unanswerable question but you guys have helped so many times in the past without me ever having to post. Here is my set up when I first got iTunes way back I had it on my first laptop, we'll call this PC A, but the Hard

  • Spliting a table in to two table based on the groups in SSRS

    Hi, I am trying to a split a rows accross two tables based on a group. So far I have added a list and added a row group and grouped it using lineof business Inside my list i have two identical tables so i can display the data for the first table i ha

  • Oracle 8.1.7 and Linux 6.2

    Hi Please help us in solving the below mentioned problem. We are trying to install Oracle 8.1.7 under Linux 6.2 . During the installation the following error displays and could not able to finish the instllation. The problem is Error in invoking targ

  • Error for File to Netezza transfer

    Hi, Iam doing file to netezza table transfer. Iam getting the following error while load to staging area step. org.apache.bsf.BSFException: exception from Jython: Traceback (innermost last): File "<string>", line 1, in ? File "<string>", line 172, in

  • 2 iSights

    Hello, i have a macbook with built in iSight and i own an external iSight. My question is can i plug in my external iSight and use that one instead of the built in one?