Setting textArea and Button Size

Hi with a TextArea is there a way to set the text area so that you only can type in the box and the words will wrap when they get to the end? I dont want the text that a user types to keep on extending until the user click enter which brings them to the next line. I want it so that when the user hits the end of the text box in the applet they are brought to the next line of the text box without having to hit enter. i dont want them to have to scroll to see all of thier text.
Also can I use a constructor to resize the default buttons created with java? i want my buttons to be a ceratain square size to fill the applet. The Default Buttons are small but I want my Buttons to fill a section of my panel. Here is my code. I am using a grid layout.
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.lang.*;
import java.math.*;
public class TextChat extends Applet
   private Button new_chat, begin;
   private Label errors;
   private TextArea text_top, text_bottom;
   public void init()
      //Set Layout
      setLayout( new GridLayout(3, 1, 10, 10));
      text_top = new TextArea();
      text_bottom = new TextArea();
      add (text_top);
      add(MidPanel());
      add (text_bottom);
   // Set Mid Panel
   public Panel MidPanel()
      Panel p = new Panel( new GridLayout(1, 3, 5, 5) );
      //Set up Buttons
      new_chat = new Button("New Chat");
      begin = new Button("Begin");
      errors = new Label("Errors: ");
      Panel p1 = new Panel();
      p1.add(new_chat);
      Panel p2 = new Panel();
      p2.add(begin);
      Panel p3 = new Panel();
      p3.add(errors);
      p.add(p1);
      p.add(p2);
      p.add(p3);
      return p;
}Thanks

I tried this
TextArea text_top = new TextArea();
TextArea text_bottom = new TextArea();
text_top.setLineWrap(true);I get a error
method setLineWrap (boolean)
It points to the text_top"."setLinewarp as the
error?
I looked up examples and they all used swing
ThanksThe examples might use swing but you are using AWT!!
change to
JTextArea text_top = new JTextArea();
JTextArea text_bottom = new JTextArea();
text_top.setLineWrap(true);

Similar Messages

  • Problem : JButton set border reduces button size

    Hi,
    I have a small problem with a JButton. I am setting the border with button.setBorder(BorderFactory.createLineBorder(Color.blue)). Unfoetunately using this means that my button is visibly reduced when the border is applied and halves its size. How can I prevent this.
    Dave.

    Its ok now, problem solved.
    D.

  • Textarea and buttons not displaying

    I've been playing around with the code for awhile. I feel like I'm overlooking something really simple here. But I can't get the app to display the text-box or buttons. Makes it kinda hard to do unit testing. Any advice on oppurtunites would be greatly appreciated!
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.util.List;
    import javax.swing.*;
    public class FirstName extends JFrame implements ActionListener {
         private String names[] =
                   "Joe",
                   "Mark",
                   "David",
                   "Bryan",
                   "Amber",
                   "Abigail",
                   "Skyler",
                   "Melanie" };
         private JButton jButton;
         private JTextArea jTextArea;
         private JPanel jPanel;
         private JTextField jTextField;
         private JLabel label;
         public FirstName() {
              initComponents();
              List link = new LinkedList(Arrays.asList(names));
              setSize(400, 200);
              show();
         private void initComponents() {
              jPanel = new JPanel();
              label = new JLabel();
              jTextField = new JTextField();
              jButton = new JButton();
              jTextArea = new JTextArea();
              label.setText("Enter a Name to Search:");
              jPanel.add(label);
              jTextField.setColumns(20);
              jPanel.add(jTextField);
              jButton = new JButton(" OK ");
              jButton.addActionListener(this);
         public void actionPerformed(ActionEvent e) {
              boolean found = true;
              String entered = jTextField.getText();
              if (found) {
                   jTextArea.setText("found");
              } else {
                   jTextArea.setText("not found");
              jPanel.add(jButton);
              jTextArea.setColumns(30);
              jTextArea.setRows(5);
              jPanel.add(jTextArea);
              getContentPane().add(jPanel, BorderLayout.CENTER);
    public static void main(String args[]) {
              FirstName application = new FirstName();
              application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

    You've forgotten to add the panel to the frame, eg, at the end of initComponents().
    Have a read of the Swing section in Sun's Tutorial to see an example of the "approved" way of creating and showing the frame. A typical example using invokeLater() is here: [HelloWorldSwing.java|http://java.sun.com/docs/books/tutorial/uiswing/examples/start/HelloWorldSwingProject/src/start//HelloWorldSwing.java]. Notice, too, that it uses setVisible(true) rather than the deprecated show().
    (When you post code, use the {code} tags. The idea is that you put {code} at the start of your code and the same thing again at the end. That way your code will be properly formatted and syntax coloured when it appears here.)

  • SQL Plus: Set pagesize and line size

    Can anyone help me make my output look better...... output below....what do I need to set?
    CUST_ID
    CUS_NAME
    1
    Leroy
    2
    Rama
    3
    Riley
    4
    Adena
    5
    Stuart
    6
    Jena
    7
    Tanisha
    8
    Shellie
    9
    Ignacia
    10
    Reuben

    btw you can use ** tags for preserving formatting code and results in this forum. See the FAQ for more formatting help.                                                                                                                                                                                                                                                           

  • Scan directly into Aperture - setting dpi and output size?

    Am I able to scan an old photo from a flatbed scanner directly into Aperture.
    Set the dpi before along with the output/print size I want?
    thx
    Deb

    I've been researching this for my project too. Here's 3 great articles I found on migrating your film scans to Aperture via Automator.
    http://www.kremalicious.com/2008/05/scan-images-directly-into-apple-aperture/
    http://www.oreillynet.com/pub/a/oreilly/digitalmedia/2007/05/25/digitizing-your- film-archive.html?page=1
    http://blogs.oreilly.com/aperture/2008/09/some-tips-on-scanning-film-int.html

  • Adjust position and size of textField and button...

    Dear All,
    I have the following sample program which has a few textFields and a button, but the positions are not good. How do I make the textField to be at the right of label and not at the bottom of the label ? Also how to adjust the length of textField and button ? The following form design looks ugly. Please advise.
    import javax.swing.*; //This is the final package name.
    //import com.sun.java.swing.*; //Used by JDK 1.2 Beta 4 and all
    //Swing releases before Swing 1.1 Beta 3.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.text.*;
    import javax.swing.JTable;
    import javax.swing.JScrollPane;
    import javax.swing.JPanel;
    import javax.swing.JFrame;
    public class SwingApplication extends JFrame {
    private static String labelPrefix = "Number of button clicks: ";
    private int numClicks = 0;
    String textFieldStringVEHNO = "Vehicle No";
    String textFieldStringDATEOFLOSS = "Date of Loss";
    String textFieldStringIMAGETYPE = "Image Type";
    String textFieldStringIMAGEDESC = "Image Description";
    String textFieldStringCLAIMTYPE = "Claim Type";
    String textFieldStringSCANDATE = "Scan Date";
    String textFieldStringUSERID = "User ID";
    String ImageID;
    public Component createComponents() {
    //Create text field for vehicle no.
    final JTextField textFieldVEHNO = new JTextField(5);
    textFieldVEHNO.setActionCommand(textFieldStringVEHNO);
    //Create text field for date of loss.
    final JTextField textFieldDATEOFLOSS = new JTextField(10);
    textFieldDATEOFLOSS.setActionCommand(textFieldStringDATEOFLOSS);
    //Create text field for image type.
    final JTextField textFieldIMAGETYPE = new JTextField(10);
    textFieldIMAGETYPE.setActionCommand(textFieldStringIMAGETYPE);
    //Create text field for image description.
    final JTextField textFieldIMAGEDESC = new JTextField(10);
    textFieldIMAGEDESC.setActionCommand(textFieldStringIMAGEDESC);
    //Create text field for claim type.
    final JTextField textFieldCLAIMTYPE = new JTextField(10);
    textFieldCLAIMTYPE.setActionCommand(textFieldStringCLAIMTYPE);
    //Create text field for scan date.
    final JTextField textFieldSCANDATE = new JTextField(10);
    textFieldSCANDATE.setActionCommand(textFieldStringSCANDATE);
    //Create text field for user id.
    final JTextField textFieldUSERID = new JTextField(10);
    textFieldUSERID.setActionCommand(textFieldStringUSERID);
    //Create some labels for vehicle no.
    JLabel textFieldLabelVEHNO = new JLabel(textFieldStringVEHNO + ": ");
    textFieldLabelVEHNO.setLabelFor(textFieldVEHNO);
    //Create some labels for date of loss.
    JLabel textFieldLabelDATEOFLOSS = new JLabel(textFieldStringDATEOFLOSS + ": ");
    textFieldLabelDATEOFLOSS.setLabelFor(textFieldDATEOFLOSS);
    //Create some labels for image type.
    JLabel textFieldLabelIMAGETYPE = new JLabel(textFieldStringIMAGETYPE + ": ");
    textFieldLabelIMAGETYPE.setLabelFor(textFieldIMAGETYPE);
    //Create some labels for image description.
    JLabel textFieldLabelIMAGEDESC = new JLabel(textFieldStringIMAGEDESC + ": ");
    textFieldLabelIMAGEDESC.setLabelFor(textFieldIMAGEDESC);
    //Create some labels for claim type.
    JLabel textFieldLabelCLAIMTYPE = new JLabel(textFieldStringCLAIMTYPE + ": ");
    textFieldLabelCLAIMTYPE.setLabelFor(textFieldCLAIMTYPE);
    //Create some labels for scan date.
    JLabel textFieldLabelSCANDATE = new JLabel(textFieldStringSCANDATE + ": ");
    textFieldLabelSCANDATE.setLabelFor(textFieldSCANDATE);
    //Create some labels for user id.
    JLabel textFieldLabelUSERID = new JLabel(textFieldStringUSERID + ": ");
    textFieldLabelUSERID.setLabelFor(textFieldUSERID);
    Object[][] data = {
    {"Mary", "Campione",
    "Snowboarding", new Integer(5), new Boolean(false)},
    {"Alison", "Huml",
    "Rowing", new Integer(3), new Boolean(true)},
    {"Kathy", "Walrath",
    "Chasing toddlers", new Integer(2), new Boolean(false)},
    {"Mark", "Andrews",
    "Speed reading", new Integer(20), new Boolean(true)},
    {"Angela", "Lih",
    "Teaching high school", new Integer(4), new Boolean(false)}
    String[] columnNames = {"First Name",
    "Last Name",
    "Sport",
    "# of Years",
    "Vegetarian"};
    final JTable table = new JTable(data, columnNames);
    table.setPreferredScrollableViewportSize(new Dimension(500, 70));
    //Create the scroll pane and add the table to it.
    JScrollPane scrollPane = new JScrollPane(table);
    //Add the scroll pane to this window.
    getContentPane().add(scrollPane, BorderLayout.CENTER);
    final JLabel label = new JLabel(labelPrefix + "0 ");
    JButton buttonOK = new JButton("OK");
    buttonOK.setMnemonic(KeyEvent.VK_I);
    buttonOK.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
              try {
    numClicks++;
              ImageID = textFieldVEHNO.getText() + textFieldDATEOFLOSS.getText() + textFieldIMAGETYPE.getText();
    label.setText(labelPrefix + ImageID);
              ScanSaveMultipage doScan = new ScanSaveMultipage();
              doScan.start(ImageID);
         catch (Exception ev)
    label.setLabelFor(buttonOK);
    * An easy way to put space between a top-level container
    * and its contents is to put the contents in a JPanel
    * that has an "empty" border.
    JPanel pane = new JPanel();
    pane.setBorder(BorderFactory.createEmptyBorder(
    20, //top
    30, //left
    30, //bottom
    20) //right
    pane.setLayout(new GridLayout(0, 1));
         pane.add(textFieldLabelVEHNO);
         pane.add(textFieldVEHNO);
         pane.add(textFieldLabelDATEOFLOSS);
         pane.add(textFieldDATEOFLOSS);
         pane.add(textFieldLabelIMAGETYPE);
         pane.add(textFieldIMAGETYPE);
         pane.add(textFieldLabelIMAGEDESC);
         pane.add(textFieldIMAGEDESC);
         pane.add(textFieldLabelCLAIMTYPE);
         pane.add(textFieldCLAIMTYPE);
         pane.add(textFieldLabelDATEOFLOSS);
         pane.add(textFieldDATEOFLOSS);
         pane.add(textFieldLabelUSERID);
         pane.add(textFieldUSERID);
    pane.add(buttonOK);
         pane.add(table);
    //pane.add(label);
    return pane;
    public static void main(String[] args) {
    try {
    UIManager.setLookAndFeel(
    UIManager.getCrossPlatformLookAndFeelClassName());
    } catch (Exception e) { }
    //Create the top-level container and add contents to it.
    JFrame frame = new JFrame("SwingApplication");
    SwingApplication app = new SwingApplication();
    Component contents = app.createComponents();
    frame.getContentPane().add(contents, BorderLayout.CENTER);
    //Finish setting up the frame, and show it.
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    frame.pack();
    frame.setVisible(true);

    Post Author: Ranjit
    CA Forum: Crystal Reports
    Sorry but, i've never seen formula editor for altering position and size. If you know one please navigate me.
    I guess you have updated formula editor beside "Lock size and position" - if yes its not right. There is only one editor beside 4 items and editor is actually for Suppress.
    Anyways, A trick to change size a position is:
    Create 4-5 copies (as many as you expect positions) of the text object. place each at different positions,  right click, Format, Suppress and in formula editor for suppress write the formula: If your condition is true, Suppress=false, else true.
    Position will not change but user will feel; for different conditions -position is changed
    Hope this helps.
    Ranjit

  • Best Practice Buttons? and Swing Button Sizes

    Hi,
    I am wondering what the best way to make a custom styled button was....
    Since I need my own style of button (width,height,background image, selected, clicked) I thought I would use Swing buttons with a Synth style. However, when I place swing buttons inside a CustomNode, all of the button widths, heights, x, y settings are discarded. I can understand the x/y being discarded as the component location should become relative and set by the wrapping CustomNode. I can also understand this because I can set the positions with translateX and translateY. However, I can't see how I can set a width and height of the swing button from inside the CustomNode.
    Can this be done?
    Alternatively, I don't mind using an alternative to the swing button however this is the only button I can see in JavaFX.
    Thanks for reading

    Ok, looks like I can wrap the button's inside a group, stage eta Node wrapper. Then I can preserve the button sizes and can produce relative/translatable positioning of the group/stage. This I understand and find to be a good feature. One thing that does concern me is that with the Swing button's - the Synth styles are not correctly applied. No matter what I do I can not get button text color to change. Changing the background mostly works but the text label styling is completely ignored.

  • How to change font and font size of textarea item

    hi -- I have several form pages which for the most part have text items. However, I do
    have a few textarea items, and the font and font size of these are defaulting to
    something different than the text items.
    How can I change the font and font size of the textarea items, preferably in such a
    way that it will apply to all textarea items in my app?
    (And, to take a step back, where can I find the font and size definitions for these
    items? I assume it's in the CSS (??) but don't really know what to look for.)
    Thanks,
    Carol

    >
    I do have one last thing I'd like to get resolved, if possible. Both the text and textarea items are
    width 100 and height 1, but the textarea is a bit wider and taller than the text item. If possible,
    I'd like to get at least the widths to match exactly, for aesthetics. (There was a much larger
    discrepancy before the size and fonts matched...) Maybe it's just a characteristic of textareas
    that they have that extra bit of width and height... I don't know
    >
    If you look at the generated HTML source you'll see that the APEX width value ends up in 2 different attributes: size for the text field and cols for the textarea. How each of these is transformed into the dimension used to render the control obviously differs, and how either is used will also differ across browsers and platforms. Where you want control over this the best idea appears to be to ignore the width value (APEX lets you blank this out, but resets it to 30 if the definition is subsequently edited) and explicitly set the width property in CSS, as I've now done on your example using HTML Form Element Attributes. This could also be done in a style sheet using the APEX-generated item IDs (P1_TEXT etc) as selectors.
    The APEX height value is only applied to the textarea rows attribute: it has no effect on the text field. Again, how this works will be implementation-specific and is better handled explicity using CSS. (Anyway I'm doubtful about a 1 row high textarea? It doesn't affect the ability to enter more than 1 line of text. Looks confusing.)
    cols and rows are required attributes for textareas, so APEX has to generate the attributes, but we're better off specifying width and height in CSS to override the browser's computed rendering.
    (This is the first time I've put an app on apex.oracle.com... so hopefully it'll be smooth sailing for you.)Apart from not noticing that the region was cached and wondering why my changes weren't having any effect? Thought I was losing it... ;-)
    Edited by: fac586 on Jul 8, 2009 9:14 AM

  • HT5012 I am having difficulty XMIT/REC text messages to family members using Android phones?  I have a 3GB data plan and all switches and buttons are set properly.  Any suggestions?

    I am having difficulty XMIT/REC text messages to family members using Android phones?  I have a 3GB data plan and all switches and buttons are set properly.  Any suggestions?

        Hello APVzW, we absolutely want the best path to resolution. My apologies for multiple attempts of replacing the device. We'd like to verify the order information and see if we can locate the tracking number. Please send a direct message with the order number so we can dive deeper. Here's steps to send a direct message: http://vz.to/1b8XnPy We look forward to hearing from you soon.
    WiltonA_VZW
    VZW Support
    Follow us on twitter @VZWSupport

  • Can you save your own theme and button set up so I can use the same format

    Can you save your own theme and button set up, so I can use this same format for similar content. I want to keep the button content and the theme the same without having to create it everytime? I am trying to streamline the process for multiple dvd's with the same menu and buttons but different content. Does that make sense?

    I am only new to this caper too, but I am pretty sure you can save a theme as a favourite by pressing the "save theme as favourite" button under file. If you have edited an existing theme but don't want to lose it, make sure you untick the replace existing button.

  • Apex listener installed no test and set bind variables buttons

    I have installed Apex listener and while creating restful service module i dont see test and set bind variables buttons in the source region.
    I went through the many posts. Installed apex listener successfully.
    getting http://localhost:8080/ords/ started message when i start the listener.
    and using Apex URL as http://localhost:7780/pls/htmldb.
    What are the possibilities for this issues?
    Please help me on this.
    Thanks
    Chandran

    Apex listener version is 2.0.9
    Apex version is 4.2

  • Purchased a new Apple TV and the remote double clicks each time I press the button. It worked fine during set up and for the first two days.  I have since moved it and this problem started. Restarted,reset,unplugged,change remotes, no change.Help please.

    Purchased a new Apple TV and the remote double clicks each time I press the button. It worked fine during set up and for the first two days.  I have since moved it and this problem started. Restarted,reset,unplugged,changed remotes, no change. Latest software update. This is really annoying.  iPhone remote app works just fine.  Any suggestions?

    That's one of the weird things.. it recognizes it maybe 10% of the time. And usually, only after I do the two-button reset. Problem is.. since it won't charge above 2%, anytime I try to do a restore or anything like that using iTunes, my device shuts off and I lose whatever progress I'd made.
    So, an update... after reading through a bunch of similar complaints (there are literally 1000's of them so there's NO WAY this isn't somehow ios7 related, thanks a lot APPLE ) I decided to try a restore in recovery mode. After 3 hours and several disconnections... I ended up having to just set it up as a new iPad, as the restore did nothing. Weirdly though... as I was doing the restore in recovery mode.. I noticed I'd gotten up to a 10% charge.. higher than it's been since September, so after setting it up as a new device, I turned it off and plugged it in using the wall charger. 2 hours later and I was up to 38%. Still not great, as my iPad, before ios7 could've fully charged twice in the amount of time it took for me to now get 28% more of a charge. And that's with a fully cleaned out device.. so that really ***** and I'm now more confused than ever.
    But I'm gonna leave it overnight charging and see what I come up with tomorrow. Sadly, when I paid $600 for it in February, I never expected to have to play "wait and see" with it...

  • How do I set a default page size, orientation, and printer for a particular document in Pages?

    I have a simple label document in Pages which I print to my label printer. The label is 1.49 x 3.47 inches and needs to print in Landscape, and it needs to print to my Dymo label printer. How do I set up the Page Setup or Print Setup so it defaults to this document size, orientation, and printer, every time, without me having to manually enter those settings every time?

    Thank you for your reply. However, I could not get Templates to work correctly for me.  Following your instructions, I opened my document, opened Page Setup, set the printer, paper size, orientation, and printed a copy to make sure it was right. Then I re-opened Page Setup to verify that the settings were still correct. Then I saved the document as a Template. Then I found my template in Pages, opened the template, and tried to print. The first thing I noticed was that the template did not remember my printer. Then I set the printer, and printed, but I found that the template also did not remember the page size or the document orientation. So, did I miss a step here? Lion 10.7.5 and Mac Mini.

  • What is the best Practice to improve MDIS performance in setting up file aggregation and chunk size

    Hello Experts,
    in our project we have planned to do some parameter change to improve the MDIS performance and want to know the best practice in setting up file aggregation and chunk size when we importing large numbers of small files(one file contains one record and each file size would be 2 to 3KB) through automatic import process,
    below is the current setting in production:-
    Chunk Size=2000
    No. Of Chunks Processed In Parallel=40
    file aggregation-5
    Records Per Minute processed-37
    and we made the below setting in Development system:-
    Chunk Size=70000
    No. Of Chunks Processed In Parallel=40
    file aggregation-25
    Records Per Minute processed-111
    after making the above changes import process improved but we want to get expert opinion making these changes in production because there is huge number different between what is there in prod and what change we made in Dev.
    thanks in advance,
    Regards
    Ajay

    Hi Ajay,
    The SAP default values are as below
    Chunk Size=50000
    No of Chunks processed in parallel = 5
    File aggregation: Depends  largely on the data , if you have one or 2 records being sent at a time then it is better to cluster them together and send it at one shot , instead of sending the one record at a time.
    Records per minute Processed - Same as above
    Regards,
    Vag Vignesh Shenoy

  • Set maximum matrix row and column size

    I hope someone can help me with this. Is there any way to set the row and column size of a matrix control? I have not been able to find a solution. The only way I've been able to set the size is by resetting matrix to its previous state if the user inputs a value outside of the bounds I would like to set. This is done in the 'value changed' event case.
    The matrix is large and therefore I cannot increase the size of the control to be the maximum size and then hide the row and column index controls. These have to be displayed.
    Any suggestions or help would be greatly appreciated. Thanks in advance.

    Here's a quick and dirty way.
    Simply hide the index controls and replace them with some fake numeric controls and set the data range accoding to your requirements.
    In the attached example (LV8.0), the fake index controls are limited to 0..2, the array size is 5x5 and the displayed array portion is 3x3. Seems to work fine.
    (Of course you could add a bit more code to set the limits automatically based on the various sizes.)
    You could also make it more fancy and turn the entire thing into an Xcontrol.
    Message Edited by altenbach on 06-06-2007 05:32 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    LimitArrayControl.vi ‏18 KB

Maybe you are looking for

  • Automatically generated INSERT, UPDATE & DELETE statements

    It appears when you choose this option to configure a data adapter via a SQL statement, the above command objects are generated without parameter names along with unneccessary double quotes all over the command text. Will this be corrected in the PRO

  • Reconciliation account to be chaned to normal gl account

    Hi, Can some guide me whether we can change a reconciliation gl account to normal gl account and guide me how the same can be done and the implications of the same. Regards, Gokul

  • Im so confuse

    I did the recovery mode thing, and it wont get out of recovery mode... how do you do that? (by the way I'm using a 5 gig Zen Micro.)

  • Problems Synchronizing photos

    Hello, I have Synchronozed about 2500 photos to my ipod. When I first did this, the "optomizing Photos" part took about 3 hours, which was okay because there was so many. However, now, even if add one new photo to my folder, Itunes wants to optomize

  • Exceution time in QP_LIST_LINES_V

    Dear all, I have query, I have to compare an item in 2 price list in QP_LIST_LINES_V table, and if the item is not there in destination price list then I have to insert a record in the destination price list. As you all would know the product_attribu