public ejemplo6_javaya() {
   setLayout(null);
   combo1 = new JComboBox();
   combo1.setBounds(10, 10, 80, 20);
   add(combo1);
   combo1.addItem("rojo");
   combo1.addItem("vede");
   combo1.addItem("azul");
   combo1.addItem("amarillo");
   combo1.addItem("negro");
   combo1.addItemListener(this);
 }
  /*Aqui viene lo interesante*/
  public void
      Interfaz_Trabajador() // metodo que lo que hace es poner los botones y demas cosas de la GUI
                            // para ingresar Trabajadores
      {
    this.setLayout(
        null); // me permite poner donde yo quiera los botones ya que el layout no es el por defecto

    trab = new JLabel("Nombre del Trabajador");
    boton1 = new JButton("Ingresar trabajador");
    user = new JTextField(null); // campo donde se ingresa el nombre del trabajador
    id1 = new JTextField(); // campo para ingresar el id
    list = new JComboBox /*<String>*/(); // lista de trabajadores ingresados que se pueden usar
    ID = new JLabel("Numero de Identificaci�n");
    ventas = new JButton("Ingresar");
    informe = new JButton("Informe de ventas");

    trab.setBounds(
        5, 10, 130,
        9); /*localizacion del objeto. X,Y,H,W. X es la posicion en X, Y es lo mismo pero en Y.
            H y W son la altura y ancho del boton respectivamante*/
    this.add(trab); // es agregado a la ventana

    user.setBounds(138, 5, 130, 20);
    this.add(user);

    ID.setBounds(5, 40, 145, 9);
    this.add(ID);

    id1.setBounds(165, 35, 80, 20);
    this.add(id1);

    boton1.setBounds(55, 60, 150, 20);
    boton1.addActionListener(
        this); // el boton recibe la propiedad de actionListener, se le pone el daemon y si es
               // cliceado, se mandara al metodo
    this.add(boton1);

    list.setBounds(55, 100, 150, 50);
    this.add(list);

    ventas.setBounds(55, 170, 150, 20);
    ventas.addActionListener(this);
    this.add(ventas);

    informe.setBounds(55, 200, 150, 20);
    informe.addActionListener(this); // si es cliceado, se mandara al metodo
    this.add(informe);
  }
Esempio n. 3
0
  /** Creates new form gui */
  public gui() {
    super(new BorderLayout());
    initComponents();

    // Load user list and images
    images = new ImageIcon[userStrings.length];
    Integer[] intArray = new Integer[userStrings.length];
    for (int i = 0; i < userStrings.length; i++) {
      intArray[i] = new Integer(i);
      images[i] = createImageIcon("images/" + userStrings[i] + ".png");
      if (images[i] != null) {
        images[i].setDescription(userStrings[i]);
      }
    }
    users = new JComboBox(intArray);
    Color bg = (Color) UIManager.get("ComboBox.background");
    Color fg = (Color) UIManager.get("ComboBox.foreground");
    UIManager.put("ComboBox.selectionBackground", bg);
    UIManager.put("ComboBox.selectionForeground", fg);
    users.setUI(new MetalComboBoxUI());
    // ComboBoxRenderer renderer = new ComboBoxRenderer();
    ComboBoxRenderer renderer = new ComboBoxRenderer(userStrings, images);
    renderer.setPreferredSize(new Dimension(650, 150));
    users.setRenderer(renderer);
    users.setSize(renderer.getPreferredSize());
    users.setMaximumRowCount(4);
    users.setBounds(150, 250, 650, 200);
    add(users);
    // setBorder(BorderFactory.createEmptyBorder(20,20,20,20));

    // Set the user satisfaction labels
    jSlider1.setPaintTicks(true);
    Hashtable labelTable = new Hashtable();
    for (int i = 0; i < labels.length; i++) {
      labelTable.put(new Integer(i), new JLabel(labels[i]));
    }

    jSlider1.setLabelTable(labelTable);

    jSlider1.setPaintLabels(true);

    socket = new generalSocket(machine, 1099);

    statusThread thread = new statusThread(socket, jLabel4);
    Thread theThread = new Thread(thread);
    theThread.start();
  }
Esempio n. 4
0
  newframe() {
    super("USER 1");
    setSize(870, 760);
    setLocation(500, 200);
    panel.setLayout(null);

    rent.setBounds(350, 120, 140, 20);
    his.setBounds(350, 180, 140, 20);
    avai.setBounds(350, 150, 140, 20);
    welcome.setBounds(365, 50, 150, 60);
    cat.setBounds(350, 210, 140, 20);

    panel.add(welcome);
    panel.add(rent);
    panel.add(his);
    panel.add(avai);
    panel.add(cat);

    getContentPane().add(panel);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setVisible(true);
  }
Esempio n. 5
0
  private void initStart() {
    // setResizable(false);
    setLayout(null);

    jlb = new JLabel("참여 인원수를 선택하세요");
    jlb.setBounds(7, 7, 160, 20);

    jcb = new JComboBox();
    for (int i = 2; i <= 10; i++) jcb.addItem(i);
    jcb.setSelectedItem(6);
    jcb.setMaximumRowCount(9);
    jcb.setBounds(50, 34, 70, 20);

    start_bt = new JButton("Start");
    start_bt.setBounds(45, 62, 80, 30);
    con.add(jlb);
    con.add(start_bt);
    con.add(jcb);

    start_bt.addActionListener(this);
    jcb.addActionListener(this);

    setVisible(true);
  }
  private void InitUI() {
    System.out.println("Create new Opportunity");

    setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
    add(Box.createRigidArea(new Dimension(0, 35)));

    eventTsText = new JTextField("2011-07-11 11:00:00.000 +0:00");
    eventTsLabel = new JLabel();

    try {
      ownerId =
          new JComboBox(
              tools.readLines("D:\\DataGenerator\\DataGenerator\\resources\\employees.txt"));
      ownerId.setSelectedIndex(-1);
    } catch (IOException e) {
      e.printStackTrace();
    }

    ownerIdLabel = new JLabel();

    try {
      accountId =
          new JComboBox(
              tools.readLines("D:\\DataGenerator\\DataGenerator\\resources\\accounts.txt"));
      accountId.setSelectedIndex(-1);
    } catch (IOException e) {
      e.printStackTrace();
    }
    accountIdLabel = new JLabel();

    try {
      leadSource =
          new JComboBox(
              tools.readLines("D:\\DataGenerator\\DataGenerator\\resources\\leadSources.txt"));
      leadSource.setSelectedIndex(-1);
    } catch (IOException e) {
      e.printStackTrace();
    }
    leadSourceLabel = new JLabel();

    ECDText = new JTextField("2011-07-11");
    ECDLabel = new JLabel();

    amountText = new JTextField("1000");
    amountLabel = new JLabel();

    nameText = new JTextField("");
    nameLabel = new JLabel();

    descriptionText = new JTextField("");
    descriptionLabel = new JLabel();

    stageNameText = new JTextField("");
    stageNameLabel = new JLabel();

    stageDescrText = new JTextField("");
    stageDescrLabel = new JLabel();

    statusText = new JTextField("");
    statusLabel = new JLabel();

    resultText = new JTextField("");
    resultLabel = new JLabel();

    isClosed = new JCheckBox("IsClosed");
    isWon = new JCheckBox("IsWon");

    createButton = new JButton("Create");
    cleanFormButton = new JButton("Clean Form");
    generateSQLButton = new JButton("Generate SQL");

    ownerId.setBounds(210, 20, 190, 30);
    ownerIdLabel.setBounds(30, 20, 150, 30);
    ownerIdLabel.setText("Owner ID");

    accountId.setBounds(210, 50, 190, 30);
    accountIdLabel.setBounds(30, 50, 150, 30);
    accountIdLabel.setText("Account ID");

    leadSource.setBounds(210, 80, 190, 30);
    leadSourceLabel.setBounds(30, 80, 150, 30);
    leadSourceLabel.setText("Lead Source");

    eventTsText.setBounds(210, 110, 190, 30);
    eventTsLabel.setBounds(30, 110, 150, 30);
    eventTsLabel.setText("Event TS");

    ECDText.setBounds(210, 140, 190, 30);
    ECDLabel.setBounds(30, 140, 150, 30);
    ECDLabel.setText("Expected Close Date");

    amountText.setBounds(210, 170, 150, 30);
    amountLabel.setBounds(30, 170, 80, 30);
    amountLabel.setText("Amount");

    nameText.setBounds(210, 200, 150, 30);
    nameLabel.setBounds(30, 200, 80, 30);
    nameLabel.setText("Name");

    descriptionText.setBounds(210, 230, 150, 30);
    descriptionLabel.setBounds(30, 230, 80, 30);
    descriptionLabel.setText("Description");

    stageNameText.setBounds(210, 260, 150, 30);
    stageNameLabel.setBounds(30, 260, 80, 30);
    stageNameLabel.setText("Stage Name");

    stageDescrText.setBounds(210, 290, 150, 30);
    stageDescrLabel.setBounds(30, 290, 80, 30);
    stageDescrLabel.setText("Stage Description");

    statusText.setBounds(210, 320, 150, 30);
    statusLabel.setBounds(30, 320, 80, 30);
    statusLabel.setText("Status");

    resultText.setBounds(210, 350, 150, 30);
    resultLabel.setBounds(30, 350, 80, 30);
    resultLabel.setText("Result");

    isClosed.setBounds(30, 380, 90, 30);
    isWon.setBounds(210, 380, 90, 30);

    createButton.setBounds(20, 420, 90, 30);
    cleanFormButton.setBounds(125, 420, 120, 30);
    generateSQLButton.setBounds(260, 420, 120, 30);

    setLayout(null);

    add(ownerId);
    add(ownerIdLabel);

    add(accountId);
    add(accountIdLabel);

    add(leadSource);
    add(leadSourceLabel);

    add(eventTsLabel);
    add(eventTsText);

    add(ECDText);
    add(ECDLabel);

    add(amountText);
    add(amountLabel);

    add(nameText);
    add(nameLabel);

    add(descriptionText);
    add(descriptionLabel);

    add(stageNameText);
    add(stageNameLabel);

    add(stageDescrText);
    add(stageDescrLabel);

    add(statusText);
    add(statusLabel);

    add(resultText);
    add(resultLabel);

    add(isClosed);
    add(isWon);

    add(createButton);
    add(cleanFormButton);
    add(generateSQLButton);

    setSize(420, 510);
    setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    setLocationRelativeTo(null);
    setVisible(true);
  }
  public vehicle() {
    message = new JLabel("VEHICLE  DETAILS");
    mname = new JLabel("Model Name");
    cap = new JLabel("Capacity");
    cc = new JLabel("CC");
    eng = new JLabel("Engine");
    stroke = new JLabel("Stroke");
    bhp = new JLabel("BHP");
    volt = new JLabel("Volts");
    rpm = new JLabel("RPM");
    weight = new JLabel("Weight");
    kg = new JLabel("Kg");
    gear = new JLabel("Gears");
    color = new JLabel("Color");

    jcmname = new JComboBox();

    tfcap = new JTextField(30);
    tfeng = new JTextField(20);
    tfbhp = new JTextField(10);
    tfvolt = new JTextField(20);
    tfrpm = new JTextField(20);
    tfweight = new JTextField(20);
    tfgear = new JTextField(30);

    jccolor = new JComboBox();

    ok = new JButton("OK");
    can = new JButton("CANCEL");

    can.addActionListener(this);
    can.setActionCommand("can");
    ok.addActionListener(this);
    ok.setActionCommand("Ok");

    Container c = getContentPane();

    setSize(800, 600);
    setTitle("Vehicle Details");
    c.setLayout(null);
    setVisible(true);

    c.add(message);
    c.add(mname);
    c.add(cap);
    c.add(cc);
    c.add(eng);
    c.add(stroke);
    c.add(bhp);
    c.add(volt);
    c.add(rpm);
    c.add(weight);
    c.add(kg);
    c.add(gear);
    c.add(color);

    c.add(jcmname);

    c.add(tfcap);
    c.add(tfeng);
    c.add(tfbhp);
    c.add(tfvolt);
    c.add(tfrpm);
    c.add(tfweight);
    c.add(tfgear);

    c.add(jccolor);

    c.add(ok);
    c.add(can);
    c.setBackground(Color.pink);

    message.setBounds(300, 40, 200, 50);
    mname.setBounds(50, 100, 100, 30);
    cap.setBounds(50, 150, 100, 30);
    cc.setBounds(275, 150, 50, 30);
    eng.setBounds(50, 200, 50, 30);
    stroke.setBounds(275, 200, 100, 30);
    bhp.setBounds(50, 250, 100, 30);
    volt.setBounds(50, 300, 100, 30);
    rpm.setBounds(50, 350, 100, 30);
    weight.setBounds(50, 400, 50, 30);
    kg.setBounds(275, 400, 100, 30);
    gear.setBounds(450, 150, 150, 30);
    color.setBounds(450, 200, 100, 30);

    jcmname.setBounds(200, 100, 100, 30);
    jcmname.addItem(" -- Select --");
    jcmname.addItem("Pulsar");
    jcmname.addItem("CT 100");
    jcmname.addItem("Discover DTS-i");
    jcmname.addItem("Wave DTS-i");

    tfcap.setBounds(200, 150, 70, 30);
    tfeng.setBounds(200, 200, 70, 30);
    tfbhp.setBounds(200, 250, 70, 30);
    tfvolt.setBounds(200, 300, 70, 30);
    tfrpm.setBounds(200, 350, 70, 30);
    tfweight.setBounds(200, 400, 70, 30);
    tfgear.setBounds(500, 150, 70, 30);

    jccolor.setBounds(500, 200, 100, 30);
    jccolor.addItem("Black");
    jccolor.addItem("Blue");
    jccolor.addItem("Red");
    jccolor.addItem("Grey");

    ok.setBounds(270, 480, 85, 30);
    can.setBounds(370, 480, 85, 30);
  }
Esempio n. 8
0
  public PanelMore(OSeaMAction dia) {
    dlg = dia;
    setLayout(null);
    panelPat = new PanelPat(dlg, Ent.BODY);
    panelPat.setBounds(new Rectangle(0, 0, 110, 160));
    add(panelPat);
    add(getRegionButton(regionAButton, 110, 0, 34, 30, "RegionA"));
    add(getRegionButton(regionBButton, 110, 32, 34, 30, "RegionB"));
    add(getRegionButton(regionCButton, 110, 64, 34, 30, "RegionC"));

    elevLabel = new JLabel(Messages.getString("Elevation"), SwingConstants.CENTER);
    elevLabel.setBounds(new Rectangle(140, 0, 90, 20));
    add(elevLabel);
    elevBox = new JTextField();
    elevBox.setBounds(new Rectangle(160, 20, 50, 20));
    elevBox.setHorizontalAlignment(SwingConstants.CENTER);
    add(elevBox);
    elevBox.addFocusListener(flElev);

    heightLabel = new JLabel(Messages.getString("Height"), SwingConstants.CENTER);
    heightLabel.setBounds(new Rectangle(140, 40, 90, 20));
    add(heightLabel);
    heightBox = new JTextField();
    heightBox.setBounds(new Rectangle(160, 60, 50, 20));
    heightBox.setHorizontalAlignment(SwingConstants.CENTER);
    add(heightBox);
    heightBox.addFocusListener(flHeight);

    sourceLabel = new JLabel(Messages.getString("Source"), SwingConstants.CENTER);
    sourceLabel.setBounds(new Rectangle(110, 80, 130, 20));
    add(sourceLabel);
    sourceBox = new JTextField();
    sourceBox.setBounds(new Rectangle(110, 100, 130, 20));
    sourceBox.setHorizontalAlignment(SwingConstants.CENTER);
    add(sourceBox);
    sourceBox.addFocusListener(flSource);

    infoLabel = new JLabel(Messages.getString("Information"), SwingConstants.CENTER);
    infoLabel.setBounds(new Rectangle(110, 120, 130, 20));
    add(infoLabel);
    infoBox = new JTextField();
    infoBox.setBounds(new Rectangle(110, 140, 130, 20));
    infoBox.setHorizontalAlignment(SwingConstants.CENTER);
    add(infoBox);
    infoBox.addFocusListener(flInfo);

    statusLabel = new JLabel(Messages.getString("Status"), SwingConstants.CENTER);
    statusLabel.setBounds(new Rectangle(250, 0, 100, 20));
    add(statusLabel);
    statusBox = new JComboBox();
    statusBox.setBounds(new Rectangle(250, 20, 100, 20));
    addStsItem("", Sts.UNKSTS);
    addStsItem(Messages.getString("Permanent"), Sts.PERM);
    addStsItem(Messages.getString("Occasional"), Sts.OCC);
    addStsItem(Messages.getString("Recommended"), Sts.REC);
    addStsItem(Messages.getString("NotInUse"), Sts.NIU);
    addStsItem(Messages.getString("Intermittent"), Sts.INT);
    addStsItem(Messages.getString("Reserved"), Sts.RESV);
    addStsItem(Messages.getString("Temporary"), Sts.TEMP);
    addStsItem(Messages.getString("Private"), Sts.PRIV);
    addStsItem(Messages.getString("Mandatory"), Sts.MAND);
    addStsItem(Messages.getString("Destroyed"), Sts.DEST);
    addStsItem(Messages.getString("Extinguished"), Sts.EXT);
    addStsItem(Messages.getString("Illuminated"), Sts.ILLUM);
    addStsItem(Messages.getString("Historic"), Sts.HIST);
    addStsItem(Messages.getString("Public"), Sts.PUB);
    addStsItem(Messages.getString("Synchronized"), Sts.SYNC);
    addStsItem(Messages.getString("Watched"), Sts.WATCH);
    addStsItem(Messages.getString("UnWatched"), Sts.UNWAT);
    addStsItem(Messages.getString("Doubtful"), Sts.DOUBT);
    add(statusBox);
    statusBox.addActionListener(alStatus);

    constrLabel = new JLabel(Messages.getString("Construction"), SwingConstants.CENTER);
    constrLabel.setBounds(new Rectangle(250, 40, 100, 20));
    add(constrLabel);
    constrBox = new JComboBox();
    constrBox.setBounds(new Rectangle(250, 60, 100, 20));
    addCnsItem("", Cns.UNKCNS);
    addCnsItem(Messages.getString("Masonry"), Cns.BRICK);
    addCnsItem(Messages.getString("Concreted"), Cns.CONC);
    addCnsItem(Messages.getString("Boulders"), Cns.BOULD);
    addCnsItem(Messages.getString("HardSurfaced"), Cns.HSURF);
    addCnsItem(Messages.getString("Unsurfaced"), Cns.USURF);
    addCnsItem(Messages.getString("Wooden"), Cns.WOOD);
    addCnsItem(Messages.getString("Metal"), Cns.METAL);
    addCnsItem(Messages.getString("GRP"), Cns.GLAS);
    addCnsItem(Messages.getString("Painted"), Cns.PAINT);
    add(constrBox);
    constrBox.addActionListener(alConstr);

    conLabel = new JLabel(Messages.getString("Conspicuity"), SwingConstants.CENTER);
    conLabel.setBounds(new Rectangle(250, 80, 100, 20));
    add(conLabel);
    conBox = new JComboBox();
    conBox.setBounds(new Rectangle(250, 100, 100, 20));
    addConItem("", Con.UNKCON);
    addConItem(Messages.getString("Conspicuous"), Con.CONSP);
    addConItem(Messages.getString("NotConspicuous"), Con.NCONS);
    add(conBox);
    conBox.addActionListener(alCon);

    reflLabel = new JLabel(Messages.getString("Reflectivity"), SwingConstants.CENTER);
    reflLabel.setBounds(new Rectangle(250, 120, 100, 20));
    add(reflLabel);
    reflBox = new JComboBox();
    reflBox.setBounds(new Rectangle(250, 140, 100, 20));
    addReflItem("", Con.UNKCON);
    addReflItem(Messages.getString("Conspicuous"), Con.CONSP);
    addReflItem(Messages.getString("NotConspicuous"), Con.NCONS);
    addReflItem(Messages.getString("Reflector"), Con.REFL);
    add(reflBox);
    reflBox.addActionListener(alRefl);
  }
Esempio n. 9
0
  public PanelSpec(SmedAction dia) {
    dlg = dia;
    setLayout(null);
    add(getShapeButton(pillarButton, 0, 0, 34, 32, "Pillar", Shp.PILLAR, Obj.BOYSPP));
    add(getShapeButton(sparButton, 34, 0, 34, 32, "Spar", Shp.SPAR, Obj.BOYSPP));
    add(getShapeButton(canButton, 68, 0, 34, 32, "Can", Shp.CAN, Obj.BOYSPP));
    add(getShapeButton(coneButton, 102, 0, 34, 32, "Cone", Shp.CONI, Obj.BOYSPP));
    add(getShapeButton(sphereButton, 0, 32, 34, 32, "Sphere", Shp.SPHERI, Obj.BOYSPP));
    add(getShapeButton(barrelButton, 34, 32, 34, 32, "Barrel", Shp.BARREL, Obj.BOYSPP));
    add(getShapeButton(superButton, 68, 32, 34, 32, "Super", Shp.SUPER, Obj.BOYSPP));
    add(getShapeButton(floatButton, 102, 32, 34, 32, "Float", Shp.FLOAT, Obj.LITFLT));
    add(getShapeButton(beaconButton, 0, 64, 34, 32, "Beacon", Shp.BEACON, Obj.BCNSPP));
    add(getShapeButton(towerButton, 34, 64, 34, 32, "TowerB", Shp.TOWER, Obj.BCNSPP));
    add(getShapeButton(stakeButton, 68, 64, 34, 32, "Stake", Shp.STAKE, Obj.BCNSPP));
    add(getShapeButton(cairnButton, 102, 64, 34, 32, "CairnB", Shp.CAIRN, Obj.BCNSPP));

    categoryLabel = new JLabel(Messages.getString("Category"), SwingConstants.CENTER);
    categoryLabel.setBounds(new Rectangle(5, 125, 160, 18));
    add(categoryLabel);
    categoryBox = new JComboBox();
    categoryBox.setBounds(new Rectangle(5, 142, 160, 18));
    add(categoryBox);
    categoryBox.setVisible(true);
    categoryBox.addActionListener(alCategoryBox);
    addCatItem("", Cat.NOCAT);
    addCatItem(Messages.getString("UKPurpose"), Cat.SPM_UNKN);
    addCatItem(Messages.getString("Warning"), Cat.SPM_WARN);
    addCatItem(Messages.getString("ChanSeparation"), Cat.SPM_CHBF);
    addCatItem(Messages.getString("Yachting"), Cat.SPM_YCHT);
    addCatItem(Messages.getString("Cable"), Cat.SPM_CABL);
    addCatItem(Messages.getString("Outfall"), Cat.SPM_OFAL);
    addCatItem(Messages.getString("ODAS"), Cat.SPM_ODAS);
    addCatItem(Messages.getString("RecreationZone"), Cat.SPM_RECN);
    addCatItem(Messages.getString("Mooring"), Cat.SPM_MOOR);
    addCatItem(Messages.getString("LANBY"), Cat.SPM_LNBY);
    addCatItem(Messages.getString("Leading"), Cat.SPM_LDNG);
    addCatItem(Messages.getString("Notice"), Cat.SPM_NOTC);
    addCatItem(Messages.getString("TSS"), Cat.SPM_TSS);
    addCatItem(Messages.getString("FoulGround"), Cat.SPM_FOUL);
    addCatItem(Messages.getString("Diving"), Cat.SPM_DIVE);
    addCatItem(Messages.getString("FerryCross"), Cat.SPM_FRRY);
    addCatItem(Messages.getString("Anchorage"), Cat.SPM_ANCH);
    mooringBox = new JComboBox();
    mooringBox.setBounds(new Rectangle(5, 142, 160, 18));
    add(mooringBox);
    mooringBox.setVisible(false);
    mooringBox.addActionListener(alMooringBox);
    addMorItem("", Cat.NOCAT);
    addMorItem(Messages.getString("Dolphin"), Cat.MOR_DLPN);
    addMorItem(Messages.getString("DevDolphin"), Cat.MOR_DDPN);
    addMorItem(Messages.getString("Bollard"), Cat.MOR_BLRD);
    addMorItem(Messages.getString("Wall"), Cat.MOR_WALL);
    addMorItem(Messages.getString("Post"), Cat.MOR_POST);
    addMorItem(Messages.getString("Chain"), Cat.MOR_CHWR);
    addMorItem(Messages.getString("Rope"), Cat.MOR_ROPE);
    addMorItem(Messages.getString("Automatic"), Cat.MOR_AUTO);
    addMorItem(Messages.getString("MooringBuoy"), Cat.MOR_BUOY);
    addMorItem(Messages.getString("CALM"), Cat.INB_CALM);
    addMorItem(Messages.getString("SBM"), Cat.INB_SBM);

    topmarkButton.setBounds(new Rectangle(136, 0, 34, 32));
    topmarkButton.setToolTipText(Messages.getString("Topmark"));
    topmarkButton.setBorder(BorderFactory.createLoweredBevelBorder());
    topmarkButton.addActionListener(alTop);
    add(topmarkButton);

    //		noticeButton.setBounds(new Rectangle(136, 32, 34, 32));
    //		noticeButton.setToolTipText(Messages.getString("Notice"));
    //		noticeButton.setBorder(BorderFactory.createLoweredBevelBorder());
    //		noticeButton.addActionListener(alNotice);
    //		add(noticeButton);

    mooringButton.setBounds(new Rectangle(136, 64, 34, 32));
    mooringButton.setToolTipText(Messages.getString("Mooring"));
    mooringButton.setBorder(BorderFactory.createLoweredBevelBorder());
    mooringButton.addActionListener(alMooring);
    add(mooringButton);
  }
Esempio n. 10
0
  public static void main(String args[]) {
    // style that is necessary
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (ClassNotFoundException e) {
    } catch (InstantiationException e) {
    } catch (IllegalAccessException e) {
    } catch (UnsupportedLookAndFeelException e) {
    }

    // Standard preparation for a frame
    fmain = new JFrame("Schedule Appointments"); // Create and name frame
    fmain.setSize(330, 375); // Set size to 400x400 pixels
    pane = fmain.getContentPane();
    pane.setLayout(null); // Apply null layout
    fmain.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Close when X is clicked

    // controls and portions of Calendar
    lmonth = new JLabel("January");
    lyear = new JLabel("Change year:");
    cyear = new JComboBox();
    prev = new JButton("<<");
    next = new JButton(">>");
    canc = new JButton("Cancel");
    mcal =
        new DefaultTableModel() {
          public boolean isCellEditable(int rowIndex, int mColIndex) {
            return false;
          }
        };
    Cal = new JTable(mcal);
    scal = new JScrollPane(Cal);
    pcal = new JPanel(null);

    canc.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            System.exit(0);
          }
        });

    // action listeners for buttons and the like
    prev.addActionListener(new btnPrev_Action());
    next.addActionListener(new btnNext_Action());
    cyear.addActionListener(new cmbYear_Action());
    Cal.addMouseListener(new mouseCont());

    // Adding the elements to the pane
    pane.add(pcal);
    pcal.add(lmonth);
    pcal.add(cyear);
    pcal.add(prev);
    pcal.add(next);
    pcal.add(canc);
    pcal.add(scal);

    // Setting where the elements are on the pane
    pcal.setBounds(0, 0, 320, 335);
    lmonth.setBounds(160 - lmonth.getPreferredSize().width / 2, 25, 100, 25);
    canc.setBounds(10, 305, 80, 20);
    cyear.setBounds(215, 305, 100, 20);
    prev.setBounds(10, 25, 50, 25);
    next.setBounds(260, 25, 50, 25);
    scal.setBounds(10, 50, 300, 250);

    // Make frame visible
    fmain.setResizable(false);
    fmain.setVisible(true);

    // Inner workings for the day mechanism
    GregorianCalendar cal = new GregorianCalendar(); // Create calendar
    rday = cal.get(GregorianCalendar.DAY_OF_MONTH); // Get day
    rmonth = cal.get(GregorianCalendar.MONTH); // Get month
    ryear = cal.get(GregorianCalendar.YEAR); // Get year
    currentMonth = rmonth; // Match month and year
    currentYear = ryear;

    // Add days
    String[] days = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; // All of the days
    for (int i = 0; i < 7; i++) {
      mcal.addColumn(days[i]);
    }

    Cal.getParent().setBackground(Cal.getBackground()); // Set background

    // No resize/reorder
    Cal.getTableHeader().setResizingAllowed(false);
    Cal.getTableHeader().setReorderingAllowed(false);

    // Single cell selection
    Cal.setColumnSelectionAllowed(true);
    Cal.setRowSelectionAllowed(true);
    Cal.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    // Set row/column count
    Cal.setRowHeight(38);
    mcal.setColumnCount(7);
    mcal.setRowCount(6);

    // Placing the dates in the cells
    for (int i = ryear - 100; i <= ryear + 100; i++) {
      cyear.addItem(String.valueOf(i));
    }

    // Refresh calendar
    refreshCalendar(rmonth, ryear); // Refresh calendar
  }
Esempio n. 11
0
  /** Create the frame. */
  public SotrudnikDialog() {
    setTitle(
        "\u041D\u043E\u0432\u044B\u0439 \u0441\u043E\u0442\u0440\u0443\u0434\u043D\u0438\u043A");
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    setBounds(100, 100, 450, 330);
    contentPane = new JPanel();
    contentPane.setBackground(new Color(255, 204, 255));
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JLabel label_familiya = new JLabel("\u0424\u0430\u043C\u0438\u043B\u0438\u044F");
    label_familiya.setBounds(10, 37, 110, 14);
    contentPane.add(label_familiya);

    JLabel label_imya = new JLabel("\u0418\u043C\u044F");
    label_imya.setBounds(10, 62, 110, 14);
    contentPane.add(label_imya);

    JLabel label_otchestvo = new JLabel("\u041E\u0442\u0447\u0435\u0441\u0442\u0432\u043E");
    label_otchestvo.setBounds(10, 87, 110, 14);
    contentPane.add(label_otchestvo);

    textField_otchestvo = new JTextField();
    textField_otchestvo.setBounds(167, 84, 186, 20);
    contentPane.add(textField_otchestvo);
    textField_otchestvo.setColumns(10);

    textField_imya = new JTextField();
    textField_imya.setBounds(167, 58, 186, 20);
    contentPane.add(textField_imya);
    textField_imya.setColumns(10);

    textField_familiya = new JTextField();
    textField_familiya.setBounds(167, 33, 186, 20);
    contentPane.add(textField_familiya);
    textField_familiya.setColumns(10);

    JLabel label_data_priema =
        new JLabel(
            "\u0414\u0430\u0442\u0430 \u043F\u0440\u0438\u0435\u043C\u0430 \u043D\u0430 \u0440\u0430\u0431\u043E\u0442\u0443");
    label_data_priema.setBounds(10, 112, 147, 14);
    contentPane.add(label_data_priema);

    JLabel label_phone = new JLabel("\u0422\u0435\u043B\u0435\u0444\u043E\u043D");
    label_phone.setBounds(10, 137, 134, 14);
    contentPane.add(label_phone);

    JLabel label_doljnost = new JLabel("\u0414\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C");
    label_doljnost.setBounds(10, 162, 140, 14);
    contentPane.add(label_doljnost);

    JLabel label_kvalification =
        new JLabel("\u041A\u0432\u0430\u043B\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u044F");
    label_kvalification.setBounds(10, 190, 147, 14);
    contentPane.add(label_kvalification);

    textField_phone = new JTextField();
    textField_phone.setBounds(167, 134, 186, 20);
    contentPane.add(textField_phone);
    textField_phone.setColumns(10);

    textField_date.setBounds(167, 109, 186, 20);
    contentPane.add(textField_date);

    label_id_hidden.setFont(new Font("Tahoma", Font.BOLD, 12));
    label_id_hidden.setBounds(143, 11, 122, 14);
    contentPane.add(label_id_hidden);

    button_insert.setBounds(83, 230, 160, 23);
    contentPane.add(button_insert);

    button_cancel.setBounds(264, 230, 104, 23);
    contentPane.add(button_cancel);

    button_update.setBounds(83, 230, 160, 23);
    contentPane.add(button_update);

    JButton button_plus_doljnost = new JButton("+");
    button_plus_doljnost.addActionListener(
        new ActionListener() {
          @SuppressWarnings("deprecation")
          public void actionPerformed(ActionEvent arg0) {
            DoljnostDialog d = new DoljnostDialog();
            d.setTitle("Добавление должности");
            d.show();
          }
        });
    button_plus_doljnost.setBounds(359, 159, 41, 23);
    contentPane.add(button_plus_doljnost);

    JButton button_plus_kvalification = new JButton("+");
    button_plus_kvalification.addActionListener(
        new ActionListener() {
          @SuppressWarnings("deprecation")
          public void actionPerformed(ActionEvent arg0) {
            KvalificationDialog d = new KvalificationDialog();
            d.setTitle("Добавление квалификации");
            d.show();
          }
        });
    button_plus_kvalification.setBounds(359, 184, 41, 23);
    contentPane.add(button_plus_kvalification);

    JLabel label =
        new JLabel(
            "\u041F\u043E\u043B\u044F, \u043E\u0442\u043C\u0435\u0447\u0435\u043D\u043D\u044B\u0435 ");
    label.setBounds(60, 264, 122, 14);
    contentPane.add(label);

    JLabel label_3 = new JLabel("*");
    label_3.setForeground(Color.RED);
    label_3.setFont(new Font("Tahoma", Font.BOLD, 11));
    label_3.setBounds(186, 264, 12, 14);
    contentPane.add(label_3);

    JLabel label_4 =
        new JLabel(
            "\u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u044B  \u0434\u043B\u044F \u0437\u0430\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u044F!");
    label_4.setBounds(197, 264, 203, 14);
    contentPane.add(label_4);

    JLabel label_5 = new JLabel("*");
    label_5.setForeground(Color.RED);
    label_5.setFont(new Font("Tahoma", Font.BOLD, 11));
    label_5.setBounds(356, 37, 12, 14);
    contentPane.add(label_5);

    JLabel label_1 = new JLabel("*");
    label_1.setForeground(Color.RED);
    label_1.setFont(new Font("Tahoma", Font.BOLD, 11));
    label_1.setBounds(356, 62, 12, 14);
    contentPane.add(label_1);

    comboBox_doljnost.setBounds(167, 159, 186, 20);
    contentPane.add(comboBox_doljnost);

    comboBox_kvalification.setBounds(167, 187, 186, 20);
    contentPane.add(comboBox_kvalification);

    // Actions for button "Добавить"
    button_insert.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            if (!textField_familiya.getText().equals("") && !textField_imya.getText().equals("")) {
              try {
                Sotrudnik s = new Sotrudnik();
                s.setFamiliya(textField_familiya.getText());
                s.setImya(textField_imya.getText());
                s.setOtchestvo(textField_otchestvo.getText());
                s.setData_priema(Date.valueOf(textField_date.getText()));
                s.setPhone(textField_phone.getText());
                Doljnost d = (Doljnost) comboBox_doljnost.getSelectedItem();
                s.setId_doljnosti(d.getId_doljnosti());
                Kvalification k = (Kvalification) comboBox_kvalification.getSelectedItem();
                s.setId_kvalification(k.getId_kvalification());

                DBClass db = new DBClass();
                db.sotrudnikUpsert(s, "INSERT");
                MyFrame.updateList();
                ZakazDialog.updateSotrudnik();
              } catch (SQLException e) {
                e.printStackTrace();
                JOptionPane.showMessageDialog(panelException, e.getMessage());
              } catch (ClassNotFoundException ee) {
                ee.printStackTrace();
                JOptionPane.showMessageDialog(panelException, ee.getMessage());
              } finally {
                dispose();
              }
            } else JOptionPane.showMessageDialog(null, "Введите обязательные параметры!");
          }
        });

    // Actions for button "Отмена"
    button_cancel.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            dispose();
          }
        });

    // Actions for button "Сохранить изменения"
    button_update.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            if (!textField_familiya.getText().equals("")
                && !textField_imya.getText().equals("")
                && !textField_date.getText().equals("")) {
              if (textField_date.getText().length() == 10) {
                try {
                  Integer.parseInt((textField_date.getText().substring(0, 3)));
                  Integer.parseInt((textField_date.getText().substring(5, 6)));
                  Integer.parseInt((textField_date.getText().substring(8, 9)));

                  Sotrudnik s = new Sotrudnik();
                  s.setId_sotrudnika(Integer.parseInt(label_id_hidden.getText()));
                  s.setFamiliya(textField_familiya.getText());
                  s.setImya(textField_imya.getText());
                  s.setOtchestvo(textField_otchestvo.getText());
                  s.setPhone(textField_phone.getText());

                  Doljnost d = (Doljnost) comboBox_doljnost.getSelectedItem();
                  s.setId_doljnosti(d.getId_doljnosti());

                  Kvalification k = (Kvalification) comboBox_kvalification.getSelectedItem();
                  s.setId_kvalification(k.getId_kvalification());

                  DBClass db = new DBClass();
                  db.sotrudnikUpsert(s, "UPDATE");
                  MyFrame.updateList();
                  dispose();
                } catch (NumberFormatException e) {
                  JOptionPane.showMessageDialog(panelException, e.getMessage());
                } catch (SQLException e) {
                  // e.printStackTrace();
                  JOptionPane.showMessageDialog(panelException, e.getMessage());
                } catch (ClassNotFoundException ee) {
                  // ee.printStackTrace();
                  JOptionPane.showMessageDialog(panelException, ee.getMessage());
                }
              } else JOptionPane.showMessageDialog(null, "Введите дату в правильном формате!");
            } else JOptionPane.showMessageDialog(null, "Введите обязательные параметры!");
          }
        });
  }
Esempio n. 12
0
  /** Initializes the graphical components */
  public void init() {
    username = getParameter("username");
    if (username == null) {
      username =
          JOptionPane.showInputDialog(
              this, "Please enter a username", "Login", JOptionPane.QUESTION_MESSAGE);
    }
    try {
      PORT = Integer.valueOf(getParameter("port")).intValue();
    } catch (NumberFormatException e) {
      PORT = 42412;
    }

    URL url = getDocumentBase();
    site = url.getHost();
    locationURL = "http://" + site + ":" + url.getPort() + "/" + url.getPath();

    setSize(615, 362);
    c = getContentPane();

    c.setBackground(new Color(224, 224, 224));

    if (site == null || locationURL == null) {
      c.add(new JLabel("ERROR: did not recieve needed data from page"));
    }

    myAction = new MyAction();
    myKeyListener = new MyKeyListener();
    myMouseListener = new MyMouseListener();
    myHyperlinkListener = new MyHyperlinkListener();

    c.setLayout(null);

    cboChannels = new JComboBox();
    cboChannels.setBounds(5, 5, 150, 24);

    butChannel = new JButton("Join");
    butChannel.setToolTipText("Join channel");
    butChannel.addActionListener(myAction);
    butChannel.setBounds(160, 5, 60, 24);

    butCreate = new JButton("Create");
    butCreate.setToolTipText("Create new channel");
    butCreate.addActionListener(myAction);
    butCreate.setBounds(230, 5, 100, 24);
    butCreate.setEnabled(false);

    butInvite = new JButton("Invite");
    butInvite.setToolTipText("Invite Friend");
    butInvite.addActionListener(myAction);
    butInvite.setBounds(340, 5, 80, 24);

    mainChat = new ChatPane(this);
    textScroller =
        new JScrollPane(
            mainChat,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    textScroller.setBounds(5, 34, 500, 270);

    userList = new JList();
    userList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    userList.setCellRenderer(new MyCellRenderer());
    userList.setBackground(new Color(249, 249, 250));
    JScrollPane userScroller = new JScrollPane(userList);
    userScroller.setBounds(510, 34, 100, 297);

    messageText = new JTextField();
    messageText.setBounds(5, 309, 500, 22);
    messageText.setColumns(10);
    messageText.setBackground(new Color(249, 249, 250));

    JMenuItem item;
    popup = new JPopupMenu("test");
    popup.add("whisper").addActionListener(myAction);
    popup.add("private message").addActionListener(myAction);
    popup.add("ignore").addActionListener(myAction);
    popup.add("clear ignore list").addActionListener(myAction);

    conNo = new ImageIcon(getURL("images/connect_no.gif"));
    conYes = new ImageIcon(getURL("images/connect_established.gif"));
    secNo = new ImageIcon(getURL("images/decrypted.gif"));
    secYes = new ImageIcon(getURL("images/encrypted.gif"));

    conIcon = new JLabel(conNo);
    conIcon.setBorder(new EtchedBorder());
    secIcon = new JLabel(secNo);
    secIcon.setBorder(new EtchedBorder());

    conIcon.setBounds(563, 334, 22, 22);
    secIcon.setBounds(588, 334, 22, 22);

    bottomText =
        new JLabel(
            "<html><body><font color=#445577><b>"
                + "LlamaChat "
                + VERSION
                + "</b></font> &nbsp;&copy; "
                + "<a href=\""
                + linkURL
                + "\">Joseph Monti</a> 2002-2003"
                + "</body></html>");
    bottomText.setBounds(5, 336, 500, 20);

    c.add(cboChannels);
    c.add(butChannel);
    c.add(butCreate);
    c.add(butInvite);
    c.add(textScroller);
    c.add(userScroller);
    c.add(messageText);
    c.add(conIcon);
    c.add(secIcon);
    c.add(bottomText);

    userList.addMouseListener(myMouseListener);
    messageText.addKeyListener(myKeyListener);
    bottomText.addMouseListener(myMouseListener);

    users = new ArrayList();
    ignores = new ArrayList(5);
    afks = new ArrayList(5);
    admins = new ArrayList(5);
    history = new CommandHistory(10);
    admin = false;
    channels = new Hashtable();
    privates = new PrivateMsg(this);
    showUserStatus = false;

    myColors[0] = new Color(200, 0, 0);
    myColors[1] = new Color(0, 150, 0);
    myColors[2] = new Color(0, 0, 200);

    rect = new Rectangle(0, 0, 1, 1);

    String opening =
        "<font color=#333333>"
            + "==================================<br>"
            + "Welcome to LlamaChat "
            + VERSION
            + "<br>"
            + "If you need assistance, type \\help<br>"
            + "Enjoy your stay!<br>"
            + "Maestria Aplicada en Redes<br>"
            + "==================================<br></font>";
    HTMLDocument doc = (HTMLDocument) mainChat.getDocument();
    HTMLEditorKit kit = (HTMLEditorKit) mainChat.getEditorKit();
    try {
      kit.insertHTML(doc, doc.getLength(), opening, 0, 0, HTML.Tag.FONT);
    } catch (Throwable t) {
      t.printStackTrace(System.out);
    }

    // validate the name
    if (!username.matches("[\\w_-]+?")) {
      error(
          "username contains invalid characters, changing to "
              + "'invalid' for now. "
              + "Type \\rename to chose a new name");
      username = "******";
    }
    if (username.length() > 10) {
      username = username.substring(0, 10);
      error("username too long, changed to " + username);
    }

    connect();
  }
Esempio n. 13
0
  editprof(String str, String user) {
    cp = getContentPane();
    cp.setLayout(null);
    user1 = user;
    try {

      UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");

    } catch (Exception e) {
    }

    JTextField ft = new JTextField();
    name1 = new JLabel("First Name");
    try {
      r = new FileReader(user + "/First name.txt");
      ft.read(r, null);
      r.close();
    } catch (Exception de) {
    }
    name = new JTextField();
    name.setText(ft.getText());

    last1 = new JLabel("Enter Last Name");
    try {
      r = new FileReader(user + "/last name.txt");
      ft.read(r, null);
      r.close();
    } catch (Exception de) {
    }
    last = new JTextField();
    last.setText(ft.getText());

    pass = new JLabel("Password");
    try {
      r = new FileReader(user + "/password.txt");
      ft.read(r, null);
      r.close();
    } catch (Exception de) {
    }
    pwd = new JPasswordField();
    pwd.setText(ft.getText());
    pwd.setEditable(false);

    email1 = new JLabel("Enter email address");
    try {
      r = new FileReader(user + "/email.txt");
      ft.read(r, null);
      r.close();
    } catch (Exception de) {
    }
    email = new JTextField();
    email.setText(ft.getText());

    addimage = new JButton("Add Image");
    icon = new JLabel();

    date1 = new JLabel("Date Of Birth");
    date = new JComboBox();
    for (int i = 1; i <= 31; i++) {
      date.addItem(i);
    }

    month = new JComboBox();
    month.addItem("Jan");
    month.addItem("Feb");
    month.addItem("Mar");
    month.addItem("Apr");
    month.addItem("May");
    month.addItem("Jun");
    month.addItem("Jul");
    month.addItem("Aug");
    month.addItem("Sep");
    month.addItem("Oct");
    month.addItem("Nov");
    month.addItem("Dec");

    year = new JComboBox();
    for (int j = 1900; j <= 2010; j++) {
      year.addItem(j);
    }

    sx = new JLabel("Gender");
    gen = new JComboBox();
    gen.addItem("Male");
    gen.addItem("Female");

    con1 = new JLabel("Country Name");
    con = new JComboBox();
    con.addItem(" Austrelia");
    con.addItem(" America");
    con.addItem(" Antartica");
    con.addItem(" Africa");
    con.addItem(" Canda");
    con.addItem(" Corea");
    con.addItem(" Chaina");
    con.addItem(" Denmark");
    con.addItem(" England");
    con.addItem(" Franc");
    con.addItem(" Hangery");
    con.addItem(" Holand");
    con.addItem(" Itali");
    con.addItem(" India");
    con.addItem(" Indonesia");
    con.addItem(" Jermany");
    con.addItem(" Japan");
    con.addItem(" Korea");
    con.addItem(" Kembridge");
    con.addItem(" Merusalem");
    con.addItem(" Noth America");
    con.addItem(" Norvey");
    con.addItem(" West Indies");
    con.addItem(" Peru");
    con.addItem(" Zimbawe");

    about = new JLabel("About me");
    try {
      r = new FileReader(user + "/about.txt");
      ft.read(r, null);
      r.close();
    } catch (Exception de) {
    }
    int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS;
    int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS;

    main = new JTextArea();
    main.setText(ft.getText());

    JScrollPane jsp = new JScrollPane(main, v, h);

    allow = new JLabel("Allow To:");
    JCheckBox c1 = new JCheckBox(" orkut Friends");
    JCheckBox c2 = new JCheckBox("Collage Friends");
    JCheckBox c3 = new JCheckBox("Business Partner");
    JCheckBox c4 = new JCheckBox("Relatives");

    col = new JLabel("Collage Name:");
    try {
      r = new FileReader(user + "/Collage.txt");
      ft.read(r, null);
      r.close();
    } catch (Exception de) {
    }
    col1 = new JTextField();
    col1.setText(ft.getText());
    try {
      r = new FileReader(user + "/UniverSity.txt");
      ft.read(r, null);
      r.close();
    } catch (Exception de) {
    }
    uni = new JLabel("Univercity");
    uni1 = new JTextField();
    uni1.setText(ft.getText());

    state1 = new JLabel("State Name");
    try {
      r = new FileReader(user + "/state.txt");
      ft.read(r, null);
      r.close();
    } catch (Exception de) {
    }
    state = new JTextField();
    state.setText(ft.getText());

    city = new JLabel("City");
    try {
      r = new FileReader(user + "/City.txt");
      ft.read(r, null);
      r.close();
    } catch (Exception de) {
    }
    city1 = new JTextField();
    city1.setText(ft.getText());

    try {
      r = new FileReader(user + "/imagepath.txt");
      ft.read(r, null);
      r.close();
    } catch (Exception de) {
    }
    ImageIcon io = new ImageIcon(ft.getText());
    icon.setIcon(io);

    next = new JButton("Update");
    next.setBackground(Color.white);
    // adding to container

    name1.setBounds(10, 10, 130, 25);
    name.setBounds(150, 10, 130, 25);

    last1.setBounds(10, 40, 130, 25);
    last.setBounds(150, 40, 130, 25);

    email1.setBounds(10, 70, 130, 25);
    email.setBounds(150, 70, 130, 25);

    pass.setBounds(290, 70, 130, 25);
    pwd.setBounds(390, 70, 130, 25);

    addimage.setBounds(350, 440, 100, 25);
    icon.setBounds(490, 410, 100, 100);

    date1.setBounds(10, 100, 130, 25);
    date.setBounds(120, 100, 40, 25);
    month.setBounds(180, 100, 130, 25);
    year.setBounds(320, 100, 130, 25);

    sx.setBounds(10, 140, 130, 25);
    gen.setBounds(150, 140, 130, 25);

    about.setBounds(10, 180, 130, 25);
    jsp.setBounds(150, 180, 250, 80);

    allow.setBounds(10, 260, 130, 25);
    c1.setBounds(150, 260, 130, 25);
    c2.setBounds(290, 260, 130, 25);

    c3.setBounds(150, 290, 130, 25);
    c4.setBounds(290, 290, 130, 25);

    uni.setBounds(10, 330, 130, 25);
    uni1.setBounds(150, 330, 130, 25);
    col.setBounds(10, 360, 130, 25);
    col1.setBounds(150, 360, 130, 25);

    con1.setBounds(10, 390, 130, 25);
    con.setBounds(150, 390, 130, 25);

    state1.setBounds(10, 430, 130, 25);
    state.setBounds(150, 430, 130, 25);

    city.setBounds(10, 460, 130, 25);
    city1.setBounds(150, 460, 130, 25);

    next.setBounds(50, 490, 130, 25);

    cp.add(name);
    cp.add(name1);
    cp.add(last);
    cp.add(last1);
    cp.add(email);
    cp.add(email1);
    cp.add(addimage);
    cp.add(icon);
    cp.add(date1);
    cp.add(date);
    cp.add(month);
    cp.add(year);
    cp.add(about);
    cp.add(jsp);
    cp.add(sx);
    cp.add(gen);
    cp.add(allow);
    cp.add(c1);
    cp.add(c2);
    cp.add(c3);
    cp.add(c4);
    cp.add(next);
    cp.add(uni);
    cp.add(uni1);
    cp.add(col);
    cp.add(col1);
    cp.add(con);
    cp.add(con1);
    cp.add(state1);
    cp.add(state);
    cp.add(city);
    cp.add(city1);
    cp.add(next);
    cp.add(pwd);
    cp.add(pass);

    addimage.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            filepath = name.getText();
            JFileChooser chooser = new JFileChooser();

            while (true) {
              int val = chooser.showOpenDialog(editprof.this);
              File f = chooser.getSelectedFile();
              String path = f.getPath();
              String name = f.getName();

              try {

                if (val == JFileChooser.CANCEL_OPTION || val == -1) {
                  break;
                } else {
                  image = new ImageIcon(path);
                  icon.setIcon(image);
                  w = new FileWriter(filepath + "/" + "imagePath.txt");
                  w.write(path + "");
                  w.close();
                  break;
                }
              } catch (Exception se) {
              }
            }
          }
        });

    date.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            int str = (Integer) e.getItem();
            File f = new File(name.getText());
            f.mkdir();
            try {
              w = new FileWriter(name.getText() + "/" + "date.txt");
              w.write(str + "");
              w.close();
            } catch (IOException de) {
            }
          }
        });

    month.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e1) {
            String str = (String) e1.getItem();
            File f = new File(name.getText());
            f.mkdir();
            try {
              w = new FileWriter(name.getText() + "/" + "month.txt");
              w.write(str + "");
              w.close();
            } catch (IOException de) {
            }
          }
        });
    con.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e2) {
            String str = (String) e2.getItem();
            File f = new File(name.getText());
            f.mkdir();
            try {
              w = new FileWriter(name.getText() + "/" + "contry.txt");
              w.write(str + "");
              w.close();
            } catch (IOException de) {
            }
          }
        });
    year.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e2) {
            int str = (Integer) e2.getItem();
            File f = new File(name.getText());
            f.mkdir();
            try {
              w = new FileWriter(name.getText() + "/" + "year.txt");
              w.write(str + "");
              w.close();
            } catch (IOException de) {
            }
          }
        });
    gen.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e3) {
            String str = (String) e3.getItem();
            File f = new File(name.getText());
            f.mkdir();
            try {
              w = new FileWriter(name.getText() + "/" + "gender.txt");
              w.write(str + "");
              w.close();
            } catch (IOException de) {
            }
          }
        });

    next.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent se) {
            try {

              w = new FileWriter(name.getText() + "/" + "First name.txt");
              w.write(name.getText());
              w.close();

              w = new FileWriter(name.getText() + "/" + "last name.txt");
              w.write(last.getText());
              w.close();

              w = new FileWriter(name.getText() + "/" + "email.txt");
              w.write(email.getText());
              w.close();

              w = new FileWriter(name.getText() + "/" + "Collage.txt");
              w.write(col1.getText());
              w.close();

              w = new FileWriter(name.getText() + "/" + "UniverSity.txt");
              w.write(uni1.getText());
              w.close();

              w = new FileWriter(name.getText() + "/" + "state.txt");
              w.write(state.getText());
              w.close();

              w = new FileWriter(name.getText() + "/" + "City.txt");
              w.write(city1.getText());
              w.close();

              w = new FileWriter(name.getText() + "/" + "about.txt");
              w.write(main.getText());
              w.close();

              w = new FileWriter(name.getText() + "/" + "password.txt");
              w.write(pwd.getText());
              w.close();

              profile e1 = new profile("My Profile", user1);
              e1.setVisible(true);
              e1.setLocation(00, 00);
              e1.setSize(800, 800);
              setVisible(false);
            } catch (Exception be) {
            }
          }
        });
  }
Esempio n. 14
0
  InputFrame() {
    JPanel pane = new JPanel();
    pane.setLayout(null);
    pane.setBackground(Color.LIGHT_GRAY);
    add(pane);
    // JTextField文字欄位元件
    lblName = new JLabel("姓名:");
    lblName.setBounds(10, 10, 40, 20);
    pane.add(lblName);
    text0.setBounds(50, 10, 80, 20);
    text0.addActionListener(textfield);
    pane.add(text0);
    // JSpinner數位序列元件
    lblAge = new JLabel("年齡:");
    lblAge.setBounds(170, 10, 40, 20);
    pane.add(lblAge);
    JSpinner spin = new JSpinner(new SpinnerNumberModel(20, 1, 100, 1));
    spin.setBounds(210, 10, 80, 20);
    spin.addChangeListener(spinner);
    pane.add(spin);
    // JRadioButton選項圓鈕元件
    lblSex = new JLabel("性別:");
    lblSex.setBounds(10, 40, 40, 20);
    pane.add(lblSex);
    ButtonGroup group = new ButtonGroup();
    JRadioButton rb1 = new JRadioButton("帥哥", false);
    rb1.setBounds(50, 40, 60, 20);
    JRadioButton rb2 = new JRadioButton("美女", false);
    rb2.setBounds(110, 40, 60, 20);
    rb1.setOpaque(false);
    rb2.setOpaque(false); // 秀出底色
    rb1.addActionListener(radio);
    rb2.addActionListener(radio);
    group.add(rb1);
    group.add(rb2);
    pane.add(rb1);
    pane.add(rb2);
    // JCheckBox核對方塊元件
    lblInter = new JLabel("興趣:");
    lblInter.setBounds(10, 70, 50, 20);
    pane.add(lblInter);
    for (int i = 0; i < check.length; i++) {
      check[i] = new JCheckBox(checkItem[i]);
      check[i].setBounds(50 + 60 * i, 70, 60, 20);
      check[i].setOpaque(false);
      check[i].addActionListener(checkbox);
      pane.add(check[i]);
    }
    // JComboBox下拉式清單元件
    lblAcad = new JLabel("學歷:");
    lblAcad.setBounds(10, 100, 50, 20);
    pane.add(lblAcad);
    String[] items_c = {"博士", "碩士", "大學", "高中", "國中", "國小"};
    JComboBox c_box = new JComboBox(items_c);
    c_box.setBounds(50, 100, 100, 20);
    c_box.addItemListener(cbo);
    pane.add(c_box);
    // JList清單元件
    lblPlace = new JLabel("居住地區:");
    lblPlace.setBounds(170, 100, 70, 20);
    pane.add(lblPlace);
    String[] items_p = {
      "台北", "桃園", "新竹", "苗栗", "台中", "彰化", "雲林", "嘉義", "台南", "高雄", "屏東", "花蓮", "台東", "澎湖"
    };
    JList list = new JList(items_p);
    list.setVisibleRowCount(4);
    list.addListSelectionListener(list_p);
    JScrollPane scroll = new JScrollPane(list);
    scroll.setBounds(240, 100, 80, 80);
    pane.add(scroll);
    // JTextArea文字區域元件
    texta.setBounds(10, 190, 330, 40);
    texta.setEditable(false);
    pane.add(texta);

    setTitle("輸入元件綜合應用");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(50, 50, 360, 280);
    setVisible(true);
  }
  public startbooking1() {
    // construct preComponents
    String[] jcb_mmItems = {"3", "4"};
    String[] jcb_ddItems = {
      "2", "3", "4", "5", "6", "7", "8", "9", "10", "13", "14", "15", "16", "17", "18", "20", "21",
      "22", "23", "24", "27", "28", "30"
    };
    String[] jcb_matItems = {"RCB vs RR", "CSK vs KXIP"};
    String[] jcb_standItems = {"A", "B", "Pavilion", "Terrace"};

    // construct components
    jlbl_date = new JLabel("Date:");
    jcb_mm = new JComboBox(jcb_mmItems);
    jcb_dd = new JComboBox(jcb_ddItems);
    jl_match = new JLabel("Match:");
    jcb_mat = new JComboBox(jcb_matItems);
    jl_stand = new JLabel("Stand:");
    jcb_stand = new JComboBox(jcb_standItems);
    jlbl_tic = new JLabel("No of Tickets:");
    jt_tic = new JTextField(1);
    jl_price = new JLabel("Price:");
    jt_price = new JTextField(1);
    jl_rupee = new JLabel("```");
    jb_chkav = new JButton("Check Availability");
    jb_booknow = new JButton("Book Now");
    jb_choose = new JButton("Choose");
    jb_home = new JButton("Home");
    jl_gilly = new JLabel("Gilly");
    jl_yuvi = new JLabel("Yuvi");
    jl_yn = new JLabel("yes/no");

    // set components properties
    jcb_stand.setEnabled(false);
    jt_price.setEnabled(false);
    jb_booknow.setEnabled(false);
    jb_choose.setEnabled(false);

    // adjust size and set layout
    setPreferredSize(new Dimension(560, 435));
    setLayout(null);

    // add components
    add(jlbl_date);
    add(jcb_mm);
    add(jcb_dd);
    add(jl_match);
    add(jcb_mat);
    add(jl_stand);
    add(jcb_stand);
    add(jlbl_tic);
    add(jt_tic);
    add(jl_price);
    add(jt_price);
    add(jl_rupee);
    add(jb_chkav);
    add(jb_booknow);
    add(jb_choose);
    add(jb_home);
    add(jl_gilly);
    add(jl_yuvi);
    add(jl_yn);

    // set component bounds (only needed by Absolute Positioning)
    jlbl_date.setBounds(170, 80, 35, 25);
    jcb_mm.setBounds(250, 80, 35, 25);
    jcb_dd.setBounds(290, 80, 35, 25);
    jl_match.setBounds(170, 110, 50, 25);
    jcb_mat.setBounds(250, 110, 100, 25);
    jl_stand.setBounds(170, 140, 40, 25);
    jcb_stand.setBounds(250, 140, 60, 25);
    jlbl_tic.setBounds(260, 205, 85, 25);
    jt_tic.setBounds(340, 205, 45, 25);
    jl_price.setBounds(170, 235, 40, 25);
    jt_price.setBounds(265, 235, 100, 25);
    jl_rupee.setBounds(240, 235, 20, 25);
    jb_chkav.setBounds(170, 170, 135, 25);
    jb_booknow.setBounds(170, 265, 130, 25);
    jb_choose.setBounds(170, 205, 80, 25);
    jb_home.setBounds(305, 265, 80, 25);
    jl_gilly.setBounds(10, 80, 135, 210);
    jl_yuvi.setBounds(430, 80, 135, 210);
    jl_yn.setBounds(320, 170, 80, 25);
  }
Esempio n. 16
0
 private void relayout() {
   int preferredHeight = b.getPreferredSize().height;
   b.setBounds(0, topOffset, getWidth(), preferredHeight);
 }
Esempio n. 17
0
  /**
   * Constructeur de recherche
   *
   * @param titre
   * @throws IOException
   */
  public Recherche(String titre) throws IOException {
    setTitle(titre);
    // Container conteneur=this.getContentPane();
    // conteneur.setLayout(new BorderLayout(2,1));
    switchcherche = 0;
    setSize(1200, 800);
    InputStream input = img.class.getResourceAsStream("med.jpg");
    JPanel panneau = new PanelImage(input);
    panneau.setLayout(null);

    // this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    String[] typeRecherche = {
      "Docteur", "Malade", "Chambre", "Employe", "Infirmier", "Service", "Hospitalisation", "Soigne"
    };

    rechercheDesire = new JLabel();
    rechercheDesire.setText("                               Selectionner une table :");
    rechercheDesire.setBounds(400, 120, 400, 40);
    rechercheDesire.setBackground(Color.lightGray);
    rechercheDesire.setOpaque(true);
    panneau.add(rechercheDesire);

    rechercheDesireBox = new JComboBox();
    for (int i = 0; i < typeRecherche.length; i++) {
      rechercheDesireBox.insertItemAt(typeRecherche[i], i);
    }
    rechercheDesireBox.setBounds(400, 160, 400, 80);
    panneau.add(rechercheDesireBox);

    explication = new JLabel();
    explication.setBounds(200, 240, 800, 40);
    panneau.add(explication);
    explication.setBackground(Color.LIGHT_GRAY);
    explication.setOpaque(true);
    explication.setText(
        "                                                    Pour tout afficher : ne rien saisir dans les lignes de recherche");

    rech1 = new JLabel();
    rech1.setBounds(200, 300, 200, 50);
    rech1.setText("              Recherche 1");
    rech1.setBackground(Color.LIGHT_GRAY);
    rech1.setOpaque(true);
    panneau.add(rech1);

    recherche1 = new JTextField("");
    recherche1.setBounds(400, 300, 200, 50);
    // this.add("South",result1);
    panneau.add(recherche1);

    result1 = new JComboBox();
    result1.setBounds(600, 300, 400, 50);
    panneau.add(result1);

    rech2 = new JLabel();
    rech2.setBounds(200, 370, 200, 50);
    rech2.setText("              Recherche 2");
    rech2.setBackground(Color.lightGray);
    rech2.setOpaque(true);
    panneau.add(rech2);

    recherche2 = new JTextField("");
    recherche2.setBounds(400, 370, 200, 50);
    // this.add("South",result2);
    panneau.add(recherche2);

    result2 = new JComboBox();
    result2.setBounds(600, 370, 400, 50);
    panneau.add(result2);

    rech3 = new JLabel();
    rech3.setBounds(200, 440, 200, 50);
    rech3.setText("              Recherche 3");
    rech3.setBackground(Color.lightGray);
    rech3.setOpaque(true);
    panneau.add(rech3);

    recherche3 = new JTextField("");
    recherche3.setBounds(400, 440, 200, 50);
    panneau.add(recherche3);

    result3 = new JComboBox();
    result3.setBounds(600, 440, 400, 50);
    panneau.add(result3);

    exit = new JButton("Retour");
    exit.setForeground(Color.red);
    exit.setBounds(430, 700, 160, 40);

    valider = new JButton("Rechercher");
    // valider.setForeground(Color.green);
    valider.setBounds(610, 700, 160, 40);
    panneau.add(valider);
    panneau.add(exit);

    rechercheDesireBox.addActionListener(this);
    recherche1.addActionListener(this);
    recherche2.addActionListener(this);
    recherche3.addActionListener(this);
    valider.addActionListener(this);
    exit.addActionListener(this);

    //  conteneur.add(panneau);
    fentreCard.add("Recherche", panneau);
    setVisible(false);
  }
Esempio n. 18
0
    private void initComponents() {
      label1 = new JLabel();
      comboBox1 = new JComboBox();
      button1 = new JButton();

      // ======== this ========
      setTitle("SneakyFarmer");
      Container contentPane = getContentPane();
      contentPane.setLayout(null);

      // ---- label1 ----
      label1.setText("Which herb to farm:");
      label1.setFont(label1.getFont().deriveFont(label1.getFont().getSize() + 1f));
      contentPane.add(label1);
      label1.setBounds(10, 10, 125, 35);

      // ---- comboBox1 ----
      comboBox1.setModel(
          new DefaultComboBoxModel(
              new String[] {
                "Guam",
                "Marrentill",
                "Tarromin",
                "Harralander",
                "Ranarr",
                "Toadflax",
                "Irit",
                "Avantoe",
                "Kwuarm",
                "Snapdragon",
                "Cadantine",
                "Lantadyme",
                "Dwarf Weed",
                "Torstol"
              }));
      contentPane.add(comboBox1);
      comboBox1.setBounds(135, 10, 90, 35);

      // ---- button1 ----
      button1.setText("Start Farming!");
      button1.setFont(button1.getFont().deriveFont(button1.getFont().getSize() + 7f));
      contentPane.add(button1);
      button1.setBounds(10, 50, 215, 35);
      button1.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              startActionPerformed(e);
            }
          });

      { // compute preferred size
        Dimension preferredSize = new Dimension();
        for (int i = 0; i < contentPane.getComponentCount(); i++) {
          Rectangle bounds = contentPane.getComponent(i).getBounds();
          preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
          preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
        }
        Insets insets = contentPane.getInsets();
        preferredSize.width += insets.right;
        preferredSize.height += insets.bottom;
        contentPane.setMinimumSize(preferredSize);
        contentPane.setPreferredSize(preferredSize);
      }
      pack();
      setLocationRelativeTo(getOwner());
    }
  public Design() throws Exception {
    super.setBackground(Color.BLACK);
    this.setTitle("");
    con = getContentPane();
    con.setLayout(null);
    dim = tk.getDefaultToolkit().getScreenSize();
    this.setTitle("Customer Peer Login");

    l1 = new JLabel(new ImageIcon("plain.jpg"));
    l1.setBounds(0, 0, 400, 400);
    con.add(l1);
    l1.setBorder(BorderFactory.createEtchedBorder(5, Color.black, Color.black));

    title = new JLabel("CUSTOMER PEER LOGIN ");
    title.setFont(new Font("Bookman Old Style", Font.ROMAN_BASELINE, 20));
    title.setForeground(Color.red);
    title.setBounds(80, 30, 300, 30);
    l1.add(title);

    l4 = new JLabel("CMACHINE NAME");
    l4.setFont(new Font("Bookman Old Style", Font.BOLD, 16));
    l4.setForeground(Color.BLUE);
    l4.setBounds(70, 100, 160, 20);
    //	l4.setBorder(BorderFactory.createEtchedBorder(5,Color.green,Color.green));

    l1.add(l4);
    jtf2 = new JTextField();
    jtf2.setBounds(250, 100, 100, 20);
    jtf2.setBorder(BorderFactory.createEtchedBorder(5, Color.green, Color.green));

    l1.add(jtf2);

    l2 = new JLabel("CUSER LOGIN");
    l2.setFont(new Font("Bookman Old Style", Font.BOLD, 16));
    l2.setForeground(Color.blue);
    l2.setBounds(70, 150, 120, 20);
    l1.add(l2);

    jtf1 = new JTextField();
    jtf1.setBounds(250, 150, 100, 20);
    jtf1.setBorder(BorderFactory.createEtchedBorder(5, Color.green, Color.green));

    l1.add(jtf1);

    l3 = new JLabel("CPASSWORD");
    l3.setFont(new Font("Bookman Old Style", Font.BOLD, 16));
    l3.setForeground(Color.blue);
    l3.setBounds(70, 200, 120, 20);
    l1.add(l3);

    jptf1 = new JPasswordField();
    jptf1.setBounds(250, 200, 100, 20);
    jptf1.setBorder(BorderFactory.createEtchedBorder(5, Color.green, Color.green));

    l1.add(jptf1);

    JLabel l4 = new JLabel("DAgent");
    l4.setFont(new Font("Bookman Old Style", Font.BOLD, 16));
    l4.setForeground(Color.blue);
    l4.setBounds(70, 250, 120, 20);
    l1.add(l4);

    box = new JComboBox();
    box.setBounds(250, 250, 100, 20);
    box.setBorder(BorderFactory.createEtchedBorder(5, Color.green, Color.green));
    l1.add(box);

    b2 = new JButton("Register");
    b2.setBounds(50, 300, 100, 20);
    l1.add(b2);
    b2.setBorder(BorderFactory.createEtchedBorder(10, Color.BLUE, Color.BLUE));

    b3 = new JButton("Login");
    b3.setBounds(150, 300, 100, 20);
    b3.setBorder(BorderFactory.createEtchedBorder(10, Color.BLUE, Color.BLUE));
    l1.add(b3);

    b1 = new JButton("Cancel");
    b1.setBounds(250, 300, 100, 20);
    b1.setBorder(BorderFactory.createEtchedBorder(10, Color.BLUE, Color.BLUE));

    l1.add(b1);

    b1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent we) {

            dispose();
          }
        });

    try {

      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      conn = DriverManager.getConnection("jdbc:odbc:agent");

    } catch (Exception exp) {

    }

    try {
      Statement satem = conn.createStatement();
      ResultSet rsatem = satem.executeQuery("select * from Dagent");
      while (rsatem.next()) {
        String namem = rsatem.getString("uname");
        box.addItem(namem);
      }

    } catch (Exception expo1) {

    }

    b2.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent we) {

            String username = jtf1.getText().trim();
            String password = jptf1.getText().trim();
            String mechine = jtf2.getText().trim();
            String dname = box.getSelectedItem().toString();
            int porte = 0;

            try {
              Statement sate = conn.createStatement();
              ResultSet rsate =
                  sate.executeQuery("select * from Dagent where uname='" + dname + "'");
              if (rsate.next()) {
                servermachine = rsate.getString("umechine");
                porte = rsate.getInt("ulistport");
                System.out.println(servermachine);
              }
              System.out.println(servermachine);

            } catch (Exception exp) {
              exp.printStackTrace();
            }

            try {
              packet p = new packet();
              p.setaction("Creg");
              p.setCuser(username);
              p.setCpass(password);
              p.setCmname(mechine);
              p.setCDpeer(dname);
              Socket soc = new Socket(servermachine, porte);
              ObjectOutputStream out = new ObjectOutputStream(soc.getOutputStream());
              out.writeObject(p);
              ObjectInputStream in = new ObjectInputStream(soc.getInputStream());
              packet rpac = (packet) in.readObject();
              if (rpac.getaction().equals("ok")) {

                JOptionPane.showMessageDialog(null, "Sucessfully Registered");

                jtf2.setText("");
                jtf1.setText("");
                jptf1.setText("");

              } else {

                JOptionPane.showMessageDialog(null, "Already Registered");
                jtf2.setText("");
                jtf1.setText("");
                jptf1.setText("");
              }

            } catch (Exception exp) {
            }
          }
        });

    b3.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent we) {

            String username = jtf1.getText().trim();
            String password = jptf1.getText().trim();
            String mechine = jtf2.getText().trim();
            String Dname = box.getSelectedItem().toString();

            int porte = 0;

            try {
              Statement sate = conn.createStatement();
              ResultSet rsate =
                  sate.executeQuery("select * from Dagent where uname='" + Dname + "'");
              if (rsate.next()) {
                servermachine = rsate.getString("umechine");
                porte = rsate.getInt("ulistport");
                System.out.println(servermachine);
              }
              System.out.println(servermachine);

            } catch (Exception exp) {

            }

            try {

              packet p1 = new packet();
              p1.setaction("clogin");
              p1.setCuser(username);
              p1.setCpass(password);
              p1.setCmname(mechine);
              p1.setCDpeer(Dname);
              Socket soc1 = new Socket(servermachine, porte);
              ObjectOutputStream out1 = new ObjectOutputStream(soc1.getOutputStream());
              out1.writeObject(p1);
              ObjectInputStream in1 = new ObjectInputStream(soc1.getInputStream());
              packet rpac1 = (packet) in1.readObject();
              if (rpac1.getaction().equals("ok")) {
                int port1 = 0;
                try {

                  int portm = rpac1.getCport();
                  System.out.println("XXXXXXX" + portm);
                  //	JOptionPane.showMessageDialog(null,"Sucessfully Started");

                  new Listen(portm);
                  new process(username, portm);
                  dispose();
                } catch (Exception exp) {
                }
              } else {
                JOptionPane.showMessageDialog(
                    null, "Enter valid username and password", "Server reply", 2);
                jtf1.setText("");
                jtf2.setText("");
                jptf1.setText("");
              }

            } catch (Exception exp) {
            }
          }
        });

    setSize(400, 400);
    show();
    setLocation(150, 100);
    setResizable(false);
  }