Hello everyone and a good day to you.
I'm having trouble with this swing based GUI program that is considerably not finished. However, it should compile and run at least. Unfortunately it doesn't, and I suspect it's because the main method call is being ignored. The error appears to be happening at the part where the panel with the JSliders is being built, but it's not being any more specific than that. What is happening? >
package charactercreationquest;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.border.TitledBorder;
public class CharacterCreationQuest extends JFrame {
//contains: image, race, raceLabel, job, jobLabel, genderLabel male, and female.
private final JPanel picPanel;
//contains: str, intel, dex, wis, ptsSpent, and ptsRemain.
private final JPanel sliderPanel;
//contains: name, and nameLabel
private final JPanel namePanel;
//contains: save and load
private final JPanel savePanel;
private JSlider str;
private JSlider intel;
private JSlider dex;
private JSlider wis;
private JTextField name;
private JComboBox race;
private JComboBox job;
private JRadioButton male;
private JRadioButton female;
private JButton save;
private JButton load;
private JLabel image;
private JLabel genderLabel;
private JLabel nameLabel;
private JLabel jobLabel;//Label for lifestyles
private JLabel raceLabel;
private JLabel strLabel;
private JLabel intelLabel;
private JLabel dexLabel;
private JLabel wisLabel;
private JLabel ptsRemain;
private JLabel ptsSpent;
//what the heck is OCA look it up dumbo
public CharacterCreationQuest()
{
picPanel = new JPanel();
sliderPanel = new JPanel();
namePanel = new JPanel();
savePanel = new JPanel();
setTitle("Character Creation Quest");
setSize(500,500);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new GridLayout(2,2));
buildPic();
buildSlider();
buildName();
buildSave();
add(picPanel);
add(namePanel);
add(savePanel);
add(sliderPanel);
pack();
setVisible(true);
}//end c'tor
public final void buildPic()
{
//contains image, race, raceLabel, job, jobLabel, genderLabel male, female
String[] raceList = new String[]{"a","b","c"};
String[] jobList = new String[]{"a","b","c"};
image = new JLabel();
race = new JComboBox();
job = new JComboBox();
male = new JRadioButton("Male");
female = new JRadioButton("Female");
picPanel.add(image);
picPanel.add(race);
picPanel.add(job);
picPanel.add(male);
picPanel.add(female);
}//end buildPic
public final void buildSlider()
{
//contains: str, intel, dex, wis, and ptsRemain.
int numSpent = (str.getValue() + intel.getValue()
+ dex.getValue() + wis.getValue());
int numRemain = (100 - numSpent);
String remain;
String spent;
remain = ("Points Remaining: " + numRemain);
spent = ("Points Spent: " + numSpent);
str = new JSlider();
intel = new JSlider();
dex = new JSlider();
wis = new JSlider();
ptsRemain = new JLabel(remain);
ptsSpent = new JLabel(spent);
strLabel = new JLabel("Strength");
intelLabel = new JLabel("Intelligence");
dexLabel = new JLabel("Dexterity");
wisLabel = new JLabel("Wisdom");
sliderPanel.setLayout(new GridLayout(5,2));
sliderPanel.add(ptsRemain);
sliderPanel.add(ptsSpent);
sliderPanel.add(strLabel);
sliderPanel.add(str);
sliderPanel.add(intelLabel);
sliderPanel.add(intel);
sliderPanel.add(dexLabel);
sliderPanel.add(dex);
sliderPanel.add(wisLabel);
sliderPanel.add(wis);
pack();
}//end buildSlider
public final void buildName()
{
//contains: name and namelabel
name = new JTextField(10);
nameLabel = new JLabel();
namePanel.add(name);
}//end buildName
public final void buildSave()
{
//contains: save and load
save = new JButton("Save");
load = new JButton("Load");
TitledBorder title;
title = BorderFactory.createTitledBorder("SHIN");
savePanel.setBorder(title);
savePanel.add(save);
savePanel.add(load);
}//end buildSave
//ignore this for now. get rid of the space above later plz.
public static void main(String[] args) {
new CharacterCreationQuest();
}
}