<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Unlimited Edition &#187; Java</title>
	<atom:link href="http://michaelodden.com/category/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://michaelodden.com</link>
	<description>Unlimited views, cleverness and love</description>
	<lastBuildDate>Sat, 23 Jan 2010 20:31:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Getting dirty &#8211; reverse engineering</title>
		<link>http://michaelodden.com/java/getting-dirty-reverse-engineering/</link>
		<comments>http://michaelodden.com/java/getting-dirty-reverse-engineering/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 14:06:51 +0000</pubDate>
		<dc:creator>michaelo</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://blog.michaelodden.com/?p=88</guid>
		<description><![CDATA[Mats has just written a good post about reverse-engineering a binary Java-library. He mention some possible ways to do this, and how he ended up doing it.Well worth checking out. e-mats.org: New Adventures in Reverse Engineering Related posts:Acquiring full screen in Java-applications

<h2>Related posts:</h2><ul><li><a href='http://michaelodden.com/mac/acquiring-full-screen-in-java-applications/' rel='bookmark' title='Permanent Link: Acquiring full screen in Java-applications'>Acquiring full screen in Java-applications</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>Mats has just written a good post about reverse-engineering a binary Java-library. He mention some possible ways to do this, and how he ended up doing it.Well worth checking out.</p>
<p><a href="http://e-mats.org/2009/02/new-adventures-in-reverse-engineering/">e-mats.org: New Adventures in Reverse Engineering</a></p><img src="http://michaelodden.com/?ak_action=api_record_view&id=88&type=feed" alt="" />

<h2>Related posts:</h2><ul><li><a href='http://michaelodden.com/mac/acquiring-full-screen-in-java-applications/' rel='bookmark' title='Permanent Link: Acquiring full screen in Java-applications'>Acquiring full screen in Java-applications</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://michaelodden.com/java/getting-dirty-reverse-engineering/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Acquiring full screen in Java-applications</title>
		<link>http://michaelodden.com/mac/acquiring-full-screen-in-java-applications/</link>
		<comments>http://michaelodden.com/mac/acquiring-full-screen-in-java-applications/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 13:36:51 +0000</pubDate>
		<dc:creator>michaelo</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://blog.michaelodden.com/?p=65</guid>
		<description><![CDATA[Inn a recent project I&#8217;ve been toying around with, the need to acquire the entire screen came up as a need. Being rather new to Java as I am, this took some time figuring out. I use the javax.swing-library to handle my GUI. My first try was to  set the JFrame undecorated, &#8220;always on top&#8221;, [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Inn a recent project I&#8217;ve been toying around with, the need to acquire the entire screen came up as a need. Being rather new to Java as I am, this took some time figuring out. I use the javax.swing-library to handle my <acronym title="Graphical User Interface">GUI</acronym>.</p>
<p>My first try was to  set the JFrame undecorated, &#8220;always on top&#8221;, start at (x,y)=(0,0) and size=screen size, like this:</p>
<pre name="code" class="java">public class Window extends JFrame {
    Window() {
        super();
        // Not too important in this example
        this.setLayout(new GridLayout(1,1));

        // Start at top-left
        this.setLocation(0, 0);

        // Get screensize, set as window-size
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        this.setSize(screenSize);

       // I don't want it to look like a window
        this.setResizable(false);
        this.setUndecorated(true);
        this.setAlwaysOnTop(true);

        // Woop-de-do
        this.setVisible(true);
    }
}</pre>
<p>So when instantiating a new Window(), it will cover the entire screen. Almost. This will behave as expected in Windows (XP at least), but not in <acronym title="Operating System">OS</acronym> X. In <acronym title="Operating System">OS</acronym> X the dock will overlap, and the coordinates (0,0) will mean &#8220;first pixel _underneath_ the menubar&#8221; &#8211; obviously not what I want &#8211; and not ideal for this application.</p>
<p>The solution is to take over the entire screen, the same way as ie <acronym title="Digital Versatile Disc">DVD</acronym> Players, games and other presentation-apps. One way to do this in Java is like this:</p>
<pre name="code" class="java">import java.awt.GraphicsEnvironment;
import java.awt.GraphicsDevice;

public class Main {
    public static void main(String[] args) {
        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice[] gs = ge.getScreenDevices(); // There may be more than one screen-device
        // Can also get the default-screen directly with ge.getDefaultScreenDevice()
        window = new Window(); // Instantiating the class from above, to create a dummy-window
        // Setting device to full-screen
        gs[0].setFullScreenWindow(window); // In my case, only interested in the first screen
    }
}</pre>
<p>I suppose this is the correct way to do it always for Windows XP etc as this will actually take over the entire screen, not just overlapping the existing one.</p>
<p>Thanks goes to <a href="http://dispo.se/">Jan-Petter</a> for giving me a push in the correct direction.</p><img src="http://michaelodden.com/?ak_action=api_record_view&id=65&type=feed" alt="" />

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://michaelodden.com/mac/acquiring-full-screen-in-java-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
