Beispiel #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);
  }
 @SuppressWarnings({"boxing"})
 public void show(Point point, Vehicle vehicle) {
   final String exitString;
   if (vehicle.exitRoadSegmentId() == Vehicle.ROAD_SEGMENT_ID_NOT_SET) {
     exitString = this.trafficCanvas.popupStringExitEndRoad;
   } else {
     exitString = this.trafficCanvas.roadNetwork.findById(vehicle.exitRoadSegmentId()).userId();
   }
   final PhysicalQuantities vehiclePhysical = vehicle.physicalQuantities();
   final String string =
       String.format(
           this.trafficCanvas.popupString,
           vehicle.getId(),
           vehicle.getLabel(),
           vehicle.lane(),
           vehiclePhysical.getFrontPosition(),
           vehiclePhysical.getSpeed() * Units.MS_TO_KMH,
           vehiclePhysical.getAcc(),
           vehicle.totalTravelDistance(),
           exitString);
   final Label label = new Label(string, Label.LEFT);
   label.setBackground(new Color(200, 220, 240));
   removeAll();
   add(label);
   pack();
   final Point screenLocation = owner.getLocationOnScreen();
   setLocation(point.x + screenLocation.x + 15, point.y + screenLocation.y + 90);
   currentPopupId = vehicle.getId();
   setVisible(true);
   final PopupTimer popupTimer = new PopupTimer();
   popupTimer.start(currentPopupId);
 }
Beispiel #3
0
  @Override
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == logout) {
      Main.Frame.setPanel(new LoginPanel());
    }
    /*Ao filtrar por AUTOR*/
    if (e.getSource() == autor) {
      Main.Frame.setPanel(new AutorPanel());
    }

    /*Ao filtrar por TRABALHO ARTISTICO*/
    if (e.getSource() == titulo) {
      Main.Frame.setPanel(new TrabalhoPanel());
    }

    /*Ao filtrar por GÊNERO*/
    if (e.getSource() == genero) {
      genero.setSelected(true);
      autor.setSelected(false);
      titulo.setSelected(false);
      list.removeAll();
      selecionado1.setText("");
      selecionado2.setText("");
      selecionado3.setText("");
      PreencheGenero();
    }

    if (e.getSource() == adicionar) {
      this.setVisible(false);
      Main.Frame.setPanel(new AdicionarPanel());
    }
  }
Beispiel #4
0
  public DialogBox(Frame parent, String frametitle, String line1, String line2) {
    super(parent, frametitle, true);

    GridBagLayout gb = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    setLayout(gb);

    // line 1
    c.gridy = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    Label line1Label = new Label(line1, Label.CENTER);
    gb.setConstraints(line1Label, c);
    line1Label.setForeground(Color.blue);
    line1Label.setFont(new Font("arial", Font.BOLD | Font.ITALIC, 16));
    add(line1Label);

    // line 2
    c.gridy = 1;
    Label line2Label = new Label(line2, Label.CENTER);
    gb.setConstraints(line2Label, c);
    add(line2Label);

    // Button
    c.gridy = 2;
    c.fill = GridBagConstraints.NONE;
    Button okButton = new Button("OK");
    gb.setConstraints(okButton, c);
    okButton.addActionListener(this);
    add(okButton);

    setLocation(400, 200);
    pack();
    setVisible(true);
    toFront();
  }
Beispiel #5
0
  public UserInfoDialog(Frame parent) {
    super(parent, "Input", true);
    setLayout(null);

    l.setFont(default_font);
    l.setSize(50, 30);
    l.setLocation(30, 50);

    name.setFont(default_font);
    name.setSize(150, 30);
    name.setLocation(90, 50);
    // name.selectAll();

    ok.setFont(default_font);
    ok.setSize(50, 30);
    ok.setLocation(30, 90);

    add(l);
    add(name);
    add(ok);
    ok.addActionListener(this);
    setSize(300, 150);

    Point my_loc = parent.getLocation();
    my_loc.x += 50;
    my_loc.y += 150;
    setLocation(my_loc);
    show();
  }
Beispiel #6
0
 public void setResourceAvailable(int i, int newAvailable) {
   Label label = (Label) resourceAvailableLabelVector.elementAt(i);
   Dimension oldSize = label.getSize();
   label.setText(Integer.toString(newAvailable));
   Dimension newSize = label.getMinimumSize();
   if (newSize.width > oldSize.width) label.invalidate();
 }
Beispiel #7
0
  public void itemStateChanged(ItemEvent evt) {
    if (evt.getSource() == farbe) {
      status.setText("Farbe " + farben[farbe.getSelectedIndex()] + " ausgewaehlt");

      switch (farbe.getSelectedIndex()) {
        case 0:
          color = Color.blue;
          break;
        case 1:
          color = Color.yellow;
          break;
        case 2:
          color = Color.green;
          break;
        case 3:
          color = Color.red;
          break;
        case 4:
          color = Color.black;
          break;
        case 5:
          color = Color.white;
      }
    } else if (evt.getSource() == filled) {
      if (filled.getState() == true) status.setText("Ausgefuellt zeichnen");
      else status.setText("Rahmen zeichnen");
    }
  }
Beispiel #8
0
 public void b_1_ActionPerformed(ActionEvent evt) {
   if (von > 0 && bis > 0 && bis > von) {
     l_1.setText("" + randInt(von, bis));
   } else {
     l_1.setText("Error");
   }
 }
  @Override
  public void paint(Graphics g) {
    for (int i = 0; i < 5; i++) {
      g.drawRect(i, i, 410 - 2 * i, 410 - 2 * i);
    }
    if (gameOver) {
      g.setColor(Color.RED);
      g.fillRect(0, 0, 410, 410);
      score.setBackground(Color.RED);
      score.setText("Your score is: " + (int) points);
      score.setSize(160, 20);
      score.setLocation(120, 50);

      record.setBackground(Color.RED);
      record.setSize(160, 20);
      record.setLocation(120, 80);

      tips.setBackground(Color.RED);
      tips.setSize(400, 20);
      tips.setLocation(0, 350);

    } else {
      map.paint(g);
      snake.paint(g);
      food.paint(g);
    }
  }
Beispiel #10
0
  public void mouseReleased(MouseEvent evt) {
    Graphics g = canvas.getGraphics();
    g.setColor(color);
    g.setPaintMode();
    end = evt.getPoint();

    if (type == 0) {
      g.drawRect(start.x, start.y, end.x - start.x, end.y - start.y);

      if (filled.getState() == true) g.fillRect(start.x, start.y, end.x - start.x, end.y - start.y);

      status.setText("2. Ecke des Rechtecks festgelegt");
    } else if (type == 1) {
      int radius;

      radius = (int) Math.sqrt(Math.pow(end.x - start.x, 2) + Math.pow(end.y - start.y, 2));

      g.drawOval(start.x - radius, start.y - radius, 2 * radius, 2 * radius);

      if (filled.getState() == true)
        g.fillOval(start.x - radius, start.y - radius, 2 * radius, 2 * radius);

      status.setText("Radius des Kreises festgelegt");
    } else if (type == 2) {
      g.drawOval(start.x, start.y, end.x - start.x, end.y - start.y);

      if (filled.getState() == true) g.fillOval(start.x, start.y, end.x - start.x, end.y - start.y);

      status.setText("Radius der Ellipse festgelegt");
    }
  }
  private void updateDebugPanelState(String result, boolean debug, boolean test) {
    result = result == null ? "nothing" : result;

    List<Component> componentList = Arrays.asList(getComponents());
    if (!componentList.contains(p_debug)) {

      choice = new Label(String.format("Your choice is: %s", result));
      isDebug = new Label(String.format("Debug mode: %b", debug));
      isTest = new Label(String.format("Test mode: %b", test));
      GridBagLayout layout = new GridBagLayout();
      GridBagConstraints constraints = new GridBagConstraints();
      layout.setConstraints(choice, constraints);
      constraints.gridy = 1;
      layout.setConstraints(isDebug, constraints);
      constraints.gridy = 2;
      layout.setConstraints(isTest, constraints);

      p_debug.setLayout(layout);
      p_debug.add(choice);
      p_debug.add(isDebug);
      p_debug.add(isTest);
      add(p_debug, BorderLayout.SOUTH);

    } else {
      choice.setText(String.format("Your choice is: %s", result));
      isDebug.setText(String.format("Debug mode: %b", debug));
      isTest.setText(String.format("Test mode: %b", test));
    }
  }
Beispiel #12
0
  public void init() {
    GridBagConstraints gbc;
    GridBagLayout gbl = new GridBagLayout();

    resourcesLabel = new Label("Resources");
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbl.setConstraints(resourcesLabel, gbc);

    idLabel = new Label("Id", Label.RIGHT);
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 2;
    gbl.setConstraints(idLabel, gbc);

    availableLabel = new Label("Available", Label.RIGHT);
    gbc = new GridBagConstraints();
    gbc.gridx = 2;
    gbc.gridy = 2;
    gbl.setConstraints(availableLabel, gbc);

    for (int i = 0; i < resourceCount; i++) {
      Label idLabel;
      Label availableLabel;
      // create the labels
      // add labels to the vectors
      // set constraints
      idLabel = new Label();
      idLabel.setAlignment(Label.RIGHT);
      resourceIdLabelVector.insertElementAt(idLabel, i);
      gbc = new GridBagConstraints();
      gbc.gridx = 1;
      gbc.gridy = 3 + i;
      gbl.setConstraints(idLabel, gbc);

      availableLabel = new Label();
      availableLabel.setAlignment(Label.RIGHT);
      resourceAvailableLabelVector.insertElementAt(availableLabel, i);
      gbc = new GridBagConstraints();
      gbc.gridx = 2;
      gbc.gridy = 3 + i;
      gbl.setConstraints(availableLabel, gbc);
    }

    setLayout(gbl);

    add(resourcesLabel);
    add(idLabel);
    add(availableLabel);
    for (int i = 0; i < resourceCount; i++) {
      Label idLabel;
      Label availableLabel;
      idLabel = (Label) resourceIdLabelVector.elementAt(i);
      availableLabel = (Label) resourceAvailableLabelVector.elementAt(i);
      add(idLabel);
      add(availableLabel);
    }
  }
Beispiel #13
0
  public void mousePressed(MouseEvent evt) {
    start = end = evt.getPoint();

    if (type == -1) status.setText("Keine Form ausgewaehlt");
    else if (type == 0) status.setText("1. Ecke des Rechtecks festgelegt");
    else if (type == 1) status.setText("Mittelpunkt des Kreises festgelegt");
    else if (type == 2) status.setText("Zentrum der Ellipse festgelegt");
  }
Beispiel #14
0
  public void update_display(int lat, int lon, int alt, int heading) {
    String lat_str = Math.abs(lat) + "" + DEGREE + ((lat > 0) ? " N" : " S");
    String long_str = Math.abs(lon) + "" + DEGREE + ((lon > 0) ? " E" : " W");

    lat_.setText(lat_str);
    long_.setText(long_str);
    alt_.setText(alt + " Kft");
    heading_.setText(heading + "" + DEGREE + "  ");
  }
Beispiel #15
0
 public void setTitle(String title) {
   if (null == label) {
     label = new Label(title);
     label.setAlignment(Label.CENTER);
     add(label, BorderLayout.NORTH);
   } else {
     label.setText(title);
   }
 }
Beispiel #16
0
 /**
  * Adds a group of checkboxs using a grid layout.
  *
  * @param rows the number of rows
  * @param columns the number of columns
  * @param labels the labels
  * @param defaultValues the initial states
  * @param headings the column headings Example:
  *     http://imagej.nih.gov/ij/plugins/multi-column-dialog/index.html
  */
 public void addCheckboxGroup(
     int rows, int columns, String[] labels, boolean[] defaultValues, String[] headings) {
   Panel panel = new Panel();
   int nRows = headings != null ? rows + 1 : rows;
   panel.setLayout(new GridLayout(nRows, columns, 6, 0));
   int startCBIndex = cbIndex;
   if (checkbox == null) checkbox = new Vector(12);
   if (headings != null) {
     Font font = new Font("SansSerif", Font.BOLD, 12);
     for (int i = 0; i < columns; i++) {
       if (i > headings.length - 1 || headings[i] == null) panel.add(new Label(""));
       else {
         Label label = new Label(headings[i]);
         label.setFont(font);
         panel.add(label);
       }
     }
   }
   int i1 = 0;
   int[] index = new int[labels.length];
   for (int row = 0; row < rows; row++) {
     for (int col = 0; col < columns; col++) {
       int i2 = col * rows + row;
       if (i2 >= labels.length) break;
       index[i1] = i2;
       String label = labels[i1];
       if (label == null || label.length() == 0) {
         Label lbl = new Label("");
         panel.add(lbl);
         i1++;
         continue;
       }
       if (label.indexOf('_') != -1) label = label.replace('_', ' ');
       Checkbox cb = new Checkbox(label);
       checkbox.addElement(cb);
       cb.setState(defaultValues[i1]);
       cb.addItemListener(this);
       if (Recorder.record || macro) saveLabel(cb, labels[i1]);
       if (IJ.isLinux()) {
         Panel panel2 = new Panel();
         panel2.setLayout(new BorderLayout());
         panel2.add("West", cb);
         panel.add(panel2);
       } else panel.add(cb);
       i1++;
     }
   }
   c.gridx = 0;
   c.gridy = y;
   c.gridwidth = 2;
   c.anchor = GridBagConstraints.WEST;
   c.insets = getInsets(10, 0, 0, 0);
   grid.setConstraints(panel, c);
   add(panel);
   y++;
 }
Beispiel #17
0
 public void update_score_line(String location, int score, int turns) {
   this.timegame = false;
   this.location = location;
   this.score = score;
   this.turns = turns;
   Left.setText(location);
   Right.setText(score + "/" + turns);
   doLayout();
   repaint();
 }
Beispiel #18
0
  public void stopRecording() {
    statusLabel.setText("Status: Not recording.");
    statusLabel.setFont(new Font("Helvetica", Font.PLAIN, 12));
    statusLabel.setForeground(Color.black);
    recordButton.setLabel("Record");

    recording = false;

    viewer.setRecordingStatus(null);
  }
Beispiel #19
0
  public void startRecording() {
    statusLabel.setText("Status: Recording...");
    statusLabel.setFont(new Font("Helvetica", Font.BOLD, 12));
    statusLabel.setForeground(Color.red);
    recordButton.setLabel("Stop recording");

    recording = true;

    viewer.setRecordingStatus(fnameField.getText());
  }
Beispiel #20
0
  /**
   * Initialize the contents of the frame.
   *
   * @throws IOException
   */
  private void initialize() throws IOException {
    frmGomoku = new JFrame();
    frmGomoku.setTitle("GOMOKU");
    frmGomoku.setBounds(150, 20, 1000, 670);
    frmGomoku.setResizable(false);
    frmGomoku.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frmGomoku.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            try {
              listener.close();
            } catch (IOException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
          }
        });
    frmGomoku.getContentPane().add(layeredPane);
    setLayeredPane();
    JLabel lblGomoku = DefaultComponentFactory.getInstance().createTitle("G . O . M . O . K . U");
    lblGomoku.setFont(new Font("Roboto", Font.BOLD, 20));
    lblGomoku.setBounds(425, 11, 205, 38);
    layeredPane.add(lblGomoku);

    textField = new TextField();
    textField.setBounds(764, 27, 182, 22);
    layeredPane.add(textField);

    textField_1 = new TextField();
    textField_1.setBounds(764, 74, 182, 22);
    layeredPane.add(textField_1);

    button = new Button("Maiin");
    button.setBackground(Color.WHITE);

    button.setBounds(764, 106, 105, 22);
    layeredPane.add(button);
    Label label = new Label("Nama");
    label.setBounds(689, 27, 62, 22);
    layeredPane.add(label);
    Label label_1 = new Label("Nama room");
    label_1.setBounds(689, 74, 69, 22);
    layeredPane.add(label_1);

    lblGiiliran = DefaultComponentFactory.getInstance().createLabel("");
    lblGiiliran.setFont(new Font("Tahoma", Font.BOLD, 15));
    lblGiiliran.setBounds(689, 221, 257, 22);
    layeredPane.add(lblGiiliran);

    lblRoom = DefaultComponentFactory.getInstance().createLabel("");
    lblRoom.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblRoom.setBounds(689, 170, 257, 22);
    layeredPane.add(lblRoom);
    listener = new ServerSocket(PORT);
  }
 /** Capture des évènements des scrollbars */
 public void adjustmentValueChanged(AdjustmentEvent e) {
   if (e.getSource().equals(sb_victoires)) {
     int valeur = sb_victoires.getValue();
     lbl_victoires.setText("Nombre De Victoires: " + valeur);
     nb_victoires = valeur;
   } else {
     int valeur = sb_fps.getValue();
     lbl_fps.setText("FPS: " + valeur);
     fps = valeur;
   }
 } // adjustmentValueChanged()
Beispiel #22
0
  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    g.setFont(new Font("Arial", Font.BOLD, 14));

    Label title = new Label("Construction");
    title.setFont(new Font("Arial", Font.BOLD, 14));
    add(title);
    setAlignmentX(CENTER_ALIGNMENT);
    g.drawImage(
        ImagePanel().getScaledInstance(getWidth(), getWidth(), Image.SCALE_SMOOTH), 0, 30, null);
  }
Beispiel #23
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);
  }
Beispiel #24
0
 public void actionPerformed(ActionEvent ae) {
   String s = ae.getActionCommand();
   double we, h;
   double r;
   we = Integer.parseInt(weight.getText());
   h = Integer.parseInt(height.getText());
   h = (h / 100);
   h = h * h;
   r = we / h;
   result.setText(String.valueOf(r));
   if (r < 18.5) {
     not.setForeground(Color.YELLOW);
     not.setText(String.valueOf("UnderWeight"));
   }
   if (r >= 18.5 && r < 24.9) {
     not.setForeground(Color.GREEN);
     not.setText(String.valueOf("Normal"));
   }
   if (r > 25 && r < 29.9) {
     not.setForeground(Color.ORANGE);
     not.setText(String.valueOf("Overweight"));
   }
   if (r >= 30) {
     not.setForeground(Color.RED);
     not.setText(String.valueOf("Obese"));
   }
   repaint();
 }
Beispiel #25
0
  public Position() {
    Panel grid_panel = new Panel();

    lat_.setFont(FONT);
    long_.setFont(FONT);
    alt_.setFont(FONT);
    heading_.setFont(FONT);

    setLayout(new GridLayout(1, 4));
    add(lat_);
    add(long_);
    add(heading_);
    add(alt_);
  }
Beispiel #26
0
  /** DOCUMENT ME! */
  public void doLayout() {
    int x = getInsets().left;
    int y = getInsets().top;
    int width = getSize().width - getInsets().left - getInsets().right;
    int height = getSize().height - getInsets().top - getInsets().bottom;
    int space = 5;

    int cfx = playerInterface.getInsets().left;
    int cfy = playerInterface.getInsets().top;
    int cfwidth =
        playerInterface.getSize().width
            - playerInterface.getInsets().left
            - playerInterface.getInsets().right;
    int cfheight =
        playerInterface.getSize().height
            - playerInterface.getInsets().top
            - playerInterface.getInsets().bottom;

    int sqwidth = ColorSquare.WIDTH;
    int sqspace = (width - (5 * sqwidth)) / 5;

    int keepY;
    int discY;

    /* put the dialog in the center of the game window */
    setLocation(cfx + ((cfwidth - width) / 2), cfy + ((cfheight - height) / 2));

    try {
      msg.setBounds((width - 188) / 2, getInsets().top, 180, 20);
      discardBut.setBounds((width - 88) / 2, (getInsets().bottom + height) - 25, 80, 25);
      youHave.setBounds(getInsets().left, getInsets().top + 20 + space, 70, 20);
      discThese.setBounds(
          getInsets().left, getInsets().top + 20 + space + 20 + space + sqwidth + space, 100, 20);
    } catch (NullPointerException e) {
    }

    keepY = getInsets().top + 20 + space + 20 + space;
    discY = keepY + sqwidth + space + 20 + space;

    try {
      for (int i = 0; i < 5; i++) {
        keep[i].setSize(sqwidth, sqwidth);
        keep[i].setLocation((i * sqspace) + ((width - ((3 * sqspace) + (4 * sqwidth))) / 2), keepY);
        disc[i].setSize(sqwidth, sqwidth);
        disc[i].setLocation((i * sqspace) + ((width - ((3 * sqspace) + (4 * sqwidth))) / 2), discY);
      }
    } catch (NullPointerException e) {
    }
  }
Beispiel #27
0
  public void adjustmentValueChanged(AdjustmentEvent evt) {
    // chamado quando o usu�rio modifica o valor de uma das
    // barras de rolagem

    int r = redScroll.getValue();
    int g = greenScroll.getValue();
    int b = blueScroll.getValue();
    redLabel.setText(" R = " + r);
    greenLabel.setText(" G = " + g);
    blueLabel.setText(" B = " + b);
    colorCanvas.setBackground(new Color(r, g, b));
    colorCanvas.repaint();
    // Redraw the canvas in its new color.

  } // end adjustmentValueChanged
  public void run() {
    while (true) {
      try {
        DatagramSocket ClientSoc = new DatagramSocket(ClinetPortNumber);
        String Command = "GET";

        byte Sendbuff[] = new byte[1024];
        Sendbuff = Command.getBytes();

        InetAddress ServerHost = InetAddress.getLocalHost();
        ClientSoc.send(new DatagramPacket(Sendbuff, Sendbuff.length, ServerHost, 5217));

        byte Receivebuff[] = new byte[1024];
        DatagramPacket dp = new DatagramPacket(Receivebuff, Receivebuff.length);
        ClientSoc.receive(dp);

        NewsMsg = new String(dp.getData(), 0, dp.getLength());
        System.out.println(NewsMsg);
        lblNewsHeadline.setText(NewsMsg);

        Thread.sleep(5000);
        ClientSoc.close();
      } catch (Exception ex) {
        ex.printStackTrace();
      }
    }
  }
Beispiel #29
0
  DomainPanel(DomainConnection connection) {
    _connection = connection;
    _useColor = System.getProperty("bw") == null;
    if (_useColor) {
      setBackground(Color.red);
    }
    setLayout(new BorderLayout());
    _leftPanel = new LeftPanel();
    _topLabel = new Label("Domain", Label.CENTER);
    _topLabel.setFont(new Font("fixed", Font.ITALIC, 18));
    add(_topLabel, "North");
    add(new BorderPanel(_leftPanel), "West");

    _cellPanel = new CellPanel(_connection);
    _commandPanel = new CommandPanel(_connection);

    _cardPanel = new Panel(_cards);
    _cardPanel.add(new BorderPanel(_cellPanel), "cell");
    _cardPanel.add(new BorderPanel(_commandPanel), "command");
    _cards.show(_cardPanel, "cell");

    add(_cardPanel, "Center");

    _updateButton.addActionListener(this);
    _detailButton.addActionListener(this);
    _commandButton.addActionListener(this);
    _list.addItemListener(this);
  }
Beispiel #30
0
 public void showDomain(CellDomainNode domainNode) {
   _topLabel.setText(">>> " + domainNode.getName() + " <<<");
   _domainNode = domainNode;
   _cellPanel.clear();
   _commandPanel.clear();
   updateDomain();
 }