Skip to content

Instantly share code, notes, and snippets.

@davidgomes
Created October 2, 2011 16:31
Show Gist options
  • Save davidgomes/5fa4a007d265dc0ac750 to your computer and use it in GitHub Desktop.
Save davidgomes/5fa4a007d265dc0ac750 to your computer and use it in GitHub Desktop.
Surrounded
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();
}
}
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);
}
}
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