Screen Flashing while Dragging JWindows

I know this question has been asked here in different forms but ...
I have a top level JWindow. I implemented the mouse motion handlers to implement dragging the window around, but when the window is dragged you get screen flashing and the JWindow repaints in a fashion similar to mouse trails. If you've tried this you know what it looks like.
I have seen the solution to this a long time ago but I didn't save the code, so I know there is a way to get the painting to work properly. Seems like it involved paintImmediately() or invokeLater() or something like that.
If you've tried to implement "transparent top levels" in Java (not possible btw) you know what a pain it is to get this to work. I have requested this feature from Sun Java Team and they said they were looking at it.
I know about the 1.4 JFrame.setUndecorated() but that won't work for me.
Thanks.
K.

Hello @rpowell55317,
Welcome to the HP Forums, I hope you enjoy your experience! To help you get the most out of the HP Forums I would like to direct your attention to the HP Forums Guide First Time Here? Learn How to Post and More.
I understand that you are having issues with your HP TouchSmart 520 while playing games. I would be happy to assist you, but first I would encourage you to post your product number for your computer as there are various versions of the 520. I am linking an HP Support document below that will show you how to find your product number. As well, if you could indicate which operating system you are using. And whether your operating system is 32-bit or 64-bit as with this and the product number I can provide you with accurate information.
How Do I Find My Model Number or Product Number?
Which Windows operating system am I running?
Is the Windows Version on My Computer 32-bit or 64-bit?
Please re-post with the requested information and I would be happy to provide you with assistance. Thank you for posting on the HP Forums. Have a great day!
Please click the "Thumbs Up" on the bottom right of this post to say thank you if you appreciate the support I provide!
Also be sure to mark my post as “Accept as Solution" if you feel my post solved your issue, it will help others who face the same challenge find the same solution.
Dunidar
I work on behalf of HP
Find out a bit more about me by checking out my profile!
"Customers don’t expect you to be perfect. They do expect you to fix things when they go wrong." ~ Donald Porter

Similar Messages

  • White Screen Flash while in use

    So I tried doing some resarch about a white screen, but I all I keep finding is a white screen issue when you boot the macbook and that is not my problem.   For the past week I have noticed that when I am using my computer the screen will flash to white for about 3 second then go back to the screen/page I was working on.  At first I brushed it off, but it has happened about four times in the past week.  The main programs I have been using are Safari and Microsoft Word for mac.  I have also noticed that my computer has been running slower than usual.  I have researched that and tried many fixes like getting files off my desktop/empting my cache among other things.  I have not updated to Lion, but all of my software is up to date.  
    My macbook is 3 years old and just wanted to see if anybody has any idea what white flashes mean.

    Create a new account, name it "test" and see how your apps work in that User acct? (That will tell if your problem is systemwide or limited to your User acct.) This account is just for test, do nothing further with it.
    Open System Preferences >> Accounts >> "+" make it an admin account.
    If the problem is present in the test account also, then it is systemwide. In this case try repairing this with the 10.5.2 Combo Update This is a fuller install, as opposed to an incremental "delta" update so it should overwrite any files that are damaged or missing. It does not matter if you have applied it before.
    Remember to Verify Disk before update and repair permissions after update from /Applications/Utilities/Disk Utility.
    If the problem does not appear in the test account try starting in "Safe Mode" (It will take a bit more time to startup because it runs a directory check first).
    If that works go to System Preferences >> Accounts >> Login Items and remove them. Boot normally and test. If there are still problems, go to ~(yourHome)/Library/Contextual Menu Items and move whatever is there to the desktop. Then do the same with /Library/Contextual Menu Items. Lastly, try moving /Users/Home)/Library/Fonts to your desktop and restarting.
    Log out/in or restart, if that sorts it start putting items back one at a time until you find the culprit.
    Let us know.
    -mj

  • Black screen flashing while playing BF4

    Currently using my GT80 titan display port out to a UD590 and ill randomly get black screens while playing almost like a loss of video out to the monitor. I've tried this with HDMI and get the same issue. This is with latest 980m drivers. Anyone had this problem before?

    Would a lower resolution on UD590 be helpful? How about other monitors, still happen? The native driver shipped with the laptop get the same failure?

  • Error 6 while restoring iPhone 6 with red screen flashing

    I was trying to update to iOS 8.0.2 which failed. Since then, I have been trying to restore my device to the earlier version. While I try to restore, iTunes would say "extracting software" after which it would say "waiting for iPhone" and then I get this "An unknown error has occurred[6]" On repeatedly trying, once I got an instance when there was a scary red screen flashing right after the apple logo that shows when booting the device. And this loop of "red screen flashing" and "the apple boot logo appearing" would continue forever. Anybody else face such problems? Any solut

    Error 1015 is usually a downgrade error. If you are restoring to 4.2.1 firmware then this is most often due to iPhone having iPad baseband. Did you get this iPhone from someone else? If this is the case you will need to search the web for help. Search for iPad baseband, 1015, etc.

  • There is a screen flash on the left top corner of the iPhone 5 while using search iPhone option to open any application. what to be done to resolve the issue?

    Hi. im facing an issue with iPhone 5. when im using the search iPhone option for opening apps. the left top corner of the screen flashes for a second or two. and vanishes when the app is opened. But this problem does not occur when i m searching from the second or third home screens. its only when i search it from the first home screen. kindly help me solve this issue. is it aany kinda hardware or software issue?
    KIndly help. thank you

    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]

  • Screen flashes black while playing games

    When I play games. The screen flashes black for a few seconds and then comes back and does it again?

    After reading this one sentence problem description it is not easy to say much about your problem.
    Maybe you should tell us something about your machine, preinstalled OS, display driver that you use and of course be a bit more detailed about this issue.

  • Screen flashing on error, despite being disabled

    I have the setting under universal access to disable the screen flash on error, yes it's still doing it everytime an error occurs (i.e. a "beep" should be audible if searching a webpage for a word that doesn't exist.)
    Anyone else having this issue?

    That's good news.
    The new account is using information from a brand new Preferences file which is unaffected by whatever made yours misbehave.
    Do this: Go to the Finder and select Go to folder like so:
    then type library like so:
    oops, posting too fast... stand by while I edit this...
    As I was saying...
    Click Go, then find the folder called Preferences and open it. Then find the files called
    com.apple.universalaccess.plist, and
    com.apple.systemsound.plist
    and drag them both to the Trash.
    Log out.
    Log in again and open System Preferences > Universal Access. Configure all four tabs the way you want, then close System Preferences.
    Does that fix things?
    Message was edited by: John Galt

  • R9 280x screen flashes

    First off, I read we were to supply our system's details. So here are mine;
    Main Board: MSI B75MA-E33 (MS-7808)
    Bios Version: 1.70
    Video Card: MSI R9 280X GAMING 3G
    Bios Version: TV277MH.350
    Full Revision String: 015.042.000.000.003435 (113-C3865000-O77)
    When uploading it tells me there's a duplicate here; http ://www. techpowerup.com/vgabios/151603/msi-r9280x-3072-131204.html
    PSU: CoolerMaster GX 750W   http ://www.coolermaster.com/powersupply/gx-series/gx-750w/
    12v rail Rating of listed PSU: +12V 60A 720W, -12V 0.3A 3.6W
    CPU: Intel Core i5-3470 Ivy Bridge 3.2GHz
    Memory: Crucial 1600 2x4gb BLT4G3D1608ET3LX0.
    SSD: KINGSTONSV300S37A120G
    HDD: WD2002FAEX
    CPU COOLER: CoolerMaster Hyper TX3 EVO
    Raid Card: None.
    Sound Card: None.
    Any Additional hardware plugged into your system:
    OC: No
    Operating System: Windows 7 Ultimate 64-bit (6.1, Build 7601)
    From what I gather, the screen flashes whenever the card clocks itself up or down with its automated power saving marketing whatever. (I don't know how it works, I only know it seems to happen when the clock speeds are changing, which is apparently for power saving. Which is nice, but I rather have a working product without issues.)
    The problem here is; the screen flashes.
    When watching a movie, when browsing, even while you are playing some games, you will have screen flashes. Usually not just once or twice, but many times in a row, as if it doesn't know where to settle. It is overly abundant and safe to say; annoying. Adding to that, in a game like Guild Wars 2, it also seems to actively cause artifacts to appear. Making you either restart the game, or run out and back into a zone to force a reload. Which is just a drag to deal with.
    So far my solution to this has been to use the MSI Gaming App which seems to lock it to a speed.
    What I do specifically, is to turn it to silent mode (which simply lists 1000 Mhz, but which I take it uses clocked down settings across the board) and I activate the freeze button (which turns on the fan every once in a while to keep it all nice and cool).
    However, every so often, which could be after three hours, just as easily as after 5 minutes, something kicks in which turns on the default settings again. Returning your screenflashes, and needing a restart of the Gaming App to force its settings down the system's throat again.
    This solution, though effective, doesn't seem ideal for a bunch of reasons. if anything it only seems to be temporary, but most of all, all of this just doesn't make it feel like I've not gotten the product I thought I had bought.
    And it worries me that having the fan run at full speed every so often will drastically wear it down over time and as such is just not an ideal long term solution.
    However, turning on the freeze option does seem to be necessary to prevent artifacts from appearing after about 30 minutes of gametime otherwise.
    Meanwhile, I've of course tried various ways of solving this. Among the drivers that AMD offers on its website, I don't think there is one left that I haven't tried at this point. I've tried every, single, driver, since the R9 series came into existence. And all of which will give me screen flashes.
    As such I am now left with two questions;
    1. Should I try a different BIOS version for this card?  This idea hadn't popped up in me until just now when I had to look up my system specs and came across the BIOS upload option from GPU-Z (which told me there's a duplicate), and where on the website, it seems there's a BIOS version from roughly a day later. Somehow that seems like it's worth a shot. Unless of course someone here tells me that that is just really not a smart idea.
    2. Am I just really unlucky in receiving a card that has something wrong with it and should I try return it or try get a replacement?

    May I ask how do you know your vBIOS version?
    And where did you find the newer vBIOS?
    Flash vBIOS have some risk, if the VGA card is still in warranty,
    I think it is better RMA it...

  • I have a 16GB iPhone 3G and my screen will not work. When I have my sim card inserted into the phone calls go through, but I take it out and they don't go through. It was fine one minute and then the screen flashed and now it will not work. any answers?

    I own a 16GB iPhone 3G. My father passed it down to me a year ago after he got the iPhone 4. I pressed the sleep/wake button on the top of the iPhone to check the time, and as I did so, the screen flashed on and off and now the screen won't work. Whenever I put my simcard in there calls will go through but I am unable to hear them, but if I take it out calls don't go through. I've tried charging it for a while, connecting to my laptop, holding the sleep/wake button and the home button for 10seconds to restore it, but nothing works. I've looked around and no-one'ed seemed to have this problem. I'd like to know what is wrong with my iPhone ASAP. thanks.

    First, update iTunes, then connect the phone to the computer and do a restore. This will also get your iOS up to date. Your phone should operate correctly after doing this, if not, you will most likely need to have the phone serviced or replaced.

  • Mac mini dual display - blue screen flashes frequently

    I recently purchased a mac mini i7 model, with fusion drive.
    I have upgraded the RAM to 16GB.
    I have also purchased 2 monitors, both are LG 22EA63V LED.
    I connected one monitor direct HDMI to HDMI.
    The other monitor is connected from Thunderbolt to HDMI.
    Everything worked amazingly well for the first few weeks. Now, not so much....
    I frequently have the screen freeze and flash blue, and then resume as normal dual display mode.
    Other times the screen will flash blue and then come back as a single display. In this case the Thunderbolt to HDMI display appears as primary display, while the HDMI display loses connection.
    If I unplug the HDMI display completely, the blue screen flashing does not happen at all.
    So, what could be causing this problem, and how do i fix it?

    Hi Matt,
    See if there's some setting on the HDMI monitor for Input Source, or things like Auto-tune.

  • MB screen flashes on and off...HELP!

    Just got a new macbook for my wife. Came from Apple with 2 sticks of 256mb RAM. I added 2 1gb Patriot sticks from Newegg. all seemed well. but now under load, not full load just opening apps, the screen flashes black and then after a few seconds it comes back on. It happens often enough to be annoying.
    Here's what I did:
    1. Replaced with apple shipped ram.- Doesn't seem to occur, so I figured bad ram...
    2. Ran memtest on both stick individually. 3 passes on each stick
    3. Reset PMU as advised by AppleCare
    Still could be bad ram but...
    1. I pulled the two 1gb APPLE RAM sticks from my 17" MBP, still occured.
    2. Tried the Patriot 1gb sticks in my MPB, all is fine.
    So I don't think it is bad ram?
    Any helpers out there? Apple wants to blame 3rd party RAM, but their ram that shipped with my MBP exhibit's the problem too...

    My screen was flashing just like yours and failed tonight, 20 days into the purchase. Take it back and get a refund. Don't take another macbook until they get all of these quality control issues worked out. This was my third macbook and I had not been having any problems, but was experiencing the flash. It is starting up in the background and can be used in target disk mode, so the issue is the screen. Return while you can, it will eventually go out completely.

  • Screen flashing/black screen for 1-2 seconds - 7850 power edition 2gb/OC

    I recently bought the MSI R7850 Power Edition 2GD5/OC. I have installed amd catalyst 12.10. I have no issues while playing games...the only game i have played since i bought the card is prototype 2 (all settings set to high). The problem is while browsing or when not playing my screen flashes (just once - screen becomes black) for about 1-2 seconds. This does not happen regularly, but quite a few times.. i have uninstalled and re-installed the same catalyst version twice (downloaded from different sources - one from msi and the other from amd). The problem still persists.
    Board: ASUS P8-H67-M PRO
    VGA:   MSI R7850 Power Edition 2GB DDR5/OC
    PSU:   Cooler Master GX550 550W (44a 12v rail)
    Intel Core i5-2500K Sandy Bridge 3.3GHz (3.7GHz Turbo Boost) LGA 1155 95W
    MEM: Corsair 1333 8gb (2x4gb)
    HDD: Seagate 500 GB 7200 rpm
    Thanks.
    OS: Windows 7 64bit ultimate.

    I've experienced the same issue exactly as described, with the R7850 Twin Frozr OC Edition. However, I've also experienced a crash or 2 in which the screen goes black and the monitor goes to sleep. The computer doesn't wake up and I'm forced to do a hard reset. One such event was severe enough that I was unable to restore Windows 8 and had to do a full reinstall...!)
    Everything is clocked at factory default, passes Memtest 86+, Prime95 overnight run, even FurMark successfully...
    Board: ASUS P8Z77-M
    Bios:   American Megatrends Inc., v1708
    VGA:   MSI R7850 Twin Frozr III 2GD5/OC
    PSU:   Seasonic X-750 (+12V@62A)
    CPU:   Intel Core i5-3750K
    MEM:   Samsung DDR3 PC1600 8GB (2x4GB)
    HDD:   WD 500 GB 7200rpm
    COOLER: GPU: Stock. CPU: Xigmatek SD1283 Gaia w/Scythe 120mm Slipstream PWM
    Sound card: Creative SoundBlaster X-Fi XtremeGamer
    OC:     No overclocking, factory default.
    OS:     Windows 8 Pro, 64-bit
    When I tried to save the GPU-Z BIOS settings to a file, my computer crashed my computer (!)... Hopefully this is sufficient to indicate if I should follow the same steps or if this is a different issue / hardware issue / ???
    TechPowerUp GPU-Z 0.6.7
    Driver Version: atiumdag 9.2.0.0 (Catalyst 12.10) / Win8 64
    BIOS Version: 015.017.000.000.000861 (113-C4030400-100)
    edit:
    S/N: 602-V273-010B1210251006
    Also updated format of table above
    (Perhaps worth noting that the box didn't include any driver CD for some reason)
    Thanks for the help.
    -DH

  • Screen flashing black

    My ipad with retina display has been acting up. The screen flashes black in all applications. Then the screen will turn off and I have to hit the power button several times before the screen will turn back on. What is wrong? What should I do?

    Hello there, AlysonLB.
    The following Knowledge Base article offers some practical troubleshooting steps that are applicable to your iPad:
    iPhone: Hardware troubleshooting
    http://support.apple.com/kb/ts2802
    Particularly:
    Will not turn on, will not turn on unless connected to power, or unexpected power off
    Verify that the Sleep/Wake button functions. If it does not function, inspect it for signs of damage. If the button is damaged or is not functioning when pressed, seek service.
    Check if a Liquid Contact Indicator (LCI) is activated or there are signs of corrosion. Learn about LCIsand corrosion.
    Connect the iPhone to the iPhone's USB power adapter and let it charge for at least ten minutes.
    After at least 30 minutes, if:
    The home screen appears: The iPhone should be working. Update to the latest version of iOS if necessary. Continue charging it until it is completely charged and you see this battery icon in the upper-right corner of the screen . Then unplug the phone from power. If it immediately turns off, seek service.
    The low-battery image appears, even after the phone has charged for at least 20 minutes: See "iPhone displays the low-battery image and is unresponsive" symptom in this article.
    Something other than the Home screen or Low Battery image appears, continue with this article for further troubleshooting steps.
    If the iPhone did not turn on, reset it while connected to the iPhone USB power adapter.
    If the display turns on, go to step 4.
    If the display remains black, go to next step.
    Connect the iPhone to a computer and open iTunes. If iTunes recognizes the iPhone and indicates that it is in recovery mode, attempt to restore the iPhone. If the iPhone doesn't appear in iTunes or if you have difficulties in restoring the iPhone, see this article for further assistance.
    If restoring the iPhone resolved the issue, go to step 4. If restoring the iPhone did not solve the issue, seek service.
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

  • How to show MouseOver effect on dropable region while dragging a MovieClip?

    Hello friends,
    I am creating Drag and drop flash application.
    While dragging an instance of a movieclip I want also the dropable region to show effect like MouseOver case.
    So that end user can confirm that they are dropping the item in right region.
    Here the mouse is moved while it is kept clicked
    Plz help me,
    Thanks.
    Venkat

    Thanks for taking interest.
    I did the first part of your reply already, but  How to check if a MovieClip is being dragged?
    Say, I have two MovieClips
    TargetToDrop_mc
    DropableRegion_mc
    TargetToDrop_mc.addEventListener(MouseEvent.MOUSE_DOWN, gotMouseDown);
    TargetToDrop_mc.addEventListener(MouseEvent.MOUSE_UP, gotMouseUp);
    TargetToDrop_mc.addEventListener(MouseEvent.MOUSE_OVER, gotMouseOver);
    TargetToDrop_mc.addEventListener(MouseEvent.MOUSE_OUT, gotMouseOut);
    DropableRegion_mc.addEventListener(MouseEvent.MOUSE_DOWN, gotMouseDown);
    DropableRegion_mc.addEventListener(MouseEvent.MOUSE_UP, gotMouseUp);
    DropableRegion_mc.addEventListener(MouseEvent.MOUSE_OVER, gotMouseOver);
    DropableRegion_mc.addEventListener(MouseEvent.MOUSE_OUT, gotMouseOut);
    function gotMouseDown(EventReceived:MouseEvent):void {
        EventReceived.currentTarget.startDrag ();
    function gotMouseUp(EventReceived:MouseEvent):void{
        EventReceived.currentTarget.stopDrag();
    function gotMouseOver(EventReceived:MouseEvent):void{
        EventReceived.currentTarget.alpha=0.5;
    function gotMouseOut(EventReceived:MouseEvent):void{
        EventReceived.currentTarget.alpha=0.7;
    Now plze guide me on basis of above.
    Thanks,
    Venkat

  • High CPU consumption with repaint while dragging

    Hi! I certainly hope someone can help me with this. I am building a graphical user interface for a graph with custom nodes and edges, the nodes being draggable. I have tried making each network component (node or edge) a JComponent. Now, I'm trying using only one JPanel to paint all the components. Either way, I find that dragging takes up too much CPU % especially when using full screen graphics, usually around 92%. And that is on a machine with >1.9GHz.
    It does not really make much of a difference when I paint outlines of the components while dragging. Any ideas about this? Thanks.
    My runnable test code is rather long so I've uploaded it to : http://web.mit.edu/jabos/www/SyncTest/GUILoad2.java.
    -Bosun

    Comments about changes to your code:
    1 - trouble in rendering with setOpaque(false). Set this to true and add super.paintComponent(g) in paintComponent to take care of background paint updates
    2 - had to doctor your ConnComp class; the constructor was under construction...
    3 - I'm using j2se 1.4 so I converted your:
    ArrayList generics to the old Object casts and
    the JFrame setPreferredSize to setSize
    This runs okay now. The highest cpu usage numbers I saw were 52% in full screen and 37% in regular mode (2.6 GHz).
    The painting part seems okay; I think the trouble is in excessive data storage and manipulation. I would re–design your program to eliminate all the type checking with the instanceof operator. Specifically I would try to use only one ArrayList for the node objects and draw the connection lines between them inside paintComponent depending on how a boolean is set, eg if(showLines). As an aside, GradientPaint is for fill operations and will not benefit your line display.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.util.ArrayList;
    * This demo paints all network components in a single JComponent
    * @author jabos
    public class DragTest extends JPanel {
         * all components
        public ArrayList comps;
        public ArrayList compsDragged; // actually only RectComps
         * arraylist of all connection components
        public ArrayList conncomps;
        public boolean dragging = false, repaintWhileDragging = true;
        Point2D initp = null;
        public JLabel repaintDrag;
        public DragTest() {
            repaintDrag = new JLabel("repaintWhileDragging : " + repaintWhileDragging);
            repaintDrag.setForeground(Color.MAGENTA);
            add(repaintDrag);
            add(new JLabel("Press \"R\" to change repaint protocols during dragging"));
            comps = new ArrayList();
            compsDragged = new ArrayList();
            conncomps = new ArrayList();
            addMouseMotionListener(new MouseMotionAdapter() {
                public void mouseDragged(MouseEvent e) {
                    //* // Remove initial slash to disable repainting while dragging
                    if (repaintWhileDragging) {
                        Point2D pp = e.getPoint();
                        AffineTransform t = AffineTransform.getTranslateInstance(
                                                    pp.getX() - initp.getX(),
                                                    pp.getY() - initp.getY());
                        initp = pp; // reset initp
                        for (int j = 0; j < compsDragged.size(); j++) {
                            Comp comp = (Comp)compsDragged.get(j);
                            if (comp instanceof RectComp)
                                comp.updateCompLocation(t);
                        // and again to update ConnComps
                        for (int j = 0; j < conncomps.size(); j++) {
                            Comp comp = (Comp)conncomps.get(j);
                            if (comp instanceof ConnComp)
                                comp.updateCompLocation(t);
                        dragging = true;
                        repaint();
                    dragging = true;
            addMouseListener(new MouseAdapter() {
                // does final repaint if dragging just finished
                public void mouseReleased(MouseEvent e) {
                    if (dragging) {
                        Point2D pp = e.getPoint();
                        AffineTransform t = AffineTransform.getTranslateInstance(
                                                    pp.getX() - initp.getX(),
                                                    pp.getY() - initp.getY());
                        for (int j = 0; j < compsDragged.size(); j++) {
                            Comp comp = (Comp)compsDragged.get(j);
                            if (comp instanceof RectComp)
                                comp.updateCompLocation(t);
                        // and again to update ConnComps
                        for (int j = 0; j < conncomps.size(); j++) {
                            Comp comp = (Comp)conncomps.get(j);
                            if (comp instanceof ConnComp)
                                comp.updateCompLocation(t);
                    repaint();
                    dragging = false;
                    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                // Updates list of components being dragged
                public void mousePressed(MouseEvent e) {
                    compsDragged.clear();
                    initp = e.getPoint();
                    for (int j = 0; j < comps.size(); j++) {
                        Comp comp = (Comp)comps.get(j);
                        if (comp.graphic.contains(initp))
                            compsDragged.add(comp);
                    setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
            addKeyListener(new KeyAdapter() {
                public void keyReleased(KeyEvent e) {
                    if(e.getKeyCode() == KeyEvent.VK_R) {
                        repaintWhileDragging = !repaintWhileDragging;
                        repaintDrag.setText("repaintWhileDragging : " +
                                             repaintWhileDragging);
    //        setOpaque(false);
            setFocusable(true);
            requestFocusInWindow();
        public static void main(String[] args) {
            GraphicsDevice device =
                GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
            JFrame f = new JFrame("GUILOAD2", device.getDefaultConfiguration());
            //* // remove initial slash to disable full screen
            device.setFullScreenWindow(SwingUtilities.getWindowAncestor(f));
            //needs to be set AFTER fullscreenmode so that the toolbar is NOT draggable!
            f.setExtendedState(JFrame.MAXIMIZED_BOTH);
                // enable use of Look and Feel
                f.setUndecorated(true);    // Set false, EE is still minimizable
                f.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
            f.setBounds(GraphicsEnvironment.getLocalGraphicsEnvironment().
                                getMaximumWindowBounds());
            DragTest p = new DragTest();
            p.setBackground(Color.WHITE);
            RectComp[] rc = new RectComp[100];
            int n = -1, x = 30, y = 30, b = 100, inc = 40;
            // add REctComps
            for (int i = 0; i < 10; i++) {
                p.add(rc[++n] = new RectComp(new Point2D.Double(x += inc, y += inc),
                                             new Color(x % 255, y % 255, (b += 10) % 255)));
            x = 34; y = 32; b = 32;
            // add ConnComps
            while (n > 0) {
                p.add(new ConnComp(rc[n--], rc[n],
                                   new Color((x += inc) % 255, (y += inc) % 255,
                                             (b += inc) % 255),
                                   new Color((x += inc) % 255, (y += inc) % 255,
                                             (b += inc) % 255)));
            f.setContentPane(p);
            f.setSize(700, 700);
            makeFramex(f, false);
            /* // remove initial slash to disable full screen; Also, uncomment above
            f.setResizable(false);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.setIgnoreRepaint(true);
            f.setVisible(true);
        public static void makeFramex(JFrame frame, boolean resizable) {
            frame.setSize(frame.getSize());
    //        frame.setResizable(resizable);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //        frame.pack();
            frame.setVisible(true);
         * Adds network component c to this simulation
         * @param c
        public void add(Comp c) {
            comps.add(c);
            if (c instanceof ConnComp) {
                conncomps.add((ConnComp)c);
        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2D = (Graphics2D) g;
            g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                 RenderingHints.VALUE_ANTIALIAS_ON);
            for (int j = 0; j < comps.size(); j++) {
                Comp comp = (Comp)comps.get(j);
                //for (Comp i : dragging ? compsDragged : comps) {
                try {
                    g2D.setPaint(comp.color);
                    if (comp instanceof ConnComp) {
                        g2D.setStroke(((ConnComp) comp).compStroke);
                        g2D.draw(comp.graphic);
                    if (comp instanceof RectComp)
                        g2D.fill(comp.graphic);
                } catch (Exception e) {
                    e.printStackTrace();  //To change body of catch statement
                                          // use File | Settings | File Templates.
         * A network component that simulates a node
        private static class RectComp extends Comp {
            RectComp(Point2D centero, Paint c) {
                super(c);
                center = centero;
                graphic = new Ellipse2D.Double(center.getX() - radius,
                                  center.getY() - radius, radius * 2 - 2, radius * 2 - 2);
            public void updateCompLocation(AffineTransform t) {
                graphic = t.createTransformedShape(graphic);
                Rectangle2D r = graphic.getBounds2D();
                center = new Point2D.Double(r.getCenterX(), r.getCenterY());
                //System.out.println("newCenterX=" + r.getCenterX());
         * A network component that simulates a connection between two nodes
        private static class ConnComp extends Comp {
            Stroke compStroke;
            RectComp origin, destination;
            Paint color;
            ConnComp(RectComp origino, RectComp desto, Color c1, Color c2) {
                super(c1);
                if (c2 != null)
                    color = new GradientPaint(origino.center, c1, desto.center, c2);
                else
                    color = c1;
                graphic = new Line2D.Double(origino.center, desto.center);
                this.origin = origino;
                this.destination = desto;
                compStroke = new BasicStroke(3);
    //            updateCompLocation(new AffineTransform());
            public void updateCompLocation(AffineTransform t) {
                ((Line2D)graphic).setLine(origin.center, destination.center);
                if(color instanceof GradientPaint)
                    color = new GradientPaint(((Line2D)graphic).getP1(),
                                              ((GradientPaint)color).getColor1(),
                                              ((Line2D)graphic).getP2(),
                                              ((GradientPaint)color).getColor2());
                //System.out.println("newLineX:" + ((Line2D) graphic).getX1() +
                //                     "---" + ((Line2D) graphic).getX2());
         * demo Superclass for all network components
        private abstract static class Comp {
            Point2D center;
            Shape graphic;
            int radius = 20;
            Paint color;
            Comp(Paint c) {
                color = c;
             * Updates internal parameters of Comp necessary for correct repaint
             * @param t
            public abstract void updateCompLocation(AffineTransform t);
    }

Maybe you are looking for

  • Can't get usb fax modem to work

    I have one of those small white apple phone/fax usb connectors, and I am trying to send a fax of a word doc but I can't get the process to work. It reports that there is no dial tone yet it is connected correctly from the computer to my phone line. I

  • Need USB 3.0 driver for Windows 7 running in Fusion

    Greetings -     I have a MacBookpro Retina that is about 3 weeks old.  So far it is running fairly well.  I have installed Fusion5 and am running Windows7 Ultimate 64 bit.  I have run into an issue however with my WD my passport 2tb USB3.0 drives.  t

  • SFTP FCC module parameters

    Dear Experts, kindly provide the module parameters to convert CSV to xml messages in SFTP adapter. please find the below my falt structure. ENUMBER,ENAME,SAL,LAST_NAME,FIRST_NAME 1234         , srinu    , 10lac , p,srinu 2344        ,   reee   , 2 la

  • How does iPhoto sharing work? Does it enable someone to share your photos on a public wifi?

    How does iPhoto sharing (in preferences) work?  If you enable it, does it allow someone to view your photos while on a public wifi? I am using a macbook pro with 10.7.4

  • Satellite A60-156: Where to find graphic driver for Vista

    I've recently upgraded my A60 with new dvd, memory and hard drive. Upgraded to Vista and all works perfect except i cannot find an upgrade for my display driver. Just shows as standard graphics adaptor and i cannot get any 3d functionality on it even