Exemplo n.º 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);
  }
Exemplo n.º 2
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();
 }
Exemplo n.º 3
0
 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);
 }
Exemplo n.º 4
0
  @SuppressWarnings("deprecation")
  public static void main(String[] args) {
    System.out.println("");
    for (int i = 0; i < credits.length; i++) System.out.println(credits[i]);
    System.out.println("");

    try {
      java.awt.Frame f = new java.awt.Frame(credits[0]);
      f.setLayout(new java.awt.GridLayout(credits.length, 1));
      for (int i = 0; i < credits.length; i++)
        f.add(new java.awt.Label(credits[i], java.awt.Label.CENTER));
      f.pack();
      java.awt.Toolkit t = f.getToolkit();
      f.setLocation(
          (t.getScreenSize().width - f.getSize().width) / 2,
          (t.getScreenSize().height - f.getSize().height) / 2);
      f.addWindowListener(
          new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent e) {
              System.exit(0);
            } // end windowClosed
          }); // end WindowAdapter
      f.show();
    } // end try
    catch (Exception e) {
    }
  } // end main
Exemplo n.º 5
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);
  }
Exemplo n.º 6
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);
	}
Exemplo n.º 7
0
 /*    */ public static void main(String[] args) /*    */ {
   /* 59 */ System.out.println("");
   /* 60 */ for (int i = 0; i < credits.length; i++) /* 61 */ System.out.println(credits[i]);
   /* 62 */ System.out.println("");
   /*    */ try
   /*    */ {
     /* 65 */ Frame f = new Frame(credits[0]);
     /* 66 */ f.setLayout(new GridLayout(credits.length, 1));
     /* 67 */ for (int i = 0; i < credits.length; i++) /* 68 */ f.add(new Label(credits[i], 1));
     /* 69 */ f.pack();
     /* 70 */ Toolkit t = f.getToolkit();
     /* 71 */ f.setLocation(
         (t.getScreenSize().width - f.getSize().width) / 2,
         (t.getScreenSize().height - f.getSize().height) / 2);
     /* 72 */ f.addWindowListener(
         new WindowAdapter() {
           /*    */ public void windowClosing(WindowEvent e) {
             /* 74 */ System.exit(0);
             /*    */ }
           /* 76 */ });
     /* 77 */ f.show();
     /*    */ }
   /*    */ catch (Exception localException) {
   }
   /*    */ }
Exemplo n.º 8
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()
Exemplo n.º 9
0
 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));
 }  
Exemplo n.º 10
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);
 }
Exemplo n.º 11
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);
 }
Exemplo n.º 12
0
 public static void main(String[] args) {
   Frame frame = new Frame("GridLayout");
   frame.setLayout(new GridLayout(3, 5, 10, 15));
   TextField tf = new TextField("Default Text");
   for (int i = 0; i < 15; i++) {
     frame.add(new Button(Integer.toHexString(i)));
   }
   frame.setVisible(true);
   frame.setSize(300, 400);
 }
  public static void main(String s[]) {
    initParams(s);
    initAdapters();
    f = new Frame();
    final int[] modifiers = {InputEvent.SHIFT_MASK, InputEvent.CTRL_MASK};
    final String[] modifierNames = {"InputEvent.SHIFT_MASK", "InputEvent.CTRL_MASK"};
    f.setLayout(new FlowLayout());
    f.addMouseWheelListener(
        new MouseWheelListener() {
          public void mouseWheelMoved(MouseWheelEvent e) {
            System.out.println("WHEEL " + e);
          }
        });
    f.setSize(300, 300);
    f.setVisible(true);

    try {
      robot = new Robot();
      robot.delay(500);
      robot.mouseMove(
          f.getLocationOnScreen().x + f.getWidth() / 2,
          f.getLocationOnScreen().y + f.getHeight() / 2);
      if (autorun) {
        // testing buttons 1, 2, 3 only
        testPlainButtons();
        robot.delay(500);

        // testing buttons 1, 2, 3 with SHIFT, CTRL, ALT keyboard modifiers
        testButtonsWithShift();
        robot.delay(500);

        testButtonsWithControl();
        robot.delay(500);

        testButtonsWithAlt();
        robot.delay(500);
      } else {
        switch (testModifier) {
          case SHIFT:
            f.addMouseListener(adapterTest2);
            break;
          case CTRL:
            f.addMouseListener(adapterTest3);
            break;
          case ALT:
            f.addMouseListener(adapterTest4);
            break;
          default: // NONE inclusive
            f.addMouseListener(adapterTest1);
        }
      }
    } catch (Exception e) {
      throw new RuntimeException("Test failed.");
    }
  }
Exemplo n.º 14
0
  @Test
  public void testWindowParenting04ReparentNewtWin2TopLayouted() 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");
    frame.setLayout(new BorderLayout());
    frame.add(new Button("North"), BorderLayout.NORTH);
    frame.add(new Button("South"), BorderLayout.SOUTH);
    frame.add(new Button("East"), BorderLayout.EAST);
    frame.add(new Button("West"), BorderLayout.WEST);
    frame.setSize(width, height);
    frame.setLocation(640, 480);
    frame.setVisible(true);

    frame.add(newtCanvasAWT, BorderLayout.CENTER);
    Assert.assertEquals(newtCanvasAWT.getNativeWindow(), glWindow1.getParentNativeWindow());

    Animator animator1 = new Animator(glWindow1);
    animator1.start();

    int state = 0;
    while (animator1.isAnimating() && animator1.getDuration() < 3 * durationPerTest) {
      Thread.sleep(durationPerTest);
      switch (state) {
        case 0:
          glWindow1.reparentWindow(null, null);
          Assert.assertEquals(true, glWindow1.isNativeWindowValid());
          Assert.assertNull(glWindow1.getParentNativeWindow());
          break;
        case 1:
          glWindow1.reparentWindow(newtCanvasAWT.getNativeWindow(), null);
          Assert.assertEquals(true, glWindow1.isNativeWindowValid());
          Assert.assertEquals(newtCanvasAWT.getNativeWindow(), glWindow1.getParentNativeWindow());
          break;
      }
      state++;
    }

    animator1.stop();
    Assert.assertEquals(false, animator1.isAnimating());

    frame.dispose();
    glWindow1.destroy(true);
  }
Exemplo n.º 15
0
  public static void main(String[] args) {
    GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice displayDevice = environment.getDefaultScreenDevice();

    frame = new Frame(displayDevice.getDefaultConfiguration());
    frame.setBackground(new Color(0xCC, 0xCC, 0xCC));
    frame.setTitle("TestBug735Inv0AppletAWT");

    try {
      Class<?> c =
          Thread.currentThread()
              .getContextClassLoader()
              .loadClass(Bug735Inv0AppletAWT.class.getName());
      applet = (Bug735Inv0AppletAWT) c.newInstance();
    } catch (Exception e) {
      throw new RuntimeException(e);
    }

    frame.setLayout(null);
    frame.add(applet);
    frame.pack();
    frame.setResizable(false);

    applet.init();

    Insets insets = frame.getInsets();
    int windowW = applet.width + insets.left + insets.right;
    int windowH = applet.height + insets.top + insets.bottom;
    frame.setSize(windowW, windowH);

    Rectangle screenRect = displayDevice.getDefaultConfiguration().getBounds();
    frame.setLocation(
        screenRect.x + (screenRect.width - applet.width) / 2,
        screenRect.y + (screenRect.height - applet.height) / 2);

    int usableWindowH = windowH - insets.top - insets.bottom;
    applet.setBounds(
        (windowW - applet.width) / 2,
        insets.top + (usableWindowH - applet.height) / 2,
        applet.width,
        applet.height);

    // This allows to close the frame.
    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });

    applet.initGL();
    frame.setVisible(true);
    applet.start();
  }
Exemplo n.º 16
0
  public void init() {
    f = new Frame("My frame");
    f.setBounds(300, 100, 600, 500);
    f.setLayout(new FlowLayout());

    b = new Button("MyButton");

    f.add(b);
    // 加载事件
    myEvent();
    f.setVisible(true);
  }
Exemplo n.º 17
0
  /**
   * Creates a new SWT {@link Composite} with this <code>ViewAppState</code> embedded within it.
   * This method gets an {@link VizEmbeddedView} from the {@link MasterApplication}, connects with
   * that view, and embeds that view in the <code>Composite</code>.
   *
   * @param parent The parent <code>Composite</code>.
   * @return The <code>Composite</code> that has an embedded jME view managed by this <code>
   *     ViewAppState</code>. This <code>Composite</code>'s layout should be set by the caller.
   *     <b>This <code>Composite</code> should be disposed when it is no longer required</b>.
   */
  public Composite createComposite(Composite parent) {

    // Set the default return value and check the parameter.
    Composite composite = null;
    if (parent != null && embeddedView == null) {

      // Get an EmbeddedView that uses the app for rendering.
      embeddedView = app.getEmbeddedView();

      // Create the embedded Composite. When it is disposed, the
      // associated EmbeddedView should be released.
      composite =
          new Composite(parent, SWT.EMBEDDED) {
            @Override
            public void dispose() {
              // Dispose of resources tied with this specific view.
              disposeView(embeddedView);
              super.dispose();
            }
          };
      // Create the AWT frame inside the SWT.EMBEDDED Composite.
      Frame embeddedFrame = SWT_AWT.new_Frame(composite);
      // Add the AwtPanel to the embedded AWT Frame. The panel needs to
      // fill the Frame.
      embeddedFrame.setLayout(new BorderLayout());
      // Attach the EmbeddedView to the embedded Frame.
      embeddedView.addToEmbeddedFrame(embeddedFrame);
      embeddedFrame.pack();
      embeddedFrame.setVisible(true);

      // Wait for a maximum of 5 seconds if the view has not been
      // initialized yet. The ViewAppState must be initialized!!!
      int limit = 5000;
      int count = 0;
      while (!isInitialized() && count < limit) {
        try {
          Thread.sleep(50);
          count += 50;
        } catch (InterruptedException e) {
          logger.error(getClass().getName() + " Exception!", e);
        }
      }

      // Register with the EmbeddedView.
      embeddedView.registerViewClient(this);

      // Make sure the controls are enabled.
      enableControls();
    }

    return composite;
  }
Exemplo n.º 18
0
 public static void main(String[] args) {
   Frame f = new Frame("测试窗口");
   // 设置Frame容器使用FlowLayout布局管理器
   f.setLayout(new FlowLayout(FlowLayout.LEFT, 20, 5));
   // 向窗口中添加10个按钮
   for (int i = 0; i < 10; i++) {
     f.add(new Button("按钮" + i));
   }
   // 设置窗口为最佳大小
   f.pack();
   // 将窗口显示出来(Frame对象默认处于隐藏状态)
   f.setVisible(true);
 }
  @Override
  public void createPartControl(Composite parent) {
    ListenerStore.addListener(this);
    plate = new Composite(parent, SWT.EMBEDDED | SWT.NO_BACKGROUND);
    frame = SWT_AWT.new_Frame(plate);
    frame.setLayout(new java.awt.GridLayout(1, 1));
    // panel = new JPanel();

    tabbedPane = new JTabbedPane();
    tabbedPane.setTabPlacement(JTabbedPane.LEFT);

    frame.add(tabbedPane);
  }
Exemplo n.º 20
0
  public Bai2() {

    lbNumber1.setText("a =");
    lbNumber2.setText("b =");
    lbResult.setText("Kết quả:");
    txtNumber1.setText("0");
    txtNumber2.setText("0");
    txtResult.setText("0");
    btResult.setLabel("Thực hiện");
    choCalculator.add("Cộng");
    choCalculator.add("Trừ");
    choCalculator.add("Nhân");
    choCalculator.add("Chia");
    choCalculator.add("UCLN");
    choCalculator.add("BCNN");

    frMain.setBounds(100, 100, 400, 300);
    frMain.setBackground(Color.LIGHT_GRAY);
    frMain.setLayout(null);

    lbNumber1.setBounds(30, 50, 50, 20);
    lbNumber2.setBounds(30, 70, 50, 20);
    lbResult.setBounds(30, 140, 50, 20);

    choCalculator.setBounds(300, 70, 60, 20);

    btResult.setBounds(100, 100, 100, 20);

    txtNumber1.setBounds(100, 50, 150, 20);
    txtNumber2.setBounds(100, 70, 150, 20);
    txtResult.setBounds(100, 140, 150, 20);

    frMain.add(lbNumber1);
    frMain.add(lbNumber2);
    frMain.add(lbResult);
    frMain.add(txtNumber1);
    frMain.add(txtNumber2);
    frMain.add(txtResult);
    frMain.add(btResult);
    frMain.add(choCalculator);

    btResult.addActionListener(new ProcessButton());

    frMain.addWindowListener(
        new WindowAdapter() {
          public void windowsClosing(WindowEvent evt) {
            System.exit(0);
          }
        });
  }
Exemplo n.º 21
0
  /** Prepare the window that shall show the openGL content. */
  private void initWindow() {
    IllarionLookAndFeel.setupLookAndFeel();
    // create canvas that shall show the openGL content
    display = Graphics.getInstance().getRenderDisplay();
    display.getRenderArea().setBackground(Color.red);

    configChanged(IllaClient.getCfg(), CFG_RESOLUTION);

    final Component displayParent = display.getRenderArea();
    displayParent.setBackground(Color.green);
    displayParent.setVisible(true);

    // set up the window settings
    displayFrame = new Frame();
    displayFrame.setLayout(new BorderLayout(0, 0));
    displayFrame.setTitle(IllaClient.getVersionText());
    displayFrame.setBackground(Color.black);

    setIcon(displayFrame);

    displayFrame.addWindowListener(new ClientWindowListener());
    displayFrame.setResizable(false);
    displayFrame.setFocusable(false);
    displayFrame.setFocusableWindowState(true);
    displayFrame.setFocusTraversalKeysEnabled(false);
    displayParent.setFocusable(true);
    displayParent.setFocusTraversalKeysEnabled(false);

    // add the canvas to the window and make the canvas the openGL render
    // target.
    displayFrame.add(displayParent, BorderLayout.CENTER);
    displayFrame.pack();

    displayFrame.setLocationRelativeTo(null);
    displayFrame.setVisible(true);

    displayParent.requestFocusInWindow();

    final RenderDisplay usedDisplay = display;
    Graphics.getInstance()
        .getRenderManager()
        .addTask(
            new RenderTask() {
              @Override
              public boolean render(final int delta) {
                usedDisplay.startRendering();
                return false;
              }
            });
  }
Exemplo n.º 22
0
 public void start() {
   // Get things going.  Request focus, set size, et cetera
   setSize(200, 200);
   setVisible(true);
   validate();
   Frame f = new Frame("Set action for Robot here.");
   f.setLayout(new FlowLayout());
   f.add(buttonNumber);
   f.add(pressOn);
   f.add(releaseOn);
   f.add(clickOn);
   f.add(target);
   f.pack();
   f.setVisible(true);
 } // start()
Exemplo n.º 23
0
  public static void main(String[] args) {

    Frame frame = new Frame();
    frame.setSize(400, 200);
    frame.setLocation(200, 100);
    frame.setIconImage(Toolkit.getDefaultToolkit().createImage("src/day20_GUI/png-0015.png"));
    frame.setTitle("这是标题"); // 设置标题

    frame.setLayout(new FlowLayout()); // 将Frame布局设置为流式布局

    Button button = new Button("这是一个按钮");
    frame.add(button); // Frame默认布局是BorderLayout边界布局, 我们未指定放在哪个位置, 默认是Center

    frame.setVisible(true); // 设置窗口可见
  }
Exemplo n.º 24
0
 public static void main(String[] args) {
   Frame f = new Frame("测试窗口");
   // 设置Frame容器使用BorderLayout布局管理器
   f.setLayout(new BorderLayout(30, 5));
   f.add(new Button("南"), SOUTH);
   f.add(new Button("北"), NORTH);
   // 默认添加到中间
   f.add(new Button("中"));
   f.add(new Button("东"), EAST);
   f.add(new Button("西"), WEST);
   // 设置窗口为最佳大小
   f.pack();
   // 将窗口显示出来(Frame对象默认处于隐藏状态)
   f.setVisible(true);
 }
Exemplo n.º 25
0
 /** ClipboardTest constructor comment. */
 public DictAWTView(String cfg) {
   super();
   IDictEngine e = org.dict.server.DatabaseFactory.getEngine(cfg);
   this.engine = e;
   f = new Frame("Dictionary lookup");
   f.setSize(600, 400);
   f.setLayout(new BorderLayout());
   ta = new TextArea();
   ta.setBackground(Color.white);
   ta.setForeground(Color.black);
   ta.addMouseListener(new ML());
   ta.addFocusListener(new FL());
   Button prev = new Button("History");
   prev.addActionListener(new History());
   mode = new Checkbox("Automatic", false);
   db = new Choice();
   for (int i = 0; i < e.getDatabases().length; i++) {
     db.add(e.getDatabases()[i].getName());
   }
   db.add("Any database");
   fontChoice = new Choice();
   fontChoice.add("serif");
   fontChoice.add("monospaced");
   fontChoice.add("dialog");
   fontChoice.addItemListener(new IL());
   sizeChoice = new Choice();
   sizeChoice.add("10");
   sizeChoice.add("12");
   sizeChoice.add("15");
   sizeChoice.addItemListener(new IL());
   Panel north = new Panel();
   north.setBackground(Color.lightGray);
   north.add(mode);
   north.add(db);
   north.add(fontChoice);
   north.add(sizeChoice);
   north.add(prev);
   f.add(north, "North");
   f.add(ta, "Center");
   f.addWindowListener(
       new WindowAdapter() {
         @Override
         public void windowClosing(WindowEvent e) {
           System.exit(0);
         }
       });
   f.setVisible(true);
 }
  private void createPlayerFrame() {
    if (playerFrame == null) {
      GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
      GraphicsDevice[] gs = ge.getScreenDevices();

      GraphicsDevice graphicsDevice =
          (screenNumber >= 0 && screenNumber < gs.length) ? gs[screenNumber] : gs[0];

      playerFrame = new Frame(graphicsDevice.getDefaultConfiguration());
      playerFrame.setLayout(new BorderLayout());
      playerFrame.setUndecorated(true);
      playerFrame.setExtendedState(Frame.MAXIMIZED_BOTH);
      playerFrame.setBackground(new java.awt.Color(0, 0, 0));
      playerFrame.setVisible(true);
    }
  }
Exemplo n.º 27
0
  public static void main(String args[]) {
    Frame f = new Frame();
    f.setLayout(new GridLayout(2, 2));
    Label l = new Label("Name");
    TextField t = new TextField();
    Label l1 = new Label("Regno");
    TextField t1 = new TextField();

    f.add(l);

    f.add(t);
    f.add(l1);
    f.add(t1);
    f.setSize(300, 300);
    f.setVisible(true);
  }
Exemplo n.º 28
0
 public static void main(String[] args) {
   Frame f = new Frame();
   f.setLocation(300, 200);
   f.setSize(200, 200);
   f.setLayout(null); // 取消布局管理器
   bt.addMouseListener(new MouseMove()); // 注册鼠标事件监听器
   bt.setBackground(Color.cyan);
   bt.setBounds(new Rectangle(45, 100, 90, 30));
   f.add(bt);
   f.pack();
   f.addWindowListener(
       new WindowAdapter() { // 关闭窗口
         public void windowClosing(WindowEvent e) {
           System.exit(0);
         }
       });
   f.setVisible(true); // 设置窗体可见
 }
Exemplo n.º 29
0
  public void createGUI() {

    frame = new Frame();
    frame.setTitle("KeyMaskTest");
    frame.setLayout(new GridLayout(1, 6));

    button = new Button();
    button.addKeyListener(this);
    frame.add(button);

    buttonLW = new LWButton();
    buttonLW.addKeyListener(this);
    frame.add(buttonLW);

    textField = new TextField(5);
    textField.addKeyListener(this);
    frame.add(textField);

    textArea = new TextArea(5, 5);
    textArea.addKeyListener(this);
    frame.add(textArea);

    list = new List();
    for (int i = 1; i <= 5; ++i) {
      list.add("item " + i);
    }
    list.addKeyListener(this);
    frame.add(list);

    listLW = new LWList();
    for (int i = 1; i <= 5; ++i) {
      listLW.add("item " + i);
    }
    listLW.addKeyListener(this);
    frame.add(listLW);

    frame.setBackground(Color.gray);
    frame.setSize(500, 100);
    frame.setVisible(true);
    frame.toFront();
  }
Exemplo n.º 30
0
  /**
   * Construct a {@link LabelControlKeyboard} to parse keypresses and generate servo commands.
   *
   * @param out Node to send {@link ImageData}s to.
   */
  public LabelControlKeyboard(final Node out) {
    super(out);
    System.out.println("Initializing LabelControlKeyboard");
    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            frame.setVisible(false);
          }
        });

    frame.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            // System.out.println("Keyboard: key pressed");
            switch (e.getKeyCode()) {
              case KeyEvent.VK_UP:
                {
                  System.out.println("LabelControlKeyboard: time between sends up");
                  out.process(ImageDataManip.create(Command.TIME_UP, 0));
                  break;
                }
              case KeyEvent.VK_DOWN:
                {
                  System.out.println("LabelControlKeyboard: time between sends down");
                  out.process(ImageDataManip.create(Command.TIME_DOWN, 0));
                  break;
                }
              default:
                {
                }
            }
          }
        });
    frame.setLayout(new GridLayout(3, 1));
    frame.add(new java.awt.Label("LABEL CONTROLS:  "));
    frame.add(new java.awt.Label("Increase time: Arrow Up"));
    frame.add(new java.awt.Label("Decrease time: Arrow Down"));
    frame.pack();
    frame.setVisible(true);
  }