How to do some cleanup when closing JFrame

Hi all,
1st: Is it possible to call a method (or something) when the user clicks the close button on a JFrame so that some cleanup can happen before exiting? I have a dropdown menu that has an exit button which calls a method that performs a whole lot of neccesary cleanup operations. The problem is that Im not sure how to call that cleanup method if the user clicks the 'x' instead of exititing with the menu. (I know Java has automatic garbage collection but there are additional things i need to do when the program exits)
2nd: Once ive done all the necessary cleanup is it correct to simply call Sytem.exit(0); ? Is that a safeway of closing the program?
3rd: How do you display multiple lines of text on a JButton? I have a button wich has a small amount of horizontal space and so I need to display the text on two lines but I cant figure out how to make the text rollover. Ive tried using '\n' which doesnt work., and there is no multiline or rollover property that I am aware of.
Much appreciated. R
ps. Is there a page here where i can read more on assigning dukes and rewarding them? Im feeling stingy not knowing how to assign them to helpfull people.

You might also want to have a look at shutdown hooks. You can use them to be sure that certain cleanup will happen before exiting even if exiting was forced because of your application crashing or the user killing it through the task manager or the unix "kill" command.
http://java.sun.com/developer/TechTips/2000/tt0711.html#tip1
2) calling Sytem.exit(0) will be enough
3) There are a couple of ways: you can use HTML in the label or do something a bit more fancy:
http://javaalmanac.com/egs/javax.swing/button_MultiLine.html
http://www.javaworld.com/javaworld/javaqa/2000-03/01-qa-button.html
4) The Duke Dollars FAQ is at http://forum.java.sun.com/rewardFaq.jsp

Similar Messages

  • Newbie: How to call a method when a JFrame closed ?

    Hya,
    how I can call a method to perform some operations when the JFrame's close(x) button is pressed?
    thanks in advance

    try this
    (change System.exit(0) if you don't want to close the app)
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    class Testing extends JFrame
      public Testing()
        setLocation(300,200);
        setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);//<---------
        setSize(300,200);
        addWindowListener(new WindowAdapter(){//<-----------
          public void windowClosing(WindowEvent we){
            someMethod();
            System.exit(0);}});
      public void someMethod()
        JOptionPane.showMessageDialog(this,"Closing...");
      public static void main(String[] args){new Testing().setVisible(true);}
    }

  • How to show a confirmation when closing browser window in jdeveloper11g

    Hi
    I'm Using Jdev 11g
    How to show a confirmation when closing browser window in jdeveloper11g
    Regards
    Abhilash

    Abhilash,
    My goodness...
    Didn't search the forum, eh? In fact, didn't even look at the last 5 or 6 posts - this was posted by another user within the past few hours.... Giving a message while closing a jspx page.
    John

  • Dynpro application: how to perform some  code when user click window close

    Hello,
    I'm developing dynpro application. This application needs to perform some code when exiting.
    I can do that with MODULE xxxxx AT EXIT-COMMAND. But this code can't be performed when user of application click on button closing window (classic R/3 window, not pop-up).
    Does anybody know how to bind some code to clicking on button closing window?
    Best regards,
    Josef Motl

    As far as the prompt that you get when you close the last window is coming from the counter that SAP maintains regarding the number of open sessions(windows). When this counter reaches 1, I guess they have a check to issue a prompt. There was a discussion in this forum a long time back regarding how we can know that session id like SM04. There was no conclusion reached then. Theoritically, let us know you know this id for the session in which the user opened a particular page, then you can see if that session is deleted and then take the necessary action. There are some TH_* function modules that seem to be promising, but I was not able to conclusively achieve the control over a particular session.
    See if you can look at SM04 and get an idea. Please do let us know if you find the solution.
    Srinivas

  • How to initiate some action when user clicks a field in CRViewer?

    <p><span style="font-family: Courier"><font size="1">ReportObjects doesn't expose click event despite the fact that a field can get focus frame, you can even tab from field to field. </font></span><span style="font-family: Courier"><font size="1">Drill() event works only on group names.</font></span><span style="font-family: Courier"><font size="1">So, how to initiate some action (based on a clicked field value) when user clicks a field in CRViewer?</font></span><span style="font-family: Courier"><font size="1">After doing some googling, have found that something similar exists but it's FoxPro API</font></span></p><p><strong><span style="font-size: 12pt; font-family: Courier"><font size="1">From some PDF: </font></span></strong><strong><span style="font-size: 12pt; font-family: Courier"><font size="1"> </font></span></strong></p><p><strong><span style="font-size: 12pt; font-family: Courier"><font size="1">> Report objects events</font></span></strong> </p><p style="margin: 0cm 0cm 0pt; line-height: normal" class="MsoNormal"><span style="font-size: 10pt; font-family: Courier"><font size="1"><span style="font-size: 12pt; font-family: Courier"><font size="1"><strong>> </strong></font></span>Report object events occur when you click or double-click a field, </font></span></p><span style="font-size: 10pt; font-family: Courier"><font size="1"><span style="font-size: 12pt; font-family: Courier"><font size="1"><strong>> </strong></font></span>heading, or label in a report.</font></span> <p style="margin: 0cm 0cm 0pt; line-height: normal" class="MsoNormal"><span style="font-size: 10pt; font-family: Courier"><font size="1"><span style="font-size: 12pt; font-family: Courier"><font size="1"><strong>> </strong></font></span>Doing this creates the EventInfo object. This object contains </font></span></p><span style="font-size: 10pt; font-family: Courier"><font size="1"><span style="font-size: 12pt; font-family: Courier"><font size="1"><strong>> </strong></font></span>information about the event and</font></span> <p style="margin: 0cm 0cm 0pt; line-height: normal" class="MsoNormal"><font size="1"><span style="font-size: 10pt; font-family: Courier"><span style="font-size: 12pt; font-family: Courier"><font size="1"><strong>> </strong></font></span>passes as a parameter to the event method. </span><strong><span style="font-size: 10pt; font-family: Courier">Table 3 </span></strong><span style="font-size: 10pt; font-family: Courier">lists the</span></font></p><p style="margin: 0cm 0cm 0pt; line-height: normal" class="MsoNormal"><font size="1"><span style="font-size: 10pt; font-family: Courier"><strong><span style="font-size: 12pt; font-family: Courier"><font size="1">> </font></span></strong>EventInfo object properties.......</span></font></p>

    The article you found refers to the ActiveX viewer which is used with the COM-based tool called Report Designer Component. Since you have posted to the .NET forum, I'm assuming you're not using the RDC and therefore this article will not apply.
    Recently, Click events were added to the Windows Form Viewer to get similar functionality as the ActiveX viewer. Take a look at the following link for more information....
    [http://diamond.businessobjects.com/node/2109 | /node/2109]
    However, if you are using the CR Web Forms Viewer in an ASP.NET app, then this functionality is not available.

  • How do i add selection when closing firefox to save and quit, the tabs?

    how do i save and quit when closing firefox?

    '''cosmos''':
    For illustrated example and explanation of entering/using '''''about:config''''' see: http://kb.mozillazine.org/About:config
    <br />
    <br />
    '''Other issues needing your attention'''
    The information submitted with your question indicates that you have out of date plugins with known security and stability issues that should be updated. To see the plugins submitted with your question, click "More system details..." to the right of your original question post. You can also see your plugins from the Firefox menu, Tools > Add-ons > Plugins.<br />
    <br />
    *Adobe PDF Plug-In For Firefox and Netscape "9.4.1"
    *Next Generation Java Plug-in 1.6.0_20 for Mozilla browsers
    #'''''Check your plugin versions''''' on either of the following links':
    #*http://www.mozilla.com/en-US/plugincheck/
    #*https://www-trunk.stage.mozilla.com/en-US/plugincheck/
    #*'''Note: plugin check page does not have information on all plugin versions'''
    #'''Update Adobe Reader (PDF plugin):'''
    #*From within your existing Adobe Reader ('''<u>if you have it already installed</u>'''):
    #**Open the Adobe Reader program from your Programs list
    #**Click Help > Check for Updates
    #**Follow the prompts for updating
    #**If this method works for you, skip the "Download complete installer" section below and proceed to "After the installation" below
    #*Download complete installer ('''if you do <u>NOT</u> have Adobe Reader installed'''):
    #**Use the links below to avoid getting the troublesome "getplus" Adobe Download Manager and other "extras" you may not want
    #**Use Firefox to download and SAVE the installer to your hard drive from the appropriate link below
    #**Click "Save to File"; save to your Desktop (so you can find it)
    #**After download completes, close Firefox
    #**Click the installer you just downloaded and allow the install to continue
    #***Note: Vista and Win7 users may need to right-click the installer and choose "Run as Administrator"
    #**'''<u>Download link</u>''': ftp://ftp.adobe.com/pub/adobe/reader/
    #***Choose your OS
    #***Choose the latest #.x version (example 9.x, for version 9)
    #***Choose the highest number version listed
    #****NOTE: 10.x is the new Adobe Reader X (Windows and Mac only as of this posting)
    #***Choose your language
    #***Download the file, SAVE it to your hard drive, when complete, close Firefox, click on the installer you just downloaded and let it install.
    #***Windows: choose the .exe file; Mac: choose the .dmg file
    #*Using either of the links below will force you to install the "getPlus" Adobe Download Manager. Also be sure to uncheck the McAfee Scanner if you do not want the link forcibly installed on your desktop
    #**''<u>Also see Download link</u>''': http://get.adobe.com/reader/otherversions/
    #**Also see: https://support.mozilla.com/en-US/kb/Using+the+Adobe+Reader+plugin+with+Firefox (do not use the link on this page for downloading; you may get the troublesome "getplus" Adobe Download Manager (Adobe DLM) and other "extras")
    #*After the installation, start Firefox and check your version again.
    #'''Update the [[Java]] plugin''' to the latest version.
    #*Download site: http://www.oracle.com/technetwork/java/javase/downloads/index.html (Java Platform: Download JRE)
    #**'''''Be sure to <u>un-check the Yahoo Toolbar</u> option during the install if you do not want it installed.
    #*Also see "Manual Update" in this article to update from the Java Control Panel in Windows Control Panel: http://support.mozilla.com/en-US/kb/Using+the+Java+plugin+with+Firefox#Updates
    #* Removing old versions (if needed): http://www.java.com/en/download/faq/remove_olderversions.xml
    #* Remove multiple Java Console extensions (if needed): http://kb.mozillazine.org/Firefox_:_FAQs_:_Install_Java#Multiple_Java_Console_extensions
    #*Java Test: http://www.java.com/en/download/help/testvm.xml

  • [SOLVED] how to prevent suspending/sleeping when closing laptop lid

    Hi all,
    My laptop, a Lenovo Thinkpad T430u, suspends whenever I close the lid. It's been doing this since I first installed Arch.  I want to turn this feature off.  How can I do it?
    Relevant information:
    acpid is installed
    the configuration file /etc/acpi/handler.sh
    #!/bin/bash
    # Default acpi script that takes an entry for all actions
    case "$1" in
    button/power)
    case "$2" in
    PBTN|PWRF)
    logger 'PowerButton pressed'
    logger "ACPI action undefined: $2"
    esac
    button/sleep)
    case "$2" in
    SLPB|SBTN)
    logger 'SleepButton pressed'
    logger "ACPI action undefined: $2"
    esac
    ac_adapter)
    case "$2" in
    AC|ACAD|ADP0)
    case "$4" in
    00000000)
    logger 'AC unpluged'
    00000001)
    logger 'AC pluged'
    esac
    logger "ACPI action undefined: $2"
    esac
    battery)
    case "$2" in
    BAT0)
    case "$4" in
    00000000)
    logger 'Battery online'
    00000001)
    logger 'Battery offline'
    esac
    CPU0)
    *) logger "ACPI action undefined: $2" ;;
    esac
    button/lid)
    case "$3" in
    close)
    logger 'LID closed'
    open)
    logger 'LID opened'
    logger "ACPI action undefined: $3"
    esac
    case $(cat /proc/acpi/button/lid/LID0/state | awk '{print $2}') in
    closed) XAUTHORITY=$(ps -C xinit -f --no-header | sed -n 's/.*-auth //; s/ -[^ ].*//; p') xset -display :0 dpms force off ;;
    open) XAUTHORITY=$(ps -C xinit -f --no-header | sed -n 's/.*-auth //; s/ -[^ ].*//; p') xset -display :0 dpms force on ;;
    esac
    logger "ACPI group/action undefined: $1 / $2"
    esac
    # vim:set ts=4 sw=4 ft=sh et:
    dmesg output:
    [ 1530.790532] PM: Syncing filesystems ... done.
    [ 1530.805678] PM: Preparing system for mem sleep
    [ 1530.844445] Freezing user space processes ... (elapsed 0.01 seconds) done.
    [ 1530.856658] Freezing remaining freezable tasks ... (elapsed 0.10 seconds) done.
    [ 1530.963435] PM: Entering mem sleep
    [ 1530.963572] Suspending console(s) (use no_console_suspend to debug)
    [ 1531.123543] iwlwifi 0000:03:00.0: iwl_pcie_cmdq_reclaim: Read index for DMA queue txq id (9), index 207 is out of range [0-256] 208 208.
    [ 1531.124216] sd 0:0:0:0: [sda] Synchronizing SCSI cache
    [ 1531.124579] sd 0:0:0:0: [sda] Stopping disk
    [ 1531.360682] mei 0000:00:16.0: suspend
    [ 1531.440517] ahci 0000:00:1f.2: power state changed by ACPI to D3hot
    [ 1531.687309] PM: suspend of devices complete after 722.490 msecs
    [ 1531.687784] PM: late suspend of devices complete after 0.469 msecs
    [ 1531.688232] pcieport 0000:00:1c.3: System wakeup enabled by ACPI
    [ 1531.714222] ehci-pci 0000:00:1d.0: System wakeup enabled by ACPI
    [ 1531.727619] ehci-pci 0000:00:1a.0: System wakeup enabled by ACPI
    [ 1531.754015] xhci_hcd 0000:00:14.0: System wakeup enabled by ACPI
    [ 1531.767422] PM: noirq suspend of devices complete after 79.565 msecs
    [ 1531.768301] ACPI: Preparing to enter system sleep state S3
    [ 1531.797647] PM: Saving platform NVS memory
    [ 1531.799282] Disabling non-boot CPUs ...
    [ 1531.900721] smpboot: CPU 1 is now offline
    [ 1532.004162] smpboot: CPU 2 is now offline
    [ 1532.107554] smpboot: CPU 3 is now offline
    I have pmutils and tlpinstalled
    tlp config
    # tlp - Parameters for power save
    # Hint: some features are disabled by default, remove the leading # to enable them
    # Set to 0 to disable/1 to enable TLP
    TLP_ENABLE=1
    # Seconds laptop mode has to to wait after the disk goes idle before doing a sync.
    # Non-zero value enables, zero disables laptop mode.
    DISK_IDLE_SECS_ON_AC=0
    DISK_IDLE_SECS_ON_BAT=2
    # Dirty page values (timeouts in secs).
    MAX_LOST_WORK_SECS_ON_AC=15
    MAX_LOST_WORK_SECS_ON_BAT=60
    # Select a cpu frequency scaling governor: ondemand/powersave/performance/conservative
    # Important:
    # - You *must* disable your distribution's governor settings or conflicts will occur
    # - ondemand is sufficient for *almost all* workloads, you should know what you're doing!
    #CPU_SCALING_GOVERNOR_ON_AC=ondemand
    #CPU_SCALING_GOVERNOR_ON_BAT=ondemand
    # Set the min/max frequency available for the scaling governor.
    # Possible values strongly depend on your cpu. For available frequencies see
    # tlp-stat output, Section "+++ Processor".
    # Hint: Parameters are disabled by default, remove the leading # to enable them,
    # otherwise kernel default values are used.
    #CPU_SCALING_MIN_FREQ_ON_AC=0
    #CPU_SCALING_MAX_FREQ_ON_AC=0
    #CPU_SCALING_MIN_FREQ_ON_BAT=0
    #CPU_SCALING_MAX_FREQ_ON_BAT=0
    # Set the cpu "turbo boost" feature: 0=disable / 1=allow
    # Requires an Intel Core i processor and kernel 3.7 or later.
    # Important:
    # - This may conflict with your distribution's governor settings
    # - A value of 1 does *not* activate boosting, it just allows it
    #CPU_BOOST_ON_AC=1
    #CPU_BOOST_ON_BAT=0
    # Minimize number of used cpu cores/hyper-threads under light load conditions
    SCHED_POWERSAVE_ON_AC=0
    SCHED_POWERSAVE_ON_BAT=1
    # Kernel NMI Watchdog
    # 0=disable (default, saves power) / 1=enable (for kernel debugging only)
    NMI_WATCHDOG=0
    # Change CPU voltages aka "undervolting" - Kernel with PHC patch required
    # Freq:voltage pairs are written to /sys/devices/system/cpu/cpu0/cpufreq/phc_controls
    # CAUTION: only use this, if you thoroughly understand what you are doing!
    #PHC_CONTROLS="F:V F:V F:V F:V"
    # Hard disk devices, separate multiple devices with spaces (default: sda).
    # Devices can be specified by disk id too (lookup with: tlp diskid).
    DISK_DEVICES="sda sdb"
    # Hard disk advanced power management level: 1(max saving)..254(off)
    # Levels 1..127 may spin down the disk.
    # Separate values for multiple devices with spaces.
    DISK_APM_LEVEL_ON_AC="254 254"
    DISK_APM_LEVEL_ON_BAT="128 128"
    # Hard disk spin down timeout:
    # 0: spin down disabled
    # 1..240: timeouts from 5s to 20min (in units of 5s)
    # 241..251: timeouts from 30min to 5.5 hours (in units of 30min)
    # (see 'man hdparm' for details)
    #DISK_SPINDOWN_TIMEOUT_ON_AC="0 0"
    #DISK_SPINDOWN_TIMEOUT_ON_BAT="0 0"
    # Select io scheduler for the disk devices: noop/deadline/cfq (Default: cfq)
    # Separate values for multiple devices with spaces.
    #DISK_IOSCHED="cfq cfq"
    # SATA aggressive link power management (ALPM):
    # min_power/medium_power/max_performance
    SATA_LINKPWR_ON_AC=max_performance
    SATA_LINKPWR_ON_BAT=min_power
    # PCI Express Active State Power Management (PCIe ASPM):
    # default/performance/powersave
    # Hint: needs kernel boot option pcie_aspm=force on some machines
    PCIE_ASPM_ON_AC=performance
    PCIE_ASPM_ON_BAT=powersave
    # Radeon graphics clock speed (profile method): low/mid/high/auto/default
    # auto = mid on BAT, high on AC; default = use hardware defaults
    # (Kernel >= 2.6.35 only, not with fglrx driver!)
    RADEON_POWER_PROFILE_ON_AC=high
    RADEON_POWER_PROFILE_ON_BAT=low
    # WiFi power saving mode: 1=disable/5=enable
    # (Linux 2.6.32 and later, some adapters only!)
    WIFI_PWR_ON_AC=1
    WIFI_PWR_ON_BAT=5
    # Disable wake on lan: Y/N
    WOL_DISABLE=Y
    # Enable audio power saving for Intel HDA, AC97 devices (timeout in secs).
    # A value of 0 disables / >=1 enables power save.
    SOUND_POWER_SAVE=1
    # Disable controller too (HDA only): Y/N
    SOUND_POWER_SAVE_CONTROLLER=Y
    # Set to 1 to power off optical drive in UltraBay (ThinkPads only)
    # when running on battery. A value of 0 disables this Feature (Default).
    # Drive can be powered on again by releasing (and reinserting) the
    # eject lever or by pressing the disc eject button on newer models.
    # Note: an UltraBay hard disk is never powered off.
    BAY_POWEROFF_ON_BAT=0
    # Optical drive device to power off (default sr0)
    BAY_DEVICE="sr0"
    # Runtime Power Management for pci(e) bus devices
    # (Kernel >= 2.6.35 only): on=disable/auto=enable
    RUNTIME_PM_ON_AC=on
    RUNTIME_PM_ON_BAT=auto
    # Runtime PM for *all* pci(e) bus devices: 0=disable / 1=enable
    # Warning: experimental option, could cause system instabilities
    RUNTIME_PM_ALL=0
    # Set to 0 to disable/1 to enable usb autosuspend feature
    USB_AUTOSUSPEND=1
    # Devices from the following list are excluded from usb autosuspend
    # (separate with spaces). Use lsusb to get the id's.
    # Note: input devices (usbhid) are excluded automatically
    #USB_BLACKLIST="1111:2222 3333:4444"
    # Set to 1 to disable autosuspend before shutdown/0 to do nothing
    # (workaround for usb devices that cause shutdown problems)
    #USB_AUTOSUSPEND_DISABLE_ON_SHUTDOWN=1
    # Restore radio device state (bluetooth, wifi, wwan) from previous shutdown
    # on system startup: 0=disable/1=enable
    # Hint: the parameters DEVICES_TO_DISABLE/ENABLE_ON_STARTUP/SHUTDOWN below
    # are ignored when this is enabled!
    RESTORE_DEVICE_STATE_ON_STARTUP=0
    # Radio devices to disable on startup: bluetooth wifi wwan
    #DEVICES_TO_DISABLE_ON_STARTUP="bluetooth wifi wwan"
    # Radio devices to enable on startup: bluetooth wifi wwan
    #DEVICES_TO_ENABLE_ON_STARTUP="wifi"
    # Radio devices to disable on shutdown: bluetooth wifi wwan
    # (workaround for devices that are blocking shutdown)
    #DEVICES_TO_DISABLE_ON_SHUTDOWN="bluetooth wifi wwan"
    # Radio devices to enable on shutdown: bluetooth wifi wwan
    # (to prevent other operating systems from missing radios)
    #DEVICES_TO_ENABLE_ON_SHUTDOWN="wwan"
    # Radio devices to enable when wireless radio switch is turned on:
    # bluetooth wifi wwan (Ubuntu + ThinkPad only)
    #DEVICES_TO_ENABLE_ON_RADIOSW="wifi wwan"
    # Battery charge thresholds (ThinkPad only, tp-smapi or acpi-call kernel module required)
    # Charging starts when the remaining capacity falls below the START_CHARGE_TRESH
    # value and stops when exceeding the STOP_CHARGE_TRESH value.
    # Main battery (values in %)
    #START_CHARGE_THRESH_BAT0=75
    #STOP_CHARGE_THRESH_BAT0=80
    # Ultrabay or slice battery (values in %)
    #START_CHARGE_THRESH_BAT1=75
    #STOP_CHARGE_THRESH_BAT1=80
    # Set to 1 to disable use of tpacpi-bat on Sandy Bridge or newer Thinkpads
    # and force usage of tp-smapi instead
    #DISABLE_TPACPIBAT=1
    # tlp-rdw - Parameters for the radio device wizard
    # Possible devices: bluetooth/wifi/wwan
    # Hint: parameters are disabled by default, remove the leading # to enable them
    # Radio devices to disable on connect
    DEVICES_TO_DISABLE_ON_LAN_CONNECT="wifi wwan"
    DEVICES_TO_DISABLE_ON_WIFI_CONNECT="wwan"
    DEVICES_TO_DISABLE_ON_WWAN_CONNECT="wifi"
    # Radio devices to enable on disconnect
    DEVICES_TO_ENABLE_ON_LAN_DISCONNECT="wifi wwan"
    #DEVICES_TO_ENABLE_ON_WIFI_DISCONNECT=""
    #DEVICES_TO_ENABLE_ON_WWAN_DISCONNECT=""
    # Radio devices to enable/disable when docked
    #DEVICES_TO_ENABLE_ON_DOCK=""
    #DEVICES_TO_DISABLE_ON_DOCK=""
    # Radio devices to enable/disable when undocked
    #DEVICES_TO_ENABLE_ON_UNDOCK="wifi"
    #DEVICES_TO_DISABLE_ON_UNDOCK=""
    thanks guys
    I love arch
    Last edited by beitme (2013-06-08 10:05:37)

    @ Karol, done
    @ 65kid, here's my logind.conf
    [Login]
    #NAutoVTs=6
    #ReserveVT=6
    #KillUserProcesses=no
    #KillOnlyUsers=
    #KillExcludeUsers=root
    #Controllers=
    #ResetControllers=cpu
    #InhibitDelayMaxSec=5
    #HandlePowerKey=poweroff
    #HandleSuspendKey=suspend
    #HandleHibernateKey=hibernate
    #HandleLidSwitch=ignore
    #PowerKeyIgnoreInhibited=no
    #SuspendKeyIgnoreInhibited=no
    #HibernateKeyIgnoreInhibited=no
    #LidSwitchIgnoreInhibited=yes
    #IdleAction=ignore
    #IdleActionSec=30min

  • How to hide tray icon when in jframe

    how to hide the tray icon when v display a new JFrame in jdk1.5?

    use a JWindow or JDialog, but you may come across other problems if using
    them without a parent (the parent will be the one in the task bar)

  • How to disable some color when printing separations in Ai CS6-CC (JS)

    Hello Everyone!
    Configuration: Win 7 Pro x64, Illustrator CS6x64-CCx64, default printer PDF.
    When printing separations from Illustrator CS4 following script prints all colors except Cyan (as was intended).
    But when printing from CS6-SS disable the color is not possible - all colors are printed without exception.
    var adoc = activeDocument;
    var o = new PrintOptions();
    o.colorSeparationOptions = new PrintColorSeparationOptions();
    o.colorSeparationOptions.colorSeparationMode = PrintColorSeparationMode.HOSTBASEDSEPARATION;
    o.colorSeparationOptions.inkList = adoc.inkList;
    for (var i = 0; i < o.colorSeparationOptions.inkList.length; i++) {
    if (o.colorSeparationOptions.inkList[i].name == 'Process Cyan') {
      o.colorSeparationOptions.inkList[i].inkInfo.printingStatus = InkPrintStatus.DISABLEINK;
    adoc.print(o);
    If you check, you have inkInfo.printingStatus Cyan changed to "InkPrintStatus.DISABLEINK".
    Why it is printed and how to disable?
    Thanks!

    Hi saaiful,
    Thank you for posting your question. window. will print header and footer.
    Here are some solutions I found after researching your issue:
    *[http://forums.mozillazine.org/viewtopic.php?f=12&t=216810]
    *[http://stackoverflow.com/questions/8228088/remove-header-and-footer-from-window-print]
    *[http://www.dreamincode.net/forums/topic/22598-using-windowprint-without-printing-header-and-footer/]
    *take a screenshot and create a page that is printable [http://www.webdeveloper.com/forum/showthread.php?210947-Using-window-print-without-printing-header-and-footer]
    *Target to another window then print: [http://www.liferay.com/community/forums/-/message_boards/view_message/3401817]
    Hope this helps.

  • How to display a popup when closing a sales order form

    Hi Team,
    I need to display a popup when a user tries to close a sales order. Can anyone please let me know if we can do it through personalization or custom.pll.
    Thanks,
    Vikash S.

    When we close order form with out saving , a pop up shows to save or not, try to check that how closing event is being captured.

  • How to activate save session when closing multiple tabs?

    i've opened many tabs that i want. When I close Firefox there are many tabs. Those tabs have to be restored when i open again Firefox. how to activate in firefox 4.o. In firefox 3.6 it is asking defaultly to save sessions.

    In Firefox 4 you can always restore the previous session via Firefox > History > Restore Previous Session
    You can set the warn prefs on the about:config page to true via the right-click context menu or toggle with a double left-click.
    * browser.showQuitWarning, see http://blog.zpao.com/post/3174360617/about-that-quit-dialog
    * browser.tabs.warnOnClose, see http://kb.mozillazine.org/About%3Aconfig_entries
    * browser.warnOnQuit , see http://kb.mozillazine.org/browser.warnOnQuit
    * browser.warnOnRestart , see http://kb.mozillazine.org/browser.warnOnRestart
    To open the <i>about:config</i> page, type <b>about:config</b> in the location (address) bar and press the "<i>Enter</i>" key, just like you type the url of a website to open a website.<br />
    If you see a warning then you can confirm that you want to access that page.<br />
    * http://kb.mozillazine.org/about%3Aconfig

  • How to prevent saving edits when closing Adobe

    I have several blank forms saved on my tablet and I need to use the same blank form for different jobs. Every time I fill the form it gets automatically saved and I no longer have my original blank form.
    Is there a way to disable this feature.
    Thank You

    Adobe Reader for iOS automatically saves any changes to a currently viewed PDF document when you close the document by going back to the home screen (showing the file browser).  There is no preference or option to disable/turn off the "Auto Save" feature.
    You can make a copy of your blank form before you open it.
    In the home screen, tap Documents.
    Long press (press & hold) the document that you want to make a copy of.
    Tap the overflow icon (with small three squares) in the upper right corner.
    Tap Duplicate.
    Open the newly duplicated PDF document (instead of the original one).

  • How do i save pointeers to opened web sites when closing down to reboot, sometimes a dialogue box asks this , sometimes it warns that to continue will loose the settings thanks?

    simple question: when closing ff by clicking on the X upper rh corner sometimes diialogue box warns 'you are about to close tabs'.
    other times it asks 'do you wish to save tabs'. Why is this? how do i save tabs when closing browser in order to reboot etc

    Do you organise your email into separate folders, or do you just let it accumulate in the Inbox?
    I would strongly advise you not to let it sit in the Inbox.
    When you see this happening, try right-click on the affected folder, select '''Properties''' then '''Repair Folder'''.
    Large folders (actually, a folder in Thunderbird is stored as a file, so it is sensitive to file size limits set by the underlying file system) can be problematic. This is one reason not to let messages collect in one folder. I use Thunderbird's Archive folders so that accumulated mails over several years can happily coexist because they are effectively stored in many small folders. No single mail store folder then exceeds the 2GB or 4GB sizes that have been known to stress the OS. I appreciate that current builds of Thunderbird and a modern 64-bit OS should be able to cope, but practically I find it slows down when given huge files, so I err towards a pragmatic solution; a large number of not very big files.
    Archives are searchable, and a Saved Search folder can give you a virtual composite folder allowing access to the entire Archive.

  • When closing and reopening, my tabs aren't restoring like the once did. My history is only keeping one day. Need to know how to change these settings.

    When closing and reopening Firefox, my tabs aren't restoring like they once did. I used to have all my tabs restore each time I opened Firefox. Now it starts with one fresh new tab and all my others are lost. I do a lot of research so this is important.
    My history is only displaying one day even though I have never changed my settings even after I updated it last year.
    Need to know how to restore these settings.
    ***OH! special note: I can't use the recently closed tabs or recently closed windows because its a grayed out option****

    Are you using cleanup software like CCleaner?
    If you use [[Clear Recent History]] to clear the 'Browsing History' when you close Firefox then restoring tabs from the last session ("Save & Quit" or "Show my windows and tabs from last time") doesn't work.
    * http://kb.mozillazine.org/Session_Restore
    There are other things that need attention:
    Your above posted system details show outdated plugin(s) with known security and stability risks that you should update.
    *Java Plug-in 1.6.0_05 for Netscape Navigator (DLL Helper)
    Update the [[Java]] plugin to the latest version.
    *http://www.oracle.com/technetwork/java/javase/downloads/index.html (Java Platform: Download JRE)

  • How to add one component when some action take place

    Hi,
    i created a GUI using Netbeans Ide, In that i want add a component when i click some button
    i showed it here see the diagram
    [click here to see|http://www.mediafire.com/imageview.php?quickkey=jtgzjrfenwm]
    my sample code
    public class ProcessFiles1 extends javax.swing.JFrame implements ActionListener,
                                                        PropertyChangeListener{
        private JProgressBar progressBar;
        / Creates new form ProcessFiles1 */*
    *    public ProcessFiles1() {*
    *        initComponents();*
    *    /** This method is called from within the constructor to
    *initialize the form.*
    WARNING: Do NOT modify this code. The content of this method is
    *always regenerated by the Form Editor.*
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">
        private void initComponents() {====================================>here i am not adding Progress bar
                                                                                                                             to GUI
            jToggleButton1 = new javax.swing.JToggleButton();
            jToggleButton2 = new javax.swing.JToggleButton();
            jComboBox1 = new javax.swing.JComboBox();
            jLabel1 = new javax.swing.JLabel();
            jLabel2 = new javax.swing.JLabel();
            jComboBox2 = new javax.swing.JComboBox();
            jScrollPane1 = new javax.swing.JScrollPane();
            jTextArea1 = new javax.swing.JTextArea();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setTitle("Admin@localhost");
            setIconImage(Toolkit.getDefaultToolkit().getImage("c:\\Logo.PNG"));
            jToggleButton1.setText("Select File");
            jToggleButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    FileChooser(evt);
            jToggleButton2.setText("Run Files");
            jToggleButton2.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    addComp(evt);
            jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
            jComboBox1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jComboBox1ActionPerformed(evt);
            jLabel1.setText("Success");
            jLabel2.setText("Faild");
            progressBar = new JProgressBar(0, 100);
            progressBar.setValue(0);
            progressBar.setStringPainted(true);
            jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
            jTextArea1.setColumns(20);
            jTextArea1.setEditable(false);
            jTextArea1.setRows(5);
            jScrollPane1.setViewportView(jTextArea1);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());=================>from here i am adding components
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(26, 26, 26)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 965, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(layout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(jToggleButton1)
                            .addGap(18, 18, 18)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jToggleButton2)
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(jLabel1)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(32, 32, 32)
                                    .addComponent(jLabel2)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                    .addContainerGap(29, Short.MAX_VALUE))
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jToggleButton1)
                        .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel1)
                        .addComponent(jLabel2)
                        .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(26, 26, 26)
                    .addComponent(jToggleButton2)
                    .addGap(18, 18, 18)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 583, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(20, Short.MAX_VALUE))
            pack();
        }// </editor-fold>
    private void addComp(java.awt.event.ActionEvent evt)---------------------------------------->when 'runfile' button clicked i am
                                                                                      trying to add progressbar component it is not adding
           layout.addLayoutComponent("Progress", progressBar);
           pack();
         }how can i add progressbar when runfile button clicked
    please any one focus some light on this
    Thanks in advance,
    Nagaraju.
    Edited by: uppala on Dec 18, 2009 11:33 AM

    Well, normally the code would be:
    panel.add( someComponent );
    panel.revalidate();But since you are using the IDE to generate your code you need to learn and understand how to use the GroupLayout and all its constraints to add the component.
    My advice is to get rid of the IDE generate code and create the GUI yourself.

Maybe you are looking for

  • Error in a process chain

    Hello, i have included one APD in a process chain. If i execute APD manually the data is getting updated in the ODS. But if i include APD in a process chain then it throws an error that You are not authorized to execute this analysis process. Can any

  • Changing the background? (Keynote for iPad)

    Hi! I can't seem to figure out how to change the slide background/theme for the overall presentation. Is this feature unavailable on the iPad version? Thanks! Chela

  • I'm new to RAW. What do I do next?

    Hi everyone. I am new to Aperture and RAW files. I always used the jpeg format on my camera and now I'm experimenting with the RAW format. As expected I love the way the RAW files look. After importing the files into Aperture, and making my adjustmen

  • Forms - Can't set a required field to visible=false

    Hi, I want to set a required field to visible=false but OIM 9.1 gives an error saying it is not possible. Has anyone overcome this issue? Thanks in advance

  • 8 char limit when describing metadata

    I realize this is the wrong area...but i didnt see a relevant section... im trying to do an implicit describe of the column names of the return set from a SQL query... using OCIParamGet() within the context of a statment handle, and then OCIGetAttr o