Yesterday, I was working
with generating a graph using jfreechart library. The requirement was to show a
window with graph on full screen. When i used the following code it didn't give
me the desired results. Taskbar was overlapping bottom part of the screen.
this.setPreferredSize(new Dimension(Toolkit.getDefaultToolkit().getScreenSize().width,
Toolkit.getDefaultToolkit().getScreenSize().height));
After searching over
internet i found the solution and following code snippet worked properly as per
my requirements.
//Calculate
height of the task bar
Insets scnMax =
Toolkit.getDefaultToolkit().getScreenInsets(getGraphicsConfiguration());
int taskBarSize = scnMax.bottom;
this.setPreferredSize(new
Dimension(Toolkit.getDefaultToolkit().getScreenSize().width,
Toolkit.getDefaultToolkit().getScreenSize().height-taskBarSize));
Thanks!!!!!!!!!!!! Enjoy
Programming :)
Comments
Post a Comment
Thanks for your valuable comments.