How to swt scroll in the textarea?

Hi to all.
I can't figure out how to set scrollbars at my textarea text1.
Can anyone help me out?
Thanks in advance
I attach her bellow my application:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.lang.*;
public class EDS_SIM
   JButton  button1 = new JButton(" EOTS SIMULATION");
   JButton  button2 = new JButton("METEO STATION SIMULATION");
   JButton  button3 = new JButton("Exit Simulation");
   JTextArea text1 = new JTextArea("SIMULATION PROGRAM STATUS.........",10,100);
   JTextArea text2 = new JTextArea();
   public EDS_SIM()
     super();
     //Create a panel as a container
     JPanel panel1 = new JPanel(null);
     Color mycolor=new Color(50,0,255,200);
     panel1.setBackground(mycolor);
     //Create a frame
     JFrame.setDefaultLookAndFeelDecorated(true);
     String title = "E . D . S .";
     JFrame frame = new JFrame(title);
     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     frame.setBounds(100,80,200,50);
     //setting an image to the frame
     Image icon = Toolkit.getDefaultToolkit().getImage("icona.gif");
     frame.setIconImage(icon);
     frame.add(panel1);
     text2.setBackground(mycolor);
     text2.setForeground(Color.WHITE);
     text2.setBounds(80,10,500,20);
     Font myfont=new Font("Verdana", 3,16);
     text2.setFont(myfont);
     text2.setText("PROGRAM FOR THE SIMULATION OF EXTERNAL DEVICES");
     text2.setEditable(false);
     panel1.add(text2);
     text1.setBackground(Color.BLACK);
     text1.setForeground(Color.WHITE);
     text1.setBounds(80,100,530,150);
     text1.setEditable(false);
     panel1.add(text1);
    button1.setForeground(Color.BLUE);
    button1.setBounds(80, 300, 200, 50);
    panel1.add(button1);
    button2.setForeground(Color.BLUE);
    button2.setBounds(350, 300, 260, 50);
    panel1.add(button2);
    button3.setForeground(Color.RED);
    button3.setBounds(460, 400, 150, 50);
    panel1.add(button3);
    Action_EOTS action1 =new Action_EOTS();
    Action_MS action2 =new Action_MS();
    ExitAction action3 =new ExitAction();
    button1.addActionListener(action1);
    button2.addActionListener(action2);
    button3.addActionListener(action3);
    // Create a horizontal progress bar
    int width = 650;
    int height = 500;
    frame.setSize(width, height);
    frame.setVisible(true);
    public class Action_EOTS implements ActionListener {
        public void actionPerformed(ActionEvent evt) {
              button1.setEnabled(false);
              EOTS eots_sim = new EOTS(text1);
              text1.setText("EOTS Simulation is running\n");
     public class Action_MS implements ActionListener {
        public void actionPerformed(ActionEvent evt) {
              button2.setEnabled(false);
              MS eots_sim = new MS(text1);
              text1.append("Meteo Sation Simulation is running\n");
  public class ExitAction implements ActionListener {
        public void actionPerformed(ActionEvent evt) {
             System.exit(0);
   public static void main(String argv[])
      EDS_SIM window = new EDS_SIM();
}import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class EOTS
JButton button3 = new JButton("Close Simulation");
//Create a frame
String title = "EOTS SIMULATION";
JFrame frame = new JFrame(title);
JTextArea text12 = new JTextArea();
public EOTS(JTextArea text1)
//Create a panel as a container
JPanel panel1 = new JPanel(null);
Color mycolor=new Color(0,0,150,200);
panel1.setBackground(mycolor);
//Create a frame
JFrame.setDefaultLookAndFeelDecorated(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setBounds(50,600,80,50);
//setting an image to the frame
Image icon = Toolkit.getDefaultToolkit().getImage("icona.gif");
frame.setIconImage(icon);
frame.add(panel1);
button3.setForeground(Color.RED);
button3.setBounds(200, 100, 200, 50);
panel1.add(button3);
text12=text1;
text12.setAutoscrolls(true);
ExitAction action3 =new ExitAction();
button3.addActionListener(action3);
// Create a horizontal progress bar
int width = 500;
int height = 200;
frame.setSize(width, height);
frame.setVisible(true);
public class ExitAction implements ActionListener {
public void actionPerformed(ActionEvent evt) {
frame.setVisible(false);
// If the frame is no longer needed, call dispose
frame.dispose();
text12.append("EOTS HAS FINISHED THE SIMULATION\n");
text12.append("0123456789qwertyuiopasdfghjklzxcvbnm0123456789qwertyuiopasdfghjklzxcvbnm0123456789qwertyuiopasdfghjklzxcvbnm0123456789\n");
text12.append("3\n");
text12.append("4\n");
text12.append("5\n");
text12.append("6\n");
text12.append("7\n");
text12.append("8\n");
text12.append("9\n");
text12.append("10\n");
text12.append("11\n");
text12.append("12\n");
text12.append("13\n");
text12.append("14\n");
text12.append("15\n");
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class MS
   JButton  button3 = new JButton("Close Simulation");
   //Create a frame
     String title = "MS SIMULATION";
     JFrame frame = new JFrame(title);
     JTextArea text12 = new JTextArea();
   public MS(JTextArea text1)
     //Create a panel as a container
     JPanel panel1 = new JPanel(null);
     Color mycolor=new Color(0,0,150,200);
     panel1.setBackground(mycolor);
     //Create a frame
     JFrame.setDefaultLookAndFeelDecorated(true);
     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     frame.setBounds(600,600,400,50);
     //setting an image to the frame
     Image icon = Toolkit.getDefaultToolkit().getImage("icona.gif");
     frame.setIconImage(icon);
     frame.add(panel1);
    button3.setForeground(Color.RED);
    button3.setBounds(200, 100, 200, 50);
    panel1.add(button3);
    text12=text1;
     text12.setAutoscrolls(true);
    ExitAction action3 =new ExitAction();
    button3.addActionListener(action3);
    // Create a horizontal progress bar
    int width = 500;
    int height = 200;
    frame.setSize(width, height);
    frame.setVisible(true);
  public class ExitAction implements ActionListener {
        public void actionPerformed(ActionEvent evt) {
            frame.setVisible(false);
            // If the frame is no longer needed, call dispose
            frame.dispose();
            text12.append("METEO STATION HAS FINISHED THE SIMULATION\n");  
}

Put the JTextArea into a JScrollPane.

Similar Messages

  • How to Align Text in the TextArea

    How to Align text in the TextArea. My purpose is that I want to post the records after retrieving from database. All the records in each fields should keep aligned like Oracle WorkSheet.
    I want this way
    Code Name Place City
    a01 nilopher swiss street japan
    a02 rozina lovely street aus
    a03 benazir king's camp pitsburg
    and the out put should not look like this :-
    Code Name Place City
    a01 nilopher swiss street japan
    a02 rozina lovely street aus
    a03 benazir king's camp pitsburg
    here place and city records are getting disturbed accordingly the length of name.

    Well, first off (if it's not default, that is) you must set a monospaced font on the TextArea, unless you want to count pixelwidth of each and every string and then do an estimate on how many fill blanks you want...
    If you have the each string as a line, you use a StringTokenizer on it, extract each token, put all the tokens for that line into an array of strings.
    When every line is done, you compare the length of the nth String of each array and save the highest numbers.
    Then you reassemble each line from the arrays and pad in spaces where the tokens are too short.
    HTH,
    Fredrik

  • How can I scroll down the top menu list and then the sub-menu lists when the iPod click wheel is broken?

    I have an iPod Classic 4th Generation and my click wheel connection is broken and so does not work. I can still play music on my Bose dock station but I cannot choose which album I want to play because I cannot scroll down the playlists.  I can just play the first tune in the list or from where I last paused a tune. Is there a way to scroill down the list, including the top menu list, without using the click wheel?

    Index Values, I think, is the property you are looking for.  Set the index to 0 to be at the top.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How do i scroll in the lightbeam add on?

    i am unable to scroll to the bottom of the list to see the end of the 123 third parties list also cant get to the block hide functions.. is this a glitch in the program or am i missing something? also the graph appears just off screen in the bottom is that normal, i have to drag it to the middle of the screen every time i view it...

    Hi rayl82,
    Please contact the Light Beam add on developer for more information on this compatibility.

  • How do you scroll to the next page in apps when it says "1-9 of 20"?

    I am new to using an iPad.  I have been tyring to load some free apps.  When looking for apps, it might say "1-9of 20", then "View all".  When I hit view all, it only shows me 12 apps.  How do you get to the others? 

    'L-R'  you mean right to left, starting the side where it has the little box at the top 'Sort by" - This is for the multi app view (1-9 of 20) you mentioned.
    If already on an individaul Apps page you have to quit back by tapping the box in the top left corner marked 'Search'.  Note that default view is to display both iPad and iphone and selecting one or the other individually may result in less than the original total, dependent on availability for that device.
    Use just one finger place it on the screen then draw it across the screen - avoid tapping as this selects.
    Best regards, Ct

  • How do you scroll to the end of the address line (url)?

    This has been a frustration for me because there are times I need to erase part of the end, or add to the end.  If I have to erase, I don't want to start in the middle and let it scroll to me as I delete because most of the time, I'm deleting parts that I want to keep.  And I need to be able to add to the end, for example, when I'm searching for the date a web article was written.
    This may have a simple answer because I've searched for this for awhile and I can't find anyone who has this problem. So, I may be a dummy but I really need to know how to do this.  Thanks for your help.

    Snickersnake wrote:
    I don't want to start in the middle and let it scroll to me
    I know of no other way to do it. I tap and hold down until the magnifying glass pops up and then move the magnifying glass all the way to the right to get to the end of the address. I have never found another way to do it.
    This may have a simple answer because I've searched for this for awhile and I can't find anyone who has this problem. So, I may be a dummy but I really need to know how to do this. 
    I wish there was another answer. I guess we must both be dummies because I can't figure another way to do it either in Safari.
    Actually, my solution is to not use Safari. I don't like it and I never did. It is faster than any other iOS browser that I have tried, and I have tried about 8 of them. I keep 6 of them on my iPad and I use iCab Mobile 99.9% of the time. I only use Safari when and if I have to - like when you click on a link in an email and Safari launches as the default browser. Safari pales in comparison when comparing features with other browsers....but I digress.

  • Anyone else miss how you could scroll through the pictures in events?

    Anyone else miss how you could run the cursor over the pictures in their events and you could see all of them like flipping pages in a book?  Not a huge fan of the new photos.  I hope Apple brings some of the old features back.

    That was called scrubbing.
    http://www.apple.com/feedback/photos.html is the place for feature requests and feedback

  • How can I scroll all the way down in my inbox? There is no down arrow on the right side after severl e-mails are read.

    When reading my e-mail after about 20 or so I can't go down any farther. There is no arrow to scroll down on the right side of the screen. I have to delete some messages in order to go on down the mail list.

    And attached is a screen grab showing selected e-mails in the Inbox...the white space below are e-mails too!

  • How to scroll to the top of the page?

    How do I scroll to the top of a page in the browser? On very long pages, the address bar can not be easily reached. I have to scroll up until I get to the top to access the address bar and tabs.
    Phone: One touch fire e, 6015x, OS version: FFOS 2.0.0.0, Firmware version: 03 004, hardware version: 08, plattform: 32.0, update-channel: release-tcl-TEF-DE.
    i can reproduce this after a factory reset. i also can provide a video to prove, if demanded.

    Hi Tom,
    I fear that this is the expected behaviour in FFOS 2.0 browser. It is really annoying, of course, and hopefully it will be addressed and corrected in the following releases.

  • JScrollPane - scrolling to the top

    Hello,
    I have packed JTextArea in JScrollPane. Now when I append long text to JTextArea, it shows the bottom line of the text.
    How to programatically scroll to the top of text area after text update?
    Roberts

    try with "textArea.setCaretPosition(0);"
    Greetings,
    Marco

  • How do you scroll?

    How do you scroll on the MacPro laptop?

    Also if you look at General settings for visible scrollbars
    >System Preferences>General

  • How can I hide the scroll bar in TextArea?

    How can I hide the scroll bar in TextArea?

    Hi. To remove the horizontal scrollbar you can do this:
    textArea.setWrapText(true);
    To remove the vertical scrollbar you can do this:
    ScrollBar scrollBarv = (ScrollBar)ta.lookup(".scroll-bar:vertical");
    scrollBarv.setDisable(true);  and set the opacity to 0 in the css file:
    //css file
    .text-area .scroll-bar:vertical:disabled {
        -fx-opacity: 0;
    }Here is an example:
    import javafx.application.Application;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Node;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.ContextMenu;
    import javafx.scene.control.MenuItem;
    import javafx.scene.control.ScrollBar;
    import javafx.scene.control.TextArea;
    import javafx.scene.input.ContextMenuEvent;
    import javafx.scene.layout.StackPane;
    import javafx.stage.Stage;
    public class TextAreaSample extends Application {
        @Override
        public void start(Stage primaryStage) {
        final TextArea textArea = new TextArea();
            textArea.setWrapText(true);
            StackPane root = new StackPane();
            root.getChildren().add(textArea);
            Scene scene = new Scene(root, 300, 250);
            primaryStage.setScene(scene);
            primaryStage.show();
            scene.getStylesheets().add(getClass().getResource("style.css").toExternalForm());
            ScrollBar scrollBarv = (ScrollBar)textArea.lookup(".scroll-bar:vertical");
            scrollBarv.setDisable(true);
        public static void main(String[] args) {
            launch(args);
    }

  • Can scroller in s:TextArea appear to the left?

    Hi,
    I need to get the scroller of TextArea (in spark) to appear according to the writing language.
    i.e: Scroller to the RIGHT at LTR languages, and scroller to the LEFT in RTL languages.
    Right now it looks the scroller is hardcoded to the be at the right.
    I've done some investigations and found suggestion of how to do similar thing in Sparks Lists (Changing the s:Scroller in the skin class to s:VScrollBar), but this way the scroll is permanent, and I need the regular scroller in textArea behaviour - That scroller is added only when text overFlows the size.
    Any idea how to do it?

    Thanks dzeikei ,
    i think you ar right, and  "add the scrollbar manually to the TextArea skin and hide it as needed" is probably easier than changing the scroller class, but this also seems complicated enough..
    Did you try doing this yourself? Do you have any example of something like it?
    Also I've seen that in Flex 4.1 there is the Mirroring feature. Looks like it can do the works, but I didn't try that yet, cause we are still working with 4.0.
    Did anyoune else try that?
    Thanx.

  • Add scroll bars to TextArea - how?

    I have an application which reads user input to a text file and then on click of JButDisplay reads the contents of the file to a TextArea.
    Problem is I can't seem to get scroll bars onto the TextArea, I tried using JScrollPane,
    but had no luck (I'm using gridBagLayout)
    Could someone please advise me how to add scrollbars to this component?
    TADisplay2 = new JTextArea(10,20);     
                   c.ipadx = 12;
                   c.ipady = 12;
                        c.gridx = 2;
                        c.gridy=18;
                        c.gridwidth = 2;   //2 columns wide
                        c.gridheight = 4;
                             gridbag.setConstraints(TADisplay2, c);
                             contentPane.add(TADisplay2);

    1) Create scrollPanel
    2) Make it fill your content pane (or whatever area you wish to cover)
    3) Add your textArea to the scrollpanel

  • How can i scroll vertically without the little black box?

         Hello,
    I need to review alot of pdf documents with adobe reader 9.0 or acrobat pro, and i need to be able to move forward and backward fast alot using both the mouse wheel and the scroll bar. I'm having a problem with this.
    When i click "show one page at a time"-button and I use the scroll bar in the right, reader doesnt scroll the through the pages, but instead shows an idiotic little black box on the right thats too small to see pretty much anything from.
    If i use the "scroll through pages continuously"-button, the scroll bar works normally, but the mouse wheel works too slow.
    Using the reader in either way feels like running with a ball and chain in my leg, and I do really believe im not the only one.
    Despite of hours of searching, trial and error I've somehow managed to miss how to remove that black pop-up-thing and scroll normally, when using the "show one page at time".
    Please tell me I can scroll normally with scroll bar while being able to move fast with the wheel, and how do I do it?

    Thanks.
    What i mean in brief:
    In adobe reader you cannot live-scroll with the scroll bar when using the "show one page at a time" setting, but instead it shows a little thumbnail-window on the right. The other setting makes mouse wheel too slow to be useful.
    A scroll bar that doesn't live-scroll is probably one of the most horrible "features" you can have in a program. Since it's in a program as common as adobe reader, im guessing there's alot of frustrated googling going on about it.No answers around though.

Maybe you are looking for

  • How do I set the folder to which temporary files are saved?

    As of now, whenever I click "Open with..." when downloading a file, a copy of that file saves to my desktop and never gets cleared. I'd like to set the temporary folder so I can manually clear it periodically, but the only file management option I se

  • How to view added rows in table; there is a horizontal line below which any added rows disppear!  Pages version 5.1 which I DESPISE!!!!

    I just replaced Pages after paying Apple $400+ for replacing a wiped-out hard-drive.... MANY HORRIBLE QUIRKS with Pages 5.1... the one I listed above.....it's as if there is only one page....I can't see any added rows in the table below this arbitrar

  • Could not resolve ejbLink

    When I deploy my ejb in weblogic, I am getting the following exception. Can anybody tell me what may be the reason for this. The stace trace is Unable to deploy EJB: TheShoppingClientController from petstoreEjb.jar: weblogic.deployment.EnvironmentExc

  • Greatly reduced action performance in CS5

    The bug issue text below wouldn't fit in the bug report form even though it's less than 2000 characters (another bug, perhaps?) ******BUG****** Concise problem statement:  reduced performance in Action processing in CS5 compared to CS3 Steps to repro

  • Transaction keys and debit/credit indicator.

    Hello Gurus, The transaction key '000' is a receipt. so it should have only 's' or 'h' for the 0dcindic(debit/credit indicator) field. but in one record i see transaction key '000' and dcindicator 's' and in some other record, i see transaction key '