Example #1
2
  AdminMain() {
    l = new JLabel();
    l.setBounds(10, 20, 1340, 1000);
    l.setBackground(Color.black);
    Font ft = new Font("Arial", Font.BOLD, 30);
    Font ft1 = new Font("Arial", Font.BOLD, 14);
    Font ft2 = new Font("Arial", Font.BOLD, 20);

    f1 = new Frame("Soft Test Management (Beta)");
    f1.setLayout(null);

    l1 = new Label("Test Instructions", l1.CENTER);
    l1.setBounds(10, 20, 1300, 60);
    l1.setForeground(Color.blue);
    l1.setBackground(Color.white);
    l1.setFont(ft);

    l2 = new JLabel("Deletion of Faculty/Students");
    l2.setBounds(20, 30, 1000, 500);
    l2.setBackground(Color.blue);
    l2.setFont(ft2);
    l3 = new JLabel("Test Pattern");
    l3.setBounds(20, 90, 1300, 500);
    l3.setBackground(Color.green);
    l3.setFont(ft2);

    b1 = new JButton("Go !");
    b1.setBounds(300, 220, 120, 30);
    b1.setBackground(Color.white);
    b1.setForeground(Color.blue);
    b1.setFont(ft2);

    b2 = new JButton("Go");
    b2.setBounds(300, 240, 120, 30);
    b2.setBackground(Color.white);
    b2.setForeground(Color.blue);
    b2.setFont(ft2);

    f1.add(l);
    l.add(l1);
    l2.add(b1);
    l.add(l2);
    l3.add(b2);
    l.add(l3);

    b1.addActionListener(this);
    b2.addActionListener(this);

    f1.setVisible(true);
    f1.setSize(1800, 800);
  }
  public static void main(String[] args) {
    // Initialization
    // Setting up GL
    GLProfile.initSingleton();
    GLProfile glp = GLProfile.getDefault();
    GLCapabilities caps = new GLCapabilities(glp);
    GLCanvas canvas = new GLCanvas(caps);

    // Making the AWT frame window
    Frame frame = new Frame("Assignment 1");
    frame.setSize(800, 600);
    frame.add(canvas);
    frame.setVisible(true);

    // Adding a render listener
    canvas.addGLEventListener(new Assignment1());

    // Fixes so the exit button exits the program
    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });
  }
  public SingleARMarker(NyARParam i_cparam) throws Exception {
    JmfCaptureDeviceList devlist = new JmfCaptureDeviceList();
    this._ar_param = i_cparam;

    // キャプチャリソースの準備
    this._capture = devlist.getDevice(0);
    if (!this._capture.setCaptureFormat(SCREEN_X, SCREEN_Y, 30.0f)) {
      throw new NyARException();
    }
    this._capture.setOnCapture(this);
    this._cap_image = new JmfNyARRGBRaster(this._capture.getCaptureFormat());

    this._code_table[0] = NyARCode.createFromARPattFile(new FileInputStream(CARCODE_FILE1), 16, 16);
    this._code_table[1] = NyARCode.createFromARPattFile(new FileInputStream(CARCODE_FILE2), 16, 16);

    // OpenGLフレームの準備(OpenGLリソースの初期化、カメラの撮影開始は、initコールバック関数内で実行)
    Frame frame = new Frame("NyARToolkit[" + this.getClass().getName() + "]");
    GLCanvas canvas = new GLCanvas();
    frame.add(canvas);
    canvas.addGLEventListener(this);
    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });

    // ウインドウサイズの調整
    frame.setVisible(true);
    Insets ins = frame.getInsets();
    frame.setSize(SCREEN_X + ins.left + ins.right, SCREEN_Y + ins.top + ins.bottom);
    canvas.setBounds(ins.left, ins.top, SCREEN_X, SCREEN_Y);
    return;
  }
Example #4
0
 public void init() {
   frame = new Frame("PictureViewer");
   Panel pb = new Panel();
   Button select = new Button("choose pic");
   previous = new Button("previous");
   next = new Button("next");
   select.addActionListener(this);
   previous.addActionListener(this);
   next.addActionListener(this);
   pb.add(select);
   pb.add(previous);
   pb.add(next);
   mc = new MyCanvas();
   mc.setBackground(new Color(200, 210, 230));
   mc.addComponentListener(mc);
   frame.add(pb, "North");
   frame.add(mc, "Center");
   frame.setSize(360, 360);
   frame.setLocation(400, 200);
   frame.addWindowListener(
       new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
           System.exit(0);
         }
       });
   frame.setVisible(true);
   this.validateButton();
   filter = new MyFilter();
   fd_load = new FileDialog(frame, "Open file", FileDialog.LOAD);
   fd_load.setFilenameFilter(filter);
 }
 public static void main(String[] args) {
   Frame f = new Frame("thread");
   f.setLayout(null);
   f.setBounds(300,60,300,200); f.setVisible(true);
   f.add(new MyTextArea(150,0,Thread.NORM_PRIORITY));
   f.add(new MyTextArea(0,0,Thread.MAX_PRIORITY));
 }  
Example #6
0
 public static void main(String[] args) {
   Triangle triangle = new Triangle();
   Frame frame = new Frame("Comgr Triangle");
   frame.add(triangle);
   frame.setSize(triangle.getWidth(), triangle.getHeight());
   frame.setVisible(true);
 }
Example #7
0
  public static void main(String[] args) {
    Frame f = new Frame("Font Test");
    String abc = "ABCDDFGHIJKLMNOPQRSTUVWXYZ";

    // A-Z를 내용으로 갖는 Label들을 생성한다.
    Label abc1 = new Label(abc);
    Label abc2 = new Label(abc);
    Label abc3 = new Label(abc);
    Label abc4 = new Label(abc);
    Label abc5 = new Label(abc);

    // Serif체이며,크기가 20인 Font
    Font f1 = new Font("Serif", Font.PLAIN, 20); // 보통체
    Font f2 = new Font("Serfit", Font.ITALIC, 20); // 기울임체
    Font f3 = new Font("Serif", Font.BOLD, 20); // 굵은체
    Font f4 = new Font("Serif", Font.BOLD + Font.ITALIC, 20); // 굵은 기울임체

    abc1.setFont(f1); // Label에 새로운 Font를 적용한다.
    abc2.setFont(f2);
    abc3.setFont(f3);
    abc4.setFont(f4);
    f.setBackground(Color.CYAN);
    f.setLayout(new FlowLayout());
    f.add(abc1);
    f.add(abc2);
    f.add(abc3);
    f.add(abc4);
    f.add(abc5);

    f.setSize(400, 300);
    f.setVisible(true);
  }
Example #8
0
  public static void main(String[] args) {
    Frame frame = new Frame("Simple JOGL Application");
    GLCanvas canvas = new GLCanvas();

    canvas.addGLEventListener(new Project1());
    frame.add(canvas);
    frame.setSize(600, 600);
    final Animator animator = new Animator(canvas);
    frame.addWindowListener(
        new WindowAdapter() {

          @Override
          public void windowClosing(WindowEvent e) {
            new Thread(
                    new Runnable() {

                      public void run() {
                        animator.stop();
                        System.exit(0);
                      }
                    })
                .start();
          }
        });

    frame.setVisible(true);
    animator.start();
  }
Example #9
0
	public static void Field1(){
		fieldT.Label();
		fieldT.panel();
		f1.setSize(400, 400);
		
		Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); // 화면 픽셀 계산
		Dimension frm = f1.getSize();//창 크기 계산

		int xpos = (int)(screen.getWidth() / 2 - frm.getWidth() / 2); // 창 중앙 위치 계산
		int ypos = (int)(screen.getHeight() / 2 - frm.getHeight() / 2);


		f1.setLayout(new GridLayout(4, 4));// 프레임 레이아웃
		f1.setBackground(Color.cyan); //프레임 배경
		f1.addWindowListener(new WEventHandler());
		f1.addKeyListener(new KEventHandler());
		f1.setResizable(false);
		for(int i =0;i<4;i++){
			for(int j=0;j<4;j++){
				f1.add(p[i][j]);
			}
		}
		f1.setLocation(xpos, ypos);
		f1.setVisible(true);
	}
  public SimpleLiteMStandard(INyARMarkerSystemConfig i_config) throws NyARException {
    JmfCaptureDeviceList devlist = new JmfCaptureDeviceList();
    JmfCaptureDevice d = devlist.getDevice(0);
    d.setCaptureFormat(i_config.getScreenSize(), 30.0f);
    this._camera = new NyARJmfCamera(d); // create sensor system
    this._nyar = new NyARGlMarkerSystem(i_config); // create MarkerSystem
    this.ids[0] = this._nyar.addARMarker(ARCODE_FILE2, 16, 25, 80);
    this.ids[1] = this._nyar.addARMarker(ARCODE_FILE, 16, 25, 80);

    Frame frame = new Frame("NyARTK program");
    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });
    GLCanvas canvas = new GLCanvas();
    frame.add(canvas);
    canvas.addGLEventListener(this);
    NyARIntSize s = i_config.getNyARParam().getScreenSize();

    frame.setVisible(true);
    Insets ins = frame.getInsets();
    frame.setSize(s.w + ins.left + ins.right, s.h + ins.top + ins.bottom);
    canvas.setBounds(ins.left, ins.top, s.w, s.h);

    this._camera.start();
  }
Example #11
0
 public static void startMainThread(String s, String s1, String s2) {
   boolean flag = false;
   String s3 = s;
   Frame frame = new Frame("Minecraft");
   Canvas canvas = new Canvas();
   frame.setLayout(new BorderLayout());
   frame.add(canvas, "Center");
   canvas.setPreferredSize(new Dimension(854, 480));
   frame.pack();
   frame.setLocationRelativeTo(null);
   MinecraftImpl minecraftimpl = new MinecraftImpl(frame, canvas, null, 854, 480, flag, frame);
   Thread thread = new Thread(minecraftimpl, "Minecraft main thread");
   thread.setPriority(10);
   minecraftimpl.minecraftUri = "www.minecraft.net";
   if (s3 != null && s1 != null) {
     minecraftimpl.session = new Session(s3, s1);
   } else {
     minecraftimpl.session =
         new Session(
             (new StringBuilder())
                 .append("Player")
                 .append(System.currentTimeMillis() % 1000L)
                 .toString(),
             "");
   }
   if (s2 != null) {
     String as[] = s2.split(":");
     minecraftimpl.setServer(as[0], Integer.parseInt(as[1]));
   }
   frame.setVisible(true);
   frame.addWindowListener(new GameWindowListener(minecraftimpl, thread));
   thread.start();
 }
Example #12
0
  /**
   * Creates a new connection to the specified host of specified type. <br>
   * <br>
   * type: Type of connection to create <br>
   * destination: Host to connect to (in "host:port" or "host" syntax)
   */
  public Connection(java.net.InetAddress host, int port, PluginContext ctx)
      throws MessagingNetworkException, java.io.IOException {
    if (TRAKTOR_USED) {
      if (traktorConnectionDown) throw new IOException("network is down");

      traktor = new Frame("" + host + ":" + port + " - Traktor");
      final Checkbox c = new Checkbox("break this & ALL future connections");
      c.setState(traktorConnectionDown);
      c.addItemListener(
          new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
              traktorConnectionDown = c.getState();
              try {
                if (traktorConnectionDown) closeSocket();
              } catch (Exception ex) {
              }
            }
          });
      traktor.add(c);
      traktor.setSize(100, 50);
      traktor.setLocation(230, 450);
      traktor.setVisible(true);
    } else {
      traktor = null;
    }
  }
Example #13
0
  @Test
  public void testWindowParenting02CreateVisibleDestroy3Odd() throws InterruptedException {
    int x = 0;
    int y = 0;

    NEWTEventFiFo eventFifo = new NEWTEventFiFo();

    GLWindow glWindow1 = GLWindow.create(glCaps);
    GLEventListener demo1 = new RedSquare();
    setDemoFields(demo1, glWindow1, false);
    glWindow1.addGLEventListener(demo1);

    NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow1);

    Frame frame = new Frame("AWT Parent Frame");
    Assert.assertNotNull(frame);
    frame.setSize(width, height);

    // visible test
    frame.setVisible(true);

    frame.add(newtCanvasAWT);

    Animator animator1 = new Animator(glWindow1);
    animator1.start();
    while (animator1.isAnimating() && animator1.getDuration() < durationPerTest) {
      Thread.sleep(100);
    }

    Assert.assertEquals(true, animator1.isAnimating()); // !!!

    frame.dispose();
    glWindow1.destroy(true);
  }
 demo5() {
   f = new Frame();
   f.setSize(300, 300);
   // f.setBackground(Color.red);
   f.setLayout(null);
   s1 = new Scrollbar(Scrollbar.VERTICAL, 0, 5, 0, 260);
   s1.setBackground(Color.red);
   s1.setBounds(30, 35, 20, 255);
   s2 = new Scrollbar(Scrollbar.VERTICAL, 0, 5, 0, 260);
   s2.setBackground(Color.green);
   s2.setBounds(60, 35, 20, 255);
   s3 = new Scrollbar(Scrollbar.VERTICAL, 0, 5, 0, 260);
   s3.setBackground(Color.blue);
   s3.setBounds(90, 35, 20, 255);
   f.add(s1);
   f.add(s2);
   f.add(s3);
   s1.addAdjustmentListener(this);
   s2.addAdjustmentListener(this);
   s3.addAdjustmentListener(this);
   p1 = new Panel();
   p1.setBounds(120, 35, 170, 255);
   f.add(p1);
   f.setVisible(true);
 }
Example #15
0
  private static void init() {
    // *** Create instructions for the user here ***
    String[] instructions = {
      "This is an AUTOMATIC test, simply wait until it is done.",
      "The result (passed or failed) will be shown in the",
      "message window below."
    };
    Sysout.createDialog();
    Sysout.printInstructions(instructions);

    Frame frame = new Frame("test for 6418028");
    frame.setLayout(new FlowLayout());
    Button btn1 = new Button("Button1");
    frame.add(btn1);
    TestButton btn2 = new TestButton("Button2");
    frame.add(btn2);
    frame.pack();
    frame.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent we) {
            we.getWindow().dispose();
          }
        });
    frame.setVisible(true);

    Util.waitForIdle(null);

    btn2.instrumentPeer();
    btn2.requestFocusInWindow();
    btn2.restorePeer();
    frame.dispose();
    RequestOnCompWithNullParent1.pass();
  } // End  init()
Example #16
0
 public static void main(String[] args) {
   Frame f = new Frame();
   f.setSize(200, 100);
   Label lb = new Label("Hello World!!");
   f.add(lb);
   f.setVisible(true);
 }
Example #17
0
  public void launchCalc() {
    f.add(tf, BorderLayout.NORTH);
    p2 = new Panel();
    p2.setLayout(new GridLayout(4, 5));
    p2.add(b1);
    p2.add(b2);
    p2.add(b3);
    p2.add(b18);
    p2.add(b10);
    p2.add(b6);
    p2.add(b7);
    p2.add(b8);
    p2.add(b19);
    p2.add(b4);
    p2.add(b11);
    p2.add(b12);
    p2.add(b13);
    p2.add(b14);
    p2.add(b9);
    p2.add(b16);
    p2.add(b17);
    p2.add(b20);
    p2.add(b15);
    p2.add(b5);

    f.add(p2, BorderLayout.CENTER);
    f.pack();
    f.setSize(250, 200);
    f.setVisible(true);
  }
  public static void main(final String[] argv) {
    final Frame frame = new Frame("Cg demo (runtime_ogl_vertex_fragment)");
    final GLCanvas canvas = new GLCanvas();
    canvas.addGLEventListener(new runtime_ogl_vertex_fragment());

    frame.add(canvas);
    frame.setSize(512, 512);
    final Animator animator = new Animator(canvas);
    frame.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(@SuppressWarnings("unused") final WindowEvent e) {
            // Run this on another thread than the AWT event queue to
            // make sure the call to Animator.stop() completes before
            // exiting
            new Thread(
                    new Runnable() {
                      public void run() {
                        animator.stop();
                        System.exit(0);
                      }
                    })
                .start();
          }
        });
    frame.setVisible(true);
    animator.start();

    // and all the rest happens in the display function...
  }
Example #19
0
 public static void main(String[] args) {
   try {
     if (args.length != 1) throw new IllegalArgumentException("Wrong number of arguments");
     FileReader in = new FileReader(args[0]);
     HardcopyWriter out = null;
     Frame f = new Frame("PrintFile: " + args[0]);
     f.setSize(200, 50);
     f.show();
     try {
       out = new HardcopyWriter(f, args[0], 10, .75, .75, .75, .75);
     } catch (HardcopyWriter.PrintCanceledException e) {
       System.exit(0);
     }
     f.setVisible(false);
     char[] buffer = new char[4096];
     int numchars;
     while ((numchars = in.read(buffer)) != -1) out.write(buffer, 0, numchars);
     out.close();
   } catch (Exception e) {
     System.err.println(e);
     System.err.println("Usage: java HardcopyWriter$PrintFile <filename>");
     System.exit(1);
   }
   System.exit(0);
 }
Example #20
0
 public void go() {
   f = new Frame("좋아하는 선수 고르기");
   f.addWindowListener(
       new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
           f.setVisible(false);
           f.dispose();
           System.exit(0);
         }
       });
   lstSunsu = new List(4, true); // 4개 보여주고,여러명 선택가능
   lstSunsu.addItemListener(this); // 2. step
   lstSunsu.add("==선수선택==");
   lstSunsu.add("조오련");
   lstSunsu.add("박찬호");
   lstSunsu.add("박세리");
   lstSunsu.add("안정환");
   lstSunsu.add("이천수");
   lstSunsu.add("이영표");
   lstSunsu.add("차범근");
   lstSunsu.add("김남일");
   lstSunsu.add("차두리");
   tf = new TextField();
   f.add(new Label("좋아하는 선수를 여러명 선택하세요"), "North");
   f.add(lstSunsu, "Center");
   f.add(tf, "South");
   f.setSize(200, 300);
   f.setVisible(true);
 }
Example #21
0
  public static void main(String[] args) {
    Frame fr = new Frame();
    fr.setSize(300, 300);
    fr.setVisible(true);
    fr.addWindowListener(new MyWindowListener());
    // fr.setIconImage(new ImageIcon( "e:\\3.gif").getImage());

  }
Example #22
0
 public static void main(String[] args) {
   // TODO 自动生成的方法存根
   int pause = 5;
   int grid = 8;
   Frame f = new ColorBoxes2(pause, grid);
   f.setSize(500, 400);
   f.setVisible(true);
 }
Example #23
0
 public void init() {
   f.setLayout(null);
   b1.setBounds(20, 30, 90, 28);
   f.add(b1);
   b2.setBounds(50, 45, 120, 35);
   f.add(b2);
   f.setBounds(50, 50, 200, 100);
   f.setVisible(true);
 }
 public static void main(String[] args) {
   Frame frame = new Frame("Test");
   ScrollPane scrollPane = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS);
   scrollPane.add(new TextField(20));
   scrollPane.add(new Button("hit me"));
   frame.add(scrollPane);
   frame.setBounds(100, 100, 250, 250);
   frame.setVisible(true);
 }
  public static void main(String args[]) {
    Frame f = new SampleFrame("File Dialog Demo");
    f.setVisible(true);
    f.setSize(200, 200);

    FileDialog fd = new FileDialog(f, "File Dialog");

    fd.setVisible(true);
  }
Example #26
0
 public static void main(String[] args) {
   Frame f = new Frame("Test");
   Button b = new Button("Press me!");
   Monitor bh = new Monitor();
   b.addActionListener(bh);
   f.add(b, BorderLayout.CENTER);
   f.pack();
   f.setVisible(true);
 }
Example #27
0
  public Webcam(Player _player) {
    f = new Frame("SwingCapture");

    setLayout(new BorderLayout());
    setSize(640, 480);
    this.player = _player;
    Component comp;

    try {
      if ((comp = player.getVisualComponent()) != null) {
        add(comp, BorderLayout.CENTER);
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    f.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            f.dispose();
            // playerclose();
            // System.exit(0);
          }
        });

    f.add("Center", this);
    f.pack();
    f.setSize(new Dimension(640, 480));
    f.setVisible(true);

    FormatControl formatControl =
        (FormatControl) player.getControl("javax.media.control.FormatControl");
    // player.stop();
    Component co = formatControl.getControlComponent();
    if (co != null) {
      player.stop();
      JDialog d = new JDialog(f, "Format Control", true);
      f.add(co);
      f.pack();
      f.setLocationRelativeTo(f);
      f.setVisible(true);
      f.dispose();
      player.start();
    }
  }
Example #28
0
 public static void main(String[] args) {
   Frame f = new Frame("Viewer");
   Viewer view = new Viewer();
   f.addWindowListener(view);
   f.add(view);
   f.setSize(300, 300);
   view.init();
   view.start();
   f.setVisible(true);
 }
Example #29
0
 MyF2() {
   Frame f = new Frame("graphics");
   Button b = new Button("line");
   f.add(m);
   f.add(b);
   b.addActionListener(this);
   f.setSize(400, 400);
   f.setLayout(new GridLayout(2, 1));
   f.setVisible(true);
 }
  public void execute(TokenScanner paramTokenScanner, JavaBackEnd jbe) {
    paramTokenScanner.verifyToken("(");
    boolean value = nextBoolean(paramTokenScanner);
    paramTokenScanner.verifyToken(")");

    Frame consoleFrame = jbe.getJBEConsoleFrame();
    if (consoleFrame != null) {
      consoleFrame.setVisible(value);
    }
  }