Select problem in the JTextArea

Hi
I have a problem on the select(), I am trying to select multiple lines of text in the JTextArea, but select(int start, int end) can only select single line, int end will be cut to the length of the line instead of going to the next line. Can anyone give me any advice?
Thanks in advance

DefaultHighlighter highlighter = (DefaultHighlighter)textArea.getHighlighter();
highlighter.setDrawsLayeredHighlights(false);

Similar Messages

  • Problem with the JTextArea

    I'm using the swing packege 1.1 and having some problem when trying to limit the number of character per line in a JTextArea component.
    I want the JTextArea to change line when a certain number of character are typed in one of these lines.
    Any idea?
    thank you all.

    Do you mean you want to set the number of characters per line for example to 20 so all the lines in the JTextArea will hold only 20 characters? If so, this code shows a way to do it. If you use a fixed-width font, as in the example, all lines will hold the same number of characters. If you use a variable-width font, you could have lines with slightly more or slightly fewer characters, depending on what the user enters. The frame must not be resized.
          int chars_per_line=20;
          JFrame jf=new JFrame();
          JTextArea jta=new JTextArea(24,chars_per_line);
          jta.setFont(new Font("Courier",Font.PLAIN,14));
          jta.setLineWrap(true);
          jf.getContentPane().add(jta);
          jf.pack();
          jf.setResizable(false);
          jf.setVisible(true);

  • Selection problem in rendered JtextArea.

    I create a jtable by rendering one column using jTextarea. While selecting the row, color of selection not geting to the rendered Jtextarea. How can i solve this problem.
    please help me

    Do you include code in your getTableCellRendererComponent method to change
    the color depending on if the row is selected or not? You'll need something like
         if ( isSelected ) {
              setForeground( table.getSelectionForeground() );
              setBackground( table.getSelectionBackground() );
         } else {
              setForeground( table.getForeground() );
              setBackground( table.getBackground() );
         }: jay

  • Selecting Text in a JTextArea

    Hi, I have this problem with the JTextArea Caret positioning behaviour.
    I wanna select some text when I click (click, no dragging included) on a line. I use setcaretposition in the beggining of the line and movecaretposition in the end of the line.
    Nothing happens!!
    If I click the mouse and drag it a little bit then it works fine selecting the text showing the right colors and everything.
    I tried with the addhighlight method in the higlighter instance of JTextArea but it doesn't really select it, just changes it color.
    What do I have to do so that I can select text without having to drag when I click??
    Thaks a lot

    This shows you how to do it using a right click:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.text.*;
    public class TextAreaTest extends JFrame
         JTextArea textArea;
         JScrollPane scrollPane;
         public TextAreaTest()
              textArea = new JTextArea( "one two\nthree four", 10, 30 )
                   //  the tab character is not inserted into the text area
                   public boolean isManagingFocus()
                        return false;
              textArea.setLineWrap( true );
              textArea.setSize( textArea.getPreferredSize() );
              textArea.setSelectionColor( Color.red );
              textArea.setSelectedTextColor( Color.green );
              try
                   System.out.println( textArea.modelToView( 4 ) );
                   System.out.println( Utilities.getRowStart(textArea, 4) );
              catch (Exception e) {}
              textArea.addMouseListener( new MouseAdapter()
                   public void mouseClicked(MouseEvent e)
                        if ( SwingUtilities.isRightMouseButton(e) )
                             try
                                  int offset = textArea.viewToModel( e.getPoint() );
                                  System.out.println( textArea.modelToView( offset ) );
                                  int start = Utilities.getWordStart(textArea, offset);
                                  int end = Utilities.getWordEnd(textArea, offset);
                                  String word = textArea.getDocument().getText(start, end-start);
                                  System.out.println( "Selected word: " + word );
                                  int rowStart = Utilities.getRowStart(textArea, offset);
                                  int rowEnd = Utilities.getRowEnd(textArea, offset);
                                  System.out.println( "Row start offset: " + rowStart );
                                  System.out.println( "Row end   offset: " + rowEnd );
                                  textArea.select(rowStart, rowEnd);
                             catch (Exception e2) {}
              textArea.addCaretListener( new CaretListener()
                   public void caretUpdate(CaretEvent e)
                        int caretPosition = textArea.getCaretPosition();
                        Element root = textArea.getDocument().getDefaultRootElement();
                        int row = root.getElementIndex( caretPosition );
                        int column = caretPosition - root.getElement( row ).getStartOffset();
                        System.out.println( "Row   : " + ( row + 1 ) );
                        System.out.println( "Column: " + ( column + 1 ) );
              textArea.addKeyListener( new KeyAdapter()
                   public void keyPressed(KeyEvent e)
                        System.out.println( textArea.getDocument().getDefaultRootElement().getElementCount() );
              scrollPane = new JScrollPane( textArea );
              getContentPane().add( scrollPane );
              getContentPane().add( new JTextField(10),BorderLayout.SOUTH );
    //          textArea.getInputMap().put( KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "" );
         public static void main(String[] args)
              TextAreaTest frame = new TextAreaTest();
              frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
              frame.pack();
              frame.setVisible(true);
    }

  • Problem in updating jtextarea

    My requirement is, client has to sent string messages and server has to receive these messages and display it in jtextarea. In my code sending and receiving are done properly, but the problem is the jtextarea is not updated, it goes blank.
    I have attached the client and server files, can anyone solve my problem?
    Thanks in advance.
    //server file
    import java.net.*;
    import java.io.*;
    import javax.swing.*;
    import javax.swing.text.*;
    import javax.swing.event.*;
    import java.util.*;
    import java.text.*;
    import java.awt.*;
    import java.awt.event.*;
    public class MessageCenter extends javax.swing.JFrame {
        public MessageCenter() {
            initComponents();
        private void initComponents() {
            jLabel1 = new JLabel();
            jScrollPane1 = new JScrollPane();
            jTextArea1 = new JTextArea();
            jPanel1 = new JPanel();
            jLabel5 = new JLabel();
            jLabel3 = new JLabel();
            jButton1 = new JButton();
            jButton2 = new JButton();
            jLabel2 = new JLabel();
            jLabel4 = new JLabel();
            menuBar = new JMenuBar();
            fileMenu = new JMenu();
            Start = new JMenuItem();
            jSeparator1 = new JSeparator();
            Stop = new JMenuItem();
            jSeparator2 = new JSeparator();
            Exit = new JMenuItem();
            setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            setTitle("Message Center");
            setMaximizedBounds(new java.awt.Rectangle(0, 0, 560, 700));
            setBounds(0,0,600,700);
            setName("");
            jLabel1.setBackground(new java.awt.Color(255, 255, 255));
            jLabel1.setFont(new java.awt.Font("Georgia", 1, 24));
            jLabel1.setForeground(new java.awt.Color(34, 44, 106));
            jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
            jLabel1.setText("Message Center");
            jLabel1.setIconTextGap(0);
            getContentPane().add(jLabel1, java.awt.BorderLayout.NORTH);
            jTextArea1.setColumns(20);
            jTextArea1.setFont(new java.awt.Font("Book Antiqua", 0, 12));
            jTextArea1.setLineWrap(true);
            jTextArea1.setRows(25);
            jTextArea1.setBorder(null);
            jScrollPane1.setViewportView(jTextArea1);
            getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);
            jPanel1.setLayout(new java.awt.GridLayout(1, 6, 10, 5));
            jPanel1.add(jLabel5);
            jPanel1.add(jLabel3);
            jButton1.setText("Start");
            jPanel1.add(jButton1);
            jButton2.setText("Stop");
            jPanel1.add(jButton2);
            jPanel1.add(jLabel2);
            jPanel1.add(jLabel4);
            getContentPane().add(jPanel1, java.awt.BorderLayout.SOUTH);
            fileMenu.setText("File");
            Start.setText("Start");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    System.out.println("hello");
                    StartActionPerformed(evt);
            fileMenu.add(Start);
            fileMenu.add(jSeparator1);
            Stop.setText("Stop");
            jButton2.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    StopActionPerformed(evt);
            fileMenu.add(Stop);
            fileMenu.add(jSeparator2);
            Exit.setText("Exit");
            fileMenu.add(Exit);
            menuBar.add(fileMenu);
            setJMenuBar(menuBar);
            pack();
    private void StartActionPerformed(java.awt.event.ActionEvent evt)  {
              try{
                        Server t=new Server(jTextArea1);
                        t.listenSocket();
              catch(Exception e)
              e.printStackTrace();
        private void StopActionPerformed(java.awt.event.ActionEvent evt) {
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new MessageCenter().setVisible(true);
        private JMenuItem Exit;
        private JMenuItem Start;
        private JMenuItem Stop;
        private JMenu fileMenu;
        private JButton jButton1;
        private JButton jButton2;
        private JLabel jLabel1;
        private JLabel jLabel2;
        private JLabel jLabel3;
        private JLabel jLabel4;
        private JLabel jLabel5;
        private JPanel jPanel1;
        private JScrollPane jScrollPane1;
        private JSeparator jSeparator1;
        private JSeparator jSeparator2;
        public JTextArea jTextArea1;
        private JMenuBar menuBar;
    class ClientThread implements Runnable {
      private Socket client;
      JTextArea jt;
      ClientThread(Socket client,JTextArea jt) {
       this.client = client;
       this.jt=jt;
      public void run(){
        try{
               //DataInputStream dis= new DataInputStream(client.getInputStream());
                DataInputStream dis= new DataInputStream(new BufferedInputStream(client.getInputStream()));
               System.out.println("client connected");
               //BufferedReader dis = new BufferedReader(new InputStreamReader(s.getInputStream()));
                   String msg=null;
                   byte msg1[]=new byte[200];
                while(true)
                   try{
                   if(dis.available()>0)
                   dis.readFully(msg1,0,dis.available());
                 //  System.out.println("Msg is ==> "+new String(msg1));
                   new PrinterThread(jt,new String(msg1)).start();
                   msg1=new byte[200];
                   Thread.sleep(1000);
                      }catch (Exception e) {
                         System.out.println("Exception  ");
             } catch (IOException e) {
                         System.out.println("Exception occurred");
    class Server {
              JTextArea jt;
              public Server(JTextArea jt)
                   this.jt=jt;
              public void listenSocket() throws Exception
              ServerSocket ss=null;
              try{
              ss=new ServerSocket(8000);
              System.out.println("Server started");
             catch (IOException e) {
                         System.out.println("Exception");
                         System.exit(-1);
             while(true){
               ClientThread w;
               try{
            w = new ClientThread(ss.accept(),jt);
            Thread t = new Thread(w);
            t.start();
                catch (IOException e) {
            System.out.println("Accept failed: 8000");
           public static void main(String args[])throws Exception {
              /*Server t=new Server();
              t.listenSocket();*/
         class PrinterThread extends Thread
                public PrinterThread(JTextArea jt1,String msg)
                 jTextArea1 = jt1;
                 this.msg=msg;
                 System.out.println("PrinterThread constructor ");
                public void run()
                 try
                    Date today;
                    SimpleDateFormat formatter;
                    String output;
                     String pattern="dd.MM.yyyy '@' H:mm";
                    formatter = new SimpleDateFormat(pattern);
                    today = new Date();
                    output = formatter.format(today);
                        System.out.println(" "+output+"  "+msg+" \n");
                          jTextArea1.append(" "+output+"  "+msg+" \n");
                          jTextArea1.updateUI();
                             jTextArea1.revalidate();
    //                      JOptionPane.showMessageDialog(null,"hi");
                          //System.out.println("Get text "+jTextArea1.getText());
                 catch (Exception exception) {}
                private JComboBox combo;
                private JTextArea jTextArea1;
                String msg=null;
    //client.java
    import java.net.*;
    import java.io.*;
    import java.io.File;
    public class client {
           public static void main(String args[]) {
                   try {
                           Socket ss=new Socket(InetAddress.getLocalHost(),8000);
                           DataOutputStream dos=new DataOutputStream(ss.getOutputStream());
                           for(int i=1;i<100;i++){
                              if((i%2)==0)
                            dos.writeBytes("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,3233");
                              else
                            dos.writeBytes("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42");
                           Thread.sleep(5000);
                   catch(Exception e) {
                   e.printStackTrace();
                   System.out.println(" ");
    }

    You need to run your Server in a separate Thread.
    Right now its running in the GUI Event Thread.I created new thread for my server, now it's updating jtextarea.
    Thank you very much.

  • Problem in repainting jtextarea

    My requirement is, client has to sent string messages and server has to receive these messages and display it in jtextarea. In my code sending and receiving are done properly, but the problem is the jtextarea is not updated, it goes blank.
    I have attached the client and server files, can anyone solve my problem?
    Thanks in advance.
    //server file
    import java.net.*;
    import java.io.*;
    import javax.swing.*;
    import javax.swing.text.*;
    import javax.swing.event.*;
    import java.util.*;
    import java.text.*;
    import java.awt.*;
    import java.awt.event.*;
    public class MessageCenter extends javax.swing.JFrame {
        public MessageCenter() {
            initComponents();
        private void initComponents() {
            jLabel1 = new JLabel();
            jScrollPane1 = new JScrollPane();
            jTextArea1 = new JTextArea();
            jPanel1 = new JPanel();
            jLabel5 = new JLabel();
            jLabel3 = new JLabel();
            jButton1 = new JButton();
            jButton2 = new JButton();
            jLabel2 = new JLabel();
            jLabel4 = new JLabel();
            menuBar = new JMenuBar();
            fileMenu = new JMenu();
            Start = new JMenuItem();
            jSeparator1 = new JSeparator();
            Stop = new JMenuItem();
            jSeparator2 = new JSeparator();
            Exit = new JMenuItem();
            setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            setTitle("Message Center");
            setMaximizedBounds(new java.awt.Rectangle(0, 0, 560, 700));
            setBounds(0,0,600,700);
            setName("");
            jLabel1.setBackground(new java.awt.Color(255, 255, 255));
            jLabel1.setFont(new java.awt.Font("Georgia", 1, 24));
            jLabel1.setForeground(new java.awt.Color(34, 44, 106));
            jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
            jLabel1.setText("Message Center");
            jLabel1.setIconTextGap(0);
            getContentPane().add(jLabel1, java.awt.BorderLayout.NORTH);
            jTextArea1.setColumns(20);
            jTextArea1.setFont(new java.awt.Font("Book Antiqua", 0, 12));
            jTextArea1.setLineWrap(true);
            jTextArea1.setRows(25);
            jTextArea1.setBorder(null);
            jScrollPane1.setViewportView(jTextArea1);
            getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);
            jPanel1.setLayout(new java.awt.GridLayout(1, 6, 10, 5));
            jPanel1.add(jLabel5);
            jPanel1.add(jLabel3);
            jButton1.setText("Start");
            jPanel1.add(jButton1);
            jButton2.setText("Stop");
            jPanel1.add(jButton2);
            jPanel1.add(jLabel2);
            jPanel1.add(jLabel4);
            getContentPane().add(jPanel1, java.awt.BorderLayout.SOUTH);
            fileMenu.setText("File");
            Start.setText("Start");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    System.out.println("hello");
                    StartActionPerformed(evt);
            fileMenu.add(Start);
            fileMenu.add(jSeparator1);
            Stop.setText("Stop");
            jButton2.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    StopActionPerformed(evt);
            fileMenu.add(Stop);
            fileMenu.add(jSeparator2);
            Exit.setText("Exit");
            fileMenu.add(Exit);
            menuBar.add(fileMenu);
            setJMenuBar(menuBar);
            pack();
    private void StartActionPerformed(java.awt.event.ActionEvent evt)  {
              try{
                        Server t=new Server(jTextArea1);
                        t.listenSocket();
              catch(Exception e)
              e.printStackTrace();
        private void StopActionPerformed(java.awt.event.ActionEvent evt) {
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new MessageCenter().setVisible(true);
        private JMenuItem Exit;
        private JMenuItem Start;
        private JMenuItem Stop;
        private JMenu fileMenu;
        private JButton jButton1;
        private JButton jButton2;
        private JLabel jLabel1;
        private JLabel jLabel2;
        private JLabel jLabel3;
        private JLabel jLabel4;
        private JLabel jLabel5;
        private JPanel jPanel1;
        private JScrollPane jScrollPane1;
        private JSeparator jSeparator1;
        private JSeparator jSeparator2;
        public JTextArea jTextArea1;
        private JMenuBar menuBar;
    class ClientThread implements Runnable {
      private Socket client;
      JTextArea jt;
      ClientThread(Socket client,JTextArea jt) {
       this.client = client;
       this.jt=jt;
      public void run(){
        try{
               //DataInputStream dis= new DataInputStream(client.getInputStream());
                DataInputStream dis= new DataInputStream(new BufferedInputStream(client.getInputStream()));
               System.out.println("client connected");
               //BufferedReader dis = new BufferedReader(new InputStreamReader(s.getInputStream()));
                   String msg=null;
                   byte msg1[]=new byte[200];
                while(true)
                   try{
                   if(dis.available()>0)
                   dis.readFully(msg1,0,dis.available());
                 //  System.out.println("Msg is ==> "+new String(msg1));
                   new PrinterThread(jt,new String(msg1)).start();
                   msg1=new byte[200];
                   Thread.sleep(1000);
                      }catch (Exception e) {
                         System.out.println("Exception  ");
             } catch (IOException e) {
                         System.out.println("Exception occurred");
    class Server {
              JTextArea jt;
              public Server(JTextArea jt)
                   this.jt=jt;
              public void listenSocket() throws Exception
              ServerSocket ss=null;
              try{
              ss=new ServerSocket(8000);
              System.out.println("Server started");
             catch (IOException e) {
                         System.out.println("Exception");
                         System.exit(-1);
             while(true){
               ClientThread w;
               try{
            w = new ClientThread(ss.accept(),jt);
            Thread t = new Thread(w);
            t.start();
                catch (IOException e) {
            System.out.println("Accept failed: 8000");
           public static void main(String args[])throws Exception {
              /*Server t=new Server();
              t.listenSocket();*/
         class PrinterThread extends Thread
                public PrinterThread(JTextArea jt1,String msg)
                 jTextArea1 = jt1;
                 this.msg=msg;
                 System.out.println("PrinterThread constructor ");
                public void run()
                 try
                    Date today;
                    SimpleDateFormat formatter;
                    String output;
                     String pattern="dd.MM.yyyy '@' H:mm";
                    formatter = new SimpleDateFormat(pattern);
                    today = new Date();
                    output = formatter.format(today);
                        System.out.println(" "+output+"  "+msg+" \n");
                          jTextArea1.append(" "+output+"  "+msg+" \n");
                          jTextArea1.updateUI();
                             jTextArea1.revalidate();
    //                      JOptionPane.showMessageDialog(null,"hi");
                          //System.out.println("Get text "+jTextArea1.getText());
                 catch (Exception exception) {}
                private JComboBox combo;
                private JTextArea jTextArea1;
                String msg=null;
    //client.java
    import java.net.*;
    import java.io.*;
    import java.io.File;
    public class client {
           public static void main(String args[]) {
                   try {
                           Socket ss=new Socket(InetAddress.getLocalHost(),8000);
                           DataOutputStream dos=new DataOutputStream(ss.getOutputStream());
                           for(int i=1;i<100;i++){
                              if((i%2)==0)
                            dos.writeBytes("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,3233");
                              else
                            dos.writeBytes("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42");
                           Thread.sleep(5000);
                   catch(Exception e) {
                   e.printStackTrace();
                   System.out.println(" ");
    }

    You need to run your Server in a separate Thread.
    Right now its running in the GUI Event Thread.I created new thread for my server, now it's updating jtextarea.
    Thank you very much.

  • After download and installation of PS PE12 I have problems starting the programm. After selecting video and new project nothing happens, only the colorbar below new project is showing

    New computer.
    After download and installation of PS PE12
    I have problems starting the programm, double clicking on the icon.
    After selecting video and new project nothing happens, only the colorbar below new project is showing, nothing happens.
    (expected was to activate the program and the sarting the PE12)
    PSE12 runs fine
    System:
    WIN8.1 / i7 /16GB RAM

    New computer.
    After download and installation of PS PE12
    I have problems starting the programm, double clicking on the icon.
    After selecting video and new project nothing happens, only the colorbar below new project is showing, nothing happens.
    (expected was to activate the program and the sarting the PE12)
    PSE12 runs fine
    System:
    WIN8.1 / i7 /16GB RAM

  • I am having problems with the Preview application.  When I try to use it to open a pdf document it gets hung-up and I have to select force quit to close it.   Any ideas on how to resolve this problem?  Thanks for any help

    I am having problems with the Preview application.  When I try to use it to open a pdf document it gets hung-up and I have to select force quit to close it.   Any ideas on how to resolve this problem?  Thanks for any help

    Can you open the Preview program without loading a file, like by itself?
    If it doesn't load then I suspect a corrupt Preview preference file.
    Deleting the System Preference or other .plist file
    Can you open other files with Preview, like jpg's and images?
    How about other PDFs? or is it just that one you have downloaded?
    Run through this list of fixes
    Step by Step to fix your Mac

  • How can i use index in select query.. facing problem with the select query.

    Hi Friends,
    I am facing a serious problem in one of the select query. It is taking a lot of time to fetch data in Production Scenario.
    Here is the query:
      SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
        FROM ztftelat LEFT JOIN ztfzberep
         ON  ztfzberep~gjahr = st_input-gjahr
         AND ztfzberep~poper = st_input-poper
         AND ztfzberepcntr  = ztftelatrprctr
        WHERE rldnr  = c_telstra_accounting
          AND rrcty  = c_actual
          AND rvers  = c_ver_001
          AND rbukrs = st_input-bukrs
          AND racct  = st_input-saknr
          AND ryear  = st_input-gjahr
          And rzzlstar in r_lstar                            
          AND rpmax  = c_max_period.
    There are 5 indices present for Table ZTFTELAT.
    Indices of ZTFTELAT:
      Name   Description                                               
      0        Primary key( RCLNT,RLDNR,RRCTY,RVERS,RYEAR,ROBJNR,SOBJNR,RTCUR,RUNIT,DRCRK,RPMAX)                                          
      005    Profit (RCLNT,RPRCTR)
      1        Ledger, company code, account (RLDNR,RBUKRS, RACCT)                                
      2        Ledger, company code, cost center (RLDNR, RBUKRS,RCNTR)                           
      3        Account, cost center (RACCT,RCNTR)                                        
      4        RCLNT/RLDNR/RRCTY/RVERS/RYEAR/RZZAUFNR                        
      Z01    Activity Type, Account (RZZLSTAR,RACCT)                                        
      Z02    RYEAR-RBUKRS- RZZZBER-RLDNR       
    Can anyone help me out why it is taking so much time and how we can reduce it ? and also tell me if I want to use index number 1 then how can I use?
    Thanks in advance.

    Hi Shiva,
    I am using two more select queries with the same manner ....
    here are the other two select query :
    ***************1************************
    SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
        FROM ztftelpt LEFT JOIN ztfzberep
         ON  ztfzberep~gjahr = st_input-gjahr
         AND ztfzberep~poper = st_input-poper
         AND ztfzberepcntr  = ztftelptrprctr
        WHERE rldnr  = c_telstra_projects
          AND rrcty  = c_actual
          AND rvers  = c_ver_001
          AND rbukrs = st_input-bukrs
          AND racct  = st_input-saknr
          AND ryear  = st_input-gjahr
          and rzzlstar in r_lstar             
          AND rpmax  = c_max_period.
    and the second one is
    *************************2************************
      SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
        FROM ztftelnt LEFT JOIN ztfzberep
         ON  ztfzberep~gjahr = st_input-gjahr
         AND ztfzberep~poper = st_input-poper
         AND ztfzberepcntr  = ztftelntrprctr
        WHERE rldnr  = c_telstra_networks
          AND rrcty  = c_actual
          AND rvers  = c_ver_001
          AND rbukrs = st_input-bukrs
          AND racct  = st_input-saknr
          AND ryear  = st_input-gjahr
          and rzzlstar in r_lstar                              
          AND rpmax  = c_max_period.
    for both the above table program is taking very less time .... although both the table used in above queries have similar amount of data. And i can not remove the APPENDING CORRESPONDING. because i have to append the data after fetching from the tables.  if i will not use it will delete all the data fetched earlier.
    Thanks on advanced......
    Sourabh

  • I'm having problems (1)selecting onscreen text, (2) having problems resizing menu boxes and selecting menues with the cursor. I'm not able to select menus and move them. I'm not sure how to correct this.

    I'm having problems (1) selecting onscreen text, (2) resizing menu boxes and selecting menues with the cursor. I'm not able to select menus and move them. I'm not sure how to correct this.

    1) This is because of software version 1.1. See this
    thread for some options as to how to go back to 1.0,
    which will correct the problem...
    http://discussions.apple.com/thread.jspa?threadID=3754
    59&tstart=0
    2) This tends to happen after videos. Give the iPod a
    minute or two to readjust. It should now be more
    accurate.
    3) This?
    iPod shows a folder icon with exclamation
    point
    4) Restore the iPod
    5) Try these...
    iPod Only Shows An Apple Logo and Will Not Start
    Up
    iPod Only Shows An Apple Logo
    I think 3,4, and 5 are related. Try the options I
    posted for each one.
    btabz
    I just noticed that one of the restore methods you posted was to put it into Disk Mode First rather than just use the resstore straight off, I Have tried that and seems to have solved the problem, If it has thank you. previously I have only tried just restoring it skipping this extra step. Hope my iPod stays healthy, if it doesnt its a warrenty job me thinks any way thanks again

  • Problem with the format of dates in a select

    I'm doing a select like this
    spool /home/oracle/install_'&&1'.txt
    select * from &1;
    spool off
    it's receiving as a parameter de name of the table, that I get from a text file with another shell script
    The problem is that I'm getting all the output in just one column, Here is part of the output
    PORTTYPE
    MACLIMITDEFAULT
    FastEthernet
    10
    GigabitEthernet
    200
    TenGigabitEthernet
    200
    As you see it has two fiedls for each row, but instead of getting it in two diferent columns, I get it just in one.
    I'll like to know if there is any option to specify another format to the select to get the data in columns.
    Thanks in advanced for your help
    Javi

    I particularly like how your problem is totally unrelated to the heading of your post...

  • How to select multiple substring in JTextarea at the same time?

    I want to select multiple substring in a jtextarea at the same time by select(start,end) method, turns out only the last substring is highlighted, how to implement my goal?

    jamesybaby wrote:
    What you got so far? A SCCEE would be nice?my aim is to search key words in jtextarea and highlight all matched result.
    package frame;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    public class FrmSelect extends JFrame {
        public FrmSelect() throws HeadlessException {
            setSize(800, 600);
            final JTextField tfKey = new JTextField();
            tfKey.setPreferredSize(new Dimension(200, 20));
            final JTextArea taContent = new JTextArea();
            JScrollPane jsp = new JScrollPane(taContent);
            tfKey.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    String key = tfKey.getText();
                    String content = taContent.getText();
                    String[] splited = content.split(key);
                    Pattern ptn = Pattern.compile(key, Pattern.CASE_INSENSITIVE + Pattern.MULTILINE);
                    Matcher matcher = ptn.matcher(content);
                    taContent.requestFocusInWindow();
                    while (matcher.find()) {
                        int start = matcher.start();
                        int end = matcher.end();
                        taContent.select(start, end);
            add(tfKey,BorderLayout.SOUTH);
            add(jsp,BorderLayout.CENTER);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            setVisible(true);
        public static void main(String[] args) {
             new FrmSelect();
    }please copy below into the jtextarea and type key 'prop' in the jtextfield, press return.
    prop1adsfasfd
    prop2adsfasdfadsf
    prop3asdfasdfasdf

  • JComboBox selection and highlight problem of the selected item

    Hi,
    I have a question how can I make my newly added item to the combo-box selectable and highlighted. I am adding new items to my custom comboBox dynamically and I want whatever item I add to be selected by default. I am using my own custom ComboBoxModel that extends AbstractListModel and implements ComboBoxModel and TreeModelListener, and my custom Renderer that extends JLabel and implements ListCellRenderer. Because I am trying to get a tree structure in my comboBox model and that's why I have my own custom model and renderer. Now when I add a new node or item to my comboBox it is being added and shown in the combo-box textField, but as soon I pull down the combo-box my parent directory is selected though my current selection is the last node added. That's how I am adding new nodes and making it selectable
    treeModel.insertNodeInto(tempNode, (DefaultMutableTreeNode)nodeCollection.lastElement(), 0);
    int nodeTotal =((CMRGlobals.myTreeGlobals).getModel()).getSize();
    Object lastNode = CMRGlobals.myTreeGlobals).getModel()).getElementAt(nodeTotal - 1);
    ((CMRGlobals.myTreeGlobals).getModel()).setSelectedItem(lastNode);
    when I do this my node is added under my parentNode and is shown in the comboBox but when I try to pull down the combo my parent node is high lighted and when I move out of the combo-box my parent node gets selected and show in the combo-box though I haven't selected it,and the contents of my last node are shown. I am just writing my own custom model that simulates the effect of JTree. I am using these......
    DefaultMutableTreeNode and
    DefaultTreeModel
    and in my JComboBox I am setting my model as
    this.setModel(new myModel(treemodel));
    this.setRenderer(new myRenderer());
    I am building my own FileDialog that just works like FileDialog I have all the functionality except this problem.Thanks for any help. I know I have posted this same thread yesterday but I didn't get any response hoping now may somebody can help me.Thanks again

    never mind I got it
    Thanks

  • Function module based generic extractor - Problem with the selection

    Hi all
    The following is my code in the function module. I am able to get the entire data if i dont give any selections and the number of records is also correct. But when i select a MATNR value, it returns 0 records where as it needs to return 3 records. If i give selection based on bukrs, werks, lgort its working fine. But if i give selection based on MATNR, then it is not working.... I think there is a problem in the bold part of my code. If i debug, LS_MATNR is having the correct value which indicates that there is no problem with the value being passed to LS_MATNR from my selection screen of my datasource in RSA3. Even GT_WERKS is also having data. Please help.
    OPEN CURSOR WITH HOLD S_CURSOR FOR
    SELECT  MARA~MANDT
            MARA~MATNR
            MARC~WERKS
            MARD~LGORT
            MARA~MEINS
            MARD~LABST
            MARD~EINME
            MARD~SPEME
            MARD~RETME
            MARD~INSME
            MARD~UMLME
            MARD~VMLAB
            MARD~VMEIN
            MARD~VMSPE
            MARD~VMRET
            MARD~VMINS
            MARD~VMUML
            MARC~XCHPF
            MARD~KLABS
            MARD~KEINM
            MARD~KSPEM
            MARD~KINSM
    from MARA inner join MARC on
    MARAMANDT = MARCMANDT AND
    MARAMATNR = MARCMATNR
    inner join MARD on
    MARAMANDT = MARDMANDT AND
    MARAMATNR = MARDMATNR
    AND MARCWERKS = MARDWERKS
    for all entries in gt_werks
    where MARC~werks EQ gt_werks-werks
    AND MARA~MATNR in LS_MATNR.
        ENDIF.                             "First data package ?
    Fetch records into interface table.
      named E_T_'Name of extract structure'.
        FETCH NEXT CURSOR S_CURSOR
                   APPENDING CORRESPONDING FIELDS
                   OF TABLE E_T_DATA
                   PACKAGE SIZE S_S_IF-MAXSIZE.

    try this
    select marc~matnr MARC~WERKS into t_marc for all entries in gt_werks
    where werks EQ gt_werks-werks and lvorm = space.
    if t_marc is not initial.
    select MARD~LGORT MARD~WERKS MARA~MEINS MARD~LABST MARD~EINME
    MARD~SPEME MARD~RETME MARD~INSME MARD~UMLME
    MARD~VMLAB MARD~VMEIN MARD~VMSPE MARD~VMRET
    MARD~VMINS MARD~VMUML MARC~XCHPF MARD~KLABS
    MARD~KEINM MARD~KSPEM MARD~KINSM  MARA~MEINS  from
    mard inner join MARA on mard~matnr = mara~matnr
    for all entries in t_marc where  mard~matnr = t_marc-matnr and mard-werks = t_marc-matnr
    and mard~lvorm = space.

  • Problem with the default selection screen condition

    hi guys,
    I have got some problem with the default screen given by the PNP logical database, P0000 infotype automatically populated according to the condition given in default screen.
    Reg,
    Hariharan

    Don know what u r trying to acheive.
    1) when u have specified PNP in the logical databse field of attributes of program, the SAP wil proivde u default PNP screen and here u can also add ur paramters if u want.
    2) in the program u have to declare like
    INFOTYPES: 0000,0001. "Etc
    for all the infotypes u want to use in the program.
    3) it is the GET PERNR event which wil fil all the p0000 and p0001 (internal tables for al the infotypes declared via INFOTYPES syntax as shown above)
    4) after tht get pernr, u now have data in P tables and u can use it for further reporting.
    5) refer below dummy code -
    REPORT  ZPPL_PREVEMPLOYERS   message-id rp
                                 line-size 250
                                 line-count 65.
    *Program logic :- This Report is used to Download all the Previous
    * Employer (IT0023) records of the employees
    *eject
    *& Tables and Infotypes                                                *
    tables: pernr.
    infotypes: 0000,
               0001,
               0002,
               0023.
    *eject
    *& Constants                                                           *
    constants: c_1(1)       type c               value '1'   ,
               c_3(1)       type c               value '3'   ,
               c_i(1)       type c               value 'I'   ,
               c_x(1)       type c               value 'X'   ,
               c_eq(2)      type c               value 'EQ'  ,
               c_pl03       like p0001-werks     value 'PL03'.
    *eject
    *& Selection-Screen                                                    *
    parameters: p_file  like rlgrap-filename default 'C:TempABC.xls',
                p_test  as checkbox default c_x               .
    *eject
    *& Internal tables                                                     *
    * Internal Table for Output
    data: begin of t_output occurs 0    ,
           pernr like pernr-pernr       ,
           nachn like p0002-nachn       ,
           vorna like p0002-vorna       ,
           orgeh_stext like p1000-stext ,
           plans_stext like p1000-stext ,
           begda like p0023-begda       ,
           endda like p0023-endda       ,
           land1 like p0023-land1       ,
           arbgb like p0023-arbgb       ,
           ort01 like p0023-ort01   .
    data: end of t_output           .
    *eject
    *& Variables                                                           *
    data: o_stext like p1000-stext,
          p_stext like p1000-stext.
    *eject
    *& Initialization                                                      *
    Initialization.
    * Initialize Selection-Screen values
      perform init_selction_screen.
    *eject
    *& AT Selection-screen                                                 *
    at selection-screen .
    * Check if Test run selected, download file name should be entered
      if p_test is initial.  "
        if p_file is initial.
          message e016 with 'Please enter file name'
                            'specifying complete path'.
        endif.
      endif.
    *eject
    *& Start-of Selection                                                  *
    Start-of-selection.
    get pernr.
      clear t_output.
    * Read Infotype 0
      rp-provide-from-last p0000 space pn-begda pn-endda.
      check pnp-sw-found eq c_1.
    * Check if employee is active
      check p0000-stat2 in pnpstat2.      "pernr Active
    * Read Infotype 1
      rp-provide-from-last p0001 space pn-begda pn-endda.
      check pnp-sw-found eq c_1.
    * check if employee belongs to PL03
      check p0001-werks in pnpwerks.  "belongs to PL03
    * Check if emp belongs to Active Group
      check p0001-persg in pnppersg.
    * Read Infotype 2
      rp-provide-from-last p0002 space pn-begda pn-endda.
      check pnp-sw-found eq c_1.
    * Read Org Unit Text.
    CALL FUNCTION 'HR_READ_FOREIGN_OBJECT_TEXT'
         EXPORTING
              OTYPE                   = 'O'
              objid                   = p0001-orgeh
              begda                   = p0001-begda
              endda                   = p0001-endda
              reference_date          = p0001-begda
         IMPORTING
              object_text             = o_stext
          EXCEPTIONS
              nothing_found           = 1
              wrong_objecttype        = 2
              missing_costcenter_data = 3
              missing_object_id       = 4
              OTHERS                  = 5.
    *Read Position Text.
    CALL FUNCTION 'HR_READ_FOREIGN_OBJECT_TEXT'
         EXPORTING
              OTYPE                   = 'S'
              objid                   = p0001-plans
              begda                   = p0001-begda
              endda                   = p0001-endda
              reference_date          = p0001-begda
         IMPORTING
              object_text             = p_stext
         EXCEPTIONS
              nothing_found           = 1
              wrong_objecttype        = 2
              missing_costcenter_data = 3
              missing_object_id       = 4
              OTHERS                  = 5.
    * Gather all the required information related to the emp
      move: pernr-pernr to t_output-pernr,
            o_stext to t_output-orgeh_stext,
            p_stext to t_output-plans_stext,
            p0002-nachn to t_output-nachn,
            p0002-vorna to t_output-vorna.
    * Gather previous Employee details
      loop at p0023.
        move-corresponding p0023 to t_output.
        append t_output.
      endloop.
    *eject
    *& End-of Selection                                                    *
    end-of-selection.
      perform print_report.
    * Downlaod the file
      if not t_output[] is initial.
        if p_test eq space.
          perform download_file.
        endif.
      else.
        write: 'No records selected' color col_negative.
      endif.
    *eject
    *& Top-of-page                                                         *
    Top-of-page.
    * Print Header
      perform print_header.
    *eject
    *&      Form  download_file
    * Description :
    FORM download_file .
      DATA: full_file_name    TYPE string,
            z_akt_filesize    TYPE i     .
      full_file_name = p_file.
    *  download table into file on presentation server
      CALL METHOD cl_gui_frontend_services=>gui_download
        EXPORTING
          filename                = full_file_name
          filetype                = 'DAT'
          NO_AUTH_CHECK           = c_x
          codepage                = '1160'
        IMPORTING
          FILELENGTH              = z_akt_filesize
        CHANGING
          data_tab                = t_output[]
        EXCEPTIONS
          file_write_error        = 1
          no_batch                = 2
          gui_refuse_filetransfer = 3
          invalid_type            = 4
          no_authority            = 5
          unknown_error           = 6
          header_not_allowed      = 7
          separator_not_allowed   = 8
          filesize_not_allowed    = 9
          header_too_long         = 10
          dp_error_create         = 11
          dp_error_send           = 12
          dp_error_write          = 13
          unknown_dp_error        = 14
          access_denied           = 15
          dp_out_of_memory        = 16
          disk_full               = 17
          dp_timeout              = 18
          file_not_found          = 19
          dataprovider_exception  = 20
          control_flush_error     = 21
          not_supported_by_gui    = 22
          error_no_gui            = 23
          OTHERS                  = 24.
      IF  sy-subrc               NE        0.
        MESSAGE e016 WITH 'Download-Error; RC:' sy-subrc.
      ENDIF.
    ENDFORM.                    " download_file
    *eject
    *&      Form  print_report
    *Description:
    FORM print_report .
      data: i       type i,
            w_count type i.
      sort t_output.
    * Print the report
      loop at t_output.
        i = sy-tabix mod 2.
        if i eq 0.
          format color col_normal intensified on.
        else.
          format color col_normal intensified off.
        endif.
        write:/1     t_output-pernr          ,
               10     t_output-vorna(25)     ,
               35    t_output-nachn(25)      ,
               61   t_output-orgeh_stext     ,
               102  t_output-plans_stext     ,
               143  t_output-begda           ,
               154   t_output-endda          ,
               168   t_output-land1          ,
               178   t_output-arbgb(40)      ,
               219   t_output-ort01          ,
               249   space              .
      endloop.
      uline.
      Describe table t_output lines w_count.
      Skip 2.
      Write:/ 'Total No of Records Downloaded: ' color col_total,
              w_count.
    ENDFORM.                    " print_report
    *eject
    *&      Form  print_header
    *Description:
    FORM print_header .
      skip 1.
      Uline.
      format Intensified on color col_heading.
      write:/1   'Pers. #'        ,
             10   'Last Name'     ,
             35   'First Name'    ,
             61   'Org Unit'      ,
             102  'Position'      ,
             143  'Beg Date'      ,
            154   'End Date'      ,
            168   'Cntry Key'     ,
            178   'Prev Employer' ,
            219  'City'           ,
            249   space          .
      format intensified off color off.
      uline.
    ENDFORM.                    " print_header
    *eject
    *&      Form  init_selction_screen
    *Description:
    FORM init_selction_screen .
      refresh: pnpwerks,
               pnppersg,
               pnpstat2.
      clear:   pnpwerks,
               pnppersg,
               pnpstat2.
      pnpwerks-sign   = c_i.
      pnpwerks-option = c_EQ.
      pnpwerks-low    = c_pl03.
      append pnpwerks.
      pnppersg-sign   = c_i.
      pnppersg-option = c_EQ.
      pnppersg-low    = c_1.
      append pnppersg.
      pnpstat2-sign   = c_i.
      pnpstat2-option = c_EQ.
      pnpstat2-low    = c_3.
      append pnpstat2.
    ENDFORM.                    " init_selction_screen

Maybe you are looking for