Problem with JTextArea wanting to resize itself

First, here is a program that will create the situation in which this error occurs:
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
public class Example extends JFrame
    private final String TITLE       = "Example";
    private final int    WIDTH       = 640;
    private final int    HEIGHT      = 480;
    private JMenuBar     menuBar     = new JMenuBar();
    private JMenu        modeMenu    = new JMenu( "Mode" );
    private JMenuItem    mode1       = new JMenuItem( "Mode 1" );
    private JMenuItem    mode2       = new JMenuItem( "Mode 2" );
    private JTextArea    textArea1   = new JTextArea();
    private JTextArea    textArea2   = new JTextArea();
    private JScrollPane  scrollPane1 = new JScrollPane( textArea1, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
    private JScrollPane  scrollPane2 = new JScrollPane( textArea2, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
    private JPanel       everything  = new JPanel( new BorderLayout() );
    private JPanel       modeOptions = new JPanel();
    private int          modeInt     = 1;
    public Example ()
        setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
        setSize( WIDTH, HEIGHT );
        setLocation( 100, 100 );
        setResizable( true );
        mode1.addActionListener( new ActionListener()
            public void actionPerformed ( ActionEvent e )
                modeInt = 1;
                updateModeOptions();
        mode2.addActionListener( new ActionListener()
            public void actionPerformed ( ActionEvent e )
                modeInt = 2;
                updateModeOptions();
        modeMenu.add( mode1 );
        modeMenu.add( mode2 );
        menuBar.add( modeMenu );
        setJMenuBar( menuBar );
        updateModeOptions();
        initializeLayout();
    private void updateModeOptions ()
        modeOptions.removeAll();
        switch ( modeInt )
            case 1:
                JLabel text = new JLabel( "Change to Mode 2 to see the text areas shrink." );
                modeOptions.add( text );
                setTitle( TITLE + " - " + "Mode 1" );
                break;
            case 2:
                JPanel temp = new JPanel();
                JLabel text = new JLabel( "Text in a JPanel, to show change in text area size." );
                temp.add( text );
                modeOptions.add( temp );
                setTitle( TITLE + " - " + "Mode 2" );
                break;
            default:
                break;
        setVisible( true );
    private void initializeLayout ()
        JPanel panel1 = new JPanel( new BorderLayout() );
        JPanel panel2 = new JPanel( new BorderLayout() );
        JPanel everythingCenterPanel = new JPanel();
        everything.setBorder( BorderFactory.createEtchedBorder() );
        panel1.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Scroll Pane 1" ) );
        panel2.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Scroll Pane 2" ) );
        everythingCenterPanel.setLayout( new BoxLayout( everythingCenterPanel, BoxLayout.Y_AXIS ) );
        panel1.add( scrollPane1 );
        panel2.add( scrollPane2 );
        everythingCenterPanel.add( panel1 );
        everythingCenterPanel.add( modeOptions );
        everythingCenterPanel.add( panel2 );
        everything.add( everythingCenterPanel );
        add( everything );
    public static void main ( String[] args )
        new Example().setVisible( true );
}Try changing between Mode 1 and Mode 2 (via the Mode menu) to see how the text areas resize as the object between them grows and shrinks. This behavior is correct.
What is incorrect is what happens when the user enters a large amount of text into one of the text boxes (6 or 7 lines of text should be enough to create the problem) and switches between modes.
I've tried using the getSize and setSize methods of various components at various points in the program but none seem to work effectively. The closest thing I've been able to do is to keep the JTextAreas, the JScrollPanes, and the JPanels holding them to remain the same sizes, but the text still pushes the panel between the JTextAreas down (and possibly out of) the window, leaving a blank area between the edge of the JPanel containing the JScrollPane and the JPanel in the center.
The JPanels containing the JScrollPanes must be able to resize correctly as the user resizes the window, so a constant size would not work in this situation.
Any help is greatly appreciated.

What is incorrect is what happens when the user enters a large amount of text into one of the text boxes I don't notice anything happening when I add text to the text area. The scrollbars appear as is expected. The only difference for me when I switch between mode 1 and 2 is that the center panel changes in size slightly. This is because the panel is using a FlowLayout which by default has a 5 pixel vertical gap between each component. This is easily fixed by using:
JPanel temp = new JPanel( new FlowLayout(FlowLayout.CENTER, 5, 0) );I know you tested using JDK1.5 since I had to make the following change in order to get the example to work:
getContentPane().add( everything );
So maybe this is a version problem since I don't notice anything out of the ordinary other than what I already mentioned.

Similar Messages

  • Problem with JTextArea

    Hi all,
    I am having a class which extends JTextArea. I press backspace and I check for some condition in KeyReleased event. If the condition is true I am setting the JTextArea with the old text(retainText). What happens here is that first the backspace entered by me is reflecting on the screen and then only the new text (retainText) is set. This causes a flickering on the text area. My requirement is that this should not happen.
    Is there any way to avoid this .
    or else Is there any way to cancel this event ( say i enter backspace and if the condition becomes true in the KeyReleased event, I should stop this event. Can any body please help me ASAP. Thanks!!!
    I ve attached the code also
    package com.bankofny.iic.client.component;
    import java.awt.*;
    import java.util.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.text.*;
    import com.bankofny.iic.client.instruction.viewer.TradeDetailForm;
    import com.bankofny.iic.common.util.StringFormatter;
    public class IicTextAreaSwift extends JTextArea implements FocusListener, KeyListener
        // IicTextAreaSwift Method
         private int DescCharWidth = 0;
        private int DescCharHeight =0;
         private String retainText; //retain always the latest text
         private int KeyCode;
         private String KeyText="";
        public IicTextAreaSwift(int _rows, int _columns, boolean scrollPane)
            super(_rows, _columns + 1);
            setDisabledTextColor(Color.gray);
                rows            = _rows;
            columns         = _columns;
            setRows(_rows);
            maxTextAllowed  = _rows * _columns;
            setBorder(new BevelBorder(BevelBorder.LOWERED));
            setLineWrap(true);
            setWrapStyleWord(true);
            Font fixedFont = new Font("Courier", Font.PLAIN, 12);
            setFont(fixedFont);
            FontMetrics fm = getFontMetrics(fixedFont);
            DescCharWidth = fm.charWidth('W') * (_columns + 1);
          //  DescCharHeight = fm.getHeight() * 4 ;
               DescCharHeight =  DEFAULT_LABEL_HEIGHT * 3;
            setPreferredSize(new Dimension(DescCharWidth, DescCharHeight));
            // setSize(new Dimension(DescCharWidth, DescCharHeight));
            addKeyListener(this);
            addFocusListener(this);
            fixTAB();
        public IicTextAreaSwift(int _rows, int _columns)
              super(_rows, _columns);
              // HA this constructor is for this field not in a scroll pane
              setDisabledTextColor(Color.gray);
              rows            = _rows;
              columns         = _columns;
              setRows(_rows);
              maxTextAllowed  = _rows * _columns;
              setBorder(new BevelBorder(BevelBorder.LOWERED));
              setLineWrap(true);
              setWrapStyleWord(true);
              Font fixedFont = new Font("Courier", Font.PLAIN, 12);
              setFont(fixedFont);
              FontMetrics fm = getFontMetrics(fixedFont);
              DescCharWidth = fm.charWidth('W') * (_columns + 1);
             //  DescCharHeight = fm.getHeight() * 4 ;
              DescCharHeight =  DEFAULT_LABEL_HEIGHT * 3;
              setPreferredSize(new Dimension(DescCharWidth, DescCharHeight));
              // setSize(new Dimension(DescCharWidth, DescCharHeight));
              addKeyListener(this);
              addFocusListener(this);
              fixTAB();
        public Dimension getDimen()
              return new Dimension(     DescCharWidth, DescCharHeight);
         public void showKeys(JComponent component)
              // List keystrokes in the WHEN_FOCUSED input map of the component
              InputMap map = component.getInputMap(JComponent.WHEN_FOCUSED);
              printInputMap(map,"WHEN_FOCUSED");
              // List keystrokes in the WHEN_ANCESTOR_OF_FOCUSED_COMPONENT input map of the component
              map = component.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
              printInputMap(map,"WHEN_ANCESTOR_OF_FOCUSED_COMPONENT");
              //list(map, map.keys());
              // List keystrokes in all related input maps
              //list(map, map.allKeys());
              // List keystrokes in the WHEN_IN_FOCUSED_WINDOW input map of the component
              map = component.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
              printInputMap(map,"WHEN_IN_FOCUSED_WINDOW");
              printActionMap( getActionMap() , "JTextArea");
              //list(map, map.keys());
              // List keystrokes in all related input maps
            // list(map, map.allKeys());
         public void fixTAB()
              Set newForwardKeys = new HashSet ();
              newForwardKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0, false));
              this.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, newForwardKeys);
              Set newBackwardKeys = new HashSet ();
              newBackwardKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_MASK, false));
              this.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, newBackwardKeys);
              Set forwardKeys = this.getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
    //          System.out.println ("Desktop forward focus traversal keys: " + forwardKeys);
              Set backwardKeys = this.getFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
    //          System.out.println ("Desktop backward focus traversal keys: " + backwardKeys);
             this.setFocusTraversalKeysEnabled(true);
         public static void printActionMap(ActionMap actionMap, String who)
         {     //     System.out.println("Action map for " + who + ":");
              Object[] keys = actionMap.allKeys();
              if (keys != null)
                   for (int i = 0; i < keys.length; i++)
                        Object key = keys;
                        Action targetAction = actionMap.get(key);
                   //     System.out.println("\tName: <" + key + ">, action: " + targetAction.getClass().getName());
         public static void printInputMap(InputMap inputMap, String heading)
              //System.out.println("\n" + heading + ":");
              KeyStroke[] keys = inputMap.allKeys();
              if (keys != null)
                   for (int i = 0; i < keys.length; i++)
                        KeyStroke key = keys[i];
                        Object actionName = inputMap.get(key);
                   //     System.out.println("\tKey: <" + key + ">, action name: " + actionName);
    public void paste()
    public void focusGained(java.awt.event.FocusEvent event)
              //System.out.println("Hman " + event.paramString());
         if(event.getOppositeComponent() != null)
              if(event.getOppositeComponent().getParent() != null)
                   if (findRoot(event.getOppositeComponent()) != null && findRoot(this) != null)
                        if ( isEnabled() && findRoot(event.getOppositeComponent()) == findRoot(this))
                        selectAll();
         public Component findRoot(Component _cc)
              while (_cc.getParent() != null)
                   cc = cc.getParent();
                   //System.out.println("Parent:" + _cc);
                   if (_cc instanceof TradeDetailForm)
                   return _cc;
              return null;
    public void focusLost(java.awt.event.FocusEvent event)
         Begin Nirmal 1: Requirements 3.1 issues.
         To fix: getValue() method never returns more than the rows.
         New method added to ensure user entered text never goes beyond Rows
    * Method to ensure the getValue() never returns more than the rows.
    * will return -1 if the rows are out of range
    * @param KeyEvent
    * @return int
    public int ensureNotBeyondRows(KeyEvent e)
              String[] s = getValue();
              if (s==null)
                   return 0;
              if (s.length>rows)
                   setText(retainText);
                   return -1;
              String str=getText();
              insert(e.getKeyChar()+"", getCaretPosition());
              s = getValue();
              setText(str);
              if (s.length>rows)
                   setText(retainText);
                   return -1;
              return 0;
         End Nirmal 1:
    // main Method
    // processComponentKeyEvent Method
    public void keyTyped(KeyEvent e)
         /* Naga */
              System.out.println("inside keyTyped");
              System.out.println("e.getKeyChar() " + KeyEvent.getKeyText(e.getKeyCode()));
         /*try
                   java.lang.Thread.sleep(2000);
              catch(InterruptedException ie)
         try {
    int curPos2 = getCaretPosition();
    int curLine2 = getLineOfOffset(curPos2);
    //System.out.println( "curline:" + curLine2 + " of " + rows);
    char[] tmp = {e.getKeyChar()};
    int curPos1 = getCaretPosition();
    int line1 = getLineOfOffset(curPos1) ;
    int startOfLine = getLineStartOffset(line1) ;
    if( curPos1 == startOfLine && line1 > 0)
    if ((tmp[0] == ':') || (tmp[0] == '-' )){
    // System.out.println("hman3");
    e.consume();
    return;
                   Begin Nirmal 2: Requirements 3.1 issues.
                   To fix: getValue() method never returns more than the rows.
                   New method added to ensure user entered text never goes beyond Rows
                   if (!isArrowKey(e) &&
                        (e.paramString().indexOf("Enter") == -1 ) &&
                        !isBackspaceKey(e)) {
                             int maxLimitFlg=ensureNotBeyondRows(e);
                             setCaretPosition(curPos2);
                             if (maxLimitFlg == -1)
                                  e.consume();
                                  return;
                   End Nirmal 2:
    // System.out.println("e.paramString()" + e.paramString());
    // System.out.println("place 2 " + e.paramString());
    if (!(StringFormatter.isValidSwift(tmp[0])) && !(functionKey(e)) && notMoveForward(e))
    // System.out.println("hman2 isaction" + e.isActionKey());
    // System.out.println("KeyTyped" + e.getKeyChar()+ e.getKeyText(e.getKeyCode()) + "/keycode" + e.getKeyCode() + "/modifiers" + e.getModifiers() );
    e.consume();
    return;
    int curPosInLine = -1;
    int firstPos = -1;
    if (getText().length() < maxTextAllowed ||
    (KeyCode == KeyEvent.VK_UP || KeyCode == KeyEvent.VK_BACK_SPACE))
    int curPos = getCaretPosition();
    if (!(functionKey(e)))
    e.setKeyChar( (new String( tmp ).toUpperCase()).toCharArray()[0]);
    curPos2 = getCaretPosition();
    curLine2 = getLineOfOffset(curPos2);
    //System.out.println( "curline:" + curLine2 + " of " + rows);
    if (curLine2 + 1 >= rows &&
    (KeyCode == KeyEvent.VK_ENTER ||
    KeyCode == KeyEvent.VK_DOWN) )
    // System.out.println("hman1");
    e.consume();
    return;
    else {
    String oldText = getText();
    // super.processKeyEvent(e);
    if (getNumberOfLines(getLineCount()) == -1 && !(functionKey(e)))
    setText(oldText);
    invalidate();
    setCaretPosition(curPos);
    } } catch (javax.swing.text.BadLocationException evt) {
    System.out.println("Bad Location Exception in processKeyEvent");
    public void keyPressed(KeyEvent e){
              //System.out.println("keyPressed" + e.getKeyCode()+ e.getKeyText(e.getKeyCode()));
                   retainText = getText();//retain always the latest text
                   /* Naga */
                   //System.out.println("retainText " + retainText);
                   System.out.println("inside keyPressed");
                   System.out.println("e.getKeyChar() " + KeyEvent.getKeyText(e.getKeyCode()));
                   /*try
                        java.lang.Thread.sleep(2000);
                   catch(InterruptedException ie)
    public void keyReleased(KeyEvent e){
              //System.out.println( "keyReleased" + e.getKeyCode()+ e.getKeyText(e.getKeyCode()));
         String []s = getValue();
         /* Naga */
         System.out.println(" inside keyReleased");
         System.out.println("e.getKeyChar() " + KeyEvent.getKeyText(e.getKeyCode()));
         /*try
              java.lang.Thread.sleep(2000);
         catch(InterruptedException ie)
              /*try
                   System.out.println("s " + s[0]);
                   System.out.println("s " + s[1]);
                   System.out.println("s " + s[2]);
                   System.out.println("s " + s[3]);
              catch(Exception e1)
              //System.out.println("s.length " + s.length);
              //System.out.println("rows " + rows);
              if (s!=null && s.length>rows)
                   System.out.println("setting text");
                   //setText(retainText);
                   invalidate();
         public boolean isTab(KeyEvent e)
              if (e.paramString().indexOf("keyChar=Tab") == -1)
              return false;
              } else
                   return true;
         public boolean keepProcessing(java.awt.event.KeyEvent e)
              if (e.paramString().indexOf("keyChar=Backspace") != -1 ) { return true; }
              if (e.paramString().indexOf("keyChar=Left") != -1 ) { return true; }
              if (e.paramString().indexOf("keyChar=Down") != -1 ) { return true; }
              if (e.paramString().indexOf("keyChar=Up") != -1 ) { return true; }
              if (e.paramString().indexOf("keyChar=Delete") != -1 ) { return true; }
              if (e.paramString().indexOf("keyChar=Right") != -1 ) { return true; }
              return false;
         public boolean isArrowKey(java.awt.event.KeyEvent e)
              if (e.paramString().indexOf("Left") != -1 ||
                   e.paramString().indexOf("Down") != -1 ||
                   e.paramString().indexOf("Up") != -1 ||
                   e.paramString().indexOf("Right") != -1 )
                   return true;
              return false;
         public boolean isBackspaceKey(java.awt.event.KeyEvent e)
              if (e.paramString().indexOf("Backspace") != -1)
                   return true;
              return false;
         public boolean isDeleteKey(java.awt.event.KeyEvent e)
              if (e.paramString().indexOf("Delete") != -1)
                   return true;
              return false;
    public boolean notMoveForward(java.awt.event.KeyEvent e)
              if (e.paramString().indexOf("Backspace") == -1 &&
              e.paramString().indexOf("Left") == -1 &&
              // e.paramString().indexOf("keyText=Down") == -1 &&
              e.paramString().indexOf("Up") == -1 &&
              e.paramString().indexOf("Delete") == -1 ) { return true; }
              return false;
    // processKeyEvent Method
    public void processKeyEvent(java.awt.event.KeyEvent e)
    //     System.out.println( "processKeyEvent");
         /* Naga */
         System.out.println(" inside processKeyEvent");
         System.out.println("e.getKeyChar() " + KeyEvent.getKeyText(e.getKeyCode()));
                   if (e.paramString().indexOf("KEY_PRESSED") != -1) {
                        KeyText=e.paramString();
                   } else {
                        KeyText="";
                   KeyCode=e.getKeyCode();
    int filledRows = (getText().length()-1)/columns + 1;
    if (KeyCode == KeyEvent.VK_ENTER && filledRows >= rows)
    return;
    try {
                   if (isArrowKey(e) || isBackspaceKey(e) || isDeleteKey(e)) {
                        super.processKeyEvent(e);
                        return;
    int curPos2 = getCaretPosition();
    int curLine2 = getLineOfOffset(curPos2);
    // System.out.println( "curline:" + curLine2 + " of " + rows);
    if (curLine2 + 1 >= rows &&
    (KeyCode == KeyEvent.VK_ENTER ||
    KeyCode == KeyEvent.VK_DOWN) )
                             //System.out.println("hman5");
    e.consume();
    return;
    int curPosInLine = -1;
    int firstPos = -1;
    if (getText().length() < maxTextAllowed)
    int curPos = getCaretPosition();
    curPos2 = getCaretPosition();
    curLine2 = getLineOfOffset(curPos2);
    int curlinepos = getLineStartOffset(curLine2) ;
                   if ( (curLine2 + 1 == rows) && (curPos2 - curlinepos >= getColumns() - 1) && notMoveForward(e))
                        e.consume();
    return;
    if ((curLine2 + 1 >= rows &&
    (KeyCode == KeyEvent.VK_ENTER ||
    KeyCode == KeyEvent.VK_DOWN) ))
    // System.out.println("hman6");
    e.consume();
    return;
    } else {
    String oldText = getText();
    // System.out.println("hman7");
    super.processKeyEvent(e);
    if (getNumberOfLines(getLineCount()) == -1 && !(functionKey(e)))
    // System.out.println("hman8");
    setText(oldText);
    invalidate();
    setCaretPosition(curPos);
    } } catch (javax.swing.text.BadLocationException evt) {
    System.out.println("Bad Location Exception in processKeyEvent");
    // processFunctionalKeys Method
    public boolean processFunctionalKeys(java.awt.event.KeyEvent e)
    // System.out.println( "processFunctionalKeys");
    if (KeyCode == KeyEvent.VK_BACK_SPACE ||
    KeyCode == KeyEvent.VK_ESCAPE ||
    KeyCode == KeyEvent.VK_PAGE_UP ||
    KeyCode == KeyEvent.VK_PAGE_DOWN ||
    KeyCode == KeyEvent.VK_END ||
    KeyCode == KeyEvent.VK_HOME ||
    KeyCode == KeyEvent.VK_LEFT ||
    KeyCode == KeyEvent.VK_UP ||
    KeyCode == KeyEvent.VK_RIGHT ||
    KeyCode == KeyEvent.VK_DOWN ||
    KeyCode == KeyEvent.VK_DELETE
    //System.out.println("Process the KEY getkey:" + e.getKeyChar() + "/getcode:" + e.getKeyCode());
    super.processKeyEvent(e);
    return true;
    else
    return false;
    public boolean functionKey(java.awt.event.KeyEvent e)
    // System.out.println( "functionKey");
    if (KeyCode == KeyEvent.VK_BACK_SPACE ||
    KeyCode == KeyEvent.VK_ESCAPE ||
    KeyCode == KeyEvent.VK_PAGE_UP ||
    KeyCode == KeyEvent.VK_PAGE_DOWN ||
    KeyCode == KeyEvent.VK_END ||
    KeyCode == KeyEvent.VK_HOME ||
    KeyCode == KeyEvent.VK_LEFT ||
    KeyCode == KeyEvent.VK_UP ||
    KeyCode == KeyEvent.VK_RIGHT ||
    KeyCode == KeyEvent.VK_DOWN ||
    KeyCode == KeyEvent.VK_DELETE
    //System.out.println("Process the KEY getkey:" + e.getKeyChar() + "/getcode:" + e.getKeyCode());
    //super.processKeyEvent(e);
    return true;
    else
    return false;
    // getLineCount Method - Returns -1 if number of lines is not between 1 to 4.
    /* This method return -1 if number of lines is not between 1 to 4.
    Pass in getLineCount() to get number of lines for all elements.
    JTextArea separates elements by new line character.
    BnyTextArea treats each row as a line.
    public int getNumberOfLines(int elementCount)
    int lineCount = 0;
    int startPos = 0;
    int endPos = 0;
    for (int i = 0; i <= elementCount - 1; i++) {
    lineCount = lineCount + getLineCountOfElement(i);
    if (lineCount == -1 || lineCount > rows) {
    lineCount = -1;
    break;
    return lineCount;
    // getSpacePos Method - this method finds the first position of space found.
    public int getSpacePos(int pos)
              Begin Nirmal 3: Requirements 3.1 issues.
              Modified the end limit from 0 to pos-columns,
              so that to avoid the return index value from previous lines
              int endLimit=pos-columns;
              if (endLimit<0) {
                   endLimit=pos;
    for (int i = pos; i > endLimit; i--) {
    if (getText().charAt(i) == ' ' || getText().charAt(i) == '\n') { // 11/14/03 Eaten treat \n as space
                        return i;
    return -1;
              End Nirmal 3:
    // getLineCountOfElement Method - returns -1 if number of lines is not between 1 to 4.
    public int getLineCountOfElement(int line)
    int lineCount = 1;
    try {
    int startPos = getLineStartOffset(line) ;
    int endPos = getLineEndOffset(line) ;
    if (moreThanNumOfColumns(startPos, endPos)) {
    lineCount = 2;
    startPos = getSpacePos(startPos+columns);
    if (startPos != -1 && moreThanNumOfColumns(startPos+1,endPos)) {
    lineCount = 3;
    startPos = getSpacePos(startPos+columns);
    if (startPos != -1 && moreThanNumOfColumns(startPos+1,endPos)) {
    lineCount = 4;
    startPos = getSpacePos(startPos+columns);
    if (startPos != -1 && moreThanNumOfColumns(startPos+1,endPos)) {
    return -1;
    } catch (javax.swing.text.BadLocationException e) {
    System.out.println("Bad Location Exception in getLineCountOfElement");
    return lineCount;
    // moreThanNumOfColumns Method
    public boolean moreThanNumOfColumns(int startPos, int endPos)
    if ((endPos - startPos) > (columns + 1))
    return true;
    else
    return false;
    // getNewLineCount Method
    public int getNewLineCount()
    int count = 0;
    boolean rc = true;
    int pos = getText().indexOf(KeyEvent.VK_ENTER, 0);
    if (pos == -1)
    rc = false;
    else
    count++;
    while (rc) {
    pos = getText().indexOf(KeyEvent.VK_ENTER, pos+1);
    if (pos == -1)
    rc = false;
    else
    count++;
    return count;
    // getValue Method
    public String[] getValue()
    // System.out.println(getText());
    int lines = getLineCount();
    int spacePos = 0;
    String str = new String();
    Vector strings = new Vector();
    boolean newLine=true;
    /*Nirmal : this boolean is to add the empty only in new line.
    To avoid those lines which end with \n
    if (getDocument().getLength() > 0) {
    for (int i = 0; i < lines; i++) {
                        newLine=true;
    try {
    int startPos = getLineStartOffset(i) ;
    int endPos = getLineEndOffset(i) + 1;
    /* Naga */
    //System.out.println("startPos " + startPos);
    //System.out.println("endPos " + endPos);
    //System.out.println(i + "HHMAN startPos = " + getLineStartOffset(i));
    //System.out.println(i + "HHMAN endPos = " + getLineEndOffset(i));
    while (moreThanNumOfColumns(startPos,endPos)) {
                                  newLine=false;
    int tempEndPos = 0;
    tempEndPos = startPos + columns;
    System.out.println("tempEndPos " + tempEndPos + " columns " + columns);
    spacePos = getSpacePos(tempEndPos);
    if (spacePos == -1) {
    if (startPos >= getDocument().getLength())
    break;
    else {
    if (tempEndPos >= getDocument().getLength())
    spacePos = getDocument().getLength();
    else {
    spacePos = startPos + columns;
    str = getText().substring(startPos,spacePos);
    if (!(str.trim().equals(""))) {
                                       strings.addElement(str.trim());
    startPos = spacePos;
                             if (startPos < endPos) {
         str = getText().substring(startPos,endPos - 1).trim();
         if(str!=null) {
              if(str.trim().length()>0) {
                                            strings.addElement(str);
                                            continue;
                                       } else {
                                            if(newLine) {
                                                 strings.addElement(str);
    /*Nirmal commented the below lines to fix existing issue
    of adding even empty lines entered in textbox */
    //if ((str==null) || (str.length()==0)) continue;
    //if (!(str.trim().equals(""))) strings.addElement(str);
    } catch (javax.swing.text.BadLocationException e) {
    System.out.println("Bad Location Exception in getValue");
    String[] strs = new String[strings.size()];
    strings.copyInto(strs);
    return strs;
    } else
    return null;
         public void clear() {
    setText("");
    // invalidate();
    // repaint();
    // fixTAB();
    public int getColumnsX()
    if (columnLimits != null)
    int curPos = getCaretPosition();
    //System.out.println("getCaretPosition()" + curPos);
    if (curPos > 0)
    for (int i = 0;i < columnLimits.length;i++)
    curPos = curPos - columnLimits[i];
    if (curPos < 1)
    //System.out.println("getNumberOfLines(curElem)" + i);
    return columnLimits[i];
    } else
    return columns;
    return 0;
         public void setRowLimitX(int rows,int columns)
    maxTextAllowed = rows * columns;
    setRows(_rows);
    rows = _rows;
    columns = _columns;
    setFont(fixedFont);
    setBorder(new BevelBorder(BevelBorder.LOWERED));
    setLineWrap(true);
    setWrapStyleWord(true);
    Font fixedFont = new Font("Courier", Font.PLAIN, 12);
    FontMetrics fm = getFontMetrics(fixedFont);
    int width = fm.charWidth('W') * (35 + 1);
    int height = DEFAULT_LABEL_HEIGHT * 3 ;
    setPreferredSize(new Dimension(width, height));
    public void setEditable(boolean editable)
    super.setEditable(editable);
    super.setEnabled(editable);
    setFocusable(editable);
    if (editable)
    setForeground(Color.black);
    else
    setForeground(Color.gray);
    fixTAB();
    // add your data members here
    // add your data members here
    private int rows = 0;
    private int columns = 0;
    private int[] columnLimits = null;
    private int maxTextAllowed = 0;
    private Font fixedFont = new Font("Courier", Font.PLAIN, 12);
    public final static int LEFT_LABEL_WIDTH = 100;
         public final static int DEFAULT_LABEL_HEIGHT = 20;

    You posted way too much code. 90% of the code is not related to the "backspace" problem. We want compileable and executable code, but only that code that is relevant to the problem.
    Anyway, instead of handling KeyEvents you should read the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html]How to Use Key Bindings for the recommended approach.
    Also you may want to check out this posting which has some information on the backspace KeyStroke:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=566748

  • Problem with JTextArea or is it my code, Help!!!

    Hi,
    I am going crazy. I am sending a message to a JTextArea and I get some very wierd things happening? I really need help because this is driving me crazy. Please see the following code to see my annotations for the problems. Has anyone else experienced problems with this component?
    Thanks,
    Steve
    // THIS IS THE CLASS THAT HANDLES ALL OF THE WORK
    public class UpdateDataFields implements ActionListener {     // 400
         JTextArea msg;
         JPanel frameForCardPane;
         CardLayout cardPane;
         TestQuestionPanel fromRadio;
         public UpdateDataFields( JTextArea msgout ) {     // 100
              msg = msgout;
          }       // 100
         public void actionPerformed(ActionEvent evt) {     // 200
              String command = evt.getActionCommand();
              String reset = "Test of reset.";
              try{
                   if (command.equals("TestMe")){     // 300
                        msg.append("\nSuccessful");
                        Interface.changeCards();
                        }     // 300
              catch(Exception e){
                   e.printStackTrace();
              try{
                   if (command.equals("ButtonA")){     // 300
    // WHEN I CALL BOTH OF THE FOLLOWING METHODS THE DISPLAY WORKS
    // BUT THE CHANGECARDS METHOD DOES NOT WORK.  WHEN I COMMENT OUT
    // THE CALL TO THE DISPLAYMESSAGE METHOD THEN THE CHANGECARDS WORKS
    // FINE.  PLEASE THE INTERFACE CLASS NEXT.
                        Interface.changeCards();
                        Interface.displayMessage("test of xyz");
                        }     // 300
              catch(Exception e){
                   e.printStackTrace();
         }     // 200
    }     // 400
    // END OF UPDATEDATAFIELS  END END END
    public class Interface extends JFrame {     // 300
         static JPanel frameForCardPane;
         static CardLayout cardPane;
         static JTextArea msgout;
         TestQuestionPanel radio;
         Interface () {     // 100
              super("This is a JFrame");
            setSize(800, 400);  // width, height
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              // set-up card layout
              cardPane = new CardLayout();
              frameForCardPane = new JPanel();     // for CardLayout
              frameForCardPane.setLayout(cardPane);     // set the layout to cardPane = CardLayout
              TestQuestionPanel cardOne = new TestQuestionPanel("ABC", "DEF", msgout, radio);
              TestQuestionPanel cardTwo = new TestQuestionPanel("GHI", "JKL", msgout, radio);
              frameForCardPane.add(cardOne, "first");
              frameForCardPane.add(cardTwo, "second");
              // end set-up card layout
              // set-up main pane
              // declare components
              msgout = new JTextArea( 8, 40 );
              ButtonPanel commandButtons = new ButtonPanel(msgout);
              JPanel pane = new JPanel();
              pane.setLayout(new GridLayout(2, 4, 5, 15));             pane.setBorder(BorderFactory.createEmptyBorder(30, 20, 10, 30));
              pane.add(frameForCardPane);
                 pane.add( new JScrollPane(msgout));
                 pane.add(commandButtons);
              msgout.append("Successful");
              setContentPane(pane);
              setVisible(true);
         }     // 100
    // HERE ARE THE METHODS THAT SHOULD HANDLE THE UPDATING
         static void changeCards() {     // 200
                   cardPane.next(frameForCardPane);
                   System.out.println("Calling methods works!");
         }     // 200
         static void displayMessage(String test) {     // 200
                   String reset = "Test of reset.";
                   String passMessage = test;
                   cardPane.next(frameForCardPane);
                   System.out.println("Calling methods works!");
                   msgout.append("\n"+ test);
         }     // 200
    }     // 300

    Hi,
    I instantiate it in this class. Does that change your opinion or the advice you gave me? Please help!
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    class CardLayoutQuestionsv2 {
        public static void main(String[] arguments) {
            JFrame frame = new Interface();
            frame.show();
    }

  • JSplitPane problem with JTextArea

    The following piece of code has the problem in it. When you resize the splitpane you won't be able to decrease the size because of the setLineWrap(true).
    I am also wondering why the button in the bottom moves (and how do I stop it from moving) when the splitpane is made bigger.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.border.*;
    public class HMI extends JFrame {
         private JPanel map;
         private LeftMenu leftMenu;
         private JSplitPane split;
         public HMI(String title) {
              try {
                   UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                   SwingUtilities.updateComponentTreeUI(this);
              catch (Exception ex) {System.out.println("Look and feel does not exist");}
              map = new JPanel();
              leftMenu = new LeftMenu();
              split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,leftMenu,map);
              setLayout(new BorderLayout());
              add(split, BorderLayout.CENTER);
              split.setOneTouchExpandable(true);
              split.setBorder(BorderFactory.createEmptyBorder());
              setSize(1024,768);
              setLocationRelativeTo(null);
              setVisible(true);
              setDefaultCloseOperation(EXIT_ON_CLOSE);
    //NESTED
    public class LeftMenu extends JTabbedPane {
         TabLogg logg;
         public LeftMenu() {
              logg = new TabLogg();
              addTab("Logg",null,logg,"Visar loggar av information f�r kartan");
    //NESTED
    public class TabLogg extends JPanel {
         private JButton reset = new JButton("Clear logg");
         private TitledBorder border = BorderFactory.createTitledBorder("Logg");
         private JTextArea text = new JTextArea();
         public TabLogg() {
              setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
              text.setLineWrap(true);
              text.setEditable(false);
              reset.setAlignmentX(Component.RIGHT_ALIGNMENT);
              add(text);
              add(reset);
              text.setText("testststg sd sdgs gsdg sd gs gsdgsdg");
         public static void main (String[] arg) {
              HMI human = new HMI("V�ltnavigeringssystem Interface - Ny");
    }

    I want the button to stay alligned to the very left. Read the Swing tutorial on [How to Use Box Layout|http://java.sun.com/docs/books/tutorial/uiswing/TOC.html] for an explanation and example of how the alignment of components works.
    Also, use the following to maximize the frame:
    //setSize(1024,768);
    setExtendedState(JFrame.MAXIMIZED_BOTH);

  • A problem with JTextArea.write()

    hi, I'm writting some code about reading content of a TextArea by use the method JTextArea.write().
    when the content is short, that will be ok, but the content is too long, my thread seems to be dead. and NetBeans's debuger shows nothing, just unresponse.
    can someone to point out my problem in the code below?
    textSource.write(bfw); //textSource is extends from JTextArea, when content in it is too large, dead here
    private void output2textResult() {
            Runnable myThread = new Runnable() {
                public void run() {
                    // component.doSomething();
                    final String source = txtFldSource.getText();
                    final String destination= txtFldDestination.getText();
                    String tmp;
                    try{
                        PipedWriter pipOut = new PipedWriter();                  
                        BufferedWriter bfw = new BufferedWriter(pipOut);   //I wrapped the pipOut with the BufferedWrite
                        PipedReader pipIn = new PipedReader(pipOut);
                        BufferedReader bfr= new BufferedReader(pipIn);
    //problem line below
                        textSource.write(bfw);   //textSource is extends from JTextArea, when content in it is too large, dead here  
                        while(bfr.ready()){
                            tmp = bfr.readLine();
                            tmp.replaceAll(source, destination);
                            textResult.append(tmp+"\n");
                        bfr.close();
                        pipIn.close();
                        pipOut.close();
                    }catch(IOException e){
                        System.out.println(e);
            SwingUtilities.invokeLater(myThread);

    This won't work. Pipes are for use between threads. The implication of what you're doing in a single thread is that the pipe is somehow capable of holding the entire source text (which it isn't). In other words you're just trying to buffer it, so you may as well just get all the source text as a String and do your magic on it directly.

  • Problem with screen zooms in by itself

    I have a Nokia Lumia 625 and i m facing problem that the phone screen itself zooms in and i need to switch off to get back to actual scrren resolution
    RD

    darshik wrote:
    I am also facing same problem of screen magnification. Even when i am not using and phone is in my pocket, after a while i take a look its dinosaur fonts screen.
    phone is just 20 days old.
    only solution is too restart, no other function works.
    Did you try the solution provided in the post above yours ???

  • Problem with dragged component after resizing the frame

    My application is simple: I am displaying an image on a panel inside a frame (JFrame). I am able to drag the image inside the panel. My problem is that, after dragging the image around, if I am resizing the frame, the image goes back to its original position.
    Does anyone know a workaround?
    I have been using the sample provided by noah in his answer (reply no. 3) to a previous question on this forum: http://forum.java.sun.com/thread.jsp?forum=57&thread=126148
    Thank you!

    Chek out the visibility of your components. Some operations may render them invisible. Use the setVisible( boolean ) to make them visible.

  • I have a problem with a table not resizing correctly in some browsers

    Hi,
    I am using the fluid grid layout in DW. I have created a table to hold some images and text. I have the table set to 100% instead of a fixed width.
    The table and images resize correctly at my smartphone breakpoint in DW and Crome. They do not resize correctly in IE10 or Firefox.
    I hope somebody can point out the error of my ways.
    Thanks
    http://cupcakemary.skeeterz71.com/_cm_mockup/menu.html

    Tables do not work well in Fluid Grid Layouts because table width is always going to be determined by combined width of the content inside it.  As such it won't re-scale past a certain point no matter what you do. I typically avoid using tables for layouts anyway.  But especially in FluidGrids.
    If you build your FluidGrid layout correctly from the start, there's little reason to use tables.
    LayoutDiv 1                 LayoutDiv 2                      LayoutDiv 3
      float:left                        float:left                            float:left
    On smaller displays, these divs will naturally stack vertically.
    LayoutDiv1
    LayoutDiv2
    LayoutDiv 3
    Nancy O.

  • Problems with hangs, freezing, apps quitting - OSX 10.5.5 Server

    HELP!
    Have just taken delivery of a brand new MacPro 3.2GHZ with 10GB RAM and 4TB storage which we are running as a server.
    Installed 10.5.4 Server from the disc as an erase and install, got everything setup and running over the weekend and then installed the updates via Software update.
    Have been having problems with apps freezing up (Adobe updater and Mail) when I click on the dock to Force Quit the dock freezes too and I have to do a forced shutdown with the power button.
    As of today I am now also having problems with Acrobat 8 Pro shutting itself down after about 10 seconds. Here is the Console log:
    25/09/2008 10:01:22 Acrobat[1191] NSDocumentController Info.plist warning: The values of CFBundleTypeRole entries must be 'Editor', 'Viewer', 'None', or 'Shell'.
    25/09/2008 10:01:22 Acrobat[1191] NSDocumentController Info.plist warning: The values of CFBundleTypeRole entries must be 'Editor', 'Viewer', 'None', or 'Shell'.
    25/09/2008 10:01:22 Acrobat[1191] NSDocumentController Info.plist warning: The values of CFBundleTypeRole entries must be 'Editor', 'Viewer', 'None', or 'Shell'.
    25/09/2008 10:01:22 Acrobat[1191] NSDocumentController Info.plist warning: The values of CFBundleTypeRole entries must be 'Editor', 'Viewer', 'None', or 'Shell'.
    25/09/2008 10:01:30 [0x0-0x43043].com.adobe.Acrobat.Pro[1191] Adobe SelfHealing Error: Un
    25/09/2008 10:01:30 [0x0-0x43043].com.adobe.Acrobat.Pro[1191] able to resolve target URL for specified destination:
    25/09/2008 10:01:30 [0x0-0x43043].com.adobe.Acrobat.Pro[1191] {APP}PDFMaker
    25/09/2008 10:01:30 [0x0-0x43043].com.adobe.Acrobat.Pro[1191] Lib
    25/09/2008 10:01:30 [0x0-0x43043].com.adobe.Acrobat.Pro[1191] Adobe SelfHealing
    25/09/2008 10:01:30 [0x0-0x43043].com.adobe.Acrobat.Pro[1191] Error: Unable to resolve target
    25/09/2008 10:01:30 [0x0-0x43043].com.adobe.Acrobat.Pro[1191] URL for specified destination:
    25/09/2008 10:01:30 [0x0-0x43043].com.adobe.Acrobat.Pro[1191]
    25/09/2008 10:01:30 [0x0-0x43043].com.adobe.Acrobat.Pro[1191] {APP}PDFMakerLib
    25/09/2008 10:01:30 [0x0-0x43043].com.adobe.Acrobat.Pro[1191] Adobe SelfHealing Error: Unable to resolve targ
    25/09/2008 10:01:30 [0x0-0x43043].com.adobe.Acrobat.Pro[1191] et URL for specified destination:
    25/09/2008 10:01:30 [0x0-0x43043].com.adobe.Acrobat.Pro[1191] {APP}PDFMakerLib
    25/09/2008 10:01:30 [0x0-0x43043].com.adobe.Acrobat.Pro[1191] Adobe SelfHealing Error: Unable
    25/09/2008 10:01:30 [0x0-0x43043].com.adobe.Acrobat.Pro[1191] to resolve target URL for specified destinat
    25/09/2008 10:01:30 [0x0-0x43043].com.adobe.Acrobat.Pro[1191] ion:
    25/09/2008 10:01:30 [0x0-0x43043].com.adobe.Acrobat.Pro[1191] {APP}Office/{REPLACE}/Exce
    25/09/2008 10:01:30 [0x0-0x43043].com.adobe.Acrobat.Pro[1191] l/PDFMaker.xla
    25/09/2008 10:01:30 [0x0-0x43043].com.adobe.Acrobat.Pro[1191] Adobe SelfHealing Error: Unab
    25/09/2008 10:01:30 [0x0-0x43043].com.adobe.Acrobat.Pro[1191] le to resolve target URL for specified destinati
    25/09/2008 10:01:30 [0x0-0x43043].com.adobe.Acrobat.Pro[1191] on:
    25/09/2008 10:01:30 [0x0-0x43043].com.adobe.Acrobat.Pro[1191] {APP}Office/{REPLACE}/PowerPoint/
    25/09/2008 10:01:30 [0x0-0x43043].com.adobe.Acrobat.Pro[1191] PDFMaker.ppa
    25/09/2008 10:01:30 [0x0-0x43043].com.adobe.Acrobat.Pro[1191] Adobe SelfHealing Error: Unable to resol
    25/09/2008 10:01:30 [0x0-0x43043].com.adobe.Acrobat.Pro[1191] ve target URL for specified destination:
    25/09/2008 10:01:30 [0x0-0x43043].com.adobe.Acrobat.Pro[1191] {APP}Office/{REPLACE}/Word/PDFMaker.dot
    25/09/2008 10:01:42 com.apple.launchd[219] ([0x0-0x43043].com.adobe.Acrobat.Pro[1191]) Exited abnormally: Bus error
    I have tried trashing the preferences files but no change. Any recommendations?
    Matt

    dino_russ wrote:
    chelly Campbell wrote:
    Ok, I've been having this same problem. Took it to the Apple Store today, the guy seemed like he had absolutely no clue.
    anyway, came home from the Apple store thinking, maybe what he did (which is the same thing I did) worked. Nope.
    Any suggestions would help. It's getting so annoying to have to power down my computer and wait for it to come back every time I want to pick it up.
    Chelly
    Well as has been said above Apple supposedly knows there is a problem and some fix is on way, but til then all the workarounds -- even complete restore of OS, files and such from scratch in one case I read have not helped me or others, at best they seem temporary. Something with 10.5.5 and iTunes (other apps?) is a amiss. My Mac book with same files OS and such does not have this problem so go figure?
    Russ
    Just a note on all this, this thread has quieted last few days. My machine has also and settled down to almost normal. No updates so not sure why, but then I have not been running much videos in iTunes 8.01 and such (just audios) Store works fine for me also.
    I have done only one thing suggested amongst many. I have all but stopped using the trackwheel on my microsoft bluetooth mouse as this was one suggested problem (I have no clue why it would even be). I have noticed that one evening when I started doing the trackwheel though the spinning ball came back. So what this has to do with 10.5.5, ITunes 8.01 and all I am not sure. Still hopping for update that completely eliminates though. Since apple does admit a problem.

  • TS1884 How do you cope with a system that shuts itself down after a safe boot progress bar is completed?

    How do you resolve a problem with a system that shuts itself down after a safe reboot and when the progress bar is completed? Thanks.

    Thanks for you response - the honest answer is I don't know, not being particularly IT literate. I do know however that I'm running Maverick if that is of any help?
    I also tried the Command R route, along with holding some other keys as per the Apple troubleshooting guide, but no luck. My wife pointed out though that the system was running slowly over the last few days and we had quite a lot of the 'spinning beach ball' before being able to undertake tasks.
    Lastly, I inserted my start up disk bit as the system is unable to start I'm now unable to retrieve it. All-in-all a real pain.
    Appreciate any advice. Many thanks.
    Philip

  • My iPod Touch 3rd Gen is having problems with the touch screen being unresponsive, too responsive, freezing and constantly resizing. Is this a common problem? Is there a fix?

    My iPod Touch (3rd Gen) is having problems with the touch screen being unresponsive, too responsive, freezing and constantly resizing. It varies between not responding when I tap the screen and acting as if I double-tap or tap and hold when I tap. Every so often it freezes for a minute or so and then comes back. The scren is constantly changing sizes too such that I often can't see most of the top status bar or other edges. This makes typing almost impossible, ruins most games and generally makes everything difficult, but otherwise the iPod is working correctly. Powering off, shutting down apps, letting it sit have not worked. This has happened once before months ago, but the issue resolved itself somehow. Is this a common problem? Is there a fix?

    Try this for the freezing
    http://www.apple.com/support/ipodtouch/assistant/ipodtouch/
    Or if they don't work put it into recovery mode
    See here
    http://www.apple.com/support/ipodtouch/assistant/restore/
    Then restore
    http://support.apple.com/kb/HT1414

  • The last time you opened OpenOffice, it unexpectedly quit while reopening windows. Do you want to try to reopen its windows again? i have a problem with open office, if I press reopen, nothing happened  ans i see always this information on my mac? what ca

    The last time you opened OpenOffice, it unexpectedly quit while reopening windows. Do you want to try to reopen its windows again? i have a problem with open office, if I press reopen, nothing happened  ans i see always this information on my mac? what can I do?

    Please follow these directions to delete the Mail "sandbox" folders. In OS X 10.9 there are two sandboxes, while in 10.8 there is only one. If you're running a version older than 10.8, this comment isn't applicable.
    Back up all data.
    Triple-click anywhere in the line below on this page to select it:
    ~/Library/Containers/com.apple.mail
    Right-click or control-click the highlighted line and select
    Services ▹ Reveal
    from the contextual menu.* A Finder window should open with a folder named "com.apple.mail" selected. If it does, move the selected folder — not just its contents — to the Desktop. Leave the Finder window open for now.
    Log out and log back in. Launch Mail and test. If the problem is resolved, you may have to recreate some of your Mail settings. You can then delete the folder you moved and close the Finder window. If you still have the problem, quit Mail again and put the folder back where it was, overwriting the one that may have been created in its place. Repeat with this line:
    ~/Library/Containers/com.apple.MailServiceAgent
    Caution: If you change any of the contents of the sandbox, but leave the folder itself in place, Mail may crash or not launch at all. Deleting the whole sandbox will cause it to be rebuilt automatically.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combination  command-C. In the Finder, select
    Go ▹ Go to Folder...
    from the menu bar, paste into the box that opens (command-V). You won't see what you pasted because a line break is included. Press return.

  • Problem with Batch Resizing in CS3

    I have a bunch of .jpeg pictures I want to resize.  I created a new action, I went to File - Automate - Fit Image and set the size to 1920x1080, closed but did not save the image. Then I stopped the action.
    Then I went to File - Automate - Batch and set the Action to my new action, set up the source and destination folders and clicked OK.
    However, after resizing the first picture in the source folder, I get the JPEG quality window opening and when I click ok, it just keeps opening the JPEG quality window after each picture is resized.
    Is there anyway to prevent this jpeg quality window from opening each time, so the action just resizes all the pictures ?  I'm using CS3 Photoshop?
    Thanks in advance,
    John Rich

    That could be a video card problem, so run a check on it.
    If changing drives be sure to deactivate CS3 before doing this (in Help menu).  Then activate once installed on new HD.  Best to do this with disks rather than just file transfer.

  • Problem with JFrame resizing at runtime

    Hi All,
    I have a problem with resizing the JFrame at runtime. Even if i resize the JPanel. It is not affection on all the components over the frame. How can i solve that I am using AbsoluteLayout(jre1.6) and here i am going to provide you code snippet. My requirement is to resizt the form. If form is small in size then all the component should also be according tothe size of the form.
    public void initComponents(int size) {
    if(size >= 50) {
    x_co_or = 300;
    y_co_or = 300;
    } else if(size < 50) {
    x_co_or = 200;
    y_co_or = 200;
    jPanel1 = new javax.swing.JPanel();
    jButton1 = new javax.swing.JButton();
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
    jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
    jButton1.setText("jButton1");
    jPanel1.add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 40, 110, 40));
    getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, x_co_or, y_co_or));
    pack();
    Can anybody suggest any idea/solution.
    Any idea/solution are most welcome.
    Regards,
    Pradeep Dubey

    How can i solve that I am using AbsoluteLayout(jre1.6)
    and here i am going to provide you code snippet.no need for the snippet, you're using absolute positioning, which means you're responsible for location and size on every single change.
    start coding now, take about a week, or you could use a layout manager, take maybe, 5 minutes

  • HT4009 Do you understand me ? I want money back.Because I have problem with LINE In App Purchase.And no one try to resolve this problem.And the answer of NEVER LINE JAPAN they don't have responsibility.I think it will be effect with APPLE image also.I wan

    Do you understand me ? I want money back.Because I have problem with LINE In App Purchase.And no one try to resolve this problem.And the answer of NEVER LINE JAPAN they don't have responsibility.I think it will be effect with APPLE image also.I want you to help me everyways to refound my monet back.Could you?

    Contact iTunes Store Support.

Maybe you are looking for

  • Problem on LabVIEW + Debian 64bits

    Hello, I'm trying to install LabVIEW 7.1 on my Debian SID x64, I have all de requirement writen in the Readme.txt and I tryed to install it by INSTALL-norpm . The problem is that I always get : #sh INSTALL.norpm labview70-appbuild /usr/local/share/la

  • How to handle date prompt in report

    Hi I have date column on database as timestamp. Now need to apply filter in report based on date prompt. Do i nee to cast it in Date format..or how i can do it. thanks,

  • Force Safari to open ALL links and everything else in tabs

    I want to have just one Safari window open and all the links that I click on that are supposed to be in a new window open in a new tab and all the links that I click on any other program open on the same safari window but in a new tab just like in Fi

  • [Mobile.Actionscript.it presents the 2nd Mobile Game Contest]

    Mobile.Actionscript.it presents the 2nd Mobile Game Contest Gaming today is one of the most popular means of entertainment on mobiles, and is fast becoming the most exciting new field for mobile content developers worldwide. In this flourishing new e

  • CIN Indian Excise Law, Problem in AED

    HI, I have a problem in CIN, AED utilisation. This problem has more to do with functional knowledge than SAP knowledge. My probelm is that the user claims that the cenvat credit of 4% AED on input material can be utilised for payment of BED liability