// Color gre;
  Rules(String se) {
    email = se;
    conti = new Button("Continue");
    rules = new Button("ClicK Here For Rules");
    p1 = new JOptionPane();
    Icon image = new ImageIcon("books.jpg");
    Icon image1 = new ImageIcon("girl.jpg");
    Icon image2 = new ImageIcon("uit.jpg");
    gl = new GridBagLayout();
    gbc = new GridBagConstraints();
    conti.addActionListener(this);
    rules.addActionListener(this);
    // gre=new Color(117,102,185);
    p = new Panel();
    p2 = new Panel();
    p3 = new Panel();
    p4 = new Panel();
    f = new Frame();
    pic = new JLabel(image);
    pic1 = new JLabel(image1);
    pic2 = new JLabel(image2);
    gbc.anchor = GridBagConstraints.SOUTHWEST;
    gl.setConstraints(pic1, gbc);
    gbc.anchor = GridBagConstraints.SOUTHEAST;
    gl.setConstraints(pic, gbc);
    Insets is = new Insets(30, 30, 30, 30);
    gbc.insets = is;
    gbc.ipadx = 14;
    gbc.ipady = 8;
    gl.setConstraints(rules, gbc);
    gl.setConstraints(conti, gbc);
    p2.setLayout(gl);
    p4.add(pic2);
    p2.add(pic);
    p3.setLayout(gl);
    p3.add(pic1);
    p.add(conti);
    p.add(rules);
    p.setLayout(gl);
    f.add(p4, "North");
    f.add(p3, "East");
    f.add(p2, "West");

    f.add(p, "Center");
    f.setTitle("RULES BOOK");
    // f.setBackground(gre);
    f.setVisible(true);
    f.setSize(900, 600);
    f.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent we) {
            System.exit(0);
          }
        });
  }
Example #2
0
  public CollageList() {
    super();

    actionComponent = new Button();

    Panel toolBar;

    setLayout(new BorderLayout());
    //		ggHScroll	= new Scrollbar( Scrollbar.HORIZONTAL, 0, 0x8000, 0, 0x8000 );
    ggVScroll = new Scrollbar(Scrollbar.VERTICAL, 0, 0x8000, 0, 0x8000);
    //		ggHScroll.addAdjustmentListener( ggCurve );
    ggVScroll.addAdjustmentListener(this);

    toolBar = new Panel();
    toolBar.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 2));
    ggAdd = new JButton("    Add    ");
    ggDel = new JButton("  Delete  ");
    ggDup = new JButton(" Duplicate ");
    ggAdd.addActionListener(this);
    ggDel.addActionListener(this);
    ggDup.addActionListener(this);
    toolBar.add(ggAdd);
    toolBar.add(ggDel);
    toolBar.add(ggDup);

    add(toolBar, BorderLayout.NORTH);
    //		add( ggHScroll, BorderLayout.SOUTH );
    add(ggVScroll, BorderLayout.EAST);
    add(new CollageCanvas(this), BorderLayout.CENTER);
    //		add( ggCurve,   BorderLayout.CENTER );
  }
 public ButtonPanel() {
   int buttonPanelOrient = FlowLayout.CENTER;
   setLayout(new BorderLayout(0, 5));
   buttonPanelOrient = FlowLayout.CENTER;
   buttonPanel.setLayout(new FlowLayout(buttonPanelOrient));
   add(separator, "North");
   add(buttonPanel, "Center");
 }
 /** Component initialization */
 private void jbInit() throws Exception {
   contentPane = (JPanel) this.getContentPane();
   contentPane.setLayout(bd);
   ThreadPanel tp1 = new ThreadPanel("Passengers", Color.blue);
   ThreadPanel tp2 = new ThreadPanel("Car(2)", Color.blue);
   ThreadPanel tp3 = new ThreadPanel("Car(3)", Color.blue);
   NumberCanvas nc1 = new NumberCanvas("Platform");
   NumberCanvas nc2 = new NumberCanvas("In Car(2)");
   NumberCanvas nc3 = new NumberCanvas("In Car(3)");
   Panel p1 = new Panel();
   p1.setLayout(new BorderLayout());
   Panel p2 = new Panel();
   p2.setLayout(new BorderLayout());
   Panel p3 = new Panel();
   p3.setLayout(new BorderLayout());
   p1.add(nc1, BorderLayout.CENTER);
   p1.add(tp1, BorderLayout.SOUTH);
   p2.add(nc2, BorderLayout.CENTER);
   p2.add(tp2, BorderLayout.SOUTH);
   p3.add(nc3, BorderLayout.CENTER);
   p3.add(tp3, BorderLayout.SOUTH);
   Panel grid = new Panel();
   grid.setLayout(new GridLayout(1, 3));
   grid.add(p1);
   grid.add(p2);
   grid.add(p3);
   contentPane.add(grid, BorderLayout.CENTER);
   // construct threads, monitor & go button
   final Controller c = new Controller(nc1);
   final PlatformAccess pa = new PlatformAccess();
   Button go = new Button("Go Now");
   go.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           c.goNow();
         }
       });
   contentPane.add(go, BorderLayout.SOUTH);
   tp1.start(new Passengers(c));
   tp2.start(new CoasterCar(2, c, pa, nc2));
   tp3.start(new CoasterCar(3, c, pa, nc3));
   this.setSize(new Dimension(470, 350));
   this.setTitle("Roller Coaster Laboratory Exercise");
 }
 public void buildChooser() {
   Panel panel = new Panel();
   panel.setLayout(new GridLayout());
   for (int i = 1; i <= 3; i++) {
     for (int x = 1; x <= 2; x++) {
       panel.add(addButton(i * x + "", Color.yellow));
     }
   }
   add(panel);
 }
Example #6
0
  Board() {
    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            exit();
          }
        });
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    setSize(screenSize);
    setLocation(0, 0);
    r3 = Math.sqrt(3);
    Button ng, eg, ab;
    ng = new Button("New Game");
    eg = new Button("Exit Game");
    ab = new Button("About");
    gold = new ImageIcon("./coin2.jpg").getImage();
    silver = new ImageIcon("./coin1.jpg").getImage();
    Panel pan = new Panel();
    pan.setLayout(new FlowLayout());
    pan.add(ng);
    pan.add(eg);
    pan.add(ab);
    setLayout(new BorderLayout());
    add(pan, BorderLayout.NORTH);

    newGame();
    ng.addActionListener(this);
    eg.addActionListener(this);
    ab.addActionListener(this);

    addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            int mx = e.getX(), my = e.getY();
            place(mx, my);
          }
        });
  }
  // initialize client UI
  private void initComponents() {
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    setTitle("Distributed Hash Table Client");
    keyBox = new JTextField(7);
    valueBox = new JTextField(15);
    serverBox = new JTextField(2);
    keyLabel = new JLabel("Key: ");
    keyLabel.setLabelFor(keyBox);
    valueLabel = new JLabel("Value: ");
    valueLabel.setLabelFor(valueBox);
    serverLabel = new JLabel("Server Id: ");
    serverLabel.setLabelFor(serverBox);
    serverOutput = new JLabel("Server Output:");

    JPanel pane = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 0;
    c.gridy = 0;
    pane.add(keyLabel, c);
    c.gridx = 1;
    pane.add(keyBox, c);

    c.gridx = 0;
    c.gridy = 1;
    pane.add(valueLabel, c);
    c.gridx = 1;
    pane.add(valueBox, c);

    c.gridx = 0;
    c.gridy = 2;
    pane.add(serverLabel, c);
    c.gridx = 1;
    pane.add(serverBox, c);

    RadioListener radioListener = new RadioListener();
    actionGroup = new ButtonGroup();
    insertRadionButton = new JRadioButton("Insert");
    insertRadionButton.setSelected(true);
    insertRadionButton.setActionCommand("insert");
    insertRadionButton.addActionListener(radioListener);
    lookupRadionButton = new JRadioButton("Lookup");
    lookupRadionButton.setActionCommand("lookup");
    lookupRadionButton.addActionListener(radioListener);
    deleteRadionButton = new JRadioButton("Delete");
    deleteRadionButton.setActionCommand("delete");
    deleteRadionButton.addActionListener(radioListener);
    countRadionButton = new JRadioButton("Count");
    countRadionButton.setActionCommand("count");
    countRadionButton.addActionListener(radioListener);
    actionGroup.add(insertRadionButton);
    actionGroup.add(lookupRadionButton);
    actionGroup.add(deleteRadionButton);
    actionGroup.add(countRadionButton);

    c.gridx = 2;
    c.gridy = 0;
    pane.add(insertRadionButton, c);
    c.gridy = 1;
    pane.add(lookupRadionButton, c);
    c.gridy = 2;
    pane.add(deleteRadionButton, c);
    c.gridy = 3;
    pane.add(countRadionButton, c);

    execButton = new JButton("Execute");
    execButton.addActionListener(new ExecButtonListener());
    c.gridx = 3;
    c.gridy = 0;
    pane.add(execButton, c);

    purgeButton = new JButton("Purge");
    purgeButton.addActionListener(new PurgeButtonListener());
    c.gridx = 3;
    c.gridy = 2;
    pane.add(purgeButton, c);

    resultArea = new JTextArea(28, 70);
    resultArea.setEditable(false);
    scrollingArea = new JScrollPane(resultArea);

    upperPanel = new Panel(new BorderLayout());
    upperPanel.add(pane, BorderLayout.CENTER);

    resultPanel = new Panel();
    resultPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
    resultPanel.add(serverOutput);
    resultPanel.add(scrollingArea);

    add(upperPanel, BorderLayout.NORTH);
    add(resultPanel, BorderLayout.CENTER);
    setSize(800, 600);
    this.setVisible(true);
  }
Example #8
0
  void launch() {
    f.setSize(800, 800);
    p.setLayout(null);

    l1.setBounds(600, 10, 150, 36);

    l2.setBounds(100, 30, 400, 70);
    l13.setBounds(2, 90, 1200, 20);

    l14.setBounds(80, 150, 250, 30);
    t1.setBounds(330, 150, 150, 30);
    b1.setBounds(500, 150, 100, 30);
    l15.setBounds(2, 200, 1200, 20);

    b6.setBounds(600, 50, 100, 30);
    l3.setBounds(100, 250, 100, 30);
    t2.setBounds(300, 250, 150, 30);
    l4.setBounds(100, 300, 150, 30);
    t3.setBounds(300, 300, 150, 30);
    l5.setBounds(100, 350, 150, 30);
    t4.setBounds(300, 350, 150, 30);
    l6.setBounds(100, 400, 100, 30);
    t5.setBounds(300, 400, 150, 30);
    l7.setBounds(100, 450, 100, 30);
    c1.setBounds(300, 450, 60, 30);
    c2.setBounds(400, 450, 60, 30);
    l8.setBounds(100, 500, 100, 30);
    t6.setBounds(300, 500, 150, 30);
    l9.setBounds(100, 550, 100, 30);
    t7.setBounds(300, 550, 150, 30);
    l10.setBounds(100, 600, 120, 30);
    t8.setBounds(300, 600, 150, 30);

    l11.setBounds(100, 650, 100, 30);
    t9.setBounds(300, 650, 150, 30);
    l12.setBounds(100, 700, 150, 30);
    t10.setBounds(300, 700, 150, 30);
    b2.setBounds(500, 400, 100, 30);
    b3.setBounds(500, 500, 100, 30);
    b4.setBounds(500, 600, 100, 30);
    b5.setBounds(650, 150, 100, 30);

    b1.addActionListener(this);
    b2.addActionListener(this);
    b3.addActionListener(this);
    b4.addActionListener(this);
    b5.addActionListener(this);
    b6.addActionListener(this);
    c1.addItemListener(this);
    c2.addItemListener(this);

    p.add(l1);
    p.add(l2);
    p.add(l13);
    p.add(l14);
    p.add(t1);
    p.add(b1);
    p.add(l15);
    p.add(b5);
    p.add(b6);

    f.add(p);

    f.setVisible(true);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }