Text Positioning in Text Field

I have a 3 inch x 7 inch text field set to "Allow Multiple Lines" however, when I "Preview PDF", any text that is entered starts in the middle of the text field and moves up one line at a time as the text wraps.  How do I get the cursor to start at the top left corner of the field instead of the middle?
Thanks in advance for the help!

Right click on the field -> choose pallets -> click Paragraph. There you will find the text alignment controls.
or
Window menu -> Paragraph
Nith

Similar Messages

  • Unable to define Radio Button Text field & unable to change column position

    Hi,
    While designing a screen in Screen Painter, I am unable to define Radio Button Text field as this option is not there in Graphical Element. And also I want to specify the starting position of column of that element different from the default value, but I am unable to define that because the field is non-editable.
    Can any one please help me out.
    Regards,
    Koushik

    Hi,
    Please find below the sample program from ABAP docu :
    PROGRAM demo_dynpro_input_output.
    DATA: input  TYPE i,
          output TYPE i,
          radio1(1) TYPE c, radio2(1) TYPE c, radio3(1) TYPE c,
          box1(1) TYPE c, box2(1) TYPE c, box3(1) TYPE c, exit(1) TYPE c.
    CALL SCREEN 100.
    MODULE init_screen_100 output.
      CLEAR input.
      radio1 = 'X'.
      CLEAR: radio2, radio3.
    ENDMODULE.
    MODULE user_command_0100 input.
      output = input.
      box1 = radio1.
      box2 = radio2.
      box3 = radio3.
      IF exit NE space.
        LEAVE PROGRAM.
      ENDIF.
    ENDMODULE.
    Here radio1(1) TYPE c is defined within the program but in the element list there are RADIO1 element exist. One is actual radio button and the other is Radio Button Text.
    I am not able to create that radio button text using same object name.
    Please suggest.
    Regards,
    Koushik

  • Position cursor in text field when form is opened

    Another newbee question I'm afraid!
    I want to position the cursor in a text field when a user opens the form. I can't find a way to do it but I'm pretty sure it's straightforward!
    Also, can I remove fields from the tab order?
    Thanks (for your help and patience!)

    Hi,
    You would select the object that you want to receive focus and put the following in the docReady event.
    xfa.host.setFocus("this");
    The docReady event is a good one to use, because it only fires once.
    The tab order can be set in the Tab Order tab. Depending on the version of LC Designer that you have, the flexibility will vary. However I would do this as a last step, as any changes can throw the tab order out of sequence.
    Note that tab order is greatly affected by the relevant x/y coordinates of objects and where objects are in separate subforms.
    Hope this helps,
    Niall

  • Change the position of the text field in the report region

    Hi,
    I am having a report region in whch there are 2 buttons which are in the Region Template position #Create# and a
    text field. I added a text field in the same region. I tried to change the position of the text field near the buttons. I
    tried to change "label-Horizontal/vertical alignment" and "Element horizontal vertical alignment". But the postion of the
    text field is not changing. Plz help,
    Thanks,
    TJ

    Hi Andy,
    Sorry to ask this questions.
    1.Where exactly i need to change the HTML code(By uisng the view source?)
    2.My taskname part html code when viewing the source is given below
    tabindex="999"><img src="/i/e.gif" alt="Edit" class="eLink" />
    </a><tr></td><td nowrap align="left">
    <label for="P1_TASK_NAME" tabindex="999">
    <a class="t16OptionalLabelwithHelp" href="javascript:popupFieldHelp('5853137628393530415','676839962625525')"
    tabindex="999">Task Name</a></label></td>
    <td  colspan="1" rowspan="1" align="left" valign="top"><input type="hidden" name="p_arg_names"
    value="5853137628393530415" /><input type="text" name="p_t06" size="10" maxlength="20" value=""
    id="P1_TASK_NAME"  /><a class="eLink" title="Edit" href="javascript:popupURL('f?
    p=4000:371:676839962625525::::P371_ID,FB_FLOW_ID,FB_FLOW_PAGE_ID:5853137628393530415,107,1');" 
    tabindex="999"><img src="/i/e.gif" alt="Edit" class="eLink" /></a></td></table>
    <table summary="" cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td align="right"><table
    cellpadding="0" cellspacing="0" border="0" summary="" class="t16Button">please suggest what changes i need in this code to change the alignment of the task_name text field,
    Thanks,
    TJ

  • Positioning cursor in editable text-field

    It is almost impossible to position the cursor in a text-field. Even though I have very thin finger it takes me more than two tries to position the cursor. Would be nice if on a future PlayBook-update the behaviour of text-selection and cursor-positioning would be improved. Works much better on Android-devices (okey, they often have a scrollball) and iPhone.
    Check out my apps in the BlackBerry World
    Visit my developer blogs /dev/alopix and /home/alopix
    BBM Channel: C0047B612

    i dont have that issue with my fat fingers anymore with some practice. are you lightly touching or mashing while you select? i found mashing to make it less accurate. remember it is the first part that touches that makes the selection and not the top of your finger or thumb.
    Click here to Backup the data on your BlackBerry Device! It's important, and FREE!
    Click "Accept as Solution" if your problem is solved. To give thanks, click thumbs up
    Click to search the Knowledge Base at BTSC and click to Read The Fabulous Manuals
    BESAdmin's, please make a signature with your BES environment info.
    SIM Free BlackBerry Unlocking FAQ
    Follow me on Twitter @knottyrope
    Want to thank me? Buy my KnottyRope App here
    BES 12 and BES 5.0.4 with Exchange 2010 and SQL 2012 Hyper V

  • Is there a way to get the cursor position index of html text field

    I'm trying to work on a text pad like MC with "insert text at
    position X" and "find and replace" can anyone tell me how to find
    the cursor index of an html text field. Selection.getBeginIndex() ,
    Selection.getEndIndex(), Selection.getCaretIndex() as far as I know
    these methods only work with text and not htmltext.
    What I'm trying to do is assign different parts of the string
    to variables so that I can combine them to reconstitute my html
    string.

    enfantterrible:
    If I understand correctly, you want the corresponding
    position in the
    htmlText propery of the caret index (which as you point out
    is only the
    position in the plain text version of the textfield content).
    Below is how I would do it. Maybe there's an easier or more
    efficient
    way (using XML objects etc), but I don't know it. You could
    conduct all
    your string searches in the plain text and then convert the
    result to
    the html positions. I didn't build this to accept negative
    parameters
    for the pos parameter (e.g. from end of string backwards) but
    the
    function could be adapted to do this too if necessary. The
    test data is
    not proper html from a text field, but it doesn't really
    matter what it
    is so long as its formatted correctly. It just separates the
    tags from
    the content to enable apples with apples comparison.
    //some test data
    var testStringXML = "<format>Hel<b>lo i can't
    t<i>ell you h</i>ow hap</b>py I
    am.</format>";
    var undecoratedString = "Hello i can't tell you how happy I
    am.";
    //the conversion function
    function findDecoratedPosition(pos:Number, xmlString:String,
    test:Boolean):Number {
    //anything between '<' and '>' should be excluded from
    plain text search.
    //create an array of array elements (n=2) consisting of tag
    then plain text
    //requires correctly formatted xml/html
    var tempArr:Array = xmlString.split("<");
    for (var aa = 0; aa<tempArr.length; aa++) {
    tempArr[aa] = tempArr[aa].split(">");
    //remove the first and last elements of the new array (these
    are empty)
    tempArr.pop();
    tempArr.shift();
    //find the corresponding plaintext location and calculate
    the "decorated" position
    var retPos:Number = 0;
    var posCount:Number = 0;
    for (var aa = 0; aa<tempArr.length; aa++) {
    retPos += tempArr[aa][0].length+2+tempArr[aa][1].length;
    //+2 allows for missing < and >
    posCount += tempArr[aa][1].length;
    if (posCount>pos) {
    return (retPos+(pos-posCount));
    //out of range
    return -1;
    //test code:
    for (var aa = 0; aa<undecoratedString.length; aa++) {
    var altPos = findDecoratedPosition(aa, testStringXML);
    trace(undecoratedString.charAt(aa)+" in position "+aa+"
    plainText equates to position "+altPos+" in the decorated version
    ["+testStringXML.charAt(altPos)+"]");
    }

  • Changing text  field (need more positions) of variant ZUK01 in FF67

    I am using a variant called ZUK01 in FF67. In that variant I have a Line item text field, but with not enough positions.
    Is it possible to change the field properties so I can change the positions of the field?
    I want to use the variant but need to feel in more text then I have positions.
    Is it possible to change it? So yes where can I find it?

    Hi,
    You could go to OT43 tcode (screen variant maintenance for manual bank statement); double click on your variant and note down your Field name (for text); then click on "Technical names" and note down the table and field for that field name. Then, from SE11; you can find out how many characters that field (data element) allows. Then, you can talk to ABAP team member for the possibilities: to enhance that data element or use another field for your purpose.
    Mani

  • Position of the label in a text field

    Hi,
    By default when utilising a text field, the label appears on the laft hand side of the input area.
    Is there any way that the positioning of the label & input can be reconfigured? I'm wanting the label to appear above the input on each field.
    E.G.
    *Label*
    *Input Area*
    Could leave the label blank and create a separate static text object for each field, but would prefer to use a simpler approach if possible!
    Thanks.

    All you need to to it to set the desired position for the field caption in the Layout palette.

  • Text field highlight problem after caret position is set

    Hi,
    What I am trying to do is: set caret position and then highlight the text after it. The problem is: if I set caret position first, and highlight the rest of the text, the caret position is then set at the end of the entire text; if I highlight text first, and set caret position, then the text is not highlighted.
    I am wondering how I can achieve this. Thanks.
    The simple test program is below:
    import java.awt.FlowLayout;
    import javax.swing.JFrame;
    import javax.swing.JTextField;
    public class TestTextFieldHighlight {
         public static void main(String[] args) {
             JFrame f = new JFrame("Text Field Examples");
             f.getContentPane().setLayout(new FlowLayout());
             JTextField tf = new JTextField("SampleTextField", 20);
             tf.setEditable(true);
             f.getContentPane().add(tf);
             tf.setCaretPosition( 5 );
            tf.setSelectionStart( 6 );
            tf.setSelectionEnd( tf.getText().length() );
            //tf.setCaretPosition( 5 );
             f.pack();
             f.setVisible(true);
    }

          //tf.setCaretPosition( 5 );
          tf.setCaretPosition( tf.getDocument().getLength() );
          tf.moveCaretPosition(6);
          //tf.setSelectionStart( 6 );
          //tf.setSelectionEnd( tf.getText().length() );

  • WHy is the cursor jumping to wrong position (mainly back to position 1 in the text field) as I try to post comments to peoples posts on Facebook?

    I love FIrefox browser and prefer to use it on all my devices, PC, Smart Tv, Phone, Tablet etc. In recent times Iv'e had problems though, everytime I try to comment on a facebook post with each key stroke the cursor jumps back to the beginning of the text field and by the time I finish typing I look up and find jibberish, yesterday I upgraded this RKM Mk902 Android device that I am typing on now unfortunately using Chrome from Anroid 4.2.2 to android 4.4.2 Kit-Kat and thought I would no longer have that problem but the issue is still there. I also have discovered I'm having similar problems with FireFox on my Cube U39GT tablet. As I spend more time on Facebook than any other website I have to find a solution. I thought it may of been one of the addons that i use causing the problems such as Phony but I still get the issue without the addons and after a clean install. Please help me sort out this problem so I can once more use FireFox on my Android devices.

    I found this, it seems that there are a few issues in Android as well with the wrong placement for the cursor when you type: [https://github.com/RobinHerbots/jquery.inputmask/issues/465] but since it is only happening in facebook, this is odd.
    What this means is that they are working on fixing specific issues like this and I am not sure when this will be fixed.
    Does this happen with both keyboards that are offered in the Android Settings?

  • Changing the cursor position in an input text field and Removing leading numeric zeros

    Flash8 - AS2
    It's good to be back after all these years and thanks for the faithfull folks like kglad, Ned Murphy, Rothrock and all the others who give so much of themselves to make this forum a success!
    My Problem:
    I have an input text field that is named in the properties box as 'numberOfKids'.
    When the program is executed, and a delete or backspace is pressed the input textfield goes blank
    and any calculations that use 'numberOfKids' shows NaN.
    I have trapped the NaN and undefined so that a numeric 0 shows up instead of a blank.
    There are two problems:
    First problem:
      The cursor is to the left of the zero, so the first number inputted by the user is 10x larger than what they want.  0 becomes 10.
    Question:  How do I get the cursor to move to the right of the 0?
    Second Problem: 
      When I manually move the cursor to the right of the 0 and input a number, say 4, it shows up as 04.
    Question 2:  How do I delete the leading numeric zero in the input textfield?
    Thanks for the help.
    Here's the code I am using:
    calculateChildWeight = function () {
    if (isNaN(numberOfKids)) {
      numberOfKids = 0;
    if ((numberOfKids) == undefined) {
      numberOfKids = 0;
    if (numberOfKids>=0 && numberOfKids<=137) {
      numberOfKids = numberOfKids;
    } else {
      numberOfKids = 0;
    if (isNaN(adjustedChildWeight)) {
      adjustedChildWeight = 0;
    if ((adjustedChildWeight)=undefined) {
      adjustedChildWeight = 0;
    adjustedChildWeight = Number(numberOfKids*(-100));
    //numberOfKids.setSelection(numberOfKids.length, numberOfKids.length);
    //if (numberOfKids.length=2 && numberOfKids<10) {
      // remove the first character or leading zero
    //  numberOfKids = numberOfKids;

    Thanks Rothrock for being so  patient.
    I'm lost!
    I go back to a brand new flash file to try and implement the textfields as a stand alone test document.  I have lost the concept I think.
    I created on the stage of a blank .fla file  4 text fields, 2 input and 2 dynamic.  I gave them an instance name in the properties box.  I use this instance name.text to find the value of the field.  I use the parseInt to put that value into a numeric variable for calculation.  The results are put to the appropriate textfield.
    All seems to work except one of my input text fields.   I use the value of this field  to calculate:
    revisedValue = parseInt(numberOfKids.text);
    revisedValue = revisedValue*(-100);
    The problem now is that if the numberic '2' is inputted into numberOfKids, numberOfKids.text shows up as 200 and a trace shows up as '2NaN'.
    Flash is logical and consistant, I must conform to it but I'm in the dark.
    (( Concerning the forum:  If I click on helpful, which your posts have been in directing me, does that blank out the possibility of selecting the correct answer in the future???))

  • Expanding text fields not co-operating

    I created a new form that spans over 2 pages and saved it as a dynamic PDF. I'm trying to allow for the text fields to expand as the user types beyond the intial size of the field. The field is set to "Expand to Fit". I have several sections of the form all separated by text headings. I have tried to wrap each section in a subform (set to "Flowed"), then wrap all the subforms to a larger subform (set to "Flowed").
    The problems that I'm encountering is each section that is wrapped in a subform looses the placement and whitespace between fields of all the fields and brings them in tight to each other. Then when i wrap all the subforms into one larger subform (set to "flowed"), my text headings and other text get rearranged and I can't change the order of reposition them with the white space.
    Below is a picture of my form in the nice tidy format that I'd like to keep. Then a picture of how it looks with each section in a subform and all of those subforms in a larger subform.
    Any help would be greatly appreciated!
    Before
    After

    Hi,
    Moving to Flowed layouts can be a pain. When you change to Flowed type, all of the objects are positioned from top left, based on the order in the hierarchy.
    You will need to adjust the objects margins in order to space them out.
    First I would adjust the content area on the Master Page, so that you have your margins in the right distance from the left (and top, bottom and right).
    See some examples here:
    Objects in flowed forms: http://assure.ly/e2jR0C
    Explore difference between flowed and positioned subforms: http://assure.ly/eSGQMt
    Some aspects for laying out objects: http://assure.ly/ewrLMo.
    Master pages and content areas: http://assure.ly/g0Wx7r.
    Another thing, when working with textfields (and other objects) you can set the caption to appear above the value area (go to the Layout palette). This means that you will only be dealing with one object instead of two (currently you have a text object and a textfield).
    If things are still out of order, then drag them into the correct order in the hierarchy and they will be in the right order on the page.
    Hope that helps,
    Niall

  • Expanding text field in table

    Hi,
    I’m pretty inexperienced with Live Cycle and was hoping I could get some help using text fields within a table.
    I’m creating a form with a table into which the user enters information. I’d like the row height in the table to adjust to the amount of text entered into the text field so as that if necessary the table will expand onto a subsequent page.
    The table exists within a subform and the text fields exist with in the table. In searching this forum I seen talk of dynamic tables but not sure how to achieve this.
    Any help would be much appreciated.
    Thanks
    Graeme

    To make the textfields grow you need to select 'Expand to Fit' under height in the Layout tab. In terms of going onto another page you need to select 'Allow Page Breaks within Content' in the Object>Field tab and make sure your subform is flowed not positioned.

  • Expanding text field question?

    Is it possible to have a text field push all other fields below it down the page as a user fills the box with text content?
    ie. a text area with a logo graphic below it which always is positioned exactly the same distance between it and the content.
    Thanks...

    You can use a dynamic form created by LiveCycle Designer for this.

  • How do I change fonts in a Text field ??

    Okay I've tried to implement a JComboBox that allows the user to change fonts in the text field. So far I've tried different methods to do it but to no avail. Could somebodoy here read the programs source code for me and tell me where I went wrong?
    /* * My GUI Client */
    import javax.swing.*;
    import javax.swing.text.*;
    import java.awt.*;
    import javax.swing.event.*;
    //for HTML Headers
    import javax.swing.text.StyledEditorKit.*;
    import javax.swing.text.html.HTMLEditorKit.*;
    import javax.swing.text.html.*;
    import javax.swing.event.HyperlinkListener;
    import javax.swing.event.HyperlinkEvent;
    import javax.swing.event.HyperlinkEvent.EventType;
    import javax.swing.text.html.HTMLFrameHyperlinkEvent;
    //for layout managers
    import java.awt.event.*;
    //for action and window events
    import java.io.*;
    import java.net.*;
    import java.awt.GraphicsEnvironment;
    //for font settings
    import java.lang.Integer;
    import java.util.Vector;
    import java.awt.font.*;
    import java.awt.geom.*;
    public class guiClient extends JFrame implements ActionListener {
    protected static final String textFieldString = "JTextField";
    protected static final String loadgraphicString = "LoadGraphic";
    protected static final String connectString = "Connect";
    static JEditorPane editorPane;
    static JPanel layoutPanel = new JPanel(new BorderLayout());
    static JPanel controlPanel = new JPanel(new BorderLayout());
    static JPanel buttonPanel = new JPanel(new BorderLayout());
    static JPanel fontPanel = new JPanel(new BorderLayout());
    static PrintStream out;
    static DrawPanel dPanel;
    static DrawPanel dPButton;
    static DrawPanel dFonts;
    static DrawControls dControls;
    static DrawButtons dButtons;
    static String userString;
    static String currentFont;
    String fontchoice;
    String fontlist;
    static JTextField userName = new JTextField();
    public static JMenuBar menuBar;
    private static JButton connectbutton = new JButton("Connect");
    static boolean CONNECTFLAG = false;
    //create the gui interface
    public guiClient() {
         super("My Client");
    // Create a ComboBox
    GraphicsEnvironment gEnv = GraphicsEnvironment.getLocalGraphicsEnvironment();
    String envfonts[] = gEnv.getAvailableFontFamilyNames();
    Vector vector = new Vector();
    for ( int i = 1; i < envfonts.length; i++ ) {
    vector.addElement(envfonts);
    JComboBox fontlist = new JComboBox (envfonts);
         fontlist.setSelectedIndex(0);
         fontlist.setEditable(true);
         fontlist.addActionListener(this);
         fontchoice = envfonts[0];     
    //Create a regular text field.
         JTextField textField = new JTextField(10);
         textField.setActionCommand(textFieldString);
         textField.addActionListener(this);          
    //Create an editor pane.
    editorPane = new JEditorPane();
         editorPane.setContentType("text");
         editorPane.setEditable(false);
    //set up HTML editor kit
         HTMLDocument m_doc = new HTMLDocument();
         editorPane.setDocument(m_doc);
         HTMLEditorKit hkit = new HTMLEditorKit();
         editorPane.setEditorKit( hkit );
         editorPane.addHyperlinkListener( new HyperListener());
    //Create whiteboard
    dPanel = new DrawPanel();
    dPButton = new DrawPanel();
    dFonts = new DrawPanel();
    dControls = new DrawControls(dPanel);
    dButtons = new DrawButtons(dPButton);
         //JLable fontLab = new JLabel(fontLable);
    //fontLab.setText("Fonts");
    //Font newFont = getFont().deriveFont(1);
    //fontLab.setFont(newFont);
    //fontLab.setHorizontalAlignment(JLabel.CENTER);
    JPanel whiteboard = new JPanel();
    whiteboard.setLayout(new BorderLayout());
    whiteboard.setPreferredSize(new Dimension(300,300));
    whiteboard.add("Center",dPanel);
    whiteboard.add("South",dControls);
    whiteboard.add("North",dButtons);
         JScrollPane editorScrollPane = new JScrollPane(editorPane);
         editorScrollPane.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
         editorScrollPane.setPreferredSize(new Dimension(250, 145));
         editorScrollPane.setMinimumSize(new Dimension(50, 50));
    //put everything in a panel
         JPanel contentPane = new JPanel();
         JPanel fontPane = new JPanel();
         contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
    //add whiteboard
         contentPane.add(whiteboard);
    //add editor box
         contentPane.add(editorScrollPane);
    //add spacer
         contentPane.add(Box.createRigidArea(new Dimension(0,5)));
    //add textfield
         contentPane.add(textField);
    //set up layout pane
         //layoutPanel.add(GridLayout(2,1),fontLab);
         layoutPanel.add( BorderLayout.NORTH, fontlist);     
         layoutPanel.add(BorderLayout.WEST,new Label("Name: ")); //add a label
         layoutPanel.add(BorderLayout.CENTER, userName ); //add textfield for user names
         layoutPanel.add(BorderLayout.SOUTH, connectbutton);//add dropdown box for fonts
         //fontPane.add(BorderLayout.NORTH,fontlist);
         contentPane.add(layoutPanel);
         contentPane.add(controlPanel);
         contentPane.add(buttonPanel);
    //Create the menu bar.
    menuBar = new JMenuBar();
    setJMenuBar(menuBar);
    //Build the first menu.
         JMenu menu = new JMenu("File");
         menu.setMnemonic(KeyEvent.VK_F);
         menuBar.add(menu);
    //a group of JMenuItems
         JMenuItem menuItem = new JMenuItem("Load Graphic", KeyEvent.VK_L);
         menu.add(menuItem);
    menuItem.setActionCommand(loadgraphicString);
         menuItem.addActionListener(this);
    connectbutton.setActionCommand(connectString);
    connectbutton.addActionListener(this);
         setContentPane(contentPane);
    static private void insertTheHTML(JEditorPane editor, String html, int location) throws IOException {
         HTMLEditorKit kit = (HTMLEditorKit) editor.getEditorKit();
         Document doc = editor.getDocument();
         StringReader reader = new StringReader(html);
         try {
              kit.read(reader, doc, location);
         } catch (BadLocationException e) {}
    //listen for actions being performed and process them
    public void actionPerformed(ActionEvent e) {
    //if the action is from the textfield (e.g. user hits enter)
         if (e.getActionCommand().equals(textFieldString)) {
              JTextField fromUser = (JTextField)e.getSource();
         if (fromUser != null){
    //place user text in editor pane
    //send message to server
                   if (userName.getText() != null) {
                        userString = userName.getText().trim();
                   out.println(userString + ": " + fromUser.getText());
              fromUser.setText("");
         } else if(e.getActionCommand().equals(connectString)) {
              CONNECTFLAG = true;
    } else if (e.getActionCommand().equals(loadgraphicString) ) {
              final JFileChooser fc = new JFileChooser();
              int returnVal = fc.showOpenDialog(this);
              if (returnVal == JFileChooser.APPROVE_OPTION) {
                   File file = fc.getSelectedFile();
                   dPanel.loadImage(file.getAbsolutePath());
                   sendImage(file);
         else if (e.getActionCommand().equals(fontlist)){
         JComboBox cb = (JComboBox)e.getSource();
    String newSelection = (String)cb.getSelectedItem();
    currentFont = newSelection;
         userString = currentFont;
    return;
    /*public void itemStateChanged (ItemEvent e) {
    if ( e.getStateChange() != ItemEvent.SELECTED ) {
    return;
    if ( list == fontlist ) {
    fontchoice = (String)fontlist.getSelectedItem();
         userString.changeFont(fontchoice);
    //append text to the editor pane and put it at the bottom
    public static void appendText(String text) {
         if (text.startsWith("ID ") ) {
              userString = text.substring(3);
         } else if (text.startsWith("DRAW ") ) {
              if (text.regionMatches(5,"LINE",0,4)) {
    dPanel.processLine(text);
         }else if (text.regionMatches(5,"POINTS",0,5)) {
         dPanel.processPoint(text);
         } else if (text.startsWith("IMAGE ") ) {
    int len = (new Integer( text.substring(6, text.indexOf(",")))).intValue();
    //get x and y coordinates
         byte[] data = new byte[ (int)len ];
         int read = 0;
    try {
         while (read < len) {
         data = text.getBytes( text.substring(0, len) );
    } catch (Exception e) {}
         Image theImage = null;
         theImage = dPanel.getToolkit().createImage(data);
         dPanel.getToolkit().prepareImage(theImage, -1, -1, dPanel);
         while ((dPanel.getToolkit().checkImage(theImage, -1, -1, dPanel) & dPanel.ALLBITS) == 0) {}
              dPanel.drawPicture(0, 0, theImage);
    } else {
    //set current position in editorPane to the end
              editorPane.setCaretPosition(editorPane.getDocument().getLength());
    //put text into the editorPane
              try {
                   insertTheHTML(editorPane, text, editorPane.getDocument().getLength());
              } catch (IOException e) {}
    } //end of appendText(String)
    public void sendImage(File file) {
    //find length of file
         long len = file.length();
    //read file into byte array
         byte[] byteArray = new byte[(int)len];
         try {
              FileInputStream fstream = new FileInputStream(file);
              if (fstream.read(byteArray) < len) {
    //error could not load file
              } else {
              out.println("IMAGE " + len + ",");
                   out.write(byteArray, 0, (int)len); //write file to stream
         } catch(Exception e){}
    //run the client
    public static void main(String[] args) {
         String ipAddr=null, portNr=null;
              if (args.length != 2) {
                   System.out.println("USAGE: java guiClient IP_Address port_number");
                   System.exit(0);
              } else {
         ipAddr = args[0];
              portNr = args[1];
              JFrame frame = new guiClient();
              frame.addWindowListener(new WindowAdapter() {
                   public void windowClosing(WindowEvent e) { System.exit(0); }
              frame.pack();
              frame.setVisible(true);
              while(CONNECTFLAG == false){}
    //sames as previous client,
    //set up connection and then listen for messages from the Server
              String socketIP = ipAddr;
              int port = Integer.parseInt(portNr);
    //the IP address of the machine where the server is running
              Socket theSocket = null;
    //communication line to the server
              out = null;
    //for message sending
              BufferedReader in = null;
    //for message receiving
              try {
              theSocket = new Socket(socketIP, port );
    //try to connect
              out = new PrintStream(theSocket.getOutputStream());
                   dPanel.out = out;
    //for client to send messages
              in = new BufferedReader(new InputStreamReader(theSocket.getInputStream()));
                   BufferedReader userIn = new BufferedReader(new InputStreamReader(System.in));
                   String fromServer;
                   while ((fromServer = in.readLine()) != null) {
                   appendText(fromServer);
                   if (fromServer.equals("BYE")) {
                        appendText("Connection Closed");
                        break;
              out.close();
    //close all streams
              in.close();
              theSocket.close();
    //close the socket
         } catch (UnknownHostException e) {
    //if the socket cannot be openned
              System.err.println("Cannot find " + socketIP);
              System.exit(1);
              } catch (IOException e) { //if the socket cannot be read or written
              System.err.println("Could not make I/O connection with " + socketIP);
              System.exit(1);
    class HyperListener implements HyperlinkListener {
    public JEditorPane sourcePane;
    public void hyperlinkUpdate(HyperlinkEvent e) {
    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
    sourcePane = (JEditorPane) e.getSource();
                   if (e instanceof HTMLFrameHyperlinkEvent) {
    HTMLFrameHyperlinkEvent event = (HTMLFrameHyperlinkEvent) e;
                        System.out.println(event.getTarget());
                        HTMLDocument doc = (HTMLDocument) sourcePane.getDocument();
                        doc.processHTMLFrameHyperlinkEvent(event);
    else {
    try {}
    catch (Exception ev){
         ev.printStackTrace();
    Well sorry the source code takes up the whole forum but I need a good feedback from this.

    All right...
    public class guiClient extends JFrame implements ActionListener {
    static String userString;
    static String currentFont;
    String fontchoice;
    String fontlist;
    static JTextField userName = new JTextField();
    public guiClient() {
         super("My Client");
    public guiClient() {
         super("My Client");
    // Create a ComboBox
    GraphicsEnvironment gEnv = GraphicsEnvironment.getLocalGraphicsEnvironment();
    String envfonts[] = gEnv.getAvailableFontFamilyNames();
    Vector vector = new Vector();
    for ( int i = 1; i < envfonts.length; i++ ) {
    vector.addElement(envfonts);
    JComboBox fontlist = new JComboBox (envfonts);
         fontlist.setSelectedIndex(0);
         fontlist.setEditable(true);
         fontlist.addActionListener(this);
         fontchoice = envfonts[0];     
    //Create a regular text field.
         JTextField textField = new JTextField(10);
         textField.setActionCommand(textFieldString);
         textField.addActionListener(this);
    public void actionPerformed(ActionEvent e) {
    //if the action is from the textfield (e.g. user hits enter)
         if (e.getActionCommand().equals(textFieldString)) {
              JTextField fromUser = (JTextField)e.getSource();
         if (fromUser != null){
    //place user text in editor pane
    //send message to server
                   if (userName.getText() != null) {
                        userString = userName.getText().trim();
                   out.println(userString + ": " + fromUser.getText());
              fromUser.setText("");
         else if (e.getActionCommand().equals(fontlist)){
         JComboBox cb = (JComboBox)e.getSource();
    String newSelection = (String)cb.getSelectedItem();
    currentFont = newSelection;
         userString = currentFont;
    return;

Maybe you are looking for

  • Mac OS X 10.5.6 Fast User Switching Freezes Screen

    The past two Mac OS X versions (10.5.5 and 10.5.6) result in the screen freezing after initiating Fast User Switching. Version 10.5.4 worked as designed, but 10.5.3 had the same issue. Seems to be video display related. Using a 20" display does not r

  • Shared Services Mixed Native-MSAD group nesting

    Is anyone doing this? I am trying to make an MSAD group a member of a native group using shared services and after adding the MSAD group, the console errors out for the group i just made whenever trying to view the group members. This is repeatable a

  • I have had trouble using Plug-ins since I updated to LR3.3.

    I cannot edit in any of my plug-ins . Keep getting this message:  "Lightroom was unable to prepare the selected files at  - - - - - - - - .   It will not be opened".

  • HTML tool tip on text fragment....how?

    I need a tool tip on a piece of text using HTML. I thought below would work when pasted in the HTML snipped widget, but it does not work (everything is fine, just no tool time). text fragment What would work? Thanks bob

  • Intermittent issues with video output initialization

    Hi Guys, I have received a new (i5, 15') Mac-book Pro more than 9 months ago. About 6 months ago it started having some serious intermittent issues with video output. Those issues are numerous and different every time, but all seems to lead to GPU pr