-
-
Save davidgomes/5fa4a007d265dc0ac750 to your computer and use it in GitHub Desktop.
Surrounded
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package surrounded; | |
public class Surrounded { | |
public static void main(String[] args) { | |
SurroundedFrame frame = new SurroundedFrame("Surrounded"); | |
SurroundedPanel panel = new SurroundedPanel(); | |
frame.add(panel); | |
frame.run(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package surrounded; | |
import javax.swing.JFrame; | |
@SuppressWarnings("serial") | |
public class SurroundedFrame extends JFrame { | |
public SurroundedFrame(String title) { | |
setTitle(title); | |
setResizable(false); | |
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
} | |
public void run() { | |
this.pack(); | |
this.setVisible(true); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package surrounded; | |
import javax.swing.JPanel; | |
import java.awt.Color; | |
@SuppressWarnings("serial") | |
public class SurroundedPanel extends JPanel { | |
public SurroundedPanel() { | |
this.setSize(800, 600); | |
this.setBackground(Color.RED); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment