Swing program getting slower

Hi
I have done a simple program.It shows a JCombobox on a panel.JComboBox contained 3 String (Back,Search,GetaAll).I have addeed a addActionListener(this) to the JComboBox)
It works fine at first.When I click Back again and again its going alower and slower.After doing 20 times like this.it remains at constant stage.The CPU Usage increases continiously.and remains 100 finally.At that time my program remains in a perticular page.
My source code is given below.
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ComboBoxEditor;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class ActWithComBox extends JFrame implements ActionListener {
     JPanel jpanel ;
     JLabel label = new JLabel("Wellcom to callBack");
     JLabel label1 = new JLabel("Wellcom to Search");
     JButton button = new JButton("Back");
     JButton button1 = new JButton("Back");
     String[] item = {"Options","Back","Search","Get All"};
     JComboBox jcomboBox = new JComboBox(item);
     public ActWithComBox() {
          super();
          jpanel = new JPanel();
          jbInit();
     private void jbInit() {
          jpanel.removeAll();
          setContentPane(jpanel);
     jpanel.setLayout(null);
          jpanel.setBackground(Color.BLUE);
          jcomboBox.setBounds(150,240,100,30);
          jcomboBox.addActionListener(this);
          jpanel.add(jcomboBox);
          //jpanel.setVisible(true);
          //jcomboBox.setVisible(true);
     public void actionPerformed(ActionEvent e) {
          if(e.getSource() == button){
               jbInit();
               return ;
          }else if(e.getSource() == button1){
               jbInit();
               return;
          jcomboBox = (JComboBox)e.getSource();
          if(jcomboBox.getSelectedItem() == "Back"){
               callBack();
          }else if(jcomboBox.getSelectedItem() == "Search"){
               callSearch();
          }else if(jcomboBox.getSelectedItem() == "Get All"){
               System.out.println("inside Get All");
     private void callSearch() {
          jpanel.removeAll();
          jpanel.setLayout(null);
          jpanel.setBackground(Color.RED);
          label1.setBounds(10,10,200,30);
          label1.setForeground(Color.GREEN);
          button1.setBounds(50,50,100,50);
          button1.addActionListener(this);
          jpanel.add(label1);
          jpanel.add(button1);
          //jpanel.setVisible(true);
     private void callBack() {
          jpanel.removeAll();
          jpanel.setLayout(null);
          jpanel.setBackground(Color.BLACK);
          label.setBounds(10,10,200,30);
          label.setForeground(Color.RED);
          button.setBounds(50,50,100,50);
          button.addActionListener(this);
          jpanel.add(label);
          jpanel.add(button);
          //jpanel.setVisible(true);
     public static void main(String[] b){
          ActWithComBox act = new ActWithComBox();
          act.setSize(300,300);
          act.setVisible(true);
please reply me soon.
Excuse for my english.
Thanks..
Chagulu

Use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags when posting source code.
It looks to me like the actionListener is added to you button every time you click the comboBox. So your actionPerformed code executes 1, then 2, then 3, ....then xxx times.

Similar Messages

  • Problem with Ai when working with a logo (the program gets slow & I can´t move the logo easily)

    Hi there, Hope everyone is well. I have troubles with my Ai when working with a logo, I just want to move it from one point to another and it gets pretty slow to be moved. I am working on a brand new iMac and this problem surprises me a little bit. Do you know why is this happening? I get de Ai from the Creative Cloud...could it be the internet?

    Can you please show a screenshot?
    Are there any placed raster images in your file? Are there any raster effects in your logo file? What are your Effect > Document Raster Effects Settings... ? Also, what are your Preferences > Scratch Disks settings, and how much free space do you have on that (those) drive(s)?
    I doubt it's the internet, unless you're also synching at the same time ... and while this is taking place your internet connection is super-slow.

  • My Macbook Pro 10.6.8 is getting slow... What can I do to find out which program could be the problem?

    My Macbook is getting slow. I also hear the harddisk running.
    I would like to know which program is eating capacity... Is there an application that could tell me?

    space nbrs:
    in use: 119,39 GB
    available: 200,34
    CPU:
    kernel_task root 4,3%   but changes in 1,1 and back
    DashboardClient 4%     also changes in 1,1 and back
    fysical mem:
    kernel 380 MB
    Safari 312,9 MB
    better I provide this:
    Analysis of sampling syslogd (pid 14) every 1 millisecond
    Process:         syslogd [14]
    Path:            /usr/sbin/syslogd
    Load Address:    0x100000000
    Identifier:      syslogd
    Version:         ??? (???)
    Code Type:       X86-64 (Native)
    Parent Process:  launchd [1]
    Date/Time:       2011-08-21 20:27:25.673 +0200
    OS Version:      Mac OS X 10.6.8 (10K549)
    Report Version:  6
    Call graph:
        2691 Thread_206   DispatchQueue_1: com.apple.main-thread  (serial)
          2691 0x10000098c
            2691 0x10000f850
              2691 select$DARWIN_EXTSN
        2691 Thread_208
          2691 thread_start
            2691 _pthread_start
              2691 0x10000b0e4
                2691 mach_msg
                  2691 mach_msg_trap
        2691 Thread_209
          2691 thread_start
            2691 _pthread_start
              2691 0x10000b55d
                2691 0x100009006
                  2691 _pthread_cond_wait
                    2691 __semwait_signal
        2691 Thread_210
          2691 thread_start
            2691 _pthread_start
              2691 0x100008c61
                2691 _vprocmgr_log_drain
                  2691 vproc_mig_log_drain
                    2691 mach_msg
                      2691 mach_msg_trap
    Total number in stack (recursive counted multiple, when >=5):
    Sort by top of stack, same collapsed (when >= 5):
            mach_msg_trap        5382
            __semwait_signal        2691
            select$DARWIN_EXTSN        2691
    Binary Images:
           0x100000000 -        0x100013fff +syslogd ??? (???) <294E71C5-F936-2D72-B70F-01399F9DFB3E> /usr/sbin/syslogd
        0x7fff5fc00000 -     0x7fff5fc3bdef  dyld 132.1 (???) <B536F2F1-9DF1-3B6C-1C2C-9075EA219A06> /usr/lib/dyld
        0x7fff827c1000 -     0x7fff827c5ff7  libmathCommon.A.dylib 315.0.0 (compatibility 1.0.0) <95718673-FEEE-B6ED-B127-BCDBDB60D4E5> /usr/lib/system/libmathCommon.A.dylib
        0x7fff836cd000 -     0x7fff8388efef  libSystem.B.dylib 125.2.11 (compatibility 1.0.0) <9AB4F1D1-89DC-0E8A-DC8E-A4FE4D69DB69> /usr/lib/libSystem.B.dylib
        0x7fff8a154000 -     0x7fff8a16afef  libbsm.0.dylib ??? (???) <42D3023A-A1F7-4121-6417-FCC6B51B3E90> /usr/lib/libbsm.0.dylib
        0x7fffffe00000 -     0x7fffffe01fff  libSystem.B.dylib ??? (???) <9AB4F1D1-89DC-0E8A-DC8E-A4FE4D69DB69> /usr/lib/libSystem.B.dylib

  • Keyboard-lock of swing program on Linux box

    We are developing swing program on Linux, and we often meet keyboard-lock issues.
    I try to simplify some of them to small programs, and still meet keyboard-lock.
    Here I post two programs to show the error:
    //---first ----------------------------------------------
    package test;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
    public class KeyLock extends JFrame {
      JPanel contentPanel = new JPanel();
      JPanel wizardToolPan = new JPanel();
      JButton btnBack = new JButton("Back");
      JButton btnNext = new JButton("Next");
      JButton btnAbout = new JButton("About");
      public static final String aboutMsg =
              "<html>  This program will help to find keyboard lock problems, two way to reproduce:<br><br>" +
              "1 - press Alt+N to navigate next, and don't release keys untill there are no more next page, <br>" +
              "then try Alt+B to navigate back and also don't release keys untill page 0,<br>" +
              "repeat Alt+N and Alt+B again and again, keyboard will be locked during navigating. <br><br>" +
              "2 - press Alt+A in main window, it will popup an about dialog,<br>" +
              "then press down space key and don't release, <br>" +
              "the about dialog will be closed and opened again and again,<br>" +
              "keyboard will be locked sooner or later." +
              "</html>";
      public KeyLock() {
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        this.setTitle("Keyboard lock test");
        getContentPane().setLayout(new BorderLayout());
        btnBack.setMnemonic('B');
        btnBack.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            KeyLock.this.goBack(e);
        btnNext.setMnemonic('N');
        btnNext.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            KeyLock.this.goNext(e);
        btnAbout.setMnemonic('A');
        btnAbout.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JOptionPane.showMessageDialog(KeyLock.this, aboutMsg, "About", JOptionPane.INFORMATION_MESSAGE);
        contentPanel.setLayout(new BorderLayout());
        contentPanel.setPreferredSize(new Dimension(400, 250));
        contentPanel.setMinimumSize(new Dimension(400, 250));
        wizardToolPan.setLayout(new FlowLayout());
        wizardToolPan.add(btnBack);
        wizardToolPan.add(btnNext);
        wizardToolPan.add(btnAbout);
        this.getContentPane().add(contentPanel, java.awt.BorderLayout.CENTER);
        this.getContentPane().add(wizardToolPan, java.awt.BorderLayout.SOUTH);
        this.setSize(400, 300);
        this.createContentPanels();
        this.showCurrent();
      private Vector<JPanel> slides = new Vector<JPanel>();
      private int current = 0;
      private void createContentPanels() {
        for (int j = 0; j < 20; ++j) {
          JPanel p = new JPanel(new FlowLayout());
          p.add(new JLabel("Page: " + j));
          p.add(new JTextField("Page: " + j + ", input something here", 20));
          p.add(new JTextField("Page: " + j + ", input something here", 20));
          p.add(new JTextField("Page: " + j + ", input something here", 20));
          p.add(new JLabel("Input something in password box:"));
          p.add(new JPasswordField(20));
          p.add(new JCheckBox("Try click here, focus will be here."));
          p.add(new JRadioButton("Try click here, focus will be here."));
          slides.add(p);
      public void showCurrent() {
        if (current < 0 || current >= slides.size())
          return;
        JPanel p = slides.get(current);
        this.contentPanel.add(p, java.awt.BorderLayout.CENTER);
        this.pack();
        Component[] comps = p.getComponents();
        if (comps.length > 0) {
          comps[0].requestFocus(); // try delete this line
        this.repaint();
      public void goNext(ActionEvent e) {
        if (current + 1 >= slides.size())
          return;
        this.contentPanel.remove(slides.get(current));
        current++;
        sleep(100);
        this.showCurrent();
      public void goBack(ActionEvent e) {
        if (current <= 0)
          return;
        this.contentPanel.remove(slides.get(current));
        current--;
        sleep(100);
        this.showCurrent();
      public static void sleep(int millis) {
        try {
          Thread.sleep(millis);
        } catch (Exception e) {
          e.printStackTrace();
      public static void main(String[] args) {
        KeyLock wizard = new KeyLock();
        wizard.setVisible(true);
    }The first program will lead to keyboard-lock in RHEL 4 and red flag 5, both J2SE 5 and 6.
    //---second -----------------------------------------
    package test;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class KeyFocusLost extends JFrame {
      private JButton btnPopup = new JButton();
      private JTextField jTextField1 = new JTextField();
      private JPasswordField jPasswordField1 = new JPasswordField();
      private JPanel jPanel1 = new JPanel();
      private JScrollPane jScrollPane3 = new JScrollPane();
      private JTree jTree1 = new JTree();
      private JButton btnAbout = new JButton("About");
      public static final String aboutMsg =
              "<html>  This program is used to find keyboard focus lost problem.<br>" +
              "Click 'popup' button in main window, or select any node in the tree and press F6,<br>" +
              "a dialog popup, and click ok button in the dialog,<br>" +
              "keyboard focus will lost in main window." +
              "</html>";
      public KeyFocusLost() {
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        this.setTitle("Keyboard focus test");
        getContentPane().setLayout(null);
        btnPopup.setBounds(new Rectangle(33, 482, 200, 35));
        btnPopup.setMnemonic('P');
        btnPopup.setText("Popup and lost focus");
        btnPopup.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            PopupDialog dlg = new PopupDialog(KeyFocusLost.this);
            dlg.setVisible(true);
        btnAbout.setBounds(new Rectangle(250, 482, 100, 35));
        btnAbout.setMnemonic('A');
        btnAbout.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JOptionPane.showMessageDialog(KeyFocusLost.this, aboutMsg, "About", JOptionPane.INFORMATION_MESSAGE);
        jTextField1.setText("Try input here, and try input in password box below");
        jTextField1.setBounds(new Rectangle(14, 44, 319, 29));
        jPasswordField1.setBounds(new Rectangle(14, 96, 319, 29));
        jPanel1.setBounds(new Rectangle(14, 158, 287, 291));
        jPanel1.setLayout(new BorderLayout());
        jPanel1.add(new JLabel("Select any node in the tree and press F6."), java.awt.BorderLayout.NORTH);
        jPanel1.add(jScrollPane3, java.awt.BorderLayout.CENTER);
        jScrollPane3.getViewport().add(jTree1);
        Object actionKey = "popup";
        jTree1.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_F6, 0), actionKey);
        jTree1.getActionMap().put(actionKey, new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            PopupDialog dlg = new PopupDialog(KeyFocusLost.this);
            dlg.setVisible(true);
        this.getContentPane().add(jTextField1);
        this.getContentPane().add(jPasswordField1);
        this.getContentPane().add(jPanel1);
        this.getContentPane().add(btnPopup);
        this.getContentPane().add(btnAbout);
      public static void main(String[] args) {
        KeyFocusLost keytest = new KeyFocusLost();
        keytest.setSize(400, 600);
        keytest.setVisible(true);
      static class PopupDialog extends JDialog {
        private JButton btnOk = new JButton();
        public PopupDialog(Frame owner) {
          super(owner, "popup dialog", true);
          setDefaultCloseOperation(DISPOSE_ON_CLOSE);
          this.getContentPane().setLayout(null);
          btnOk.setBounds(new Rectangle(100, 100, 200, 25));
          btnOk.setMnemonic('O');
          btnOk.setText("OK, then focus lost");
          btnOk.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              PopupDialog.this.getOwner().toFront();
              try {
                Thread.sleep(100); // try delete this line !!!
              } catch (Exception ex) {
                ex.printStackTrace();
              PopupDialog.this.dispose();
          this.getContentPane().add(btnOk);
          this.getRootPane().setDefaultButton(btnOk);
          this.setSize(400, 300);
    }The second program will lead to keyboard-focus-lost in RHEL 3/4 and red flag 4/5, J2SE 5, not in J2SE 6.
    And I also tried java demo program "SwingSet2" in red flag 5, met keyboard-lock too.
    I guess it should be some kind of incompatibleness of J2SE with some Linux platform. Isn't it?
    Please help, thanks.

    Hi.
    I have same problems on Ubuntu with Java 6 (all versions). I would like to use NetBeans or IntelliJ IDEA but it is not possible due to keyboard locks.
    I posted this bug
    https://bugs.launchpad.net/ubuntu/+bug/174281
    before I found some info about it:
    http://forums.java.net/jive/thread.jspa?messageID=189281
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6506617
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6568693
    I don't know from which part this bug comes, but I wonder why it isn't fixed yet. Does anybody else use NetBeans or IntelliJ IDEA on linux with Java 6 ?
    (I cannot insert link :\ )

  • Running a Swing program from another program

    I'm having what is most likely newbie problems since I'm relatively new to Swing programming. Basically my situation is this: I've got a program that looks at its command line parameters and either runs through a series of actions or presents a Swing GUI to allow the user to step through the actions one by one.
    My problem is that I bascially don't know how to call (instantiate, declare, etc.) the GUI from my Java code. I tried implementing the GUI class with a runnable interface, but evertime I try to invoke the start on the interface I'm getting an error. I have a feeling I'm just missing something. The Swing GUI works fine if I call it on its own so it's the code the invokes it from the small command line processor that I'm goofing up somehow.
    So to recap, I have a small Java app that I'm trying to call a GUI that I've built and can't seem to get the code right.
    Any pointers to examples or explanation on how to accomplish the above are welcome.
    Thanks,
    Ed

    That the "2" is printed out immediately is as expected, but I don't understand why the JVM exits. The following is, AFAIK, a trimmed down version of what you are doing, and if you run it you'll see that the frame remains until you close it manually:
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    public class ShowFrame {
        public static void main(String[] args) {
            AppFrame gui = new AppFrame();
            gui.run();
        private static class AppFrame extends JFrame implements Runnable {
            public AppFrame() {
                setDefaultCloseOperation(EXIT_ON_CLOSE);
                JButton btn = new JButton("Close");
                btn.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        AppFrame.this.dispose();
                getContentPane().add(btn);
                pack();
                setLocationRelativeTo(null);
            public void run() {
                System.out.println("1");
                this.setVisible(true);
                System.out.println("2");
    }Maybe someone else can shed some light over your problem...

  • BTV getting slower and s l o w e r and s l o ...

    Hi,
    With every upgrade my Silver BTV is getting slower. I used to occasionally get the "Recorded TV is working. Please try later" every now and again, but now I get it almost every time I set up a recording or delete something. I think my record for this to be on the screen is over 20 seconds but 5 - 10 seconds is quite normal. I have done a soft reboot (and obviously BTV decides to do its own really annoying reboot around 7 am some mornings when I want to be able to rewind live BBC Breakfast to 6 am- WHY DOES IT DO THIS?) . This does not help but it least it fixes the other extremely annoying bug where it thinks it is running out of disk space and starts deleting programs when it really has no need to!!!
    Ta, Andy.

    The box does not reboot itself at 7am every day at the behest of BT that is not normal behaviour.
    I think you really ought to fo  a hard reset and clear everything off your hard drive and see if it solves your problem.
    If it does not then you are I think looking at a slowly dying box which needs to be replaced.
    Factory Reset
    Switch off the Vision+ box at the mains socket
    Hold down the front panel OK and down arrow buttons
    Switch on the power to the Vision+ box
    Allow the box to start up (about 15 seconds)
    Release the OK and down arrow buttons
    The Vision+ box will then contact the servers to get a new copy of its firmware
    This will take around 30 minutes
    Life | 1967 Plus Radio | 1000 Classical Hits | Kafka's World
    Someone Solved Your Question?
    Please let other members know by clicking on ’Mark as Accepted Solution’
    Helpful Post?
    If a post has been helpful, say thanks by clicking the ratings star.

  • Mid 2007 imac is getting slower

    seems to be getting slower ... lot of waiting between entries

    1. This procedure is a diagnostic test. It changes nothing, for better or worse, and therefore will not, in itself, solve your problem.
    2. If you don't already have a current backup, back up all data before doing anything else. The backup is necessary on general principle, not because of anything in the test procedure. There are ways to back up a computer that isn't fully functional. Ask if you need guidance.
    3. Below are instructions to run a UNIX shell script, a type of program. All it does is to gather information about the state of your computer. That information goes nowhere unless you choose to share it on this page. However, you should be cautious about running any kind of program (not just a shell script) at the request of a stranger on a public message board. If you have doubts, search this site for other discussions in which this procedure has been followed without any report of ill effects. If you can't satisfy yourself that the instructions are safe, don't follow them.
    Here's a summary of what you need to do, if you choose to proceed: Copy a line of text from this web page into the window of another application. Wait for the script to run. It usually takes a couple of minutes. Then paste the results, which will have been copied automatically, back into a reply on this page. The sequence is: copy, paste, wait, paste again. Details follow.
    4. You may have started the computer in "safe" mode. Preferably, these steps should be taken in “normal” mode. If the system is now in safe mode and works well enough in normal mode to run the test, restart as usual. If you can only test in safe mode, do that.
    5. If you have more than one user, and the one affected by the problem is not an administrator, then please run the test twice: once while logged in as the affected user, and once as an administrator. The results may be different. The user that is created automatically on a new computer when you start it for the first time is an administrator. If you can't log in as an administrator, test as the affected user. Most personal Macs have only one user, and in that case this section doesn’t apply.
    6. The script is a single long line, all of which must be selected. You can accomplish this easily by triple-clicking  anywhere in the line. The whole line will highlight, though you may not see all of it in your browser, and you can then copy it. If you try to select the line by dragging across the part you can see, you won't get all of it.
    Triple-click anywhere in the line of text below on this page to select it:
    PATH=/usr/bin:/bin:/usr/sbin:/sbin; clear; Fb='%s\n\t(%s)\n'; Fm='\n%s\n\n%s\n'; Fr='\nRAM details\n%s\n'; Fs='\n%s: %s\n'; Fu='user %s%%, system %s%%'; PB="/usr/libexec/PlistBuddy -c Print"; A () { [[ a -eq 0 ]]; }; M () { find -L "$d" -type f | while read f; do file -b "$f" | egrep -lq XML\|exec && echo $f; done; }; Pc () { o=`grep -v '^ *#' "$2"`; Pm "$1"; }; Pm () { [[ "$o" ]] && o=`sed '/^ *$/d; s/^ */   /' <<< "$o"` && printf "$Fm" "$1" "$o"; }; Pp () { o=`$PB "$2" | awk -F'= ' \/$3'/{print $2}'`; Pm "$1"; }; Ps () { o=`echo $o`; [[ ! "$o" =~ ^0?$ ]] && printf "$Fs" "$1" "$o"; }; R () { o=; [[ r -eq 0 ]]; }; SP () { system_profiler SP${1}DataType; }; id | grep -qw '80(admin)'; a=$?; A && sudo true; r=$?; t=`date +%s`; clear; { A || echo $'No admin access\n'; A && ! R && echo $'No root access\n'; SP Software | sed '8!d;s/^ *//'; o=`SP Hardware | awk '/Mem/{print $2}'`; o=$((o<4?o:0)); Ps "Total RAM (GB)"; o=`SP Memory | sed '1,5d; /[my].*:/d'`; [[ "$o" =~ s:\ [^O]|x([^08]||0[^2]8[^0]) ]] && printf "$Fr" "$o"; o=`SP Diagnostics | sed '5,6!d'`; [[ "$o" =~ Pass ]] || Pm "POST"; for b in Thunderbolt USB; do o=`SP $b | sed -En '1d; /:$/{s/ *:$//;x;s/\n//p;}; /^ *V.* [0N].* /{s/ 0x.... //;s/[()]//g;s/\(.*: \)\(.*\)/ \(\2\)/;H;}; /Apple|SCSM/{s/.//g;h;}'`; Pm $b; done; o=`pmset -g therm | sed 's/^.*C/C/'`; [[ "$o" =~ No\ th|pms ]] && o=; Pm "Thermal conditions"; o=`pmset -g sysload | grep -v :`; [[ "$o" =~ =\ [^GO] ]] || o=; Pm "System load advisory"; o=`nvram boot-args | awk '{$1=""; print}'`; Ps "boot-args"; d=(/ ""); D=(System User); E=; for i in 0 1; do o=`cd ${d[$i]}L*/L*/Dia* || continue; ls | while read f; do [[ "$f" =~ h$ ]] && grep -lq "^Thread c" "$f" && e=" *" || e=; awk -F_ '!/ag$/{$NF=a[split($NF,a,".")]; print $0 "'"$e"'"}' <<< "$f"; done | tail`; Pm "${D[$i]} diagnostics"; done; [[ "$o" =~ \*$ ]] && printf $'\n* Code injection\n'; o=`syslog -F bsd -k Sender kernel -k Message CReq 'GPU |hfs: Ru|I/O e|last value [1-9]|n Cause: -|NVDA\(|pagin|SATA W|ssert|timed? ?o' | tail -n25 | awk '/:/{$4=""; $5=""};1'`; Pm "Kernel messages"; o=`df -m / | awk 'NR==2 {print $4}'`; o=$((o<5120?o:0)); Ps "Free space (MiB)"; o=$(($(vm_stat | awk '/eo/{sub("\\.",""); print $2}')/256)); o=$((o>=1024?o:0)); Ps "Pageouts (MiB)"; s=( `sar -u 1 10 | sed '$!d'` ); [[ s[4] -lt 85 ]] && o=`printf "$Fu" ${s[1]} ${s[3]}` || o=; Ps "Total CPU usage" && { s=(`ps acrx -o comm,ruid,%cpu | sed '2!d'`); o=${s[2]}%; Ps "CPU usage by process \"$s\" with UID ${s[1]}"; }; s=(`top -R -l1 -n1 -o prt -stats command,uid,prt | sed '$!d'`); s[2]=${s[2]%[+-]}; o=$((s[2]>=25000?s[2]:0)); Ps "Mach ports used by process \"$s\" with UID ${s[1]}"; o=`kextstat -kl | grep -v com\\.apple | cut -c53- | cut -d\< -f1`; Pm "Loaded extrinsic kernel extensions"; R && o=`sudo launchctl list | sed 1d | awk '!/0x|com\.(apple|openssh|vix\.cron)|org\.(amav|apac|calendarse|cups|dove|isc|ntp|post[fg]|x)/{print $3}'`; Pm "Extrinsic system jobs"; o=`launchctl list | sed 1d | awk '!/0x|com\.apple|org\.(x|openbsd)|\.[0-9]+$/{print $3}'`; Pm "Extrinsic agents"; o=`for d in {/,}L*/Lau*; do M; done | grep -v com\.apple\.CSConfig | while read f; do ID=$($PB\ :Label "$f") || ID="No job label"; printf "$Fb" "$f" "$ID"; done`; Pm "launchd items"; o=`for d in /{S*/,}L*/Star*; do M; done`; Pm "Startup items"; o=`find -L /S*/L*/E* {/,}L*/{A*d,Compon,Ex,In,Keyb,Mail/B,P*P,Qu*T,Scripti,Servi,Spo}* -type d -name Contents -prune | while read d; do ID=$($PB\ :CFBundleIdentifier "$d/Info.plist") || ID="No bundle ID"; [[ "$ID" =~ ^com\.apple\.[^x]|Accusys|ArcMSR|ATTO|HDPro|HighPoint|driver\.stex|hp-fax|\.hpio|JMicron|microsoft\.MDI|print|SoftRAID ]] || printf "$Fb" "${d%/Contents}" "$ID"; done`; Pm "Extrinsic loadable bundles"; o=`find -L /u*/{,*/}lib -type f | while read f; do file -b "$f" | grep -qw shared && ! codesign -v "$f" && echo $f; done`; Pm "Unsigned shared libraries"; o=`for e in DYLD_INSERT_LIBRARIES DYLD_LIBRARY_PATH; do launchctl getenv $e; done`; Pm "Environment"; o=`find -L {,/u*/lo*}/e*/periodic -type f -mtime -10d`; Pm "Modified periodic scripts"; o=`scutil --proxy | grep Prox`; Pm "Proxies"; o=`scutil --dns | awk '/r\[0\] /{if ($NF !~ /^1(0|72\.(1[6-9]|2[0-9]|3[0-1])|92\.168)\./) print $NF; exit}'`; Ps "DNS"; R && o=`sudo profiles -P | grep : | wc -l`; Ps "Profiles"; f=auto_master; [[ `md5 -q /etc/$f` =~ ^b166 ]] || Pc $f /etc/$f; for f in fstab sysctl.conf crontab launchd.conf; do Pc $f /etc/$f; done; Pc "hosts" <(grep -v 'host *$' /etc/hosts); Pc "User launchd" ~/.launchd*; R && Pc "Root crontab" <(sudo crontab -l); Pc "User crontab" <(crontab -l); R && o=`sudo defaults read com.apple.loginwindow LoginHook`; Pm "Login hook"; Pp "Global login items" /L*/P*/loginw* Path; Pp "User login items" L*/P*/*loginit* Name; Pp "Safari extensions" L*/Saf*/*/E*.plist Bundle | sed -E 's/(\..*$|-[1-9])//g'; o=`find ~ $TMPDIR.. \( -flags +sappnd,schg,uappnd,uchg -o ! -user $UID -o ! -perm -600 \) | wc -l`; Ps "Restricted user files"; cd; o=`SP Fonts | egrep "Valid: N|Duplicate: Y" | wc -l`; Ps "Font problems"; o=`find L*/{Con,Pref}* -type f ! -size 0 -name *.plist | while read f; do plutil -s "$f" >&- || echo $f; done`; Pm "Bad plists"; d=(Desktop L*/Keyc*); n=(20 7); for i in 0 1; do o=`find "${d[$i]}" -type f -maxdepth 1 | wc -l`; o=$((o<=n[$i]?0:o)); Ps "${d[$i]##*/} file count"; done; o=$((`date +%s`-t)); Ps "Elapsed time (s)"; } 2>/dev/null | pbcopy; exit 2>&-
    Copy the selected text to the Clipboard by pressing the key combination command-C.
    7. Launch the built-in Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    When you launch Terminal, a text window will open with a line already in it, ending either in a dollar sign ($) or a percent sign (%). If you get the percent sign, enter
    exec bash
    in the window and press return. You should then get a new line ending in a dollar sign.
    Click anywhere in the Terminal window and paste (command-V). The text you pasted should vanish immediately. If it doesn't, press the return key.
    If you're logged in as an administrator, you'll be prompted for your login password. Nothing will be displayed when you type it. You will not see the usual dots in place of typed characters. Make sure caps lock is off. Type carefully and then press return. You may get a one-time warning to be careful. If you make three failed attempts to enter the password, the test will run anyway, but it will produce less information. In most cases, the difference is not important. If you don't know your password, or if you prefer not to enter it, just press return three times at the password prompt.
    If you're not logged in as an administrator, you won't be prompted for a password. The test will still run. It just won't do anything that requires administrator privileges.
    The test may take a few minutes to run, depending on how many files you have and the speed of the computer. A computer that's abnormally slow may take longer to run the test. While it's running, there will be nothing in the Terminal window and no indication of progress. Wait for the line "[Process completed]" to appear. If you don't see it within half an hour or so, the test probably won't complete in a reasonable time. In that case, close the Terminal window and report your results. No harm will be done.
    8. When the test is complete, quit Terminal. The results will have been copied to the Clipboard automatically. They are not shown in the Terminal window. Please don't copy anything from there. All you have to do is start a reply to this comment and then paste by pressing command-V again.
    If any private information, such as your name or email address, appears in the results, anonymize it before posting. Usually that won't be necessary.
    When you post the results, you might see the message, "You have included content in your post that is not permitted." It means that the forum software has misidentified something in the post as a violation of the rules. If it happens, please post the test results on Pastebin, then post a link here to the page you created.
    Note: This is a public forum, and others may give you advice based on the results of the test. They speak only for themselves, and I don't necessarily agree with them.
    Copyright © 2014 Linc Davis. As the sole author of this work, I reserve all rights to it except as provided in the Terms of Use of Apple Support Communities ("ASC"). Readers of ASC may copy it for their own personal use. Neither the whole nor any part may be redistributed.

  • Mac book pro getting slow. Help me.

    I have a macbook pro 13" 2011 model. And what I noticed now is that my mac is getting slow even though I didn't use any apps at all. My free memory is still 60 gig something so I don't think this could be the reason why it's getting slow. Any help? I already deleted other big apps and programs. Even though I don't use any program, the mac is getting slow now... what should I do? do i need those mac keeper thing? thanks for the help!

    How's it going Crampy?
    By the % on the CPU Processes.
    Whatever is using the most CPU Processes is the one giving the most issue.
    If you're using Firefox, Safari or Google, see if it's loading flash on activity monitor.
    You will see under %CPU how much of the CPU is actually being used by that application.
    The higher the percentage, the slower you get and the hotter your MB Pro gets.

  • My Mac Book air gets slower and slower. Is there any software or application to increase perfromance ?

    My Mac Book air gets slower and slower. Is there any software or application to increase perfromance ?

    jean-michel from France wrote:
    My Mac Book air gets slower and slower. Is there any software or application to increase perfromance ?
    Try this program to clean and optimize your Mac:
    http://www.macupdate.com/app/mac/11582/onyx
    It works for me! Air i7.

  • Creating large video portfolio site? Project's getting slow and buggy? Here's a solution:

    If, like me, you're creating a large video portfolio site (over 50 vids) in Edge, you may find after a while elements on the stage start to vanish (they're still there but invisible) and the program REALLY slows down. And lots of crashes. I've asked the experts and the response generally seems to be "Site's way too big!" HOWEVER, I have a good workaround:
    After importing a Mpeg4 and Webm file into the video library, put it into your design, animate it, add functions, preview it, etc - then DELETE it from the media folder! The elements remain with all the attributes and code attached on the timeline, stage and elements window - but it's just a placeholder. Once you've done this, you can move on adding more and more videos, repeating this process. The project file never gets too big or slow! Then right at the end, put all the Mpeg4 and webm files back in the media folder. You might not be able to launch the project and preview (it'll be too big) but you can still drop it on your browser to check. And, if all's good, upload. If there are things that still need fixing, take the video files back out the Media folder so that when you launch the project file again to make amendments, it'll run smoothly. After fixing, put the videos back.
    Hopefully in the next full version, Edge is made more robust and able to tackle.

    If, like me, you're creating a large video portfolio site (over 50 vids) in Edge, you may find after a while elements on the stage start to vanish (they're still there but invisible) and the program REALLY slows down. And lots of crashes. I've asked the experts and the response generally seems to be "Site's way too big!" HOWEVER, I have a good workaround:
    After importing a Mpeg4 and Webm file into the video library, put it into your design, animate it, add functions, preview it, etc - then DELETE it from the media folder! The elements remain with all the attributes and code attached on the timeline, stage and elements window - but it's just a placeholder. Once you've done this, you can move on adding more and more videos, repeating this process. The project file never gets too big or slow! Then right at the end, put all the Mpeg4 and webm files back in the media folder. You might not be able to launch the project and preview (it'll be too big) but you can still drop it on your browser to check. And, if all's good, upload. If there are things that still need fixing, take the video files back out the Media folder so that when you launch the project file again to make amendments, it'll run smoothly. After fixing, put the videos back.
    Hopefully in the next full version, Edge is made more robust and able to tackle.

  • Error on compling the Swing program

    Hi all,
    I am trying to run a Login Swing program. I am want to go to the next page on click of the LOGIN button.Here is my code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class login extends JFrame implements ActionListener {
         public login(){
              setTitle("Login Page");
              //setSize(500,500);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              setVisible(true);
              Container pane = getContentPane();
              FlowLayout layout = new FlowLayout();
              pane.setLayout(layout);
              JLabel loginId = new JLabel("LoginId : ", JLabel.CENTER);
              JTextField Id = new JTextField(20);
              if(Id.equals("shri"))
                   System.out.println("login successful");
              JLabel password = new JLabel("Password : ", JLabel.CENTER);
              TextField pwd = new TextField(20);
              pwd.setEchoChar('*');
              JButton Enter = new JButton("Log in");
              private void actionPerformed(ActionEvent e)) {
                   String read = Id.getText();
                   String in = new String(pwd.getText());
                   //validate login and password here. validity will be done by sending login/password to the server
                   if (read.equals("Shri") && in.equals("Shri")) {
                   System.out.println("login successfull");
                   } else {
                   JOptionPane.showMessageDialog(this,"Incorrect login or password","Error",JOptionPane.ERROR_MESSAGE);
                   Id.setText("");
                   pwd.setText("");
                   Id.requestFocusInWindow();
              pane.add(loginId);
              pane.add(Id);
              pane.add(password);
              pane.add(pwd);
              pane.add(Enter,BorderLayout.CENTER);
              setContentPane(pane);
              pack();
         public static void main(String[] args) {
              login enter = new login();
    I'm getting the error->The type login must implement the inherited abstract method ActionListener.actionPerformed(ActionEvent)
         void is an invalid type for the variable actionPerformed
         Syntax error on token "(", ; expected
         Syntax error, insert ";" to complete LocalVariableDeclarationStatement
    Please help me resolve this error and also to improvise the code.

    You code had basic problem like declaration errors. Have modified your code.
    Try this.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Login extends JFrame implements ActionListener {
        JLabel loginId;
        JTextField Id;
        TextField pwd;
        public Login(){
            setTitle("Login Page");
            //setSize(500,500);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            setVisible(true);
            Container pane = getContentPane();
            FlowLayout layout = new FlowLayout();
            pane.setLayout(layout);
            loginId = new JLabel("LoginId : ", JLabel.CENTER);
            Id = new JTextField(20);
            if(Id.equals("shri")) {
                System.out.println("login successful");
            JLabel password = new JLabel("Password : ", JLabel.CENTER);
            pwd = new TextField(20);
            pwd.setEchoChar('*');
            JButton Enter = new JButton("Log in");
            pane.add(loginId);
            pane.add(Id);
            pane.add(password);
            pane.add(pwd);
            pane.add(Enter,BorderLayout.CENTER);
            setContentPane(pane);
            pack();
        public void actionPerformed(ActionEvent e) {
            String read = Id.getText();
            String in = new String(pwd.getText());
            //validate login and password here. validity will be done by sending login/password to the server
            if (read.equals("Shri") && in.equals("Shri")) {
                System.out.println("login successfull");
            } else {
                JOptionPane.showMessageDialog(this,"Incorrect login or password","Error",JOptionPane.ERROR_MESSAGE);
                Id.setText("");
                pwd.setText("");
                Id.requestFocusInWindow();
        public static void main(String[] args) {
            Login enter = new Login();
    }

  • How to start Swing programs without console

    Hi, I'm working on Swing program, which can be started in the MS-DOS console by typing:
    java myProgram
    This works great, but for the end-users, I don't want them to see the ugly console that shows up and occasionally display exception code. How do I get the Swing program to start up without having the accompanying console?
    Any help is appreciated. Thanks! :-)

    you can also package it in a jar and make it executable. There's a good discussion in the Jar Forum about how to do that.

  • NI Session Manager gets slower and slower from call to call!

    I have the following problem with NI-Session-Manager:
    I use Session Manager a lot on my test systems. Now that I have a test system running that makes many Session Manager Calls I noticed that after a while the system gets slower and slower. I�ve attached a Sequence File, which demonstrates this problem.
    This sequence file is based on the LV Session Manager Example, which ships with TestStand.
    Instructions: In the UI-Msg Field of the Sequence Editor you will see how long the actual run took to execute. Every run makes 500 calls to Session Manager. You will notice that every run takes a little bit longer than the previous. After 100 runs the difference is significant.
    Although my example uses a COM
    port to demonstrate the problem this problem is really related to Session Manager because the same happens if I use an IVI-Instrument (i.e. NI-DMM, NI-Switch, �)
    Any help appreciated!
    Regards
    Herbert
    Herbert Koltschik
    Sagem Communication Austria
    [email protected]
    Attachments:
    sessionmgr_-_slow_down_problem.zip ‏63 KB

    Herbert -
    Thanks for the feedback. I will look into item (1).
    The design of the session manager was to solve the problem of only having to share an instrument within a multithread application. If the session already exists, than you get the same session and thus the same handle, and the instrument is only initialize once and closed after the session no longer exists.
    In the case of a C++ based program you would have to add the session as a member variable that has a specific lifetime. When the object is release, so will the session.
    In the case of an application like TestStand, you just attach the session to the execution. Once the execution goes away, the session may go away if no other execution is using it.
    In the case of L
    abVIEW being called from TestStand, you are using VIs as subroutines, so either the application (TestStand) must manage the lifetime of the session, or the VI subroutine must deligate the lifetime control to a "global" VI. The item you attach to the global could be the refnum itself or the SMgr session. One way of doing this would be to create a VI that serves the refnum to you but internally manages the lifetime of the ActiveX references to the Session Manager sessions. This would be a simple vector of names and their sessions. When called the VI would lookup and return a refnum from an existing session or create a new session and return a refnum for it.
    Scott Richardson
    Scott Richardson
    National Instruments

  • Connecting with company is getting slower and slower.

    Hi. we are experiencing a problem with our sdk program. We have about 15 machines connected with 6 different users using our sdk program. The first day everyone logs on in 10 seconds, but as the day passes they start getting slower when connecting to the company. Maybe about 2 or 3 days later we will need to reboot the server so they can start working again. A note on the side, this only affects our sdk development. SapBusinessOne.exe can successfully connecdt to the company at the 3rd day when the progam cant. Iam not calling the disconect company when the program exists, I thought the .net crl would take care of that.. dont know if this could be the problem?
    We are using SapBusiness 2007 patch 48
    Thank you.
    Jose.

    Sorry its in DI, this is the code i use to connect to the company and where it takes alot of time to call.
    the Company object I pass is simply a _oCompany = new Company(). the server is in the form of "10.0.0.14"
    How to I release ComObjects? with dispose?
    Thanks
    public static string Connect(Company _oCompany, string _sServer, string _sCompanyDB, string _sDBUser, string _sDBPassword, string _sUser, string _sPassword) {
                oCompany.DbServerType = BoDataServerTypes.dstMSSQL2005;
                _oCompany.CompanyDB = _sCompanyDB;
                _oCompany.Server = _sServer;
                _oCompany.DbUserName = _sDBUser;
                _oCompany.DbPassword = _sDBPassword;
                _oCompany.UserName = _sUser;
                _oCompany.Password = _sPassword;
                if (_oCompany.Connect() != 0) {
                    return GetLastError(_oCompany);
                else {
                    return "";

  • My computer is getting slower and slower. Is there a standard utility I can run to clean things up?

    My Imac is getting slower and slower. Is there a standard utility I can run that will clean things up? I am an old PC guy but changed to Mac about 5 years ago. PC had a program called DeFrag. Is there anything like that for the Mac?  Thanks, Rick

    Rick,
    A Mac that loses performance can be caused by many many things. Forget about Defrag, that isn't the problem and is something done by PC users in the 1990s. The more common things to check are RAM (do you have enough) and Login Items. You can easily check if you need a RAM upgrade by operating your computer as you normally do and opening Activity Monitor (Applications - Utilities - Activity Monitor) and click the System Memory tab. In the lower left you will see:
    Free
    Wired
    Active
    Inactive
    Used
    If the amount of Free RAM is in the vicinity of 500MB or less your system needs more RAM.
    To check the Login Items navigate to System Preferences - Accounts - Login Items. If you seen applications in the list that you don't need loading when you login simply highlight them and click the - symbol at the bottom of the box to remove them.
    Finally I would recommend your visit and read 25 Ways to Speed Up Your Mac.
    Roger

Maybe you are looking for