コード例 #1
0
  public CookiePanel() {
    try {
      jbInit();
    } catch (Exception e) {
      e.printStackTrace();
    }
    buttonGroupDefault.add(jRadioButtonDefaultAccept);
    buttonGroupDefault.add(jRadioButtonDefaultAsk);
    buttonGroupDefault.add(jRadioButtonDefaultReject);
    buttonGroupDomain.add(jRadioButtonDomainAccept);
    buttonGroupDomain.add(jRadioButtonDomainAsk);
    buttonGroupDomain.add(jRadioButtonDomainReject);

    Object[][] cells = {
      {"java.sun.com", "accept"},
      {"amazon.com", "ask"},
      {"evil.hacker.org", "deny"},
      {"microsoft.com", "deny"},
      {"ibm.com", "ask"},
      {"oracle.com", "accept"},
      {"netscape.com", "accept"},
      {"borland.com", "accept"},
      {"rsasecurity.com", "accept"},
      {"linux.org", "accept"},
      {"redhat.com", "accept"},
      {"linuxjournal.com", "accept"},
      {"bea.com", "accept"},
      {"sick.perverts.org", "deny"}
    };
    String[] columnNames = {"Domain", "Policy"};
    JTable table = new JTable(cells, columnNames);
    JScrollPane scrollpane = new JScrollPane(table);
    table.setPreferredScrollableViewportSize(new Dimension(28, 10));
    jPanelDomainSpecific.add(scrollpane);
  }
コード例 #2
0
  public AccountPanel() {
    try {
      jbInit();
    } catch (Exception e) {
      e.printStackTrace();
    }

    usermodel.addUser(new User("karl", "Karl Marx", ("rabid#communist").toCharArray()));
    usermodel.addUser(new User("vlad", "Vladimir Lenin", ("looney").toCharArray()));
    table = new JTable(usermodel);
    table.setPreferredScrollableViewportSize(new Dimension(28, 8));
    JScrollPane scrollpane = new JScrollPane(table);
    jPanelUsers.add(scrollpane);
  }
コード例 #3
0
 private void jbInit() throws Exception {
   titledBorder1 =
       new TitledBorder(BorderFactory.createLineBorder(new Color(153, 153, 153), 2), "New User");
   titledBorder2 =
       new TitledBorder(
           BorderFactory.createLineBorder(new Color(153, 153, 153), 2), "User accounts");
   this.setLayout(borderLayout1);
   jPanelNewUser.setBorder(titledBorder1);
   jPanelNewUser.setLayout(gridBagLayout1);
   jLabel1.setText("Account name: ");
   jTextFieldAccountname.setColumns(10);
   jLabel2.setText("Password: "******"Repeat Password: "******"Full name: ");
   jTextFieldFullname.setColumns(20);
   addButton.setText("Add");
   addButton.addActionListener(
       new charva.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           addButton_actionPerformed(e);
         }
       });
   jPanel1.setLayout(gridBagLayout2);
   deleteButton.setText("Delete");
   deleteButton.addActionListener(
       new charva.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           deleteButton_actionPerformed(e);
         }
       });
   jPanel1.setBorder(titledBorder2);
   this.add(jPanelNewUser, BorderLayout.NORTH);
   jPanelNewUser.add(
       jLabel1,
       new GridBagConstraints(
           0,
           0,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.EAST,
           GridBagConstraints.NONE,
           new Insets(0, 0, 0, 0),
           0,
           0));
   jPanelNewUser.add(
       jTextFieldAccountname,
       new GridBagConstraints(
           1,
           0,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.WEST,
           GridBagConstraints.NONE,
           new Insets(0, 0, 0, 0),
           0,
           0));
   jPanelNewUser.add(
       jLabel4,
       new GridBagConstraints(
           0,
           1,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.EAST,
           GridBagConstraints.NONE,
           new Insets(0, 0, 0, 0),
           0,
           0));
   jPanelNewUser.add(
       jTextFieldFullname,
       new GridBagConstraints(
           1,
           1,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.WEST,
           GridBagConstraints.NONE,
           new Insets(0, 0, 0, 0),
           0,
           0));
   jPanelNewUser.add(
       jLabel2,
       new GridBagConstraints(
           0,
           2,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.EAST,
           GridBagConstraints.NONE,
           new Insets(0, 0, 0, 0),
           0,
           0));
   jPanelNewUser.add(
       jPasswordField1,
       new GridBagConstraints(
           1,
           2,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.WEST,
           GridBagConstraints.NONE,
           new Insets(0, 0, 0, 0),
           0,
           0));
   jPanelNewUser.add(
       jLabel3,
       new GridBagConstraints(
           0,
           3,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.EAST,
           GridBagConstraints.NONE,
           new Insets(0, 0, 0, 0),
           0,
           0));
   jPanelNewUser.add(
       jPasswordField2,
       new GridBagConstraints(
           1,
           3,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.WEST,
           GridBagConstraints.NONE,
           new Insets(0, 0, 0, 0),
           0,
           0));
   jPanelNewUser.add(
       addButton,
       new GridBagConstraints(
           0,
           4,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.WEST,
           GridBagConstraints.NONE,
           new Insets(0, 0, 0, 0),
           0,
           0));
   this.add(jPanel1, BorderLayout.CENTER);
   jPanel1.add(
       jPanelUsers,
       new GridBagConstraints(
           0,
           0,
           1,
           1,
           100.0,
           100.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(0, 0, 0, 0),
           0,
           0));
   jPanel1.add(
       deleteButton,
       new GridBagConstraints(
           1,
           0,
           1,
           1,
           10.0,
           10.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(0, 0, 0, 0),
           0,
           0));
 }
コード例 #4
0
 private void jbInit() throws Exception {
   border1 = BorderFactory.createLineBorder(Color.black, 2);
   titledBorder1 = new TitledBorder(border1, "Domain-specific settings");
   titledBorder2 =
       new TitledBorder(
           BorderFactory.createLineBorder(new Color(153, 153, 153), 2), "Default policy");
   titledBorder3 =
       new TitledBorder(
           BorderFactory.createLineBorder(new Color(153, 153, 153), 2), "Domain policy");
   jCheckBoxEnableCookies.setText("Enable Cookies");
   this.setLayout(gridBagLayout1);
   jPanelDomainSpecific.setBorder(titledBorder1);
   jRadioButtonDefaultReject.setText("Reject");
   jRadioButtonDefaultAsk.setText("Ask");
   jPanelDefaultPolicy.setBorder(titledBorder2);
   jPanelDomainPolicy.setBorder(titledBorder3);
   jPanelDomainPolicy.setLayout(borderLayout1);
   jRadioButtonDefaultAccept.setSelected(true);
   jRadioButtonDefaultAccept.setText("Accept");
   jRadioButtonDomainReject.setText("Reject");
   jRadioButtonDomainAsk.setText("Ask");
   jRadioButtonDomainAccept.setSelected(true);
   jRadioButtonDomainAccept.setText("Accept");
   jButtonDelete.setText("Delete");
   jButtonChange.setText("Change");
   jTextField1.setColumns(20);
   jLabel1.setText("Domain: ");
   jPanelDomain.setLayout(flowLayout1);
   flowLayout1.setAlignment(FlowLayout.LEFT);
   this.add(
       jCheckBoxEnableCookies,
       new GridBagConstraints(
           0,
           0,
           1,
           1,
           0.0,
           20.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(0, 0, 0, 0),
           0,
           0));
   this.add(
       jPanelDomainSpecific,
       new GridBagConstraints(
           0,
           1,
           2,
           2,
           100.0,
           100.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.BOTH,
           new Insets(0, 0, 0, 0),
           0,
           0));
   this.add(
       jPanelDefaultPolicy,
       new GridBagConstraints(
           2,
           1,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.WEST,
           GridBagConstraints.HORIZONTAL,
           new Insets(0, 0, 0, 0),
           0,
           0));
   jPanelDefaultPolicy.add(jRadioButtonDefaultAccept, null);
   jPanelDefaultPolicy.add(jRadioButtonDefaultAsk, null);
   jPanelDefaultPolicy.add(jRadioButtonDefaultReject, null);
   this.add(
       jPanelDomainPolicy,
       new GridBagConstraints(
           2,
           2,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.NORTHWEST,
           GridBagConstraints.NONE,
           new Insets(0, 0, 0, 0),
           0,
           0));
   jPanelDomainPolicy.add(jPanelRadioButtons, BorderLayout.CENTER);
   jPanelRadioButtons.add(jRadioButtonDomainAccept, null);
   jPanelRadioButtons.add(jRadioButtonDomainAsk, null);
   jPanelRadioButtons.add(jRadioButtonDomainReject, null);
   jPanelDomainPolicy.add(jPanelButtons, BorderLayout.SOUTH);
   jPanelButtons.add(jButtonChange, null);
   jPanelButtons.add(jButtonDelete, null);
   jPanelDomainPolicy.add(jPanelDomain, BorderLayout.NORTH);
   jPanelDomain.add(jLabel1, null);
   jPanelDomain.add(jTextField1, null);
 }