A strange Jtextarea resize problem

Hello everybody:
I have a jTextArea without Jscrollpane ( I want to do my own scroll)
For example, the initial height of my jTextArea is 281 pixels
I divide the height by the rowheight (calculated using getFontMetrics(myfont).getHeight();)
so, 281/17 = 16.52 possible rows
When I resize the Frame of my application I recalculate the last values in order to know how many rows are possible
If I increase the height of the Frame everything is ok, but if I decrease it, the jTextarea makes some 'autoscroll' and the height of the JtextArea not change ????
Repeat, I'm not using no Jscrollpane linked with the JtextArea.
So, in this situation the last calculation gives me a wrong value ( height / rowheight).
I'm using Gridbaglayout, and I think this is the responsible of the situation
I supose that gridbaglayout says to Jtextarea ' Hey , your new height is least' and the JtextArea makes some 'autoscroll' , so Is there any way to avoid this AutoScroll ?
Thanks

I want to edit a file which has 2.000.000 rows of data.
I have developed a special way to edit it, showing only the number of lines that can be showed in the JtextArea. I only wnat to have a Horizontal scroll, but I dont want Vertical scroll ( I have my own vertical scrollbar)
When I resize the Jframe, the Jtextarea also resize.
But if it has content, when I decrease the vertical size of my frame 'somebody' moves the JtextArea, because it is as if the 'y' coordinate of the JtextArea was negative
The size of my JtextArea is the same before resize !!!???, this is the 'autoscroll' I mentioned in the original post.
Why is the reason because the increase resize works fine (the Jtextarea grows verticaly) and the decrease not ?
Thanks

Similar Messages

  • [SOLVED] GNOME 3.8 annoying window resize problem

    Hello all fellow early-adopters :-)
    A very annoying quirk I've noticed, moving from GNOME 3.6 to 3.8, is that it no longer remembers, nor retains, the size/positions I set for many of my application windows. For example, my mail client (Evolution) is sized to fill most of my screen (centrally), with Empathy and Skype as long narrow windows on both sides - giving me a nice, broad "communications" overview on that particular desktop (with dev tools etc open on others).
    On 3.6, this layout was retained during my session, as well as next time I started these apps up.
    In GNOME 3.8, not only does it insist that these windows are always started as small little bunched-up windows that I need to resize, but every time a window displays a notification/warning (message in internal yellow bar inside the window - such as loss of internet connection, mail retrieval failure etc) it resizes the windows spontaneously to a stupid, small size that overlays the other windows. This is driving me crazy!
    Where can I learn a bit more about how window sizing / positioning works in GNOME 3.8, or is it finally time to switch to awesome wm? I want to love GNOME 3.8, I really do. It's so slick, but so... unpolished.
    I want to dig in an assist with problems like these, but I need some pointers to some background material first to understand the problem. Is it the window manager? Is it the app?
    ** UPDATE: Doing a full system upgrade, as of May 18, 2013, has resolved this annoying problem. My windows now stay where they belong, and start with the same size they were closed with. GNOME is now pleasant to use again :-)
    Last edited by dawid.loubser (2013-05-21 13:37:25)

    dawid.loubser wrote:Thanks for the suggestion drtebi - I'll give it a try.
    I really like GNOME 3.x though (and would like to understand the windowing behaviour), but if the annoying quirks are insurmountable, I will happily switch.
    Man I love GNOME 3.x. I admire the courage they had to change, basically, everything, and I find myself more productive with my GNOME 3 Arch box than with my good ol' Slackware KDE 4 box. I just hate those bugs - for example I filed a task in their bugtracker for this window resize problem I have with gedit. If it's a love/hate relationship, I think it's marriage ^_^
    With the 3.8 upgrade, deadbeef was having a similar problem with window size/position. I just recompiled it against the latest GTK+3 package upgrade (that came after the 'big upgrade' here on Arch) and it was fixed. But not with gedit
    bwat47 wrote:
    Man I really hope this gets fixed soon, because aside from this one incredibly annoying issue I am loving gnome 3.8.
    I get the feeling gnome badly needs more beta testers, sizable regressions like this in "stable" releases happen way too often sad.
    I get the exact same feeling. Well bugs exist everywhere, there's no denying. But I think it would be wiser to 'alternate' the nature of each major stable release - one focusing on new features and one focusing on fixing bugs. For example if the only new features in GNOME 3.10 were the AppsFolder full implementation and the introduction of gnome-calendar, and the rest of the development cicle being devoted to fix bugs, I'd be more than happy.
    Like Fedora and Ubuntu, the fixed 6-month release cycle colaborates with the bugs. They don't do like Debian or Slackware which are released 'when they are ready'.
    EDIT: fout (yet) another bug. At least with facebook chat (haven't tested with other telepathy plugins) the buddy tray icon appear duplicate. Anybody with the same issue?
    Last edited by lmello (2013-05-02 14:06:06)

  • I have a strange 3g data problem.

    I have a strange 3g data problem.  At home I have zero 3G connectivity even though all bars are showing and says "3G" and wifi is "Off" ... unless I am on the phone and then magically the 3G data connection works perfectly!!  Does anyone have any idea what is happening?  Also when I bring my phone to my dad's or my friends house the problem disappears!! Is this a hardware or a AT&T network problem? os is 4.3.3
    Also called ATT and they said there was no problem with the network and that it was a hardware issue.  Also restored the phone several times but the problem did not go away.

    OK, no trouble shooting. The first thing I'd attempt is restarting in Safe Mode. If you still don't have luck try doing both a SMC and PRAM reset, it wouldn't hurt to do the SMC reset a couple of times. If still no luck let us know.
    SMC RESET
    Shut down the computer.
    Unplug the computer's power cord and all peripherals.
    Press and hold the power button for 5 seconds.
    Release the power button.
    Attach the computers power cable.
    Press the power button to turn on the computer.
    PRAM RESET
    Shut down the computer.
    Locate the following keys on the keyboard: Command, Option, P, and R. You will need to hold these keys down simultaneously in step 4.
    Turn on the computer.
    Press and hold the Command-Option-P-R keys. You must press this key combination before the gray screen appears.
    Hold the keys down until the computer restarts and you hear the startup sound for the second time.
    Release the keys.

  • Preview Application Resizing Problem

    Preview Application Resizing Problem
    Microsoft platforms have two significant advantages. The first is the concept of an operating system that can function with hardware that ranges from cellular phones to desktop computers. The second is that Microsoft has excellent software development tools
    for creating and testing computer programs.
    Software compatibility across hardware platforms requires not only meeting CPU and memory requirements. Application programs must be able to automatically adjust Window and control sizes to meet the needs of available window sizes, video display unit sizes
    and screen resolutions, switching between vertical and horizontal viewing, vertical and horizontal scrolling, changes in font sizes , and variations in the available screen space due to usage of vertical and horizontal toolbars.
     Software developers must be careful that resizing doesn’t squeeze controls too close together or make them so small that they cannot be finger or stylus selected when used with touch screens.
    Some of the required automatic resizing options are provided by the Microsoft software compilers and the Windows operating system.  Softgroup Component’s “.NET  Forms Resize” is an example of one of the third party applications that provide advanced
    resizing functionality.
    Many of the resizing functions are programmer options and, if not properly enabled, an application may not have the required resizing functionality. At the current state of the art, application programs are highly variable in their capability to do the “intelligent
    resizing” that is required to handle different display environments.
    A case in point is the Microsoft Preview Application for Windows 10. When entering lengthy comments, the send button becomes positioned off the end of the program window. It is possible to scroll to the button, but the display automatically resets when scroll
    is released. The result is that the text cannot be sent. You can try a "blind" TAB to the SEND button. This appeared to work after several tries, but the comment was apparently not received,
    RERThird

    Hi,
    What do you see when you open the same PDF file in Acrobat Reader? Are the words still squeezed than?
    Dimaxum

  • Illustrator Resizing Problems

    I am having reduction resizing problems in Illustrator CS6.  E.G. Straws & lemon wedge rinds become significantly proportionately wider when reduced.   Also, numerical text does not skew with everything else.  I have a CC membership w/PS & Ai installed.  There are no other Adobe items on my 8 month old imac, Lion 10.7.4 except Flash player & the Adobe Applications Manager.  Additionally, I have no 3rd party plug-ins & deleting the prefs file does not fix the problem.  Any help on this matter would be greatly appreciated. 

    sgem,
    And untick Align to Pixel Grid if ticked (you can do it in the Transform panel, or search for it in the Helpfile).
    Hi Steve. Still summer?

  • DV resize problem with QuickTime's iPod 320 x 240 export

    Just a heads up for those with new 5th generation iPods who plan on converting their DV movies for display on the iPod. It seems that the iPod 320 x 240 export does not resize DV correctly. Here is a link concerning this problem:
    Waymen, "Possible resize problem with iPod 320 x 240 Export?" #1, 03:02am Oct 13, 2005 CDT

    This article show a workaround to have DV export correctly in QuickTime Pro
    http://docs.info.apple.com/article.html?artnum=302955

  • CS4 Media encoder - Crop+Resize problem

    I`m attempting to both crop and resize a video at the same time.
    I have an AVCHD 1920X1080 premiere CS4 project. I export it to media encoder.
    I`m attempting to encode it to flv or f4v.
    After having cropped the video in Media encoder I would like to resize it but then I encounter a problem:
    I have 3 options in the output settings:
    Scale to fit/Black borders/Change output size.
    `Black borders` is not what I want. I need my frame to contain nothing outside of the image.
    If I choose `Scale to fit` the video immidiately becomes terribly blurred. It can`t be not a resolution issue as the size is 429X622 after the crop and the original is HD (and if I encode it the result is accordingly strangely blurred) I can resize the video but it will be `blurred`.
    If instead, in the output settings I choose `Change output size` I get a normal video image (no blur, that is)  but the the `resize video` interface under the `video` tab is disabled - it is greyed out ( even though the checkbox next to it is still marked) and the width and height boxs are greyed out too. I can`t resize.
    I`ve attached to this message a JPEG capturing a part of the frame to show the strange blurring problem as well as the greyed out `Resize` interface.
    What am I doing wrong ?

    Jim Simon asked:
    But isn't that the size you want?  If not, how did it get set that way?
    Thanks for your interest, Jim Simon. Well, no, it`s not the size I want. I want to be able to resize at will, after I had cropped. How did it get set that way ? I got that 429WX622H frame merely by cropping the original 1920X1080 frame by using the `Media encoder` crop function, while the output is set to`Change output size` . If I would go now and rechange the size of the cropping frame I would get different dimension numbers. But as to how it got `set` this way, and now I refer to the word `set` as in `not being able to change anymore, being greyed out and disabled` - I have no idea at all, and this actually stands at the core of my bewilderment. If i choose to go about it differently and change the order of actions by resizing first and then cropping, for example, if I would choose first to change the size of the video from 1920X1080 to let`s arbitrarly say: 720X440 and then I would go and crop it in order to exclude from the frame certain imagery that I don`t need, then, Oddly enough, my previous resizing action will be strangely ignored and the cropping is re-calculated from the original 1920X1080 frame. I may even end up with a  `crop` which is larger than my `resize`.
    In other words: I need to be able to change both what I include in my frame and the final video resolution, and media encoder would not allow it in `Change output settings`  and it would allow it in `Scale to fit`  but then it insists on adding a strange and impossible bluriness effect even in the result encoded video.

  • Applet resize problem

    The problem persists only in JRE 1.5
    a. We got three resizable frames in a vertical frameset.
    b. The middle frame contains the applet.
    c. We take this frame's upper border and drag it down("show window content while dragging" is off). So the frame(and applet) height decreases.
    Then strange thigns happen - applet FIRST is displayed from the new upper border BUT with PREVIOUS larger height! (it overlaps the lowest frame), then it is displayed again with good smaller sizes. So as a result we got a correct applet in resized frame but we got a piece of the image overlapping the lowest frame.
    How it looks from our debug output:
    1. After we release the mouse button we get "component resized event" - this is ok. We take getSize() and it returns the new correct smaller sizes
    2. function paint(overloaded) is called. However when we getSize() there we got bad(previous) larger height !
    3. function paint is called again, we got correct new smaller height there.
    We are not stupid - on step 2 we compare getSize() result to the sizes we got on step 1. So when this bug happens - we can understand this. We exit from paint method immediately when we catch this. But it also does not help! The part of the image still overlaps the lowest frame.
    Any ideas how can we avoid this JRE 1.5 bug?
    Thank you.

    In my case, someone told me to eliminate in applet's HTML this directives:
    <META HTTP-EQUIV="Pragma" CONTENT="No-cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
    <META HTTP-EQUIV="Expires" CONTENT="0">
    <META HTTP-EQUIV="Cache-Control" CONTENT="must-revalidate">
    <META HTTP-EQUIV="Cache-Control" CONTENT="mag-age=0">
    Further, to set in Preferences/Advanced/Cache the option "Once per session" for "Document in cache is compared to document to network"
    Believe me, in my case, it's worked with no aditional changes in the original applet's code. (Don't thank to me, my chilean friend Christian was the magician).

  • PAR Iview resizing problem....

    Hello Gurus,
    I have the following problem. I've develop a PAR Iview and i want to resize it on runtime. I've write on my PAR app. a javascript code, but the system shows me a javascript's error when i launch it on my portal, after open the error it says "EPCM Undefined" on this line:
    EPCM.subscribeEvent('urn:com.sapportals.portal:browser', 'load', initFooter);
    In my profile i've set EPCFLevel = 2, but my question is: do i have to reference or include a external jar or lib to my PAR??? witch one???. For General culture...a general info about my iview is: The type of my PAR (Iview) is: AbstractPortalComponent and it has a different namespace (com.<company>.portal.addon.footer) than the namespace i want to subscribe the event.... Please Help!!!!!, i dont know why this error happens...and how can i solve it...what am i missing here within my source code????....
    Regards,
    Mariana

    Hi Rajat,
    Thanx for answer me... now i have a question...why with the standard PAR Iviews that doesnt happens???... because that doesnt happens with all the iviews...happens only with mine's. I know that header Iviews (masthead) use the EPCM object, and it is working just fine, that is why I'm asking if there is an external library, jar, etc., that i have to include in my PAR in order to make it work. is This the only solution in my case???
    I will wait for your answer,
    Best regards,
    Mariana

  • A Very Strange Post Update Problem

    Hi guys, new to the forum here, wondering if I could get some help with a most disturbing problem...
    Off the bat, I use a ppc Mac G5 running 10.4.11. I use this for Music production, and general music listening in my studio. For Audio I use pro tools HD 7.3 (as well as logic 8), with a digidesign 192 IO interface, and run most ofmy audio thru that. Now that we have that out the way... I normally dont agree to updates, as I would not like to upset a balance thats been working perfectly for me for some time, but 2 days ago, one of my assistants was using the computer and agreed to the latest update for Itunes, quicktime, and logic (but not the security update). Immedietly after the update finished (during which he said the quicktime update crashed), the system started going haywire, pro tools was shutting down, itunes wouldn't open, the like... Well after uninstalling and reinstalling itunes and quicktime, all order was restored, except for one AWFUL problem.. the sound coming out of any program BESIDES pro tools (itunes, logic, toast) is very strange, as if its coming thru very cheap speakers. I've run itunes through both the digi interface and the standard sound card (it has the same problem), and checked the EQ settings (flat), my sample and bit rates are straight... I have no idea! if anyone could offer some insight, It would be much appreciated! Thanks!!

    HI and Welcome to Apple Discussions...
    It's possible there's an underlying problem with your hard drive.
    Insert the installer disk and Restart, holding down the "C" key until grey Apple appears.
    Go to Installer menu (Panther and earlier) or Utilities menu (Tiger and later) and launch Disk Utility.
    Select your HDD (manufacturer ID) in the left panel.
    Select First Aid in the Main panel.
    *(Check S.M.A.R.T Status of HDD at the bottom of right panel. It should say: Verified)*
    Click Repair Disk on the bottom right.
    If DU reports disk does not need repairs quit DU and restart.
    If DU reports errors Repair again and again until DU reports disk is repaired.
    When you are finished with DU, from the Menu Bar, select Utilities/Startup Manager.
    Select your start up disk and click Restart
    Also, make sure you have sufficient drive space. Control or right click the MacintoshHD icon on your Desktop. Click "Get Info". Under the General tab you will see Capacity and Available. Make sure there is at least 10% available disk space, 15% is better.
    If the drive appears to be ok and you have enough available disk space, you could try the 10.4.11 combo update available here. http://www.apple.com/downloads/macosx/apple/macosx_updates/macosx10411comboupdat eppc.html
    Make sure and run Disk Utility and repair disk permissions BEFORE and AFTER the installation.
    Quit any open applications/programs. Launch Disk Utility. Select MacintoshHD in the panel on the left, select the FirstAid tab. Click: Repair Disk Permissions. When it's finished from the Menu Bar, Quit Disk Utility and restart your Mac.
    Carolyn

  • Strange audi sync problem & different, stranger video sync issu in sequence

    I have two strange occurances with one particular set of media that was downloaded from the same original source mini-dv (recording in dvcam) tape. I have not found the same issue on any other footage.
    1) when the media is imported into FCP, the audio is out of sync. it is slightly out at the beginning and then gets progressively worse.
    2) when this footage is used in a sequence, the video that show in the sequence is not the same as the video that is exported when this sequence is exported as QT movie (or any other export option) Like the audio the video out of sync gets progressively worse.
    - The original media is perfectly in sync looking at the digitized source ie: in Quicktime. There is no audio out of sync problem.
    - the only difference I could see in the file was that this media is 3.5mb data rate whereas all the others are 3.6mb.
    - other tapes from the same camera do not have a problem
    - I do all my downloading from a firewire deck and not from the camera
    - I upgraded from 6.0.1 to 6.0.4 (as did the QT 7.5 upgrade also) to see if that fixed the problem but to no avail.
    Very perplexing. I managed to work around this problem in a sequence whos deadline was looming by manually slipping the footage in the sequence the required number of frames. This is where it also gets odd. I was able to do this by
    - double click the clip in the sequence which then loaded that into the viewer.
    - position the playhead at the beginning of the clip
    - from the canvas select the go to position in master clip option which then loaded the masterclip into the viewer. the position in the masterclip was always the correct frame (ie the frame I expected to see as per my edit). The frame showing in the canvas was also the correct frame (but this would not be the case when exported)
    - the next thing i did was to use the slip tool, as soon as i held the slip tool over the sequence clip, the frame in the canvas would be the wrong frame (the frame i would see when I exported).
    - then i would just carefully slip the sequence clip back to the matching correct frame. So watching in the viewer, I would align the frame that showed in the viewer to the frame in the canvas.
    When done the frame showing in my sequence would be a completely different frame but when exported, the frame that I expected to see would be the exported frame.
    I could find no logic to the amount I needed to slip each time (I am sure there is logic but I couldnt figure out what that was). the clip at the end of the footage needed to be slipped -10:09, and this got progressively smaller to the clip at the beginning of footage needing to be slipped -:16
    Hopefully that wasnt too confusing.

    btw, i have tried recapturing the footage and i have offlined it, copied it to another location and onlined it in the new location to no avail. still have the sync and video in sequence issues.

  • Strange system font problem

    Hello,
    I have the following problem for 2 days now:
    http://img154.imageshack.us/img154/1462/bild1.png
    I did not install anything. I tried to delete font caches but it did not help.
    I re-installed the system but that did not change anything. After resetting the PRAM the problem was solved. At least for some hours, but now the problem appeared again.
    When I do a reboot, strange white lines appear over the grey background and the Apple Logo, then the screen turns blue, the cursor consists of white lines too and nothing more happens. After several tries to reboot the Mac is running again, but the font problem still exists.
    First I thought of a graphic card problem, but it seems that this font problem only concerns system prefernces and system applications.
    I have no idea what to do now, so please help me.

    Hi "Apfelkrautsalami"
    Font caching information is stored on a per-user basis in
    /private/var/folders
    I have no idea if it'll help, but you could try this:
    - Open a Terminal and do
    *sudo rm -rf -- /private/var/folders/??*
    - Restart your machine
    (Note 1: The '--' prevents rm to think that folders like '-5' are options)
    (Note 2: The '??' will match any two-letter directory. I didn't want to say '*')

  • JViewport Resize problem -- Urgent!

    I am trying to make a program that allows the user to dynamically resize a scrollable JPanel. I have added resize buttons that work well. The JScrollPane works well, but when the JViewport's View is set to the bottom right corner of the JPanel, and the user attempts to resize the JPanel, the JViewport repaints its view to the top left corner, hence undoing any resizing. Resizing should not change the View, even if the component is no longer visible in the view.
    Here is a code example (please pardon the length and lack of comments):
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.event.*;
    import java.awt.event.*;
    public class JViewportBug extends JPanel implements Scrollable, ComponentListener
         public JViewportBug()
              this.setLayout( null );
         public Dimension getPreferredScrollableViewportSize()
              return getPreferredSize();
         public boolean getScrollableTracksViewportHeight()
              return false;
         public boolean getScrollableTracksViewportWidth()
              return false;
         public int getScrollableBlockIncrement( Rectangle visibleRect, int orientation, int direction )
              if( orientation == SwingConstants.VERTICAL )
                   return (int)( visibleRect.getHeight() * 9 / 10 );
              return (int)( visibleRect.getWidth() * 9 / 10 );
         public int getScrollableUnitIncrement( Rectangle visibleRect, int orientation, int direction )
              return 5;
         public void componentHidden(ComponentEvent e)
         public void componentMoved(ComponentEvent e)
         public void componentResized(ComponentEvent e)
              Dimension size = ( (Component)e.getSource() ).getSize();
              this.setBounds( 0, 0, 20 + size.width, 20 + size.height );
              this.setPreferredSize( new Dimension( 20 + size.width, 20 + size.height ) );
         public void componentShown(ComponentEvent e)
         public static void main( String[] args )
              JViewportBug bug = new JViewportBug();
              JFrame frame = new JFrame( "JViewport Bug" );
              frame.setExtendedState( JFrame.MAXIMIZED_BOTH );
              JScrollPane jsp = new JScrollPane( bug );
              JPanel viewable = new JPanel();
              bug.add( viewable );
              viewable.addComponentListener( bug );
              viewable.setBounds( 10, 10, 200, 200 );
              JDesktopPane jdp = new JDesktopPane();
              jdp.setLayout( null );
              for( int i = 0; i < 8; i++ )
                   ResizeButton rb = new ResizeButton( viewable, i, true );
                   bug.add( rb );
                   viewable.addComponentListener( rb );
              frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              viewable.setBackground( Color.white );
              frame.getContentPane().add( jdp, BorderLayout.CENTER );
              JInternalFrame jif = new JInternalFrame( "", true, true, true, true );
              jif.getContentPane().add( jsp );
              jdp.add( jif );
              jif.setSize( 500, 500 );
              bug.setPreferredSize( new Dimension( viewable.getWidth() + 20, viewable.getHeight() + 20 ) );
              jif.setVisible( true );
              frame.setVisible( true );
    class ResizeButton extends JComponent implements MouseMotionListener, MouseListener, ComponentListener
         public static final int NW_RESIZE_BUTTON = 0;
         public static final int N_RESIZE_BUTTON = 1;
         public static final int NE_RESIZE_BUTTON = 2;
         public static final int E_RESIZE_BUTTON = 3;
         public static final int SE_RESIZE_BUTTON = 4;
         public static final int S_RESIZE_BUTTON = 5;
         public static final int SW_RESIZE_BUTTON = 6;
         public static final int W_RESIZE_BUTTON = 7;
         JComponent resize;
         int buttonType;
         boolean enabled;
         public ResizeButton( JComponent aComponent, int type, boolean isEnabled )
              resize = aComponent;
              buttonType = type;
              setBounds();
              enabled = isEnabled;
              this.addMouseMotionListener( this );
              this.addMouseListener( this );
         public int getType()
              return buttonType;
         public void mouseEntered( MouseEvent e )
              if( enabled )
                   switch( ( (ResizeButton)e.getSource() ).getType() )
                        case 0:
                             getParent().setCursor( new Cursor( Cursor.NW_RESIZE_CURSOR ) );
                             break;
                        case 1:
                             getParent().setCursor( new Cursor( Cursor.N_RESIZE_CURSOR ) );
                             break;
                        case 2:
                             getParent().setCursor( new Cursor( Cursor.NE_RESIZE_CURSOR ) );
                             break;
                        case 3:
                             getParent().setCursor( new Cursor( Cursor.E_RESIZE_CURSOR ) );
                             break;
                        case 4:
                             getParent().setCursor( new Cursor( Cursor.SE_RESIZE_CURSOR ) );
                             break;
                        case 5:
                             getParent().setCursor( new Cursor( Cursor.S_RESIZE_CURSOR ) );
                             break;
                        case 6:
                             getParent().setCursor( new Cursor( Cursor.SW_RESIZE_CURSOR ) );
                             break;
                        case 7:
                             getParent().setCursor( new Cursor( Cursor.W_RESIZE_CURSOR ) );
         public void mouseExited( MouseEvent e )
              if( enabled )
                   getParent().setCursor( new Cursor( Cursor.DEFAULT_CURSOR ) );
         public void mouseClicked( MouseEvent e )
         public void mousePressed( MouseEvent e )
         public void mouseReleased( MouseEvent e )
         public void mouseMoved( MouseEvent e )
         public void mouseDragged( MouseEvent e )
              if( enabled && e.getSource() instanceof ResizeButton )
                   int clickedX = e.getX();
                   int clickedY = e.getY();
                   int width, height;
                   switch( ( (ResizeButton)e.getSource() ).getType() )
                        case NW_RESIZE_BUTTON:
                             width = resize.getX() + resize.getWidth() - this.getX() - clickedX > 1 ? resize.getX() - this.getX() - clickedX + resize.getWidth() : 1;
                             height = ( resize.getY() + resize.getHeight() - this.getY() - clickedY > 1 ? resize.getY() - this.getY() - clickedY + resize.getHeight() : 1 );
                             resize.setBounds( resize.getX() + resize.getWidth() - this.getX() - clickedX > 1 ? this.getX() + clickedX : resize.getX() + resize.getWidth() - 1,
                                                           resize.getY() + resize.getHeight() - this.getY() - clickedY > 1 ? this.getY() + clickedY : resize.getY() + resize.getHeight() - 1,
                                                           width,
                                                           height );
                             break;
                        case N_RESIZE_BUTTON:
                             height = resize.getY() + resize.getHeight() - this.getY() - clickedY > 1 ? resize.getY() - this.getY() - clickedY + resize.getHeight() : 1;
                             resize.setBounds( resize.getX(),
                                                           resize.getY() + resize.getHeight() - this.getY() - clickedY > 1 ? this.getY() + clickedY : resize.getY() + resize.getHeight() - 1,
                                                           resize.getWidth(),
                                                           height );
                             break;
                        case NE_RESIZE_BUTTON:
                             width = this.getX() + clickedX - resize.getX() > 1 ? this.getX() + clickedX - resize.getX() : 1;
                             height = resize.getY() + resize.getHeight() - this.getY() - clickedY > 1 ? resize.getY() - this.getY() - clickedY + resize.getHeight() : 1;
                             resize.setBounds( resize.getX(),
                                                           resize.getY() + resize.getHeight() - this.getY() - clickedY > 1 ? this.getY() + clickedY : resize.getY() + resize.getHeight() - 1,
                                                           width,
                                                           height );
                             break;
                        case E_RESIZE_BUTTON:
                             width = this.getX() + clickedX - resize.getX() > 1 ? this.getX() + clickedX - resize.getX() : 1;
                             resize.setBounds( resize.getX(),
                                                           resize.getY(),
                                                           width,
                                                           resize.getHeight() );
                             break;
                        case SE_RESIZE_BUTTON:
                             width = this.getX() + clickedX - resize.getX() > 1 ? this.getX() + clickedX - resize.getX() : 1;
                             height = this.getY() + clickedY - resize.getY() > 1 ? this.getY() + clickedY - resize.getY() : 1;
                             resize.setBounds( resize.getX(),
                                                           resize.getY(),
                                                           width,
                                                           height );
                             break;
                        case S_RESIZE_BUTTON:
                             height = this.getY() + clickedY - resize.getY() > 1 ? this.getY() + clickedY - resize.getY() : 1;
                             resize.setBounds( resize.getX(),
                                                           resize.getY(),
                                                           resize.getWidth(),
                                                           height );
                             break;
                        case SW_RESIZE_BUTTON:
                             width = resize.getX() + resize.getWidth() - this.getX() - clickedX > 1 ? resize.getX() - this.getX() - clickedX + resize.getWidth() : 1;
                             height = this.getY() + clickedY - resize.getY() > 1 ? this.getY() + clickedY - resize.getY() : 1;
                             resize.setBounds( resize.getX() + resize.getWidth() - this.getX() - clickedX > 1 ? this.getX() + clickedX : resize.getX() + resize.getWidth() - 1,
                                                           resize.getY(),
                                                           width,
                                                           height );
                             break;
                        case W_RESIZE_BUTTON:
                             width = resize.getX() + resize.getWidth() - this.getX() - clickedX > 1 ? resize.getX() - this.getX() - clickedX + resize.getWidth() : 1;
                             resize.setBounds( resize.getX() + resize.getWidth() - this.getX() - clickedX > 1 ? this.getX() + clickedX : resize.getX() + resize.getWidth() - 1,
                                                           resize.getY(),
                                                           width,
                                                           resize.getHeight() );
         public void setBounds()
              switch( buttonType )
                   case NW_RESIZE_BUTTON:
                        this.setBounds( resize.getX() - 5,
                                                 resize.getY() - 5,
                                                 5,
                                                 5 );
                        break;
                   case N_RESIZE_BUTTON:
                        this.setBounds( (int)( ( resize.getWidth() + 2 * resize.getX() ) / 2 ) - 2,
                                                 resize.getY() - 5,
                                                 5,
                                                 5 );
                        break;
                   case NE_RESIZE_BUTTON:
                        this.setBounds( resize.getWidth() + resize.getX(),
                                                 resize.getY() - 5,
                                                 5,
                                                 5 );
                        break;
                   case E_RESIZE_BUTTON:
                        this.setBounds( resize.getWidth() + resize.getX(),
                                                 (int)( ( resize.getHeight() + 2 * resize.getY() ) / 2 ) - 2,
                                                 5,
                                                 5 );
                        break;
                   case SE_RESIZE_BUTTON:
                        this.setBounds( resize.getWidth() + resize.getX(),
                                                 resize.getHeight() + resize.getY(),
                                                 5,
                                                 5 );
                        break;
                   case S_RESIZE_BUTTON:
                        this.setBounds( (int)( ( resize.getWidth() + 2 * resize.getX() ) / 2 ) - 2,
                                                 resize.getHeight() + resize.getY(),
                                                 5,
                                                 5 );
                        break;
                   case SW_RESIZE_BUTTON:
                        this.setBounds( resize.getX() - 5,
                                                 resize.getHeight() + resize.getY(),
                                                 5,
                                                 5 );
                        break;
                   case W_RESIZE_BUTTON:
                        this.setBounds( resize.getX() - 5,
                                                 (int)( ( resize.getHeight() + 2 * resize.getY() ) / 2 ) - 2,
                                                 5,
                                                 5 );
         public void componentHidden(ComponentEvent e)
         public void componentMoved(ComponentEvent e)
         public void componentResized(ComponentEvent e)
              this.setBounds();
         public void componentShown(ComponentEvent e)
         public void setEnabled( boolean enable )
              enabled = enable;
         public boolean isEnabled()
              return enabled;
         public void paint( Graphics g )
              ( (Graphics2D)g ).fillRect( 0, 0, 5, 5 );
    }

    Hi bbritta,
    Thanks for the time. I guess the setLocation MIGHT be off, tho ideally, it should place the tv somewhere near the right bottom corner of the screen.
    The basic requirement I have is in the code written. This is what I want. When I start my application, I want the small tv screen only to appear, with the two colored panels (that shall obviously contain some other code). When my mouse hovers on this small screen, the buttons should appear in a panel just below the small screen. So I have used a JLayered pane that displays two separate gifs, one for the small screen, and one for the buttons panel. On the small screen gif, I have added two panels to layer 1, and on the button panel gif, I have added 3 buttons.
    What is happening is that if I set the frame size to the size of the small screen at startup (before show()), then on mouse hover, the frame size increases, but the layered pane size stays the same, and hence i cannot see the button panel. But if I start out with the button panel showing (frame size initially set to the larger value), then on mouse exit, the button panel disappears, and reappears properly on mouse enter. But I don't want to set the original size to the larger value, since only the small screen must be seen first.
    Did I make my self clear? The whole problem is that on mouse hover, u cannot see the button panel, till u change the setSize() code in initializeFrame() to use c_o_FULL_TV_SIZE instead of c_o_TV_SIZE. That u cannot see the buttons IS my problem!
    Thanks,
    Shefali.

  • Strange freezing/display problem

    Hi,
    I've recently started having some strange problems with my 24" iMac 2.16GHz.
    What happens is the screen freezes, not just the application I'm working in, but the entire screen. If I move the mouse it looks like the screen tries to redraw itself so I might get a browser window half-duplicated and then other windows look like they leave a trail if you try to move them. I can't click on anything, I can move the mouse for about 10 seconds, then I get the coloured beachball and I have to restart from the back.
    A couple of times when I've restarted there has been a high pitched tone before the start-up chime.
    I can't say exactly what I was doing when the crashes happened but a couple of times I've been looking at videos on YouTube. It may be related, I'm not 100% sure though.
    I can't really explain it any better than that, sorry it's not as clear as it might be. I can't take a screenshot or anything when it happens.
    I've run Disk Utility from the OS CD to repair the disk and it didn't find any problems. I haven't installed any new hardware or anything like that.
    If anyone had any idea what I might try to find out what's going on I'd really appreciate it.
    Thanks.

    Sorry to bump this but this issue is still ongoing with me.
    I'm nearly positive it is caused by watching videos on YouTube, Googlevideo etc. It just happened again while on YouTube. Screenshot - http://img220.imageshack.us/img220/342/screeniu8.jpg
    After about 20 seconds I can click around and the screen goes back to normal when I move the windows. It's almost like using the eraser tool in Photoshop or something, you can 'wipe out' the bits that are not where they're supposed to be.
    Yesterday I reinstalled the OS, I did an erase and install as well. Does this mean my graphics card is the problem?
    Any advice on this would be a great help because I've got a huge amount of work at the moment and this is proving really disruptive (and before you say it I was taking a break when watching that YouTube thing!).
    thanks

  • JTextArea append problem

    I have the following problem:
    I am creating a JFrame with a JTextArea in it.
    After all components are added to the JFrame
    I call:
    setLocation(100, 100);
    pack();
    setVisible(true);
    Then a method is called that generates files and uses
    jTextArea.append(".");
    to add a "." to the JTextArea for each created file
    to show the progress.
    Now the problem is that the dots are not shown one after the other.
    The window pops up AFTER all the dots are written and not when
    setVisible(true);
    is called.
    What do I have to do that every single dot is shown in the
    JTextArea right after it is appended ?

    Move your actual file generating process to a different thread. The best way to do it is using SwingWorker. There is a tutorial on the Sun's web site at http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html that demonstrates how to use SwingWorker.
    Hope this helps
    Sai Pullabhotla

Maybe you are looking for