/** * 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
public void RedoPortraits(int screen) { // PortraitObjects = new LinkedList(); if (screen == -1) { ScreenNum = 0; screen = 0; TotalPortrait = CalculateValidPortraits(); } int CurrentNum = 0; setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR)); menucreate.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR)); PortraitsWindow.removeAll(); PortraitsWindow.repaint(); String filenames[] = (new File(directory)).list(new ImageFilter()); String sexstr = ""; int sex = ((Integer) menucreate.MainCharData[0].get(new Integer(0))).intValue(); int race = Integer.parseInt(menucreate.MainCharDataAux[1][0]); int numbif = 0; for (int p = 0; p < portraitmap.length; p++) { String basepicfilename = portraitmap[p][1]; if (basepicfilename != null && portraitmap[p][2] != null && portraitmap[p][3] != null) { basepicfilename = basepicfilename.toLowerCase(); if (!basepicfilename.startsWith("plc") && !basepicfilename.equalsIgnoreCase("door01_") && (Integer.parseInt(portraitmap[p][2]) == sex && sexlock || !sexlock) && (Integer.parseInt(portraitmap[p][3]) == race && racelock || !racelock) && CheckPortrait(directory, "po_" + basepicfilename)) { String picFilename = "po_" + basepicfilename + "m.tga"; CurrentNum++; if ((CurrentNum <= (50 * (screen + 1))) && (CurrentNum > (50 * screen))) { try { File tempImage = RESFAC.TempImageFile(picFilename); if (tempImage != null) { Portrait port = new Portrait( tempImage.getParent() + FileDelim, tempImage.getName(), true, basepicfilename); port.getComponent(0).setSize(64, 100); PortraitsWindow.add(port, -1); numbif++; } } catch (IOException err) { JOptionPane.showMessageDialog( null, "Error reading " + picFilename + ". Out of Memory. Error: " + err, "Error", 0); System.exit(0); } } } } } for (int i = 0; i < filenames.length; ++i) { ++CurrentNum; if ((CurrentNum <= (50 * (screen + 1))) && (CurrentNum > (50 * screen))) { Portrait port = new Portrait(directory, filenames[i], false, ""); port.getComponent(0).setSize(64, 100); PortraitsWindow.add(port, -1); } } FirstButton.setEnabled(screen != 0); BackButton.setEnabled(screen != 0); LastButton.setEnabled(screen < (ScreenCount - 1)); ForwardButton.setEnabled(screen < (ScreenCount - 1)); setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR)); menucreate.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR)); Runtime r = Runtime.getRuntime(); r.gc(); }