コード例 #1
0
  public ContactFileEditor(GemDesktop _desktop) {
    super(_desktop);

    note = new GemLabel();
    note.setForeground(java.awt.Color.red);
    personView = new PersonView();
    infosView = new GemPanel();

    infosView.setBorder(BorderFactory.createMatteBorder(0, 1, 0, 0, Color.lightGray));
    teleView =
        new TelView(
            ParamTableIO.find(Category.TELEPHONE.getTable(), Category.TELEPHONE.getCol(), dc));

    emailView = new EmailView();
    websiteView =
        new WebSiteView(
            ParamTableIO.find(Category.SITEWEB.getTable(), Category.SITEWEB.getCol(), dc));

    infosView.setLayout(new BoxLayout(infosView, BoxLayout.Y_AXIS));
    infosView.add(teleView);
    infosView.add(emailView);
    infosView.add(websiteView);

    JScrollPane scp = new JScrollPane(infosView);
    scp.setBorder(null);
    scp.setPreferredSize(new Dimension(400, scp.getPreferredSize().height));

    GemPanel addressPanel = new GemPanel();
    addressPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
    addressView = new AddressView();
    addressView.setBorder(null);
    addressPanel.add(addressView, BorderLayout.SOUTH);

    this.setLayout(new GridBagLayout());
    gb = new GridBagHelper(this);
    GemBorderPanel gp = new GemBorderPanel(new BorderLayout());

    gp.add(personView, BorderLayout.WEST);
    gp.add(scp, BorderLayout.EAST);

    gb.add(gp, 0, 0, 1, 1, GridBagHelper.BOTH, 1.0, 1.0);
    gb.add(addressPanel, 0, 2, 1, 1, GridBagHelper.BOTH, GridBagHelper.WEST);
    gb.add(note, 0, 3, 1, 1, GridBagHelper.HORIZONTAL, GridBagHelper.WEST);
  }
コード例 #2
0
 public void setLinkTelAddress(Vector a, Vector t, JCheckBox cb) {
   if (a != null && a.size() > 0) {
     addressView.set((Address) a.elementAt(0));
   }
   addressView.setEditable(false);
   addressView.getArchive().setEnabled(false);
   teleView.setLien(t);
   teleView.setEditable(false);
   gb.add(cb, 0, 1, 1, 1, GridBagHelper.WEST);
   cbTelAddress = cb;
   linkTelAddress = true;
   revalidate();
 }
コード例 #3
0
ファイル: DialogPanel.java プロジェクト: nirumasa/SEDSS
  private void init() {
    setName("Dialogs");
    setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));

    informationButton = new JButton("Information dialog");
    informationButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JOptionPane.showMessageDialog(
                parent, "Information dialog", "Information", JOptionPane.INFORMATION_MESSAGE);
          }
        });
    confirmationButton = new JButton("Confirmation dialog");
    confirmationButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JOptionPane.showMessageDialog(
                parent, "Confirmation dialog", "Confirmation", JOptionPane.QUESTION_MESSAGE);
          }
        });
    warningButton = new JButton("Warning dialog");
    warningButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JOptionPane.showMessageDialog(
                parent, "Warning dialog", "Warning", JOptionPane.WARNING_MESSAGE);
          }
        });
    errorButton = new JButton("Error dialog");
    errorButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JOptionPane.showMessageDialog(
                parent, "Error dialog", "Error", JOptionPane.ERROR_MESSAGE);
          }
        });
    optionButton = new JButton("Option dialog");
    optionButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Object[] options = {"Yes", "No"};
            int confirm =
                JOptionPane.showOptionDialog(
                    null,
                    "Please select yes or no using the keyboard (tab/enter) keys\n",
                    "Confirmation Required",
                    JOptionPane.YES_NO_OPTION,
                    JOptionPane.QUESTION_MESSAGE,
                    null,
                    options,
                    options[1]);
            if (confirm == 0 || confirm == 1)
              optionButton.setText("Option dialog. Selected: " + options[confirm]);
            else optionButton.setText("Option dialog. Selected: nothing ");
          }
        });

    nativeFileChooserButton = new JButton("Native FileChooser dialog");
    nativeFileChooserButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            fileDialog = new FileDialog(JOptionPane.getFrameForComponent(parent), "Open File");
            fileDialog.setResizable(true);
            fileDialog.setVisible(true);
          }
        });
    fileChooserButton = new JButton("FileChooser dialog");
    fileChooserButton.setEnabled(!(parent instanceof JApplet));
    fileChooserButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JFileChooser fc = new JFileChooser();
            int result = fc.showOpenDialog(parent);
          }
        });
    colorChooserButton = new JButton("ColorChooser dialog");
    colorChooserButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Color c = JColorChooser.showDialog(parent, "JColorChooser", Color.blue);
          }
        });

    JPanel contentPanel = new JPanel(new GridBagLayout());
    GridBagHelper.addComponent(
        contentPanel,
        informationButton,
        0,
        0,
        1,
        1,
        16,
        8,
        0,
        4,
        0.0,
        0.0,
        GridBagConstraints.HORIZONTAL,
        GridBagConstraints.CENTER);
    GridBagHelper.addComponent(
        contentPanel,
        confirmationButton,
        0,
        1,
        1,
        1,
        16,
        8,
        0,
        4,
        0.0,
        0.0,
        GridBagConstraints.HORIZONTAL,
        GridBagConstraints.CENTER);
    GridBagHelper.addComponent(
        contentPanel,
        warningButton,
        0,
        2,
        1,
        1,
        16,
        8,
        0,
        4,
        0.0,
        0.0,
        GridBagConstraints.HORIZONTAL,
        GridBagConstraints.CENTER);
    GridBagHelper.addComponent(
        contentPanel,
        errorButton,
        0,
        3,
        1,
        1,
        16,
        8,
        0,
        4,
        0.0,
        0.0,
        GridBagConstraints.HORIZONTAL,
        GridBagConstraints.CENTER);
    GridBagHelper.addComponent(
        contentPanel,
        optionButton,
        0,
        4,
        1,
        1,
        16,
        8,
        0,
        4,
        0.0,
        0.0,
        GridBagConstraints.HORIZONTAL,
        GridBagConstraints.CENTER);
    GridBagHelper.addComponent(
        contentPanel,
        nativeFileChooserButton,
        0,
        5,
        1,
        1,
        16,
        8,
        0,
        4,
        0.0,
        0.0,
        GridBagConstraints.HORIZONTAL,
        GridBagConstraints.CENTER);
    GridBagHelper.addComponent(
        contentPanel,
        fileChooserButton,
        0,
        6,
        1,
        1,
        16,
        8,
        0,
        4,
        0.0,
        0.0,
        GridBagConstraints.HORIZONTAL,
        GridBagConstraints.CENTER);
    GridBagHelper.addComponent(
        contentPanel,
        colorChooserButton,
        0,
        7,
        1,
        1,
        16,
        8,
        0,
        4,
        0.0,
        0.0,
        GridBagConstraints.HORIZONTAL,
        GridBagConstraints.CENTER);

    JScrollPane scrollPane = new JScrollPane(contentPanel);
    scrollPane.setBorder(BorderFactory.createEmptyBorder());
    add(scrollPane, BorderLayout.CENTER);
  }