Results 1 to 2 of 2

Thread: [RESOLVED] System tray/Task bar height

  1. #1

    Thread Starter
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Resolved [RESOLVED] System tray/Task bar height

    Hi all,

    Is that anyone of you know how to find the height of the system tray or task bar.

    Thanks.
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: System tray/Task bar height

    I tried something really stupid but it worked
    Code:
    import java.awt.Toolkit;
    import java.awt.event.FocusEvent;
    import java.awt.event.FocusListener;
    import javax.swing.JFrame;
    
    public class Util {
    
        public static void main(String[] args) throws Exception {
    	int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height;
    	final JFrame tempFrame = new JFrame();
    	tempFrame.addFocusListener(new FocusListener() {
    
    	    public void focusGained(FocusEvent e) {
    		tempFrame.dispose();
    	    }
    
    	    public void focusLost(FocusEvent e) {
    	    }
    	});
    	tempFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
    	tempFrame.setVisible(true);
    	int frameHeight = tempFrame.getHeight();
    	int taskbarHeight = screenHeight - frameHeight;
    	System.out.println(taskbarHeight);
        }
    }
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width