private void initComponents() { RaceButton = new JButton(); InfoNum = new JLabel(); setLayout(new GridBagLayout()); RaceButton.setBackground(new Color(0, 0, 0)); RaceButton.setForeground(new Color(222, 200, 120)); // Text color for buttons RaceButton.setText("Name Place Holder"); RaceButton.setHorizontalAlignment(2); RaceButton.setPreferredSize(new Dimension(240, 52)); RaceButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { RaceButtonActionPerformed(evt); } }); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = 2; add(RaceButton, gridBagConstraints); InfoNum.setText("Num"); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; add(InfoNum, gridBagConstraints); }
private void RaceButtonActionPerformed(ActionEvent evt) { int tmp = (new Integer(InfoNum.getText())).intValue(); descstr = racialmap[tmp][racialtypes.Description]; int descnum = ChkHex.ChkHex(descstr); // int descnum = (new Integer((String)racialmap[tmp].get(new // Integer(racialtypes.Description)))).intValue(); DescriptionText.setText(TLKFAC.getEntry(descnum)); DescriptionContainer.scrollRectToVisible(new Rectangle(10, 10)); DescriptionContainer.getViewport().setViewPosition(new Point(0, 0)); // @DUG RACENUM = tmp; OKButton.setEnabled(true); }