Label in a text field

Hi There
I am struggling a little with putting a label into three text fields of a form - please see the site at http://www.justadwater.co.uk/Firstlook/index.html I can get it to appear when you click on the text box but it needs to be there from the start and then gone when you click on the box.
Hope someone can help.
Thanks
G

Hi,
I believe this code should work.
<form action="sendmailnews.php" method="post">
<input name="First Name" id="Firstname" type="text" value="First Name"/>
<input name="Last Name" id="Lastname" type="text" value="Last Name"/>
<input name="Email" id="Email" type="text" value="Email"/>
<input name="" type="image" id="button" src="images/button.gif"/></form>
qazsd

Similar Messages

  • Can't hide text field label..only text field

    I'm trying to display text field boxes on a form to fill out when a box is checked.  I'm able to do this for the actual text field, but can't figure out how to hide then show the associated text field label.  Can you tell me what I'm doing wrong?
    Thanks!
    var nHide =
    event.target.isBoxChecked (0) ? display.visible:display,hidden;
    this.getField ("Name").display = nHide; this.getField

    First of all, you're using Acrobat JavaScript in an XFA form, which doesn't work.
    LiveCycle Designer has its own interpretation of JavaScript, which is different to Acrobat.
    There is also a second scripting language called FormCalc available.
    Its syntax is much easier to learn and is matches perfectly to manipulate XFA forms.
    Check the help (F1 button) in Designer to get the Designers scripting guide.

  • 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.

  • ADF Mobile: How to change the font size of an Input Text field in .amx view

    Is there a way to change the font size of the input data (not the label) in a text field? Changing the font size in the Style Font/Text settings doesn't seem to do anything for the label or the value in the input text field. Is this a bug or is there a way to get this to work?

    Hi Anna,
    depending on the UI element there are a range of ways. (and I'm sure people will post plenty of answers to tell you how).
    However, if generically the fonts in you portal/wd applications are too small, you should consider changing your theme so as to have larger texts. Otherwise you will either need to customise all your applications, or you will get quite a lot of inconsistency of presentation between your various WDA applications.
    Do a search on "themes for Web Dynpro ABAP" and you'll find loads of resources.
    Hope this helps,
    Cheers,
    Chris

  • Changing the text of Text field in standard SAP transaction.

    Hi expert,
    I have a requirement in which i have to change the text of Text field in standard SAP transaction.
    Is it possible? If so, how?
    Any pointers will be highly appreciated.

    Hi,
    I think you want to change the field label of the text field.
    For ex in tcode MM01, you can change the field label of Material text field.
    The description of the field label comes from the data element it is associated with. To change the text of the field label, you have to change the field label of the data element.
    But it will effect all the fields associated with this data element.
    To change the field label of the data element go to tcode CMOD. Then click on GOTO->TEXT ELEMENTS->KEYWORDS->CHANGE.
    Then enter the data element which is to be changed. In the next screen, change the field label and save it.
    Regards,
    Vinod

  • PDF Text Field Form Label

    Hello everyone.  I was wondering if there was a way to make a label viewable in normal mode for a PDF text field form.  I am making my PDF a form with a fillable text box in it.  Well, I'd like the box name to show up when someone opens the PDF, not just if they only go into the edit form view.  I hope I'm making sense.  So far, the only thing I can think of is making a Button with the label above the fillable text box or make the text box a combo box.  However, with a combo box, I can't edit how the text will look when it's typed in.  Right now, though, when a person opens the PDF normally, the highlighted fillable text boxes show up but not the labels with them even though I have names entered in on Name and Tooltip.
    Any suggestions?

    Oh my gosh... I feel like such a dork!!  I took a fresh look at it this morning, and the ONLY mistake I had was that I put the ending quotations in the wrong spot!  I forgot to include (Optional) inside the quotations for the label!
    I had this:  if (!event.value) event.value = "Company Information" (Optional);
    Instead of this:  if (!event.value) event.value = "Company Information (Optional)";
    Oi!!  That was it! lol!  I'm sorry about that.  And yes, without those quotations, my text form fields don't work.  I hadn't seen your message before (until now) asking for me to clarify that.  I'm sorry!  That's the only spot I needed quotations.  If I don't have them, Adobe tells me that I'm missing characters.
    THANK YOU SO MUCH!!!  I wish there was a way to give brownie points or something on here either than "Right Answer".  You have helped me so much and deserve a lot of brownie points!   Thank you!!
    If Adobe is reading this, please give George Johnson a reward or something, please!  He was very helpful and patient with me.

  • How to remove labels from text fields?

    Hey Everyone!
    I am having troubles with forms in Dreamweaver CC.
    I insert a text field in a form but the text field automatically comes with a label.
    How do i stop this?

    And I get that!
    But say I insert a text field.
    It is preceded by a label saying "Text Field 1:"
    But I already have written what the text field is supposed to do!
    And when I go in front of the label and press backspace, it doesn't wanna get deleted; not until I have to select the text and delete it!
    So you see a large part of my time is getting wasted in formatting the page and i can't give my full attention to the php code I want to write as I get frustrated because of this!
    So if you could help me get rid of the labels for good ; it'll be amazing!
    Thanks
    Regards
    Anuj

  • Text Field avoid tab into label

    Is there a way to avoid tabbing into a label.
    I have several Text Fields with as "Required with Help" and the user would like to tab thru the Text field without having to tab out of the label.
    Is that possible.
    Using Apex 3.2.
    Thanks

    This can be controlled using the HTML <tt>tabindex</tt> attribute. See +{thread:id=1246565}+ for a previous discussion on this.
    Basically, <tt>tabindex</tt> should NOT be applied to <tt>label</tt> elements. However in labels of type "Required with help", the help links should be accessible via tab presses on the keyboard. In this case, I'd say the user is wrong and it makes sense for the help link to receive focus before the text item, so that the help relating to the item can be accessed before entering a value. If they can't be convinced of this, then set <tt>tabindex</tt> values for the text items and label help links sequenced so that the items are accessed before the help links.

  • How to define the same font size,color for a text field label

    hi all,
    In my project i need to define the same font size & color for all the text field lables in the application.how do we can achieve this?
    Thanks & regards,

    ...or you could use declarative components....
    Not sure if skinning would prevent developers from overriding a look and feel??? hmmm not sure..
    Grant

  • Wrap a single word in a text field

    Hello everyone!
    I currently have a problem with text data that is displayed in a Flex text field <mx:Text>.
    It's a narrow textfield (100px wide) in a animated ad banner that displays content from a database. There are some words that are too long for the available space, so flash wraps some letters to the next line. I have attached a screenshot that shows the actual problem.
    The text is shown in a Java web-application as well, and since that Java app is displayed as a normale webpage, there is a lot more space for the text. I cannot put hyphens into the text because it would look weird in the normal web view.
    Is there a way to make automatic hyphenation happening when Flash wraps a single word?
    It would be perfect to get language-specific correct hyphenation, but a hyphen at the wrong spot is still better than no hyphen at all.
    Thanks for your time and help!

    I think your simplest bet would be to use mx:label and use the op
    tion truncateToFit="true". Also adjust the width so that the text appears prope
    rly. Hope this helps..!!

  • Adding user-defined number of text fields.

    Okay I am having problems, obviously. I am developing a program where the user will enter X and Y values and the program will calculate the relational data. However, I can't even get a start.
    First of all, the user defines the number of pairs of points they want to define. For example, they have 20 points, each with its own X and Y, so they click on 20 and then okay in the first window.
    The next window will then take their answer and display X and Y text fields for as many points as they defined. However, I can't figure out any way to do this.
    Feel free to run the program, the problem lies in the method setTextFields(). Help please!
    import javax.swing.*;               //FOR SWING COMPONENT CLASSES
    import java.awt.*;                  //FOR CONTAINER CLASS
    import java.awt.event.*;            //FOR EVENT HANDLING
    public class RegressInput extends JFrame
        private JComboBox listJComboBox;        //COMBO BOX TO HOLD HOW MANY PAIRS OF DATA POINTS THE USER HAS TO ENTER
        private JButton answerButton;           //BUTTON TO CLICK AFTER SELECTING PAIRS OF DATA POINTS
        private JPanel textFieldTopPanel;       //TEXT FIELD TOP PANEL
        private JPanel textFieldBottomPanel;    //TEXT FIELD BOTTOM PANEL
        private JPanel textFieldPanel;           //TEXT FIELD PANEL   
        private CardLayout cardSelector;        //DECLARE CARD LAYOUT OBJECT   
        private JPanel cardDeck;                //DECLARE CARD PANEL OBJECT
        public RegressInput(String title)
            super(title);               //CALL SUPERCLASS CONSTRUCTOR
            //CREATE A CONTAINER
            Container container = getContentPane();
            //INSTANTIATE CARD LAYOUT OBJECT
            cardSelector = new CardLayout();
            //INSTANTIATE PANEL OBJECT
            cardDeck = new JPanel();
            //SET LAYOUT OF CARD DECK PANEL TO CARD LAYOUT
            cardDeck.setLayout(cardSelector);
            //DEFINE LABEL FOR FIRST CARD
            Label question = new Label("How many PAIRS of data would you like to enter?");
            //BUTTON TO SUBMIT NUMBER OF POINTS TO PLOT
            answerButton = new JButton("OK");
            listJComboBox = new JComboBox( getArray() );//USE getArray() METHOD TO SET ITEM LIST OF THE COMBO BOX
            listJComboBox.setMaximumRowCount(10);       //SETS THE VISIBLE NUMBER OF ITEMS TO THE USER
            Label xValues = new Label("X Values");      //LABEL FOR X values
            Label yValues = new Label("Y Values");      //LABEL FOR Y values
            //BUILD CARD DECK
            JPanel comboBoxCard = new JPanel();     //CREATE FIRST CARD
            comboBoxCard.add(question);             //ADD question LABEL TO FIRST CARD
            comboBoxCard.add(listJComboBox);        //ADD listJComboBox TO FIRST CARD
            comboBoxCard.add(answerButton);         //ADD answerButton TO FIRST CARD
            textFieldTopPanel = new JPanel();       //CREATE TOP PANEL OF SECOND CARD
            textFieldTopPanel.add(xValues);         //ADD xValues Label TO SECOND CARD
            textFieldTopPanel.add(yValues);         //ADD yValues Label TO SECOND CARD
            textFieldBottomPanel = new JPanel();    //CREATE BOTTOM PANEL OF SECOND CARD
            textFieldBottomPanel.setLayout(new FlowLayout(FlowLayout.CENTER,10,10));    //SET LAYOUT FOR BOTTOM PANEL
            textFieldPanel = new JPanel();          //CREATE PANEL FOR SECOND CARD
            textFieldPanel.setLayout(new BorderLayout(10, 10)); //SET LAYOUT FOR SECOND CARD
            textFieldPanel.add(textFieldTopPanel, "North"); //ADD textFieldTopPanel TO NORTH
            textFieldPanel.add(textFieldBottomPanel, "South");  //ADD textFieldBottomPanel TO SOUTH
            cardDeck.add(comboBoxCard, "Step 1");       //ADD FIRST CARD TO DECK
            cardDeck.add(textFieldPanel, "Step 2");     //ADD SECOND CARD TO DECK
            container.add(cardDeck);                    //ADD CARD DECK TO CONTAINER
            //DEFINE BUTTON HANDLER OBJECT
            ButtonHandler buttonHandler = new ButtonHandler();
            //ADD ACTION LISTENER FOR BUTTONS
            answerButton.addActionListener(new ButtonHandler());
        }//END RegressInput() CONSTRUCTOR
        //METHOD TO CREATE AND RETURN AN ARRAY OF VALUES FOR JComboBox
        private String[] getArray()
            //CREATE ARRAY TO HOLD 30 VALUES
            int numbers[] = new int[29];
            //CREATE int IN ORDER TO START THE ARRAY AT 2 INSTEAD OF 1
            int number = 2;
            //ASSIGN VALUES FROM 2 TO 30 TO numbers[] ARRAY
            for(int count=0; count < 29; ++count)
                numbers[count] = number;        //SETS EACH INDEX TO number
                number++;                       //INCREMENTS number
            }//END for LOOP
            //CREATE pairs[] ARRAY TO HOLD 30 STRINGS
            String pairs[] = new String[29];
            //ASSIGN VALUES 1 TO 30 IN STRING ARRAY FOR COMBO BOX
            for(int count = 0; count < 29; ++count)
                pairs[count] = "" + numbers[count];
            }//END for LOOP
            return pairs;//RETURNS pairs[] ARRAY FOR THE LIST ITEMS IN listJComboBox
        }//END getArray() METHOD8
        //RETURNS THE ITEM SELECTED BY THE USER FROM THE JComboBox
        private int getValue()
            //ASSIGNS STRING VALUE OF THE JComboBox TO A WRAPPER
            Integer v = new Integer((String) listJComboBox.getSelectedItem());
            //ASSIGNS WRAPPER VALUE TO int
            int value = v.intValue();
            //RETURN VALUE OF SELECTED ITEM
            return value;
        }//END getValue()
        private void setTextFields()
        {//HERE LIES THE PROBLEM! WHAT GOES IN THIS METHOD????
            for(int count = 0; count < (2 * getValue()); ++count)
        }//END setTextFields()
        //BUTTON EVENT HANDLER CLASS
        private class ButtonHandler implements ActionListener
         //PROCESS EVENT
            public void actionPerformed(ActionEvent e)
                //WHICH BUTTON CAUSED THE EVENT?
                if(e.getSource() == answerButton)
                    cardSelector.last(cardDeck);
                    cardDeck.setSize(600,600);
                }//END if STATEMENT
            }//END actionPerformed()
        }//END ButtonHandler CLASS
    }//END RegressInput CLASSHere is main:
    import javax.swing.JFrame;
    public class TestSharpStats
         public static void main(String[] args)
            //DEFINE FRAME OBJECT
            RegressInput window = new RegressInput("Hi");     //SETS TITLE BAR
            window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);      //CLOSES WINDOW
            window.setSize(400, 600);    //SET FRAME SIZE
            window.setResizable(true);  //PREVENTS USER FROM RESIZING WINDOW
            window.setVisible(true);     //SETS window TO VISIBLE
        }//END main()
    }//END TestSharpStats CLASS

    muit-post: http://forum.java.sun.com/thread.jspa?messageID=4442652

  • Text field not showing record set options

    I entered the following php code to a text field in a form:
    <p>
          <label for="date">Select Available Date</label>
          <select name="date" class="text" id="date">
            <option value="0" selected="selected">select your preferred travel date</option>
                <?php while ($row_rsDep = mysql_fetch_assoc($rsDep)) {
                      echo '<option>' . date('d.m.Y',strtotime($row_rsDep['Start_Date_Eur'])) . ' - ' . date('d.m.Y',strtotime($row_rsDep['End_Date_Del'])) . '-' . $row_rsDep['Itinerary_Code'] . '</option>';
              ?>       
          </select>
        </p>
    In the text field it shows only the option=0 "select your preferred travel date" and does not show the rest of the options as available from the database.
    Any idea what is wrong with my code?
    Thanks,
    zabberwan

    I do have it showing in the sidebar showing as a repeating region. I commented it out and entered your code, but this time it shows nothing at all, not even an error!
    The problem may have to do with "VIEWS" as I am working partly with Views on the external server. The server guys are having problems allowing Views. They did allow it for my account, but somehow this is not working. So I update my database leaving out the 3 tables created as views out of a total of 8. On the contrary on the local server the database is working fine, so that may not be the problem after all.
    I had got it work a fortnight back, but lost it as I had to redo a few things with the forms it is in. On the sidebar it is working fine otherwise as a repeating region and showing all the dates of all itineraries. Only it's not working in the form, where it shows the preselected string (select your preferred travel date), but not the rest of the options.
    About changing the email, one has to change the whole ID  and profile etc. and then you can't log into your own account with the same user name, you have to have a different one, so that your own thread is no longer your own. What a pile of goons at the wheels! And what a disappointment with otherwise such a great bunch of forums.. I'll now have to contact the staff and would like them wipe out all my ID's and Profiles at Adobe and make a new one. It's such a rotten mess. This thing even ruined my ID at Adobe Browser Lab.
    I suppose we'll leave it for Mr. Nobody to fix it, like so many other things especially around Christmas!
    zabberwan

  • Text input box to show in another text field

    Hello,
    I have a text input box (Text1) showing during a certain label on the stage.  On another label there is another text field (Text2) that is not input-able.  This second text field (Text2) should show whatever the user has inputted in the first text input field (Text1).
    Both of these elements are not symbols and right now they are both text elements.
    Does anyone know how to do this?
    Thanks,
    ~iana~

    I believe the inputField is set accordingly.  And including your reply, here's what I've got on my stage:
    sym.$("Name").attr('contentEditable', true);
    var inputValue = sym.$("Name").value;
    // other text
    sym.$("Signature").html(inputValue);
    Thus far, this does not work. "Name" field is Text1 (inputField) and the "Signature" is Text2 (text box)
    I'm new to all this so I've prob got something wrong...do you know what I should adjust?

  • Text Fields Not Showing in Design or Live View

    Hello Everyone,
    I have run into a problem trying to create a simple contact form through Dreamweaver CS6.  I have two text fields for Name & Email, and 1 text area for Comments.  The issue I am running into is that the text fields are not showing in Design or Live view.  I have set-up all variables required for the server for the form to work... but that should not have any effect on the text field showing...  I tried uploading my contact page with the same result of no text fields showing...
    What is really laughable is that the "text area" I placed in my form for Comments shows up in Design & Live view just fine.  I am thinking that I am missing something, but just do not know what exactly.  The form is styled through CSS.
    Here is the form code:
         <div id="CRDForm">
           <form action="http://www.sweetformimi.com/formmail/formmail.php" method="post" enctype="application/x-www-form-urlencoded" name="contact" target="_self" id="contact">
        <input type="hidden" name="env_report" value="REMOTE_HOST,REMOTE_ADDR,HTTP_USER_AGENT,AUTH_TYPE,REMOTE_USER">
        <input type="hidden" name="recipients" value="[email protected]" />
        <input type="hidden" name="subject" value="Contact Form" />
             <label><p>Your Full Name
               <input name="Name" type="text" id="Name" size="40" /></p>
             </label>
             <label><p>Email
             <input name="email" type="text" accesskey="2" tabindex="2" title="Email" value="Email"></p>
             </label>
             <label>Comments<br />
             <textarea name="comments" cols="40" rows="10" accesskey="3" tabindex="3" title="Comments"></textarea>
             </label>
             <input name="submit" type="submit" accesskey="4" tabindex="4" title="submit" value="submit">
           </form>
        </div>
    Are there other variables I should be thinking about in the rest of my site?  I am using a fluid grid layout.  I have CSS for desktop, tablet, and phone devices.  I also have a primary CSS file that imports all three.  The sites structure was done by using <header>, <article>, <footer>, and of course <div> tags. 
    Has anyone ever experienced the "text fields" not showing up before? Is it a simple fix as reinstalling Dreamweaver CS6?  Finally, another thing I should mention is that I did have a previous version of Dreamweaver on my comp, which was CS3.  I did not uninstall that before installing the newer version.  I assumed (and I could be wrong here) that it would automatically replace the older version.
    I apoligize for it being long winded, but I am looking for some help on this issue...
    Thank You

    Hey thank you osgood for the reply!
    When I look at code for long hours it sort of blurs together, and I miss things... I think that happens to the most of us
    Ya I found what was blocking my text fields in my desktop.css
    I primarily work through code view, and currently working on quite a few projects kind of makes your eyes miss the small errors.
    Thanks again!

  • 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

  • Why am I getting an alert every night at 9PM?

    Here's a weird issue. Starting a couple months ago, every night at exactly 9 PM, the default text alert sounds on my phone. And I can't figure out what's causing it. - No alarm is set. - No notifications pop up, either as a banner or alert. No badge

  • Video quality is questionable

    I've recently reinstalled windows on a new hard drive as well as reinstalled Itunes and imported my libraries from my secondary drive. The video quality in ALL of my videos seems a bit questionable. It's a darker hue (maybe a bit of blue) and not as

  • Copy Documents - How to ... Documents in SEM-BPS and BW-BPS

    Hi Gurus, i need some assistance with implementing the Copy Documents functions according to How to ... Documents in SEM-BPS and BW-BPS. The aim is to copy the documents to a new version. All other document attributes are to remain unchanged. I have

  • Importing photos from Iphone to computer and there is a message it is having trouble with this part way through on a phot and then stops

    I am having trouble importing photos onto my Mac book Pro from my Iphone...in the middle of the import I get a message stating that they are having trouble with one of my photos and then stops importing...want to save photos and clear the phone stora

  • Safari logging me out / Forgets password

    So recently I decided to delete my history, cache passwords etc on Safari for my iPod, which was stupid because ever since if leave Safari for a small period of time or take it away from multi tasking, then I always have to re enter my email and pass