Help With JScrollPane and many JLabels...

I am in the process of designing an 'image browser' applet for a client, but am having some difficulty in deciding how I can most elegantly meet all of the requirements. The specification calls for an applet that can view up to 400 images (all images are small - 120 * 120 px), the view of the images can be scrolled (if not all are in the view) or scaled (zoom in and out on any area), and the images will need to 'animate' or move to new locations as sorting criteria changes. Also, I need to be able to group images into arbitrary n*n arrays and click on any image in the view (rollovers may also be necessary in the future).
At first, I thought this would be easily solved by putting the images (JLabels?) into as many groups (JPanels?) as necessary to meet the sort criteria, then adding the groups to my main view (JScrollPane w/JPanel) in a GridLayout. My current attempt at a solution scales the groups (JPanels) via. an overridden paintComponent method from within my main scrolling view (using g2d and scale). Unfortunately, I now have many problems that I am having trouble solving:
1. After I re-scale the JScrollPane (zoom in or out) and then try and scroll, the new images that scroll in are either garbled or just junk (seems like remnants of the original, non-scaled components?).
2. The scrollbars, at first, were not reflecting the current scaling and how much content is visible, so I overrode the getPreferredSize method in my JScrollPane content object to return (super.getPreferredSize * scaleFactor) - this fixes the appearance of the scroll bars (ie. they accurately reflect how much content there is), but it also offsets all of the images left depending on the scale value (less scale -> images offset further left).
3. I need pixel-perfect control over the images, so that I can animate the transition from one 'group' to another - I can't see a way to achieve this with my current solution.
Has anyone tried to do something like this before? What is a good way of accomplishing what I need here? Any code out there that does something similar? Any help would be appreciated, I've been banging my head against the wall over this for days now...
Thanks in advance,
Mike P.
Here is some relevant code:
/* From BrowserPanel (JPanel associated with my main JScrollPane) */
public void paint (Graphics g) {
    Graphics2D g2d = (Graphics2D) g;
    g2d.scale(scaleFactor, scaleFactor);
    super.paint(g2d);
/* From BrowserPanel (JPanel associated with my main JScrollPane) */
public Dimension getPreferredSize() {
    Dimension origSize = super.getPreferredSize();
    double originalSizeX;
    double originalSizeY;
    originalSizeX = origSize.getWidth();
    originalSizeY = origSize.getHeight();
    double newSizeX = originalSizeX * scaleFactor;
    double newSizeY = originalSizeY * scaleFactor;
    String strX = Double.toString(newSizeX);
    String strY = Double.toString(newSizeY);
    /* Round the string (discard anything after the decimal) */
    strX = strX.substring(0, strX.indexOf("."));
    strY = strY.substring(0, strY.indexOf("."));
    /* Convert string to int... */     
    int x = Integer.parseInt(strX);
    int y = Integer.parseInt(strY);
    return new Dimension(x, y);
}

I increased the frame size to 3 lines and noticed the the flickering is a result of the text area painting itself without the scrollbar and then repainting itself with the scrollbar. I don't know why this happens, but a work around is to use:
ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,

Similar Messages

  • My wife has been having problems with Safari, and many third party software and malware programs infecting her Mac Book Pro.

    My wife has been having problems with Safari, and many third party software and malware programs infecting her Mac Book Pro. I have tried to reset Safari but it keeps coming back, taking over Safari, changing defaults, start pages, and search engines, Etc.
    Is it safe to use programs like MacKeeper, who keeps send my wife's computer message and alerts, or should I just wipe the drive and start over?
    Skip

    I am having lot's of lag time with Safari, etc..
    I'll type in a website.. and it will take 15-20 seconds to start..
    Start time: 17:51:37 12/02/14
    Model Identifier: MacBookPro11,3
    System Version: OS X 10.10.1 (14B25)
    Kernel Version: Darwin 14.0.0
    Time since boot: 14 days 3:02
    USB
       My Passport 07B8 (Western Digital Technologies, Inc.)
    Diagnostic reports
       2014-11-13 QuickLookSatellite crash x2
       2014-11-21 com.apple.WebKit.Plugin.64 crash
    Log
       Nov 30 21:32:39 PM notification timeout (pid 345, Adobe CEF Helper)
       Nov 30 21:32:39 PM notification timeout (pid 99018, CEPHtmlEngine)
       Nov 30 21:32:39 PM notification timeout (pid 99019, CEPHtmlEngine He)
       Dec  1 09:09:03 [[0xffffff802bfa4000]  OpCode 0x0C01 (Set Event Mask) from: kernel_task (0)  Synchronous  status: 0x00 (kIOReturnSuccess) state: 2 (BUSY) timeout: 5000] Bluetooth warning: An HCI Req timeout occurred.
       Dec  1 09:52:03 PM notification timeout (pid 266, Creative Cloud)
       Dec  1 09:52:03 PM notification timeout (pid 346, Adobe CEF Helper)
       Dec  1 09:52:03 PM notification timeout (pid 345, Adobe CEF Helper)
       Dec  1 10:04:37 process WindowServer[114] caught causing excessive wakeups. Observed wakeups rate (per sec): 170; Maximum permitted wakeups rate (per sec): 150; Observation period: 300 seconds; Task lifetime number of wakeups: 12755007
       Dec  1 10:31:08 ALF: ifnet_get_address_list_family error 12
       Dec  1 10:59:17 process Meeting Center[2921] caught causing excessive wakeups. Observed wakeups rate (per sec): 647; Maximum permitted wakeups rate (per sec): 150; Observation period: 300 seconds; Task lifetime number of wakeups: 45104
       Dec  1 12:24:35 process com.apple.WebKit[4567] caught causing excessive wakeups. Observed wakeups rate (per sec): 297; Maximum permitted wakeups rate (per sec): 150; Observation period: 300 seconds; Task lifetime number of wakeups: 76962
       Dec  1 14:31:01 process com.apple.WebKit[7400] caught causing excessive wakeups. Observed wakeups rate (per sec): 397; Maximum permitted wakeups rate (per sec): 150; Observation period: 300 seconds; Task lifetime number of wakeups: 53188
       Dec  1 14:43:52 process com.apple.WebKit[7400] caught causing excessive wakeups. Observed wakeups rate (per sec): 224; Maximum permitted wakeups rate (per sec): 150; Observation period: 300 seconds; Task lifetime number of wakeups: 150084
       Dec  1 14:47:34 process com.apple.WebKit[7400] caught causing excessive wakeups. Observed wakeups rate (per sec): 332; Maximum permitted wakeups rate (per sec): 150; Observation period: 300 seconds; Task lifetime number of wakeups: 222103
       Dec  1 15:03:29 process com.apple.WebKit[7400] caught causing excessive wakeups. Observed wakeups rate (per sec): 214; Maximum permitted wakeups rate (per sec): 150; Observation period: 300 seconds; Task lifetime number of wakeups: 370572
       Dec  1 16:38:03 SIOCPROTODETACH_IN6: utun2 error=6
       Dec  1 16:38:08 SIOCPROTODETACH_IN6: utun2 error=6
       Dec  1 20:08:30 jnl: disk3s2: replay_journal: from: 112328704 to: 113115136 (joffset 0x3a38000)
       Dec  1 20:08:30 jnl: disk3s2: journal replay done.
       Dec  1 20:27:11 com.adobe.acc.AdobeCreativeCloud.75292.UUID: Service exited with abnormal code: 5
       Dec  2 08:23:00 process com.apple.WebKit[11891] caught causing excessive wakeups. Observed wakeups rate (per sec): 161; Maximum permitted wakeups rate (per sec): 150; Observation period: 300 seconds; Task lifetime number of wakeups: 527508
       Dec  2 09:29:37 firefox (map: 0xffffff80317c5960) triggered DYLD shared region unnest for map: 0xffffff80317c5960, region 0x7fff9ae00000->0x7fff9b000000. While not abnormal for debuggers, this increases system memory footprint until the target exits.
       Dec  2 10:04:39 SIOCPROTODETACH_IN6: utun2 error=6
       Dec  2 10:04:44 SIOCPROTODETACH_IN6: utun2 error=6
       Dec  2 16:42:24 process com.apple.WebKit[26151] caught causing excessive wakeups. Observed wakeups rate (per sec): 153; Maximum permitted wakeups rate (per sec): 150; Observation period: 300 seconds; Task lifetime number of wakeups: 45002
    Swap (MiB): 41556
    Activity
       Net: 210 in, 20 out (KiB/s)
    Memory: kernel_task (UID 0) is using 1632 MB
    kexts
       com.cisco.kext.acsock (1.1.0)
       com.wdc.driver.USB.64.10.9 (1.0.1)
    Daemons
       com.cisco.anyconnect.vpnagentd
       com.oracle.java.JavaUpdateHelper
       com.apple.installer.osmessagetracing
       com.microsoft.office.licensing.helper
       com.google.keystone.daemon
       com.wdc.WDSmartWareService
       com.oracle.java.Helper-Tool
       com.adobe.fpsaud
       com.wdc.SmartwareDriveService
    Agents
       com.adobe.AdobeCreativeCloud
       com.zimbra.desktop
       com.citrix.ServiceRecords
       com.google.keystone.system.agent
       com.apple.photostream-agent
       com.genieo.completer.download
       com.genieo.completer.update
       com.cisco.anyconnect.gui
       com.citrix.ReceiverHelper
       com.citrix.AuthManager_Mac
       com.citrix.FMDAgent.14800.UUID
       com.oracle.java.Java-Updater
       com.fiplab.MailTabProHelper
       com.adobe.PDApp.AAMUpdatesNotifier.74724.UUID
       com.citrixonline.GoToMeeting.G2MUpdate
       com.apple.AirPortBaseStationAgent
       com.microsoft.SyncServicesAgent
    Startup items
       /System/Library/StartupItems/ciscod/ciscod
       /System/Library/StartupItems/ciscod/StartupParameters.plist
    Bundles
       /System/Library/Extensions/hp_fax_io.kext
       - com.hp.kext.hp-fax-io
       /System/Library/Extensions/hp_Inkjet1_io_enabler.kext
       - com.hp.print.hpio.Inkjet1.kext
       /System/Library/Extensions/hp_Inkjet4_io_enabler.kext
       - com.hp.print.hpio.Inkjet4.kext
       /System/Library/Extensions/hp_Inkjet8_io_enabler.kext
       - com.hp.print.hpio.inkjet8.kext
       /System/Library/Extensions/JMicronATA.kext
       - com.jmicron.JMicronATA
       /System/Library/Extensions/WD1394_64_109HPDriver.kext
       - com.wdc.driver.1394.64.10.9
       /System/Library/Extensions/WDUSB_64_109HPDriver.kext
       - com.wdc.driver.USB.64.10.9
       /Library/Extensions/hp_io_printerclassdriver_enabler.kext
       - com.hp.hpio.hp-io-printerclassdriver-enabler
       /Library/Internet Plug-Ins/AdobeAAMDetect.plugin
       - com.AdobeAAMDetectLib.AdobeAAMDetect
       /Library/Internet Plug-Ins/CitrixICAClientPlugIn.plugin
       - com.citrix.citrixicaclientplugIn
       /Library/Internet Plug-Ins/Flash Player.plugin
       - N/A
       /Library/Internet Plug-Ins/googletalkbrowserplugin.plugin
       - com.google.googletalkbrowserplugin
       /Library/Internet Plug-Ins/JavaAppletPlugin.plugin
       - com.oracle.java.JavaAppletPlugin
       /Library/Internet Plug-Ins/npg.plugin
       - npg.graphon.com
       /Library/Internet Plug-Ins/o1dbrowserplugin.plugin
       - com.google.o1dbrowserplugin
       /Library/Internet Plug-Ins/SharePointBrowserPlugin.plugin
       - com.microsoft.sharepoint.browserplugin
       /Library/Internet Plug-Ins/SharePointWebKitPlugin.webplugin
       - com.microsoft.sharepoint.webkitplugin
       /Library/Internet Plug-Ins/Silverlight.plugin
       - com.microsoft.SilverlightPlugin
       /Library/Internet Plug-Ins/SlingPlayer.plugin
       - com.slingmedia.slingplayer.plugin.nspapi
       /Library/PreferencePanes/Flash Player.prefPane
       - com.adobe.flashplayerpreferences
       /Library/PreferencePanes/FMDSysPrefPane.prefPane
       - Citrix.FMDSysPrefPane
       /Library/PreferencePanes/JavaControlPanel.prefPane
       - com.oracle.java.JavaControlPanel
       /Library/PreferencePanes/WDQuickViewPrefsPane.prefPane
       - com.westerndigital.quickview.prefpanel
       /Library/PreferencePanes/Zimbra.prefPane
       - com.zimbra.prefpanel
       /Library/ScriptingAdditions/Adobe Unit Types.osax
       - N/A
       Library/Address Book Plug-Ins/SkypeABDialer.bundle
       - com.skype.skypeabdialer
       Library/Address Book Plug-Ins/SkypeABSMS.bundle
       - com.skype.skypeabsms
       Library/Internet Plug-Ins/CitrixOnlineWebDeploymentPlugin.plugin
       - com.citrixonline.mac.WebDeploymentPlugin
       Library/Internet Plug-Ins/Google Earth Web Plug-in.plugin
       - com.Google.GoogleEarthPlugin.plugin
       Library/Internet Plug-Ins/WebEx.plugin
       - com.webex.WebEx
       Library/Internet Plug-Ins/WebEx.plugin/Contents/Resources
       - com.webex.WebEx
       Library/Internet Plug-Ins/WebEx64.plugin
       - com.cisco_webex.plugin.gpc64
    dylibs
       /usr/lib/libaudioc.dylib
       /usr/lib/libclipc.dylib
       /usr/lib/libcs.dylib
       /usr/lib/libdc.dylib
       /usr/lib/libfilec.dylib
       /usr/lib/libMonoPosixHelper.dylib
       /usr/lib/libpbr.dylib
       /usr/lib/libprintc.dylib
       /usr/lib/libsc.dylib
       /usr/lib/libSFFileMonitor.32.dylib
       /usr/lib/libSFIPC.32.dylib
       /usr/lib/libSFIPC.I.dylib
       /usr/lib/libSFsqlite3.7.4.dylib
       /usr/lib/libSFSyncEngine.I.dylib
       /usr/lib/libupc.dylib
    App extensions
       it.bloop.airmail.beta10.Airmail-Today-Beta
       it.bloop.airmail.beta10.Airmail-Composer-Beta
       com.wunderkinder.wunderlistdesktop.sharingextension
       com.wunderkinder.wunderlistdesktop.todayextension
       com.readitlater.PocketMac.AddToPocketShareExtension
       com.stylemac.instadesk.Photodesk-Feed
       it.bloop.airmail.beta10.Airmail-Share-Beta
    Apps
       /Applications/Uninstall IM Completer.app
    Contents of /Library/LaunchAgents/com.cisco.anyconnect.gui.plist (checksum 1087717482)
       <?xml version="1.0" encoding="UTF-8"?>
       <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
       <plist version="1.0">
       <dict>
        <key>KeepAlive</key>
        <dict>
        <key>PathState</key>
        <dict>
        <key>/opt/cisco/anyconnect/gui_keepalive</key>
        <true/>
        </dict>
        </dict>
        <key>Label</key>
        <string>com.cisco.anyconnect.gui</string>
        <key>LimitLoadToSessionType</key>
        <string>Aqua</string>
        <key>ProgramArguments</key>
        <array>
        <string>open</string>
        <string>--wait-apps</string>
        <string>/Applications/Cisco/Cisco AnyConnect Secure Mobility Client.app</string>
        </array>
       </dict>
       </plist>
    Contents of /Library/LaunchAgents/com.citrix.AuthManager_Mac.plist (checksum 1591517921)
       <?xml version="1.0" encoding="UTF-8"?>
       <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
       <plist version="1.0">
       <dict>
        <key>ServiceIPC</key>
        <true/>
        <key>MachServices</key>
        <dict>
        <key>com.citrix.AuthManager_Mac</key>
        <true/>
        </dict>
        <key>Label</key>
        <string>com.citrix.AuthManager_Mac</string>
        <key>WaitForDebugger</key>
        <false/>
        <key>ProgramArguments</key>
        <array>
        <string>/usr/local/libexec/AuthManager_Mac.app/Contents/MacOS/AuthManager_Mac</ string>
        </array>
        <key>LimitLoadToSessionType</key>
        <string>Aqua</string>
        <key>Disabled</key>
        <false/>
       </dict>
       </plist>
    Contents of /Library/LaunchAgents/com.citrix.ReceiverHelper.plist (checksum 676087606)
       <?xml version="1.0" encoding="UTF-8"?>
       <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
       <plist version="1.0">
       <dict>
        <key>Label</key>
        <string>com.citrix.ReceiverHelper</string>
        <key>RunAtLoad</key>
        <true/>
        <key>KeepAlive</key>
        <dict>
        <key>SuccessfulExit</key>
        <false/>
        </dict>
        <key>WaitForDebugger</key>
        <false/>
        <key>ProgramArguments</key>
        <array>
        <string>/usr/local/libexec/ReceiverHelper.app/Contents/MacOS/ReceiverHelper</st ring>
        </array>
        <key>LimitLoadToSessionType</key>
        <string>Aqua</string>
        <key>Disabled</key>
        <false/>
       </dict>
       </plist>
    Contents of /Library/LaunchAgents/com.citrix.ServiceRecords.plist (checksum 1445213025)
       <?xml version="1.0" encoding="UTF-8"?>
       <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
       <plist version="1.0">
       <dict>
        <key>ServiceIPC</key>
        <true/>
        <key>MachServices</key>
        <dict>
        <key>com.citrix.Beacons</key>
        <true/>
        <key>com.citrix.ServiceRecords</key>
        <true/>
        </dict>
        <key>Label</key>
        <string>com.citrix.ServiceRecords</string>
        <key>RunAtLoad</key>
        <true/>
        <key>KeepAlive</key>
        <true/>
        <key>WaitForDebugger</key>
        <false/>
        <key>ProgramArguments</key>
        <array>
        <string>/usr/local/libexec/ServiceRecords.app/Contents/MacOS/ServiceRecords</st ring>
        </array>
       ...and 8 more line(s)
    Contents of /Library/LaunchAgents/com.oracle.java.Java-Updater.plist (checksum 3453356730)
       <?xml version="1.0" encoding="UTF-8"?>
       <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
       <plist version="1.0">
       <dict>
        <key>Label</key>
        <string>com.oracle.java.Java-Updater</string>
        <key>ProgramArguments</key>
        <array>
        <string>/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Resources/Java Updater.app/Contents/MacOS/Java Updater</string>
        <string>-bgcheck</string>
        </array>
        <key>StandardErrorPath</key>
        <string>/dev/null</string>
        <key>StandardOutPath</key>
        <string>/dev/null</string>
        <key>StartCalendarInterval</key>
        <dict>
        <key>Hour</key>
        <integer>9</integer>
        <key>Minute</key>
        <integer>57</integer>
        <key>Weekday</key>
        <integer>3</integer>
        </dict>
       </dict>
       ...and 1 more line(s)
    Contents of /Library/LaunchDaemons/com.cisco.anyconnect.vpnagentd.plist (checksum 2630047092)
       <?xml version="1.0" encoding="UTF-8"?>
       <!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN
       http://www.apple.com/DTDs/PropertyList-1.0.dtd >
       <plist version="1.0">
       <dict>
            <key>Label</key>
            <string>com.cisco.anyconnect.vpnagentd</string>
            <key>ProgramArguments</key>
            <array>
                 <string>/opt/cisco/anyconnect/bin/vpnagentd</string>
                 <string>-execv_instance</string>
            </array>
            <key>KeepAlive</key>
            <true/>
            <key>RunAtLoad</key>
            <true/>
            <key>AbandonProcessGroup</key>
            <true/>
            <key>EnableTransactions</key>
            <false/>
       </dict>
       </plist>
    Contents of /Library/LaunchDaemons/com.wdc.SmartwareDriveService.plist (checksum 2733252498)
       <?xml version="1.0" encoding="UTF-8"?>
       <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
       <plist version="1.0">
       <dict>
        <key>Label</key>
        <string>com.wdc.SmartwareDriveService</string>
        <key>Program</key>
        <string>/Library/Application Support/WD SmartWare Services/SmartwareDriveService</string>
        <key>RunAtLoad</key>
        <true/>
        <key>StandardErrorPath</key>
        <string>/dev/null</string>
       </dict>
       </plist>
    Contents of /Library/LaunchDaemons/com.wdc.WDSmartWareService.plist (checksum 1153517838)
       <?xml version="1.0" encoding="UTF-8"?>
       <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
       <plist version="1.0">
       <dict>
        <key>Label</key>
        <string>com.wdc.WDSmartWareService</string>
       <!-- <key>Program</key>
        <string>/Library/Application Support/WD SmartWare Services/SmartwareServerApp.app/Contents/MacOS/SmartwareServiceApp</string> -->
        <key>ProgramArguments</key>
        <array>
        <string>/Library/Application Support/WD SmartWare Services/SmartwareServiceApp.app/Contents/MacOS/SmartwareServiceApp</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>StandardErrorPath</key>
        <string>/dev/null</string>
       </dict>
       </plist>
    Contents of Library/LaunchAgents/com.genieo.completer.download.plist (checksum 1894818845)
       <?xml version="1.0" encoding="UTF-8"?>
       <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
       <plist version="1.0">
       <dict>
        <key>Label</key>
        <string>com.genieo.completer.download</string>
        <key>ProgramArguments</key>
        <array>
        <string>/Users/USER/Library/Application Support/com.genieoinnovation.Installer/Completer.app/Contents/MacOS/Installer</ string>
        <string>-trigger</string>
        <string>download</string>
        <string>-isDev</string>
        <string>0</string>
        <string>-installVersion</string>
        <string>15886</string>
        <string>-firstAppId</string>
        <string>19340001</string>
        </array>
        <key>WatchPaths</key>
        <array>
        <string>/Users/USER/Downloads</string>
        </array>
       </dict>
       </plist>
    Contents of Library/LaunchAgents/com.genieo.completer.update.plist (checksum 2339121592)
       <?xml version="1.0" encoding="UTF-8"?>
       <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
       <plist version="1.0">
       <dict>
        <key>Label</key>
        <string>com.genieo.completer.update</string>
        <key>ProgramArguments</key>
        <array>
        <string>/Users/USER/Library/Application Support/com.genieoinnovation.Installer/Completer.app/Contents/MacOS/Installer</ string>
        <string>-trigger</string>
        <string>update</string>
        <string>-isDev</string>
        <string>0</string>
        <string>-installVersion</string>
        <string>15886</string>
        <string>-firstAppId</string>
        <string>19340001</string>
        </array>
        <key>StartInterval</key>
        <integer>86400</integer>
       </dict>
       </plist>
    Contents of Library/LaunchAgents/com.microsoft.LaunchAgent.SyncServicesAgent.plist (checksum 3051698494)
       <?xml version="1.0" encoding="UTF-8"?>
       <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
       <plist version="1.0">
       <dict>
        <key>KeepAlive</key>
        <false/>
        <key>Label</key>
        <string>com.microsoft.SyncServicesAgent</string>
        <key>OnDemand</key>
        <false/>
        <key>ProgramArguments</key>
        <array>
        <string>/Applications/Microsoft Office 2011/Office/SyncServicesAgent.app/Contents/MacOS/SyncServicesAgent</string>
        </array>
       </dict>
       </plist>
    Contents of Library/LaunchAgents/com.zimbra.desktop.plist (checksum 3676173668)
       <?xml version="1.0" encoding="UTF-8"?>
       <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
       <plist version="1.0">
       <dict>
               <key>Label</key>
               <string>com.zimbra.desktop</string>
               <key>ProgramArguments</key>
               <array>
                       <string>/Users/USER/Library/Zimbra Desktop/bin/zdesktop</string>
                       <string>start</string>
                       <string>-w</string>
               </array>
       

  • Help with count and sum query

    Hi I am using oracle 10g. Trying to aggregate duplicate count records. I have so far:
    SELECT 'ST' LEDGER,
    CASE
    WHEN c.Category = 'E' THEN 'Headcount Exempt'
    ELSE 'Headcount Non-Exempt'
    END
    ACCOUNTS,
    CASE WHEN a.COMPANY = 'ZEE' THEN 'OH' ELSE 'NA' END MARKET,
    'MARCH_12' AS PERIOD,
    COUNT (a.empl_id) head_count
    FROM essbase.employee_pubinfo a
    LEFT OUTER JOIN MMS_DIST_COPY b
    ON a.cost_ctr = TRIM (b.bu)
    INNER JOIN MMS_GL_PAY_GROUPS c
    ON a.pay_group = c.group_code
    WHERE a.employee_status IN ('A', 'L', 'P', 'S')
    AND FISCAL_YEAR = '2012'
    AND FISCAL_MONTH = 'MARCH'
    GROUP BY a.company,
    b.district,
    a.cost_ctr,
    c.category,
    a.fiscal_month,
    a.fiscal_year;
    which gives me same rows with different head_counts. I am trying to combine the same rows as a total (one record). Do I use a subquery?

    Hi,
    Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved.
    Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
    user610131 wrote:
    ... which gives me same rows with different head_counts.If they have different head_counts, then the rows are not the same.
    I am trying to combine the same rows as a total (one record). Do I use a subquery?Maybe. It's more likely that you need a different GROUP BY clause, since the GROUP BY clause determines how many rows of output there will be. I'll be able to say more after you post the sample data, results, and explanation.
    You may want both a sub-query and a different GROUP BY clause. For example:
    WITH    got_group_by_columns     AS
         SELECT  a.empl_id
         ,     CASE
                        WHEN  c.category = 'E'
                  THEN  'Headcount Exempt'
                        ELSE  'Headcount Non-Exempt'
                END          AS accounts
         ,       CASE
                        WHEN a.company = 'ZEE'
                        THEN 'OH'
                        ELSE 'NA'
                END          AS market
         FROM              essbase.employee_pubinfo a
         LEFT OUTER JOIN  mms_dist_copy             b  ON   a.cost_ctr     = TRIM (b.bu)
         INNER JOIN       mms_gl_pay_groups        c  ON   a.pay_group      = c.group_code
         WHERE     a.employee_status     IN ('A', 'L', 'P', 'S')
         AND        fiscal_year           = '2012'
         AND        fiscal_month          = 'MARCH'
    SELECT    'ST'               AS ledger
    ,       accounts
    ,       market
    ,       'MARCH_12'          AS period
    ,       COUNT (empl_id)       AS head_count
    FROM       got_group_by_columns
    GROUP BY  accounts
    ,            market
    ;But that's just a wild guess.
    You said you wanted "Help with count and sum". I see the COUNT, but what do you want with SUM? No doubt this will be clearer after you post the sample data and results.
    Edited by: Frank Kulash on Apr 4, 2012 5:31 PM

  • Help with writing and retrieving data from a table field with type "LCHR"

    Hi Experts,
    I need help with writing and reading data from a database table field which has a type of "LCHR". I have given an example of the original code but don't know what to change it to in order to fix it and still read in the original data that's stored in the LCHR field.
    Basically we have two Function modules, one that saves list data to a database table and one that reads in this data. Both Function modules have an identicle table which has an array of fields from type INT4, CHAR, and type P. The INT4 field is the first one.
    Incidentally this worked in the 4.7 non-unicode system but is now dumping in the new ECC6 Unicode system.
    Thanks in advance,
    C
    SAVING THE LIST DATA TO DB
    DATA: L_WA(800).
    LOOP AT T_TAB into L_WA.
    ZDBTAB-DATALEN = STRLEN( L_WA ).
    MOVE: L_WA to ZDBTAB-RAWDATA.
    ZDBTAB-LINENUM = SY-TABIX.
    INSERT ZDBTAB.
    READING THE DATA FROM DB
    DATA: BEGIN OF T_DATA,
                 SEQNR type ZDBTAB-LINENUM,
                 DATA type ZDBTAB-RAWDATA,
               END OF T_TAB.
    Select the data.
    SELECT linenum rawdata from ZDBTAB into table T_DATA
         WHERE repid = w_repname
         AND rundate = w_rundate
         ORDER BY linenum.
    Populate calling Internal Table.
    LOOP AT T-DATA.
    APPEND T_DATA to T_TAB.
    ENDLOOP.

    Hi Anuj,
    The unicode flag is active.
    When I run our report and then to try and save the list data a dump is happening at the following point
    LOOP AT T_TAB into L_WA.
    As I say, T_TAB consists of different fields and field types whereas L_WA is CHAR 800. The dump mentions UC_OBJECTS_NOT_CONVERTIBLE
    When I try to load a saved list the dump is happening at the following point
    APPEND T_DATA-RAWDATA to T_TAB.
    T_DATA-RAWDATA is type LCHR and T_TAB consists of different fields and field types.
    In both examples the dumps mention UC_OBJECTS_NOT_CONVERTIBLE
    Regards
    C

  • MOVED: [Athlon64] Need Help with X64 and Promise 20378

    This topic has been moved to Operating Systems.
    [Athlon64] Need Help with X64 and Promise 20378

    I'm moving this the the Administration Forum.  It seems more apporpiate there.

  • Need help with JTextArea and Scrolling

    import java.awt.*;
    import java.awt.event.*;
    import java.text.DecimalFormat;
    import javax.swing.*;
    public class MORT_RETRY extends JFrame implements ActionListener
    private JPanel keypad;
    private JPanel buttons;
    private JTextField lcdLoanAmt;
    private JTextField lcdInterestRate;
    private JTextField lcdTerm;
    private JTextField lcdMonthlyPmt;
    private JTextArea displayArea;
    private JButton CalculateBtn;
    private JButton ClrBtn;
    private JButton CloseBtn;
    private JButton Amortize;
    private JScrollPane scroll;
    private DecimalFormat calcPattern = new DecimalFormat("$###,###.00");
    private String[] rateTerm = {"", "7years @ 5.35%", "15years @ 5.5%", "30years @ 5.75%"};
    private JComboBox rateTermList;
    double interest[] = {5.35, 5.5, 5.75};
    int term[] = {7, 15, 30};
    double balance, interestAmt, monthlyInterest, monthlyPayment, monPmtInt, monPmtPrin;
    int termInMonths, month, termLoop, monthLoop;
    public MORT_RETRY()
    Container pane = getContentPane();
    lcdLoanAmt = new JTextField();
    lcdMonthlyPmt = new JTextField();
    displayArea = new JTextArea();//DEFINE COMBOBOX AND SCROLL
    rateTermList = new JComboBox(rateTerm);
    scroll = new JScrollPane(displayArea);
    scroll.setSize(600,170);
    scroll.setLocation(150,270);//DEFINE BUTTONS
    CalculateBtn = new JButton("Calculate");
    ClrBtn = new JButton("Clear Fields");
    CloseBtn = new JButton("Close");
    Amortize = new JButton("Amortize");//DEFINE PANEL(S)
    keypad = new JPanel();
    buttons = new JPanel();//DEFINE KEYPAD PANEL LAYOUT
    keypad.setLayout(new GridLayout( 4, 2, 5, 5));//SET CONTROLS ON KEYPAD PANEL
    keypad.add(new JLabel("Loan Amount$ : "));
    keypad.add(lcdLoanAmt);
    keypad.add(new JLabel("Term of loan and Interest Rate: "));
    keypad.add(rateTermList);
    keypad.add(new JLabel("Monthly Payment : "));
    keypad.add(lcdMonthlyPmt);
    lcdMonthlyPmt.setEditable(false);
    keypad.add(new JLabel("Amortize Table:"));
    keypad.add(displayArea);
    displayArea.setEditable(false);//DEFINE BUTTONS PANEL LAYOUT
    buttons.setLayout(new GridLayout( 1, 3, 5, 5));//SET CONTROLS ON BUTTONS PANEL
    buttons.add(CalculateBtn);
    buttons.add(Amortize);
    buttons.add(ClrBtn);
    buttons.add(CloseBtn);//ADD ACTION LISTENER
    CalculateBtn.addActionListener(this);
    ClrBtn.addActionListener(this);
    CloseBtn.addActionListener(this);
    Amortize.addActionListener(this);
    rateTermList.addActionListener(this);//ADD PANELS
    pane.add(keypad, BorderLayout.NORTH);
    pane.add(buttons, BorderLayout.SOUTH);
    pane.add(scroll, BorderLayout.CENTER);
    addWindowListener( new WindowAdapter()
    public void windowClosing(WindowEvent e)
    System.exit(0);
    public void actionPerformed(ActionEvent e)
    String arg = lcdLoanAmt.getText();
    int combined = Integer.parseInt(arg);
    if (e.getSource() == CalculateBtn)
    try
    JOptionPane.showMessageDialog(null, "Got try here", "Error", JOptionPane.ERROR_MESSAGE);
    catch(NumberFormatException ev)
    JOptionPane.showMessageDialog(null, "Got here", "Error", JOptionPane.ERROR_MESSAGE);
    if ((e.getSource() == CalculateBtn) && (arg != null))
    try{
    if ((e.getSource() == CalculateBtn) && (rateTermList.getSelectedIndex() == 1))
    monthlyInterest = interest[0] / (12 * 100);
    termInMonths = term[0] * 12;
    monthlyPayment = combined * (monthlyInterest / (1 - (Math.pow (1 + monthlyInterest,  -termInMonths))));
    lcdMonthlyPmt.setText(calcPattern.format(monthlyPayment));
    if ((e.getSource() == CalculateBtn) && (rateTermList.getSelectedIndex() == 2))
    monthlyInterest = interest[1] / (12 * 100);
    termInMonths = term[1] * 12;
    monthlyPayment = combined * (monthlyInterest / (1 - (Math.pow (1 + monthlyInterest,  -termInMonths))));
    lcdMonthlyPmt.setText(calcPattern.format(monthlyPayment));
    if ((e.getSource() == CalculateBtn) && (rateTermList.getSelectedIndex() == 3))
    monthlyInterest = interest[2] / (12 * 100);
    termInMonths = term[2] * 12;
    monthlyPayment = combined * (monthlyInterest / (1 - (Math.pow (1 + monthlyInterest,  -termInMonths))));
    lcdMonthlyPmt.setText(calcPattern.format(monthlyPayment));
    catch(NumberFormatException ev)
    JOptionPane.showMessageDialog(null, "Invalid Entry!\nPlease Try Again", "Error", JOptionPane.ERROR_MESSAGE);
    }                    //IF STATEMENTS FOR AMORTIZATION
    if ((e.getSource() == Amortize) && (rateTermList.getSelectedIndex() == 1))
    loopy(7, 5.35);
    if ((e.getSource() == Amortize) && (rateTermList.getSelectedIndex() == 2))
    loopy(15, 5.5);
    if ((e.getSource() == Amortize) && (rateTermList.getSelectedIndex() == 3))
    loopy(30, 5.75);
    if (e.getSource() == ClrBtn)
    rateTermList.setSelectedIndex(0);
    lcdLoanAmt.setText(null);
    lcdMonthlyPmt.setText(null);
    displayArea.setText(null);
    if (e.getSource() == CloseBtn)
    System.exit(0);
    private void loopy(int lTerm,double lInterest)
    double total, monthly, monthlyrate, monthint, monthprin, balance, lastint, paid;
    int amount, months, termloop, monthloop;
    String lcd2 = lcdLoanAmt.getText();
    amount = Integer.parseInt(lcd2);
    termloop = 1;
    paid = 0.00;
    monthlyrate = lInterest / (12 * 100);
    months = lTerm * 12;
    monthly = amount *(monthlyrate/(1-Math.pow(1+monthlyrate,-months)));
    total = months * monthly;
    balance = amount;
    while (termloop <= lTerm)
    displayArea.setCaretPosition(0);
    displayArea.append("\n");
    displayArea.append("Year " + termloop + " of " + lTerm + ": payments\n");
    displayArea.append("\n");
    displayArea.append("Month\tMonthly\tPrinciple\tInterest\tBalance\n");
    monthloop = 1;
    while (monthloop <= 12)
    monthint = balance * monthlyrate;
    monthprin = monthly - monthint;
    balance -= monthprin;
    paid += monthly;
    displayArea.setCaretPosition(0);
    displayArea.append(monthloop + "\t" + calcPattern.format(monthly) + "\t" + calcPattern.format(monthprin) + "\t");
    displayArea.append(calcPattern.format(monthint) + "\t" + calcPattern.format(balance) + "\n");
    monthloop ++;
    termloop ++;
    public static void main(String args[])
    MORT_RETRY f = new MORT_RETRY();
    f.setTitle("MORTGAGE PAYMENT CALCULATOR");
    f.setBounds(600, 600, 500, 500);
    f.setLocationRelativeTo(null);
    f.setVisible(true);
    }need help with displaying the textarea correctly and the scroll bar please.
    Message was edited by:
    new2this2020

    What's the problem you're having ???
    PS.

  • Can anyone help with iPlayer and Sky Mobile?

    Ok, I'm so close to giving up with this useless phone. There are 3 apps on my N97 which give me a constant headache.
    BBC iPlayer
    Sky Mobile*
    YouTube
    *I should point out that I only use Sky Mobile to set recordings on my Sky+. I do not use it for, nor have any desire to use it for actually watching Mobile TV.
    All of these apps work absolutely fine over my home WiFi network. It's when I try to use them over 3G (my Vodafone Live! connection) that I start running in to trouble.
    All 3 give me connection problems, errors, and simply refuse to load half the time when on 3G. I got so annoyed I just did a hard reset the other week, and magically all three started working again. However, now 2 of them are failing me again. YouTube (touch wood) is working fine at the moment, but iPlayer and Sky Mobile just aren't.
    iPlayer sometimes works. But sometimes I get script errors (unable to load content), and sometimes it says something about checking my connection settings. I wouldn't mind but it's not actually possible to access any options for the iPlayer. Even in application settings there are no options you're able to set.
    Sky Mobile simply flat out refuses to work ever on 3G. But it did after I did a hard reset for a couple of weeks, now it just stopped working! It wont even load. It just gives the error message 'Unable to connect to network - please check connection settings" or something along those lines.
    I've tried so many different things. Tried setting my internet connections to 'always ask', tried setting it to default to Vodafone Live! all the time, tried setting my video streaming settings to WAP, all sorts. Every combination I can think of.
    I just can't wait to get rid of this phone. I've put so many people off buying one. They see it and think it's all swish and cool, and I just say 'Don't. You'll regret it'. I can't wait for my contract to be up so I can upgrade to an iPhone now Vodafone have got them.
    Can anyone help with these problems? Thanks in advance, but I don't hold out much hope...

    About iPlayer.
    Have a chat with Vodaphone. Streaming iPlayer over 3G IS allowed on Vodaphone contract, unlike my O2 contract. As long as your contract allows it, and you have the correct AP address, it should be fine. Vodaphone should be able to give you the setting.
    Mine only works over Wlan.
    FWIW, "... streaming over 3G is not currently available on iPhone handsets on any mobile network".
    p.s. Just to be clear. You say  "Tried setting my internet connections to 'always ask', tried setting it to default to Vodafone Live!".
    iPlayer uses the Nokia browser "Web". So that's where you should make the setting "Ask when needed". It should then offer you the choice of whatever you've set in Destinations> Internet> then select whatever you've chosen as your GPRS connection.(as advised, or sent to you by Vodaphone).

  • Using Search Help with ALV and Dynamic context node

    The topic subject already describes my situation.
    I have to create, populate and remove context nodes at runtime, and bind them to an ALV, to let user display the data or modify the data. The nodes I create are always typed with a table name, but the table name is of course, dynamic.
    This is all working: what's not working is help for entries inside the ALV; since the table has foreign keys and domains with check tables or fixed values, I expected that search helps were detected and managed by the framework.
    Instead, no help search is displayed except the input help based on data-type of the one "Date" input fields.
    I think I have to work on the dynamic node creation, and not on the ALV itself, since the latter only takes the node/attributes information, but i could be wrong. I tried with both the two following codings:
      CALL METHOD lo_nd_info_root->add_new_child_node
        EXPORTING
          static_element_type          = vs_tabname
          name                         = 'SAMPLE_NODE_NAME'
    *    is_mandatory                 = abap_false
    *    is_mandatory_selection       = abap_false
         is_multiple                  = abap_true
         is_multiple_selection        = abap_false
    *    is_singleton                 = abap_false
          is_initialize_lead_selection = abap_false
          is_static                    = abap_false
        RECEIVING
          child_node_info              = lo_nd_info_data .
    cl_wd_dynamic_tool=>create_nodeinfo_from_struct(
          parent_info = lo_nd_info_root
          node_name = 'SAMPLE_NODE_NAME'
          structure_name = vs_tabname
          is_multiple = abap_true ).
    The result is the same...is there any way to let the ALV know what search helps it has to use, and doesn't force me to manually build a VALUE_SET to be bound on the single attributes? There are many tables, with many fields, and maintaining this solution would be very costly.

    I have checked with method GET_ATTRIBUTE_VALUEHELP_TYPE of interface IF_WD_CONTEXT_NODE_INFO, on an attribute which i know to have a search help (Foreign key of a check table).
    The method returns 'N', that is the constant IF_WD_VALUE_HELP_HANDLER~CO_VH_TYPE_NO_HELP. So, the framework was not able to find a suitable search help.
    Using method GET_ATTRIBUTE_VALUE_HELP of the same interface, on the same attribute, returns me '111', which is constant C_VALUE_HELP_MODE-AUTOMATIC.
    Therefore, the WD framework knows it has to automatically detect a value help, but fails to find one.
    Also, this means in my opinion that the ALV and the dynamic external mapping are not the culprits: since node creation, no help is detected for any attribute but the date. Honestly, I don't have a clue on what's happening.

  • Help with Entities and Queries

    Hello,
    I am trying to link three tables, but only display info from a People table and a Role table. Can someone help me with the views and links needed to do this.
    Tables:
    people table key People_id, plus Last name, first name etc....
    User Role table has two columns user_id and Role_id. People_id = user_id.
    Role table also has two columns role_id and Desc. Would like to use a shuttle for the desc column.
    I would like to create / update people records with one to many roles. Is this the best way to do this? Also, would like to use a shuttle for the role desc column.
    Thanks,

    In your VO you can define more then 1 Entity. After this you can put the fields from the other entities in the VO.
    Regards,
    Menk

  • Help with BufferedImage and JPanel

    I have a program that should display some curves, but thats not the problem, the real problem is when i copy the image contained in the JPanel to the buffered image then i draw something there and draw it back to the JPanel. My panel initialy its white but after the operation it gets gray
    Please if some one could help with this
    here is my code divided in three classes
    //class VentanaPrincipal
    package gui;
    import java.awt.BorderLayout;
    import java.awt.FlowLayout;
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.Insets;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.image.BufferedImage;
    import javax.swing.BorderFactory;
    import javax.swing.JButton;
    import javax.swing.JLabel;
    import javax.swing.JSeparator;
    import javax.swing.border.LineBorder;
    import javax.swing.JMenuItem;
    import javax.swing.JPanel;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    * This code was edited or generated using CloudGarden's Jigloo
    * SWT/Swing GUI Builder, which is free for non-commercial
    * use. If Jigloo is being used commercially (ie, by a corporation,
    * company or business for any purpose whatever) then you
    * should purchase a license for each developer using Jigloo.
    * Please visit www.cloudgarden.com for details.
    * Use of Jigloo implies acceptance of these licensing terms.
    * A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
    * THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
    * LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
    public class VentanaPrincipal extends javax.swing.JFrame {
              //Set Look & Feel
              try {
                   javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
              } catch(Exception e) {
                   e.printStackTrace();
         private JMenuItem helpMenuItem;
         private JMenu jMenu5;
         private JMenuItem deleteMenuItem;
         private JSeparator jSeparator1;
         private JMenuItem pasteMenuItem;
         private JLabel jLabel4;
         private JLabel jLabel5;
         private JLabel jLabel3;
         private JLabel jLabel2;
         private JLabel jLabel1;
         private JButton jSPLineButton;
         private JButton jHermiteButton;
         private JButton jBezierButton;
         private JPanel jPanel2;
         private JPanel jPanel1;
         private JMenuItem jResetMenuItem1;
         private JMenuItem copyMenuItem;
         private JMenuItem cutMenuItem;
         private JMenu jMenu4;
         private JMenuItem exitMenuItem;
         private JSeparator jSeparator2;
         private JMenu jMenu3;
         private JMenuBar jMenuBar1;
          * Variables no autogeneradas
         private int botonSeleccionado;
         * Auto-generated main method to display this JFrame
         public static void main(String[] args) {
              VentanaPrincipal inst = new VentanaPrincipal();
              inst.setVisible(true);
         public VentanaPrincipal() {
              super();
              initGUI();
         private void initGUI() {
              try {
                        this.setTitle("Info3 TP 2");
                             jPanel1 = new pizarra();
                             getContentPane().add(jPanel1, BorderLayout.WEST);
                             jPanel1.setPreferredSize(new java.awt.Dimension(373, 340));
                             jPanel1.setMinimumSize(new java.awt.Dimension(10, 342));
                             jPanel1.setBackground(new java.awt.Color(0,0,255));
                             jPanel1.setBorder(BorderFactory.createCompoundBorder(
                                  new LineBorder(new java.awt.Color(0, 0, 0), 1, true),
                                  null));
                             BufferedImage bufimg = (BufferedImage)jPanel1.createImage(jPanel1.getWidth(), jPanel1.getHeight());
                             ((pizarra) jPanel1).setBufferedImage(bufimg);
                             jPanel2 = new JPanel();
                             getContentPane().add(jPanel2, BorderLayout.CENTER);
                             GridBagLayout jPanel2Layout = new GridBagLayout();
                             jPanel2Layout.rowWeights = new double[] {0.0, 0.0, 0.0, 0.0};
                             jPanel2Layout.rowHeights = new int[] {69, 74, 76, 71};
                             jPanel2Layout.columnWeights = new double[] {0.0, 0.0, 0.1};
                             jPanel2Layout.columnWidths = new int[] {83, 75, 7};
                             jPanel2.setLayout(jPanel2Layout);
                                  jBezierButton = new JButton();
                                  jPanel2.add(jBezierButton, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
                                  jBezierButton.setText("Bezier");
                                  jBezierButton.setFont(new java.awt.Font("Tahoma",0,10));
                                  jBezierButton.addActionListener(new ActionListener() {
                                       public void actionPerformed(ActionEvent evt) {
                                            bezierActionPerformed();
                                  jHermiteButton = new JButton();
                                  jPanel2.add(jHermiteButton, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
                                  jHermiteButton.setText("Hermite");
                                  jHermiteButton.setFont(new java.awt.Font("Tahoma",0,10));
                                  jSPLineButton = new JButton();
                                  jPanel2.add(jSPLineButton, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
                                  jSPLineButton.setText("SP Line");
                                  jSPLineButton.setFont(new java.awt.Font("Tahoma",0,10));
                                  jLabel1 = new JLabel();
                                  jPanel2.add(jLabel1, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
                                  jLabel1.setText("Posicion Mouse");
                                  jLabel2 = new JLabel();
                                  jPanel2.add(jLabel2, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(12, 0, 0, 0), 0, 0));
                                  jLabel2.setText("X:");
                                  jLabel3 = new JLabel();
                                  jPanel2.add(jLabel3, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.SOUTH, GridBagConstraints.NONE, new Insets(0, 0, 12, 0), 0, 0));
                                  jLabel3.setText("Y:");
                                  jLabel4 = new JLabel();
                                  jPanel2.add(jLabel4, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(12, 0, 0, 0), 0, 0));
                                  jLabel4.setText("-");
                                  jLabel5 = new JLabel();
                                  jPanel2.add(jLabel5, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.SOUTH, GridBagConstraints.NONE, new Insets(0, 0, 12, 0), 0, 0));
                                  jLabel5.setText("-");
                   this.setSize(600, 400);
                        jMenuBar1 = new JMenuBar();
                        setJMenuBar(jMenuBar1);
                             jMenu3 = new JMenu();
                             jMenuBar1.add(jMenu3);
                             jMenu3.setText("Archivo");
                                  jSeparator2 = new JSeparator();
                                  jMenu3.add(jSeparator2);
                                  exitMenuItem = new JMenuItem();
                                  jMenu3.add(exitMenuItem);
                                  exitMenuItem.setText("Exit");
                                  jResetMenuItem1 = new JMenuItem();
                                  jMenu3.add(jResetMenuItem1);
                                  jResetMenuItem1.setText("Reset");
                             jMenu4 = new JMenu();
                             jMenuBar1.add(jMenu4);
                             jMenu4.setText("Edit");
                                  cutMenuItem = new JMenuItem();
                                  jMenu4.add(cutMenuItem);
                                  cutMenuItem.setText("Cut");
                                  copyMenuItem = new JMenuItem();
                                  jMenu4.add(copyMenuItem);
                                  copyMenuItem.setText("Copy");
                                  pasteMenuItem = new JMenuItem();
                                  jMenu4.add(pasteMenuItem);
                                  pasteMenuItem.setText("Paste");
                                  jSeparator1 = new JSeparator();
                                  jMenu4.add(jSeparator1);
                                  deleteMenuItem = new JMenuItem();
                                  jMenu4.add(deleteMenuItem);
                                  deleteMenuItem.setText("Delete");
                             jMenu5 = new JMenu();
                             jMenuBar1.add(jMenu5);
                             jMenu5.setText("Help");
                                  helpMenuItem = new JMenuItem();
                                  jMenu5.add(helpMenuItem);
                                  helpMenuItem.setText("Help");
              } catch (Exception e) {
                   e.printStackTrace();
         private void bezierActionPerformed(){
              botonSeleccionado = 1;
              ((pizarra) jPanel1).setTipoFigura(botonSeleccionado);
              ((pizarra) jPanel1).pintarGrafico();
    //class graphUtils
    package func;
    import java.awt.Image;
    import java.awt.Point;
    import java.awt.image.BufferedImage;
    public class graphUtils {
         public static void dibujarPixel(BufferedImage img, int x, int y, int color){
              img.setRGB(x, y, color);
         public static void dibujarLinea(BufferedImage img, int x0, int y0, int x1, int y1, int color){
            int dx = x1 - x0;
            int dy = y1 - y0;
            if (Math.abs(dx) > Math.abs(dy)) {          // Pendiente m < 1
                float m = (float) dy / (float) dx;     
                float b = y0 - m*x0;
                if(dx < 0) dx = -1; else dx = 1;
                while (x0 != x1) {
                    x0 += dx;
                    dibujarPixel(img, x0, Math.round(m*x0 + b), color);
            } else
            if (dy != 0) {                              // Pendiente m >= 1
                float m = (float) dx / (float) dy;
                float b = x0 - m*y0;
                if(dy < 0) dy = -1; else dy = 1;
                while (y0 != y1) {
                    y0 += dy;
                    dibujarPixel(img, Math.round(m*y0 + b), y0, color);
         public static void dibujarBezier(BufferedImage img, Point puntos, int color){
    //class pizarra
    package gui;
    import javax.swing.*;
    import sun.awt.VerticalBagLayout;
    import sun.security.krb5.internal.bh;
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Image;
    import java.awt.Point;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import java.awt.image.BufferedImage;
    import java.util.ArrayList;
    import func.graphUtils;
    * esta clase pizarra extiende la clase JPanel y se agregan las funciones de pintado
    * y rellenado que se muestra en pantalla dentro del panel que se crea con esta clase
    * @author victorg
    public class pizarra extends JPanel implements MouseListener{
         private int tipoFigura;
         BufferedImage bufferImagen;
         Image img;
         Graphics img_gc;
         private Color colorRelleno, colorLinea;
         private Point puntosBezier[] = new Point[3];
         public pizarra(){
              super();          
              addMouseListener(this);
              //this.setBackground(Color.BLUE);
              colorLinea = Color.BLUE;
         public void setTipoFigura(int seleccion){
              // se setea para ver si es bezier, hermite, SP line
              tipoFigura = seleccion;
         public void setTipoRelleno(int seleccion){
         public void setColorRelleno(Color relleno){
              colorRelleno = relleno;          
         public void setColorLinea(Color linea){
              colorLinea = linea;
         public void setBufferedImage(BufferedImage bufimg){
              bufferImagen = bufimg;
         public void pintarGrafico(){
              Graphics g = this.getGraphics();     
              g.setColor(colorLinea);
              //accion ejecutada cuando se selecciona para graficar un poligono
              if(tipoFigura == 1){// bezier
                   if(bufferImagen == null){
                        //mantiene guardada la imagen cuando la pantalla pasa a segundo plano
                        bufferImagen = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB);
                        this.setBackground(Color.WHITE);                                                  
                        bufferImagen = (BufferedImage)createImage(getWidth(), getHeight());
                        //bufferImagen = this.createImage(getWidth(), getHeight());
                   //g.drawImage(bufferImagen,0,0,this);
                   graphUtils.dibujarLinea(bufferImagen,10, 10, 50, 50, colorLinea.getRGB());
                   g.drawImage(bufferImagen,0,0,this);
         protected void paintComponent(Graphics g) { // llamado al repintar
              //setBackground(colorFondo);
              super.paintComponent(g);
    //          Graphics2D g2 = (Graphics2D)g;          
    //          g2.drawImage(bufferImagen, 0,0, this);          
    //          g2.dispose();     
         public void mouseClicked(MouseEvent arg0) {          
         public void mousePressed(MouseEvent arg0) {
              // TODO Auto-generated method stub
         public void mouseReleased(MouseEvent arg0) {
              // TODO Auto-generated method stub
         public void mouseEntered(MouseEvent arg0) {
              // TODO Auto-generated method stub
         public void mouseExited(MouseEvent arg0) {
              // TODO Auto-generated method stub
    }

    1) Swing related questions should be posted in the Swing forum.
    Custom painting should be done in the paintComponent(..) method. You created a "pintarGraphico" method to do the custom painting, but that method is only execute once. When Java determines that the panel needs to be repainted, the paintComponent() method is executed which simply does a super.paintComponent(), which in turn simply paints the background of the panel overwriting you custom painting.

  • Please help with TV and home theater system for very large basement room....

    I'm looking to get my boyfriend either a TV or home theater system for the basement.  I know he eventually wants a 3d TV.  Right now he has a set up where he has 2 tv's so he can play video games and watch sports.
    The basement that the tv and home theater system will be in is large (I'd estimate at least 15 ft x 30 ft...maybe more) so I want to make sure the home theater system will be enough for the room.  We live in a ranch so basically the basement is almost the size of the house with some of it being storage.
    I've started to look at products online but there are so many and technology isn't really my thing.
    If anyone could help with recommendations for the home theater system and/or the tv I'd appreciate it!
    Thanks so so sooo much!!!!

    What will he be using the HT system for?  Just watching sports or skipping the movie theater and watching them at home.   If you plan to watch them at home your going to be on a tight budget with the home theater system but it is possible.   Spend good money on the sub, that is one speaker you don't want to skimp out on.  With such a big space you have a lot of room to fill and the cheap subs aren't going to cut it.   You will probably need two subs as it is.  The speakers I recommend on a tight budget Polk or Klipsch.  My list includes a Denon receiver as I am a Denon fan but Yamaha, Onkyo, or Pioneer will suffice.
    Here is a Option 1 will run you about 1700 with just one sub. You could always go up a model on each speaker if you feel the one sub is enough.  I like an explosion sounding like it happened in front of me so that is why I mention 2 subs.
    http://www.bestbuy.com/site/Denon+-+630W+7.1-Ch.+3D+Pass+Through+A/V+Home+Theater+Receiver/9894577.p...
    http://www.bestbuy.com/site/Polk+Audio+-+Dual+5-1/4%22+2-Way+Floor+Speakers+(Each)+-+Black/8825453.p... speakers&cp=1&lp=12
    http://www.bestbuy.com/site/Polk+Audio+-+5-1/4%22+Bookshelf+Speakers+(Pair)+-+Black/8825444.p?id=120... speakers&cp=1&lp=2
    http://www.bestbuy.com/site/Polk+Audio+-+5-1/4%22+Center-Channel+Speaker+-+Black/8826149.p?id=120735... speakers&cp=1&lp=28
    http://www.bestbuy.com/site/Speakers/Subwoofer-Speakers/abcat0205008.c?id=abcat0205008&&initialize=f...
    Option 2 will cost $1400 before a subwoofer
    http://www.bestbuy.com/site/Denon+-+630W+7.1-Ch.+3D+Pass+Through+A/V+Home+Theater+Receiver/9894577.p...
    http://www.bestbuy.com/site/Mirage+-+OS%26%23179%3B-CC+Ompipolar+3-Way+Center-Channel+Speaker+-+Blac... speaker&cp=1&lp=11
     and 4 of the below speaker
    http://www.bestbuy.com/site/Mirage+-+OS%26%23179%3B-SAT+4-1/2%22+2-Way+Satellite+Speaker+(Each)+-+Hi... speaker&cp=1&lp=15

  • Help with conditions AND installer Packages

    Hello everyone,
    I need help still learning.
    My shell is SHELL=/bin/sh based on env command
    I am trying to write a package with Iceberg to push Office 2004 to 250 Macs. I need a preflight script with a condition that will stop my script if /Applications/Microsoft Office 2004 exists OR if OFFICE 2004 exists. Don't know if searching on the folder name is the best or if there is better way
    If it doesn't exist I want it to continue with with placing Office 2004 in the /Applications folder.
    I don't know how to do conditions (If, then, end)
    PREFLIGHT SCRIPT
    IF /Applications/Microsoft Office 2004 folder exist = STOP
    IF /Applications/Microsoft Office 2004 folder doesn't exist continue with laying down files/folder in the package.
    LAYDOWN FILES
    LAY DOWN FILES IN ICEBERG FILE SECTION OF THE PACKAGE
    POSTFLIGHT SCRIPT
    #!/bin/sh
    #Change to root directory
    cd /
    # Move Microsoft Office X folder to Messages Received folder
    mv /Applications/Microsoft\ Office\ X /Messages\ Received
    #Open Office 2004 Installer
    open /Applications/Utilities/Installers/Office2004Installer
    G4 1.42   Mac OS X (10.3.5)  

    Hi Dmcrory,
       The answer to your question about ORing tests in a shell conditional statement could be something along the lines of:
    if [ -d /Applications/Microsoft\ Office\ 2004 -o -d "/Applications/OFFICE 2004" ]
    then
       exit 1
    fi
    I've included two different styles of quoting so you can choose which you prefer.
       That said, you appear to be asking us how to write shell scripts, starting from scratch. Time that you spend studying benefits you forever and sometimes benefits us, while time we spend doing your work is at best a trivial review for us. The above "-o" option, and many others, are documented at the compound comparison section of the Advanced Bash-Scripting Guide. Don't let the name fool you; the Guide actually assumes very little. The "Advanced" adjective refers to the completeness of work. In fact there are many good references.
       I used to have a long post of links to what I think are some of the better beginning UNIX tutorials and books. However, as others posted great links and I stole them, my post became too long so I put it in a web page. Bill Scott did the same thing so here is Bill's and here is mine.
       This is being written after reading your exchange with Roger. When you execute code that doesn't work, we certainly have no chance of knowing why without seeing the code. It generally helps a lot to see the output as well.
    Gary
    ~~~~
       University politics are vicious precisely because the
       stakes are so small.
             -- C. P. Snow

  • Please help with Firewall and/or other Settings to Chat (MSN Messenger).

    I've tried to chat on all (I think) the messenger programs available for Mac that use a hotmail account or .net passport - Adium, Fire, Mercury (current) and MSN itself - and I have the same problem with all of them: I keep getting cut off/disconnected from MSN! No problems with Yahoo messenger or Yahoo ID (although it can be a bit slow sometimes), just with .net passport account.
    I'm pretty sure it's got something to do with Firewall and/or related settings, but after months of trying to fix it, I'm about to give up... please help!
    Currently the following Firewall ports are all open:
    6891 – 6900
    1863
    80
    1080
    5060, 9000, 9010 (UDP – typed like that)
    including:
    Personal File Sharing
    Windows Sharing
    Remote Login - SSH
    and Printer Sharing.
    In my most recent disconnected conversation, Mercury logged a "socket fired exception" error.
    I'm on a broadband/adsl connection, shared with hubby's pc through ethernet (and he never gets disconnected from msn, btw).
    ANY suggestions would be welcome, but apart from the above, please tell me how/where to find what you tell me to look at or for, because I'm a new Mac user (six months), and on top of that I'm blonde
    Many Thanks!
    Mac Mini (PowerMac10,1)   Mac OS X (10.4.3)   1.42 GHz PowerPC G4 with 1 GB DDR SDRAM

    Update:
    Someone very kindly pointed out that my Firewall is actually Off (probably because I omitted to click on the Start button)... I did say I'm blonde
    So now I'm really stumped... anybody got any ideas? Please?

  • Help with Mathscipt and for loop

    I have a code in Mathscript/matlab and I need to output the array out. One option is my first code,the other option is using a for loop, but I am only getting the last ouput out. I need to get the whole output out.
    Any help.
    Thanks
    Solved!
    Go to Solution.
    Attachments:
    Help with Mathscript_for loop.vi ‏115 KB
    Help with Mathscript_for loop2.vi ‏84 KB

    Here's how it should look like.
    Message Edited by altenbach on 10-30-2008 05:12 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    MathscriptInFOR.png ‏15 KB

  • Help with encapsulation and a specific case of design

    Hello all. I have been playing with Java (my first real language and first OOP language) for a couple months now. Right now I am trying to write my first real application, but I want to design it right and I am smashing my head against the wall with my data structure, specifically with encapsulation.
    I go into detail about my app below, but it gets long so for those who don't want to read that far, let me just put these two questions up front:
    1) How do principles of encapsulation change when members are complex objects rather than primitives? If the member objects themselves have only primitive members and show good encapsulation, does it make sense to pass a reference to them? Or does good encapsulation demand that I deep-clone all the way to the bottom of my data structure and pass only cloned objects through my top level accessors? Does the analysis change when the structure gets three or four levels deep? Don't DOM structures built of walkable nodes violate basic principles of encapsulation?
    2) "Encapsulation" is sometimes used to mean no public members, othertimes to mean no public members AND no setter methods. The reasons for the first are obvious, but why go to the extreme of the latter? More importantly HOW do you go to the extreme of the latter? Would an "updatePrices" method that updates encapsulated member prices based on calculations, taking a single argument of say the time of year be considered a "setter" method that violates the stricter vision of encapsulation?
    Even help with just those two questions would be great. For the masochistic, on to my app... The present code is at
    http://www.immortalcoil.org/drake/Code.zip
    The most basic form of the application is statistics driven flash card software for Japanese Kanji (Chinese characters). For those who do not know, these are ideographic characters that represent concepts rather than sounds. There are a few thousand. In abstract terms, my data structure needs to represent the following.
    -  There are a bunch of kanji.
       Each kanji is defined by:
       -  a single character (the kanji itself); and
       -  multiple readings which fall into two categories of "on" and "kun".
          Each reading is defined by:
          -  A string of hiragana or katakana (Japanese phoenetic characters); and
          -  Statistics that I keep to represent knowledge of that reading/kanji pair.Ideally the structure should be extensible. Later I might want to add statistics associated with the character itself rather than individual readings, for example. Right now I am thinking of building a data structure like so:
    -  A Vector that holds:
       -  custom KanjiEntry objects that each hold
          -  a kanji in a primitive char value; and
          -  two (on, kun) arrays or Vectors of custom Reading objects that hold
             -  the reading in a String; and
             -  statistics of some sort, probably in primitive valuesFirst of all, is this approach sensible in the rough outlines?
    Now, I need to be able to do the obvious things... save to and load from file, generate tables and views, and edit values. The quesiton of editting values raises the questions I identified above as (1) and (2). Say I want to pull up a reading, quiz the user on it, and update its statistics based on whether the user got it right or wrong. I could do all this through the KanjiEntry object with a setter method that takes a zillion arguments like:
    theKanjiEntry.setStatistic(
    "on",   // which set of readings
    2,      // which element in that array or Vector
    "score", // which statistic
    98);      // the valueOr I could pass a clone of the Reading object out, work with that, then tell the KanjiEntry to replace the original with my modified clone.
    My instincts balk at the first approach, and a little at the second. Doesn't it make more sense to work with a reference to the Reading object? Or is that bad encapsulation?
    A second point. When running flash cards, I do not care about the subtlties of the structure, like whether a reading is an on or a kun (although this is important when browsing a table representing the entire structure). All I really care about is kanij/reading pairings. And I should be able to quickly poll the Reading objects to see which ones need quizzing the most, based on their statistics. I was thinking of making a nice neat Hashtable with the keys being the kanji characters in Strings (not the KanjiEntry objects) and the values being the Reading objects. The result would be two indeces to the Reading objects... the basic structure and my ad hoc hashtable for runninq quizzes. Then I would just make sure that they stay in sync in terms of the higher level structure (like if a whole new KanjiEntry got added). Is this bad form, or even downright dangerous?
    Apart from good form, the other consideration bouncing around in my head is that if I get all crazy with deep cloning and filling the bottom level guys with instance methods then this puppy is going to get bloated or lag when there are several thousand kanji in memory at once.
    Any help would be appreciated.
    Drake

    Usually by better design. Move methods that use the
    getters inside the class that actually has the data....
    As a basic rule of thumb:
    The one who has the data is the one using it. If
    another class needs that data, wonder what for and
    consider moving that operation away from that class.
    Or move from pull to push: instead of A getting
    something from B, have B give it to A as a method
    call argument.Thanks for the response. I think I see what you are saying.. in my case it is something like this.
    Solution 1 (disfavored):
    public class kanjiDrill{ // a chunk of Swing GUI or something
         public void runDrill(Vector kanjiEntries){
              KanjiEntry currentKanjiEntry = kanjiEntries.elementAt(0); // except really I will pick one randomly
              char theKanji = currentKanjiEntry.getKanji();
              String theReading = currentKanjiEntry.getReading();
              // build and show a flashcard based on theKanji and theReading
              // use a setter to change currentKanji's data based on whether the user answers correctly;
    }Solution 2 (favored):
    public class kanjiDrill{ // a chunk of Swing GUI or something
         public void runDrill(Vector kanjiEntries){
              KanjiEntry currentKanjiEntry = kanjiEntries.elementAt(0); // except really I will pick one randomly
              currentKanji.buildAndShowFlashcard(); // method includes updating stats
    }I can definitely see the advantages to this, but two potential reasons to think hard about it occur to me right away. First, if this process is carried out to a sufficient extreme the objects that hold my data end up sucking in all the functionality of my program and my objects stop resembling natural concepts.
    In your shopping example, say you want to generate price tags for the items. The price tags can be generated with ONLY the raw price, because we do not want the VAT on them. They are simple GIF graphics that have the price printed on a an irregular polygon. Should all that graphics generating code really go into the item objects, or should we just get the price out of the object with a simple getter method and then make the tags?
    My second concern is that the more instance methods I put into my bottom level data objects the bigger they get, and I intend to have thousands of these things in memory. Is there a balance to strike at some point?
    It's not really a setter. Outsiders are not setting
    the items price - it's rather updating its own price
    given an argument. This is exactly how it should be,
    see my above point. A breach of encapsulation would
    be: another object gets the item price, re-calculates
    it using a date it knows, and sets the price again.
    You can see yourself that pushing the date into the
    item's method is much beter than breaching
    encapsulation and getting and setting the price.So the point is not "don't allow access to the members" (which after all you are still doing, albeit less directly) so much as "make sure that any functionality implicated in working with the members is handled within the object," right? Take your shopping example. Say we live in a country where there is no VAT and the app will never be used internationally. Then we would resort to a simple setter/getter scheme, right? Or is the answer that if the object really is pure data are almost so, then it should be turned into a standard java.util collection instead of a custom class?
    Thanks for the help.
    Drake

Maybe you are looking for