Skip to content

Instantly share code, notes, and snippets.

View figengungor's full-sized avatar

Figen Güngör figengungor

View GitHub Profile
@figengungor
figengungor / gist:5125016
Created March 9, 2013 17:49
GUI Basic I : JFrame, Container and JLabel
import javax.swing.*; //For Window Frame (JFrame)
import java.awt.*; //For Container object
public class MyGUI {
public static void main(String[] args) {
new MyGUI();
}
public MyGUI(){
@figengungor
figengungor / gist:5125400
Created March 9, 2013 19:23
Java GUI JTextField
import javax.swing.*; //For Window Frame (JFrame)
import java.awt.*; //For Container object
public class MyGUI {
public static void main(String[] args) {
new MyGUI();
}
@figengungor
figengungor / gist:5125420
Created March 9, 2013 19:28
Java GUI JButton
import javax.swing.*;
import java.awt.*;
public class MyGUI {
JLabel l1,l2;
JTextField tf1,tf2;
JButton b1,b2;
public static void main(String[] args) {
@figengungor
figengungor / gist:5125637
Created March 9, 2013 20:38
Java GUI >> Creating a Simple Window(JFrame)
import javax.swing.JFrame;
public class MyGUI extends JFrame
{
public MyGUI()
{
setTitle("Tutorial");
setSize(400,400);
setVisible(true);
@figengungor
figengungor / gist:5125697
Created March 9, 2013 20:49
Java GUI >> Draw a Rectangle
import javax.swing.JFrame;
import java.awt.Graphics;
import java.awt.Color;
public class MyGUI extends JFrame
{
public MyGUI()
{
setTitle("Tutorial");
setSize(960,960);
@figengungor
figengungor / gist:5125717
Created March 9, 2013 20:56
Java GUI >> Draw an Oval
import javax.swing.JFrame;
import java.awt.Graphics;
import java.awt.Color;
public class MyGUI extends JFrame
{
public MyGUI()
{
setTitle("Tutorial");
setSize(400,400);
@figengungor
figengungor / gist:5125743
Created March 9, 2013 21:04
Java GUI >> Draw a Line
import javax.swing.JFrame;
import java.awt.Graphics;
import java.awt.Color;
public class MyGUI extends JFrame
{
public MyGUI()
{
setTitle("Tutorial");
setSize(400,400);
@figengungor
figengungor / gist:5125815
Created March 9, 2013 21:27
Java GUI >> JLabel, JButton, JPanel
import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JButton;
import javax.swing.JPanel;
public class MyGUI extends JFrame
{
@figengungor
figengungor / gist:5126354
Created March 9, 2013 23:48
Java GUI >> FlowLayout
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class MyGUI extends JFrame
{
JPanel jp; //Made global so all methods can use this
@figengungor
figengungor / gist:5130484
Created March 10, 2013 21:21
Java GUI >> Non-resizable window frame
import javax.swing.JFrame;
public class MyGUI extends JFrame {
public MyGUI(){
setTitle("Non-resizable frame");
setSize(300,300);
setVisible(true);