Ejemplo n.º 1
0
  /** Creates new form PortraitMenu1 */
  public PortraitMenu() {
    menucreate = TLKFactory.getCreateMenu();
    TLKFAC = menucreate.getTLKFactory();
    RESFAC = menucreate.getResourceFactory();
    Preferences prefs = Preferences.userRoot().node("/CharacterCreator");
    String NWNDir = prefs.get("GameDir", null);
    FileDelim = prefs.get("FileDelim", null);
    directory = NWNDir + "portraits" + FileDelim;
    menucreate.BlockWindow(true);
    initComponents();
    PortraitScrollPane.setViewportView(PortraitsWindow);
    OKButton.setEnabled(false);
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    if ((screenSize.getWidth() > getContentPane().getWidth())
        && (screenSize.getHeight() > getContentPane().getHeight())) {
      int intwidth =
          new Double(((screenSize.getWidth() - getContentPane().getWidth()) / 2)).intValue();
      int intheight =
          new Double(((screenSize.getHeight() - getContentPane().getHeight()) / 2)).intValue();
      setLocation(intwidth, intheight);
    } else setLocation(0, 0);

    try {
      portraitmap = RESFAC.getResourceAs2DA("portraits");
    } catch (IOException err) {
      JOptionPane.showMessageDialog(
          null,
          "Fatal Error - portraits.2da not found. Your data files might be corrupt.",
          "Error",
          0);
      System.exit(0);
    }

    CURRENTPORTRAIT = "resource/portrait.jpg";
    java.net.URL targurl = getClass().getResource(CURRENTPORTRAIT);
    CurrentPortrait.setIcon(new ImageIcon(targurl));
    menucreate = TLKFactory.getCreateMenu();
    sexlock = true;
    racelock = true;

    RedoPortraits(-1);

    pack();
  }
Ejemplo n.º 2
0
  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Form Editor.
   */
  private void initComponents() { // GEN-BEGIN:initComponents
    java.awt.GridBagConstraints gridBagConstraints;

    CurrentPortrait = new javax.swing.JLabel();
    RaceCheck = new javax.swing.JCheckBox();
    SexCheck = new javax.swing.JCheckBox();
    PortraitScrollPane = new javax.swing.JScrollPane();
    PortraitsWindow = new javax.swing.JPanel();
    OKButton = new javax.swing.JButton();
    CancelButton = new javax.swing.JButton();
    jPanel1 = new javax.swing.JPanel();
    jPanel2 = new javax.swing.JPanel();
    jPanel3 = new javax.swing.JPanel();
    jPanel4 = new javax.swing.JPanel();
    jPanel5 = new javax.swing.JPanel();
    jPanel6 = new javax.swing.JPanel();
    jPanel7 = new javax.swing.JPanel();
    InfoText = new javax.swing.JTextField();
    FirstButton = new javax.swing.JButton();
    BackButton = new javax.swing.JButton();
    ForwardButton = new javax.swing.JButton();
    LastButton = new javax.swing.JButton();
    jPanel8 = new javax.swing.JPanel();
    jPanel9 = new javax.swing.JPanel();

    getContentPane().setLayout(new java.awt.GridBagLayout());

    setTitle("Portraits");
    setName("PortFrame");
    setResizable(false);
    addWindowListener(
        new java.awt.event.WindowAdapter() {
          public void windowClosing(java.awt.event.WindowEvent evt) {
            exitForm(evt);
          }
        });

    CurrentPortrait.setIcon(
        new javax.swing.ImageIcon(
            getClass().getResource("/CharacterCreator/resource/portrait.jpg")));
    CurrentPortrait.setVerticalAlignment(javax.swing.SwingConstants.TOP);
    CurrentPortrait.setMaximumSize(new java.awt.Dimension(128, 200));
    CurrentPortrait.setMinimumSize(new java.awt.Dimension(128, 200));
    CurrentPortrait.setPreferredSize(new java.awt.Dimension(128, 200));
    CurrentPortrait.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    getContentPane().add(CurrentPortrait, gridBagConstraints);

    RaceCheck.setSelected(true);
    RaceCheck.setText("Lock To Race");
    RaceCheck.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            RaceCheckActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 4;
    getContentPane().add(RaceCheck, gridBagConstraints);

    SexCheck.setSelected(true);
    SexCheck.setText("Lock to Gender");
    SexCheck.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            SexCheckActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 3;
    getContentPane().add(SexCheck, gridBagConstraints);

    PortraitScrollPane.setHorizontalScrollBarPolicy(
        javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    PortraitScrollPane.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_NEVER);
    PortraitScrollPane.setMinimumSize(new java.awt.Dimension(640, 500));
    PortraitScrollPane.setPreferredSize(new java.awt.Dimension(658, 500));
    PortraitScrollPane.setAutoscrolls(true);
    PortraitsWindow.setLayout(new java.awt.GridLayout(0, 10));

    PortraitsWindow.setMaximumSize(new java.awt.Dimension(640, 500));
    PortraitsWindow.setMinimumSize(new java.awt.Dimension(640, 500));
    PortraitScrollPane.setViewportView(PortraitsWindow);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridwidth = 6;
    gridBagConstraints.gridheight = 9;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    getContentPane().add(PortraitScrollPane, gridBagConstraints);

    OKButton.setText("OK");
    OKButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            OKButtonActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 10;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH;
    getContentPane().add(OKButton, gridBagConstraints);

    CancelButton.setText("Cancel");
    CancelButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            CancelButtonActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 11;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    getContentPane().add(CancelButton, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    getContentPane().add(jPanel1, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    getContentPane().add(jPanel2, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 12;
    getContentPane().add(jPanel3, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 4;
    gridBagConstraints.gridy = 0;
    getContentPane().add(jPanel4, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 5;
    getContentPane().add(jPanel5, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 2;
    getContentPane().add(jPanel6, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 7;
    getContentPane().add(jPanel7, gridBagConstraints);

    InfoText.setBackground(new java.awt.Color(204, 204, 204));
    InfoText.setFont(new java.awt.Font("Dialog", 0, 10));
    InfoText.setForeground(new java.awt.Color(255, 0, 0));
    InfoText.setHorizontalAlignment(javax.swing.JTextField.CENTER);
    InfoText.setBorder(null);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 9;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH;
    getContentPane().add(InfoText, gridBagConstraints);

    FirstButton.setIcon(
        new javax.swing.ImageIcon(getClass().getResource("/CharacterCreator/resource/first.gif")));
    FirstButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            FirstButtonActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 4;
    gridBagConstraints.gridy = 11;
    getContentPane().add(FirstButton, gridBagConstraints);

    BackButton.setIcon(
        new javax.swing.ImageIcon(getClass().getResource("/CharacterCreator/resource/back.gif")));
    BackButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            BackButtonActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 5;
    gridBagConstraints.gridy = 11;
    getContentPane().add(BackButton, gridBagConstraints);

    ForwardButton.setIcon(
        new javax.swing.ImageIcon(
            getClass().getResource("/CharacterCreator/resource/forward.gif")));
    ForwardButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            ForwardButtonActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 7;
    gridBagConstraints.gridy = 11;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    getContentPane().add(ForwardButton, gridBagConstraints);

    LastButton.setIcon(
        new javax.swing.ImageIcon(getClass().getResource("/CharacterCreator/resource/last.gif")));
    LastButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            LastButtonActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 8;
    gridBagConstraints.gridy = 11;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    getContentPane().add(LastButton, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 11;
    gridBagConstraints.ipadx = 4;
    gridBagConstraints.insets = new java.awt.Insets(0, 85, 0, 85);
    getContentPane().add(jPanel8, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 6;
    gridBagConstraints.gridy = 11;
    gridBagConstraints.insets = new java.awt.Insets(0, 25, 0, 25);
    getContentPane().add(jPanel9, gridBagConstraints);

    pack();
  } // GEN-END:initComponents