public CFSecuritySwingISOCurrencyAskDeleteJPanel(
     ICFSecuritySwingSchema argSchema, ICFSecurityISOCurrencyObj argFocus) {
   super();
   final String S_ProcName = "construct-schema-focus";
   if (argSchema == null) {
     throw CFLib.getDefaultExceptionFactory()
         .newNullArgumentException(getClass(), S_ProcName, 1, "argSchema");
   }
   // argFocus is optional; focus may be set later during execution as
   // conditions of the runtime change.
   swingSchema = argSchema;
   swingFocus = argFocus;
   // Construct the various objects
   textAreaMessage = new JTextArea("Are you sure you want to delete this ISO Currency?");
   actionOk = new ActionOk();
   actionCancel = new ActionCancel();
   buttonOk = new JButton(actionOk);
   buttonCancel = new JButton(actionCancel);
   attrJPanel = argSchema.getISOCurrencyFactory().newAttrJPanel(argFocus);
   scrollPane = new CFHSlaveJScrollPane(attrJPanel);
   // Lay out the widgets
   setSize(1024, 480);
   Dimension min = new Dimension(480, 300);
   setMinimumSize(min);
   add(textAreaMessage);
   textAreaMessage.setBounds(0, 0, 1024, 50);
   int xparts = (768 - (2 * 125)) / 3;
   add(buttonOk);
   buttonOk.setBounds(xparts, 55, 125, 40);
   add(buttonCancel);
   buttonCancel.setBounds(xparts + 125 + xparts, 55, 125, 40);
   add(scrollPane);
   scrollPane.setBounds(0, 100, 1024, 480 - 100);
 }
Example #2
0
  public AddNewStudent() // constructor
      {
    // initializing buttons
    btnok = new JButton("OK");
    btnok.addActionListener(this);
    btnexit = new JButton("Exit");
    btnexit.addActionListener(this);
    btnaddnew = new JButton("AddNew");
    btnaddnew.addActionListener(this);

    // initializing textfields
    tf1 = new JTextField(12);
    tf2 = new JTextField(12);
    // initializing labels

    lblname = new JLabel("Name:");
    lbladd = new JLabel("Address:");
    lblmsg = new JLabel("", JLabel.CENTER);

    // initializing panels
    p1 = new JPanel();
    p2 = new JPanel();
    p3 = new JPanel();
    psouth = new JPanel();

    // adding buttons and label to panel p1
    // setting flowlayout
    p1.setLayout(new FlowLayout());

    p1.add(btnok);
    p1.add(btnexit);
    p1.add(btnaddnew);
    // adding lblmsg to panel p3
    p3.add(lblmsg);

    // adding both the panels to new panel,psouth
    // settin layout 2:1
    psouth.setLayout(new GridLayout(2, 1));
    psouth.add(p3);
    psouth.add(p1);

    // adding label and textfields to panel p2
    p2.setLayout(new GridLayout(3, 1));
    // setting line and titled border for panel p2
    p2.setBorder(BorderFactory.createLineBorder(Color.red));
    p2.setBorder(BorderFactory.createTitledBorder("Enter Your Details"));
    p2.add(lblname);
    p2.add(tf1);
    p2.add(lbladd);
    p2.add(tf2);

    // adding panel to container
    this.getContentPane().add(p2, "Center");
    this.getContentPane().add(psouth, "South");

    this.setSize(300, 300);
    this.setLocation(100, 200);
    this.show();
  }
 public void doLayout() {
   Dimension sz = getSize();
   textAreaMessage.setBounds(0, 0, sz.width, 50);
   int xparts = (sz.width - (2 * 125)) / 3;
   buttonOk.setBounds(xparts, 55, 125, 40);
   buttonCancel.setBounds(xparts + 125 + xparts, 55, 125, 40);
   scrollPane.setBounds(0, 100, sz.width, sz.height - 100);
   scrollPane.doLayout();
 }
Example #4
0
  public TestFrame() {
    super("Control Window");
    setLayout(new BorderLayout());
    setSize(400, 300);
    setLocation(500, 10);
    setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    panel = new JPanel();
    getContentPane().add(panel, BorderLayout.NORTH);
    makeSHButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            makeSHButtonActionPerformed(e);
          }
        });
    panel.add(makeSHButton);

    JButton graphButton = new JButton("morph");
    graphButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            graphButtonActionPerformed(evt);
          }
        });
    panel.add(graphButton);

    pushAllSHButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            pushAllSHButtonActionPerformed(e);
          }
        });
    panel.add(pushAllSHButton);

    makeRelationsButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            makeRelationsButtonActionPerformed(e);
          }
        });
    panel.add(makeRelationsButton);

    panel.setPreferredSize(new java.awt.Dimension(20, 80));
    panel.setBorder(new LineBorder(Color.black));
    JFrame frame = new JFrame("Relationship Frame");
    frame.setSize(500, 500);
    frame.setLocation(10, 10);
    frame.getContentPane().add(testPanel);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
  }
Example #5
0
 public void makeSHButtonActionPerformed(ActionEvent evt) {
   String name = "Stakeholder " + (this.stakeholders.size());
   boolean a, b, c, d, e;
   a = b = c = d = e = false;
   int random = (int) (Math.random() * 32);
   System.out.println(random);
   if (random >= 16) {
     a = true;
     random -= 16;
   }
   if (random >= 8) {
     b = true;
     random -= 8;
   }
   if (random >= 4) {
     c = true;
     random -= 4;
   }
   if (random >= 2) {
     d = true;
     random -= 2;
   }
   if (random >= 1) {
     e = true;
     random -= 1;
   }
   System.out.printf("Stakeholder(%s, ,%b,%b,%b,%b,%b)%n", name, a, b, c, d, e);
   Stakeholder s = new Stakeholder(name, "", a, b, c, d, e);
   stakeholders.add(s);
   pushAllSHButton.setText("Push " + stakeholders.size() + " to View");
 }
 public void doLayout() {
   Dimension sz = getSize();
   final int buttonWidth = 100;
   final int buttonHeight = 25;
   final int buttonSpacing = 10;
   final int spTop = buttonSpacing + buttonHeight + buttonSpacing;
   int buttonStart = (sz.width - ((3 * buttonWidth) + (2 * buttonSpacing))) / 2;
   if (buttonStart < 0) {
     buttonStart = 0;
   }
   int spHeight = sz.height - spTop;
   if (spHeight < 0) {
     spHeight = 0;
   }
   buttonChooseNone.setBounds(buttonStart, buttonSpacing, buttonWidth, buttonHeight);
   buttonChooseSelected.setBounds(
       buttonStart + buttonWidth + buttonSpacing, buttonSpacing, buttonWidth, buttonHeight);
   buttonCancel.setBounds(
       buttonStart + buttonWidth + buttonSpacing + buttonWidth + buttonSpacing,
       buttonSpacing,
       buttonWidth,
       buttonHeight);
   dataScrollPane.setBounds(0, spTop, sz.width, spHeight);
 }
Example #7
0
  public ImageSettings() {
    // Single Image Settings
    slice.add(new JLabel("Single Image Settings:"));
    newSlice();
    ButtonGroup group = new ButtonGroup();
    singleCylindrical = new JRadioButton("Cylindrical projection");
    singleCylindrical.setSelected(true);
    group.add(singleCylindrical);
    slice.add(singleCylindrical);
    newSlice();

    singleEllipse = new JRadioButton("Elliptical projection");
    singleEllipse.setSelected(false);
    group.add(singleEllipse);
    slice.add(singleEllipse);
    newSlice();

    singleSizeLabel = new JLabel("Image height=" + singleSize);
    slice.add(singleSizeLabel);
    singleSizeUp = new JButton("Up");
    singleSizeDown = new JButton("Down");
    singleSizeUp.addActionListener(this);
    singleSizeDown.addActionListener(this);
    slice.add(singleSizeUp);
    slice.add(singleSizeDown);
    newSlice();

    singleSquare = new JRadioButton("Square the image");
    singleSquare.setSelected(true);
    slice.add(singleSquare);
    newSlice();

    singleFaults = new JRadioButton("Show faultlines");
    singleFaults.setSelected(true);
    slice.add(singleFaults);
    newSlice();

    singleAgeDots = new JRadioButton("Show age dots");
    singleAgeDots.setSelected(true);
    slice.add(singleAgeDots);
    newSlice();

    // Sequence Image Settings
    slice.add(new JLabel("Sequence Image Settings:"));
    newSlice();
    ButtonGroup group2 = new ButtonGroup();
    seqCylindrical = new JRadioButton("Cylindrical projection");
    seqCylindrical.setSelected(true);
    group2.add(seqCylindrical);
    slice.add(seqCylindrical);
    newSlice();

    seqEllipse = new JRadioButton("Elliptical projection");
    seqEllipse.setSelected(false);
    group2.add(seqEllipse);
    slice.add(seqEllipse);
    newSlice();

    seqSizeLabel = new JLabel("Image height=" + seqSize);
    slice.add(seqSizeLabel);
    seqSizeUp = new JButton("Up");
    seqSizeDown = new JButton("Down");
    seqSizeUp.addActionListener(this);
    seqSizeDown.addActionListener(this);
    slice.add(seqSizeUp);
    slice.add(seqSizeDown);
    newSlice();

    seqSquare = new JRadioButton("Square the images");
    seqSquare.setSelected(false);
    slice.add(seqSquare);
    newSlice();

    seqFaults = new JRadioButton("Show faultlines");
    seqFaults.setSelected(true);
    slice.add(seqFaults);
    newSlice();

    seqAgeDots = new JRadioButton("Show age dots");
    seqAgeDots.setSelected(true);
    slice.add(seqAgeDots);
    // newSlice();

  }
  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);
  }