mm7627
asked on
Menu Problems in Java
Ok, so I have a menu, with a submenu, that has like 5 options to choose from. I have two submenus, and for each, i created a seperate actionListener like so:
class selectionMenuListener implements ActionListener
{
public void actionPerformed(ActionEven t event)
{
String menuName = event.getActionCommand();
// THIS IS FOR SELECTION SORT ALWAYS [INCREASING]
<b>JOptionPane.showMessage Dialog(nul l,menuName );</b>
if (menuName.equals("Name"))
{
sortSelectNameIncAlgo();
sortByString = "NAME";
}
else if (menuName.equals("PPG"))
{
sortSelectPPGIncAlgo();
sortByString = "PPG";
}
else if (menuName.equals("APG"))
{
sortSelectAPGIncAlgo();
sortByString = "APG";
}
else if (menuName.equals("RPG"))
{
sortSelectRPGIncAlgo();
sortByString = "RPG";
}
else if (menuName.equals("MPG"))
{
sortSelectMPGIncAlgo();
sortByString = "MPG";
}
menuName = "";
typeSortString = "INCREASING";
algoSortString = "SELECTION";
createPlayerInfoPanel();
bottomMessage.setText("Inf o sorted by " + sortByString + " " + typeSortString + " using " + algoSortString + " SORT");
}
}
class bubbleMenuListener implements ActionListener
{
public void actionPerformed(ActionEven t event)
{
String menuName = event.getActionCommand();
// THIS IS FOR BUBBLE SORT ALWAYS [INCREASING]
if (menuName.equals("Name"))
{
sortBubbleNameIncAlgo();
sortByString = "NAME";
}
else if (menuName.equals("PPG"))
{
sortBubblePPGIncAlgo();
sortByString = "PPG";
}
else if (menuName.equals("APG"))
{
sortBubbleAPGIncAlgo();
sortByString = "APG";
}
else if (menuName.equals("RPG"))
{
sortBubbleRPGIncAlgo();
sortByString = "RPG";
}
else if (menuName.equals("MPG"))
{
sortBubbleMPGIncAlgo();
sortByString = "MPG";
}
typeSortString = "INCREASING";
algoSortString = "BUBBLE";
createPlayerInfoPanel();
bottomMessage.setText("Inf o sorted by " + sortByString + " " + typeSortString + " using " + algoSortString + " SORT");
}
}
Now, when I click on the menu, select Bubble submenu, which is the second actionListener, it doesn't work. But then again it kinda does. The if statements and such work, because the bottomMessage.setText is set to the right stuff. But the createPlayerInfoPanel(); doesn't seem to work. That panel makes all the JLabels and such and sorts them, then adds the panel to the CENTER of a BorderLayout. Now, the thing is, i was testing the first actionListener which is the Selection submenu, and it works fine, when I output the menuName with a JOptionPane. So it repaints it perfectly. But if I take out the JOptionPane, it only sorts by the first if statements function. But still changes to the right string. I think I explained that pretty bad, but I can try if no one understands what I mean.
class selectionMenuListener implements ActionListener
{
public void actionPerformed(ActionEven
{
String menuName = event.getActionCommand();
// THIS IS FOR SELECTION SORT ALWAYS [INCREASING]
<b>JOptionPane.showMessage
if (menuName.equals("Name"))
{
sortSelectNameIncAlgo();
sortByString = "NAME";
}
else if (menuName.equals("PPG"))
{
sortSelectPPGIncAlgo();
sortByString = "PPG";
}
else if (menuName.equals("APG"))
{
sortSelectAPGIncAlgo();
sortByString = "APG";
}
else if (menuName.equals("RPG"))
{
sortSelectRPGIncAlgo();
sortByString = "RPG";
}
else if (menuName.equals("MPG"))
{
sortSelectMPGIncAlgo();
sortByString = "MPG";
}
menuName = "";
typeSortString = "INCREASING";
algoSortString = "SELECTION";
createPlayerInfoPanel();
bottomMessage.setText("Inf
}
}
class bubbleMenuListener implements ActionListener
{
public void actionPerformed(ActionEven
{
String menuName = event.getActionCommand();
// THIS IS FOR BUBBLE SORT ALWAYS [INCREASING]
if (menuName.equals("Name"))
{
sortBubbleNameIncAlgo();
sortByString = "NAME";
}
else if (menuName.equals("PPG"))
{
sortBubblePPGIncAlgo();
sortByString = "PPG";
}
else if (menuName.equals("APG"))
{
sortBubbleAPGIncAlgo();
sortByString = "APG";
}
else if (menuName.equals("RPG"))
{
sortBubbleRPGIncAlgo();
sortByString = "RPG";
}
else if (menuName.equals("MPG"))
{
sortBubbleMPGIncAlgo();
sortByString = "MPG";
}
typeSortString = "INCREASING";
algoSortString = "BUBBLE";
createPlayerInfoPanel();
bottomMessage.setText("Inf
}
}
Now, when I click on the menu, select Bubble submenu, which is the second actionListener, it doesn't work. But then again it kinda does. The if statements and such work, because the bottomMessage.setText is set to the right stuff. But the createPlayerInfoPanel(); doesn't seem to work. That panel makes all the JLabels and such and sorts them, then adds the panel to the CENTER of a BorderLayout. Now, the thing is, i was testing the first actionListener which is the Selection submenu, and it works fine, when I output the menuName with a JOptionPane. So it repaints it perfectly. But if I take out the JOptionPane, it only sorts by the first if statements function. But still changes to the right string. I think I explained that pretty bad, but I can try if no one understands what I mean.
perhaps the problem is in createPlayerInfoPanel()
ASKER
Well, the thing is, if I add the JOptionPane.showMessageDia log(), it works perfectly. But without it, nothing happens.
are you calling revalidate() after adding components to your container?
ASKER
Would I want to do it before I add it to the main container (BorderLayout.CENTER) where that panel is at?
ASKER
private void createPlayerInfoPanel()
{
JPanel panel = new JPanel();
panel.setBorder(new TitledBorder(new EtchedBorder(), "Player Information"));
panel.setLayout(new GridLayout(15,6));
panel.add(new JLabel("<html><u>Last Name</u></html>"));
panel.add(new JLabel("<html><u>First Name</u></html>"));
panel.add(new JLabel("<html><u>PPG</u></ html>"));
panel.add(new JLabel("<html><u>APG</u></ html>"));
panel.add(new JLabel("<html><u>RPG</u></ html>"));
panel.add(new JLabel("<html><u>MPG</u></ html>"));
DecimalFormat df = new DecimalFormat("0.0");
for (int i = 0; i <= 13; i++)
{
String[] result = teamMember[i].split(",");
panel.add(new JLabel(result[1]));
panel.add(new JLabel(result[0]));
panel.add(new JLabel(df.format(Double.pa rseDouble( result[2]) )));
panel.add(new JLabel(df.format(Double.pa rseDouble( result[3]) )));
panel.add(new JLabel(df.format(Double.pa rseDouble( result[4]) )));
panel.add(new JLabel(df.format(Double.pa rseDouble( result[5]) )));
}
this.getContentPane().add( panel, BorderLayout.CENTER);
}
{
JPanel panel = new JPanel();
panel.setBorder(new TitledBorder(new EtchedBorder(), "Player Information"));
panel.setLayout(new GridLayout(15,6));
panel.add(new JLabel("<html><u>Last Name</u></html>"));
panel.add(new JLabel("<html><u>First Name</u></html>"));
panel.add(new JLabel("<html><u>PPG</u></
panel.add(new JLabel("<html><u>APG</u></
panel.add(new JLabel("<html><u>RPG</u></
panel.add(new JLabel("<html><u>MPG</u></
DecimalFormat df = new DecimalFormat("0.0");
for (int i = 0; i <= 13; i++)
{
String[] result = teamMember[i].split(",");
panel.add(new JLabel(result[1]));
panel.add(new JLabel(result[0]));
panel.add(new JLabel(df.format(Double.pa
panel.add(new JLabel(df.format(Double.pa
panel.add(new JLabel(df.format(Double.pa
panel.add(new JLabel(df.format(Double.pa
}
this.getContentPane().add(
}
this.getContentPane().add( panel, BorderLayout.CENTER);
((JComponent)this.getConte ntPane()). revalidate ();
((JComponent)this.getConte
ASKER
Hmm, that didn't work. What's weird is, I have menus and then radiobuttons, with a submit button, and if I choose something different, then go to the menu and run it, it only sorts it by the first if statement, NAME.
check the action name. you don't set a default so the sort will be whatever it was previously if it doesn't match anything.
ASKER
Ok, I made a default. Still nothing. I'm just confused about how the JOptionPane causes the thing to work flawlessly.
try a revalidate() and a repaint()
ASKER
Calling both just causes it to just mess up. Is there a better way to test which menu item was selected without having to create a new actionlistener for EACH menu item?
> Calling both just causes it to just mess up.
well it definitely should not do that. Sounds like theirs a problem with your layout
how exactly does it mess up.
> Is there a better way to test which menu item was selected without having to create a new actionlistener for EACH menu item?
you could create an ActionListener that stored algorith and sort by as member vars.
But I don't think its going to fix your problem.
well it definitely should not do that. Sounds like theirs a problem with your layout
how exactly does it mess up.
> Is there a better way to test which menu item was selected without having to create a new actionlistener for EACH menu item?
you could create an ActionListener that stored algorith and sort by as member vars.
But I don't think its going to fix your problem.
ASKER
By messed up, I should say it doesn't repaint at all. Not even with the radiobuttons and submit button that work.
....
Yeah, I don't think so either. Was just a though.
....
Yeah, I don't think so either. Was just a though.
any errors?
ASKER
java.lang.IllegalThreadSta teExceptio n
it's a run-time error
it's a run-time error
can you post the stack trace
ASKER
Ok, I tried to run it again to get the stack trace, and it didn't show up. So, I guess it doesn't give an error anymore.
this.getContentPane().add( panel, BorderLayout.CENTER);
((JComponent)this.getConte ntPane()). revalidate ();
((JComponent)this.getConte ntPane()). repaint();
... If I take out .repaint(); it redraws the panel perfectly when I hit submit. But once I add that in, it never redraws.
this.getContentPane().add(
((JComponent)this.getConte
((JComponent)this.getConte
... If I take out .repaint(); it redraws the panel perfectly when I hit submit. But once I add that in, it never redraws.
thats suggests theres something wrong somewhere.
do u have any custom painting?
do u have any custom painting?
ASKER
Nah man, I just have three panels added to the main ContentPane.
if you can put together a small compilable example that reproduces the problem I can try it here for you.
ASKER
I condensed the program considerably and threw it all in one java file. It doesn't work perfect, but you should be able to see my error.
import java.awt.*;
import java.text.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.border.*;
public class NewClass extends JFrame implements ActionListener
{
private String[] teamMember;
private JMenu fileMenu;
private JMenu sortMenu;
public NewClass(String[] aMember)
{
teamMember = aMember;
setSize (500,700);
setResizable(false);
setLocation (10,10);
createFileMenu();
createSortMenu();
createSortInfoPanel();
createPlayerInfoPanel();
createStringInfoPanel();
JMenuBar menuBar = new JMenuBar();
setJMenuBar(menuBar);
menuBar.add(fileMenu);
menuBar.add(sortMenu);
this.setDefaultCloseOperat ion(EXIT_O N_CLOSE);
pack();
}
private void sortSelectNameIncAlgo()
{
int min;
String temp;
for (int start = 0; start <= teamMember.length - 2; start++)
{
min = start;
for (int j = start; j <= teamMember.length - 1; j++)
{
String[] result = teamMember[j].split(",");
String[] result2 = teamMember[min].split(",") ;
if (result[1].compareTo(resul t2[1])<0)
{
min = j;
}
}
temp = teamMember[start];
teamMember[start] = teamMember[min];
teamMember[min] = temp;
}
}
private void sortSelectPPGIncAlgo()
{
int min;
String temp;
for (int start = 0; start <= teamMember.length - 2; start++)
{
min = start;
for (int j = start; j <= teamMember.length - 1; j++)
{
String[] result = teamMember[j].split(",");
String[] result2 = teamMember[min].split(",") ;
if (Double.parseDouble(result [2]) > Double.parseDouble(result2 [2]))
{
min = j;
}
}
temp = teamMember[start];
teamMember[start] = teamMember[min];
teamMember[min] = temp;
}
}
private void createSortInfoPanel()
{
JPanel panel = new JPanel();
panel.setLayout(new GridLayout(0,1));
panel.add(sortByPanel());
panel.add(sortOptionPanel( ));
this.getContentPane().add( panel, BorderLayout.NORTH);
}
private JRadioButton nameButton;
private JRadioButton ppgButton;
private JRadioButton selectionButton;
private JRadioButton incButton;
private JPanel sortByPanel()
{
JPanel panel = new JPanel();
panel.setBorder(new TitledBorder(new EtchedBorder(), "Sort By"));
panel.setLayout(new GridLayout(1,5));
nameButton = new JRadioButton("Name");
nameButton.addItemListener (new sortByListener());
ppgButton = new JRadioButton("PPG");
ppgButton.addItemListener( new sortByListener());
ButtonGroup theGroup = new ButtonGroup();
nameButton.setSelected(tru e);
theGroup.add(nameButton);
theGroup.add(ppgButton);
panel.add(nameButton);
panel.add(ppgButton);
return panel;
}
private JPanel sortOptionPanel()
{
JPanel panel = new JPanel();
JPanel sortAlgo = new JPanel();
JPanel sortOrder = new JPanel();
JButton submit = new JButton("Submit");
submit.addActionListener(n ew submitButtonListener());
selectionButton = new JRadioButton("Selection");
incButton = new JRadioButton("Increasing") ;
selectionButton.addItemLis tener(new sortAlgoListener());
incButton.addItemListener( new sortTypeListener());
ButtonGroup algoGroup = new ButtonGroup();
ButtonGroup sortGroup = new ButtonGroup();
algoGroup.add(selectionBut ton);
sortGroup.add(incButton);
selectionButton.setSelecte d(true);
incButton.setSelected(true );
sortAlgo.setBorder(new TitledBorder(new EtchedBorder(), "Sort Algorithm"));
sortOrder.setBorder(new TitledBorder(new EtchedBorder(), "Sort Ordering"));
sortAlgo.add(selectionButt on);
sortOrder.add(incButton);
panel.add(sortAlgo);
panel.add(sortOrder);
panel.add(submit);
return panel;
}
private void createPlayerInfoPanel()
{
JPanel panel = new JPanel();
panel.setBorder(new TitledBorder(new EtchedBorder(), "Player Information"));
panel.setLayout(new GridLayout(6,3));
panel.add(new JLabel("<html><u>Last Name</u></html>"));
panel.add(new JLabel("<html><u>First Name</u></html>"));
panel.add(new JLabel("<html><u>PPG</u></ html>"));
DecimalFormat df = new DecimalFormat("0.0");
for (int i = 0; i <= teamMember.length-1; i++)
{
String[] result = teamMember[i].split(",");
panel.add(new JLabel(result[1]));
panel.add(new JLabel(result[0]));
panel.add(new JLabel(df.format(Double.pa rseDouble( result[2]) )));
}
this.getContentPane().add( panel, BorderLayout.CENTER);
//((JComponent)this.getCon tentPane() ).revalida te();
//((JComponent)this.getCon tentPane() ).repaint( );
}
private JLabel bottomMessage;
private void createStringInfoPanel()
{
JPanel panel = new JPanel();
bottomMessage = new JLabel("Info sorted by NAME INCREASING using SELECTION SORT");
panel.add(bottomMessage);
this.getContentPane().add( panel, BorderLayout.SOUTH);
}
private void createFileMenu()
{
JMenuItem item;
fileMenu = new JMenu("File");
item = new JMenuItem("Quit");
item.addActionListener(thi s);
fileMenu.add(item);
}
private void createSortMenu()
{
JMenuItem item;
sortMenu = new JMenu("Sort");
JMenuItem selectionMenu = new JMenu("Selection Sort");
item = new JMenuItem("Name");
item.addActionListener(new selectionMenuListener());
selectionMenu.add(item);
item = new JMenuItem("PPG");
item.addActionListener(new selectionMenuListener());
selectionMenu.add(item);
sortMenu.add(selectionMenu );
}
private String sortByString,algoSortStrin g,typeSort String;
class sortByListener implements ItemListener
{
public void itemStateChanged(ItemEvent event)
{
if (nameButton.isSelected())
sortByString = "NAME";
if (ppgButton.isSelected())
sortByString = "PPG";
}
}
class sortAlgoListener implements ItemListener
{
public void itemStateChanged(ItemEvent event)
{
if (selectionButton.isSelecte d())
algoSortString = "SELECTION";
}
}
class sortTypeListener implements ItemListener
{
public void itemStateChanged(ItemEvent event)
{
if (incButton.isSelected())
typeSortString = "INCREASING";
}
}
class submitButtonListener implements ActionListener
{
public void actionPerformed(ActionEven t event)
{
if (sortByString.equals("NAME ") && typeSortString.equals("INC REASING") && algoSortString.equals("SEL ECTION"))
sortSelectNameIncAlgo();
if (sortByString.equals("PPG" ) && typeSortString.equals("INC REASING") && algoSortString.equals("SEL ECTION"))
sortSelectPPGIncAlgo();
createPlayerInfoPanel();
bottomMessage.setText("Inf o sorted by " + sortByString + " " + typeSortString + " using " + algoSortString + " SORT");
}
}
class selectionMenuListener implements ActionListener
{
public void actionPerformed(ActionEven t event)
{
String menuName = event.getActionCommand();
// THIS IS FOR SELECTION SORT ALWAYS [INCREASING]
if (menuName.equals("Name"))
{
sortSelectNameIncAlgo();
sortByString = "NAME";
}
else if (menuName.equals("PPG"))
{
sortSelectPPGIncAlgo();
sortByString = "PPG";
}
typeSortString = "INCREASING";
algoSortString = "SELECTION";
createPlayerInfoPanel();
bottomMessage.setText("Inf o sorted by " + sortByString + " " + typeSortString + " using " + algoSortString + " SORT");
}
}
public static void main(String[] args)
{
String[] teamMember = null;
teamMember = new String[5];
teamMember[0] = "Katie,Gearlds,15.6,3.4,3. 9,35.6";
teamMember[1] = "Aya,Traore,13.0,2.3,4.9,3 0.5";
teamMember[2] = "Lindsay,Wisdom,10.1,1.25, 5.6,25.9";
teamMember[3] = "Erin,Lawless,9.7,1.07,3.8 ,25.8";
teamMember[4] = "Sharika,Webb,4.8,3.43,3.0 ,26";
NewClass bTeam = new NewClass(teamMember);
bTeam.setVisible(true);
}
public void actionPerformed(ActionEven t event)
{
String menuName = event.getActionCommand();
if (menuName.equals("Quit"))
System.exit(0);
}
}
import java.awt.*;
import java.text.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.border.*;
public class NewClass extends JFrame implements ActionListener
{
private String[] teamMember;
private JMenu fileMenu;
private JMenu sortMenu;
public NewClass(String[] aMember)
{
teamMember = aMember;
setSize (500,700);
setResizable(false);
setLocation (10,10);
createFileMenu();
createSortMenu();
createSortInfoPanel();
createPlayerInfoPanel();
createStringInfoPanel();
JMenuBar menuBar = new JMenuBar();
setJMenuBar(menuBar);
menuBar.add(fileMenu);
menuBar.add(sortMenu);
this.setDefaultCloseOperat
pack();
}
private void sortSelectNameIncAlgo()
{
int min;
String temp;
for (int start = 0; start <= teamMember.length - 2; start++)
{
min = start;
for (int j = start; j <= teamMember.length - 1; j++)
{
String[] result = teamMember[j].split(",");
String[] result2 = teamMember[min].split(",")
if (result[1].compareTo(resul
{
min = j;
}
}
temp = teamMember[start];
teamMember[start] = teamMember[min];
teamMember[min] = temp;
}
}
private void sortSelectPPGIncAlgo()
{
int min;
String temp;
for (int start = 0; start <= teamMember.length - 2; start++)
{
min = start;
for (int j = start; j <= teamMember.length - 1; j++)
{
String[] result = teamMember[j].split(",");
String[] result2 = teamMember[min].split(",")
if (Double.parseDouble(result
{
min = j;
}
}
temp = teamMember[start];
teamMember[start] = teamMember[min];
teamMember[min] = temp;
}
}
private void createSortInfoPanel()
{
JPanel panel = new JPanel();
panel.setLayout(new GridLayout(0,1));
panel.add(sortByPanel());
panel.add(sortOptionPanel(
this.getContentPane().add(
}
private JRadioButton nameButton;
private JRadioButton ppgButton;
private JRadioButton selectionButton;
private JRadioButton incButton;
private JPanel sortByPanel()
{
JPanel panel = new JPanel();
panel.setBorder(new TitledBorder(new EtchedBorder(), "Sort By"));
panel.setLayout(new GridLayout(1,5));
nameButton = new JRadioButton("Name");
nameButton.addItemListener
ppgButton = new JRadioButton("PPG");
ppgButton.addItemListener(
ButtonGroup theGroup = new ButtonGroup();
nameButton.setSelected(tru
theGroup.add(nameButton);
theGroup.add(ppgButton);
panel.add(nameButton);
panel.add(ppgButton);
return panel;
}
private JPanel sortOptionPanel()
{
JPanel panel = new JPanel();
JPanel sortAlgo = new JPanel();
JPanel sortOrder = new JPanel();
JButton submit = new JButton("Submit");
submit.addActionListener(n
selectionButton = new JRadioButton("Selection");
incButton = new JRadioButton("Increasing")
selectionButton.addItemLis
incButton.addItemListener(
ButtonGroup algoGroup = new ButtonGroup();
ButtonGroup sortGroup = new ButtonGroup();
algoGroup.add(selectionBut
sortGroup.add(incButton);
selectionButton.setSelecte
incButton.setSelected(true
sortAlgo.setBorder(new TitledBorder(new EtchedBorder(), "Sort Algorithm"));
sortOrder.setBorder(new TitledBorder(new EtchedBorder(), "Sort Ordering"));
sortAlgo.add(selectionButt
sortOrder.add(incButton);
panel.add(sortAlgo);
panel.add(sortOrder);
panel.add(submit);
return panel;
}
private void createPlayerInfoPanel()
{
JPanel panel = new JPanel();
panel.setBorder(new TitledBorder(new EtchedBorder(), "Player Information"));
panel.setLayout(new GridLayout(6,3));
panel.add(new JLabel("<html><u>Last Name</u></html>"));
panel.add(new JLabel("<html><u>First Name</u></html>"));
panel.add(new JLabel("<html><u>PPG</u></
DecimalFormat df = new DecimalFormat("0.0");
for (int i = 0; i <= teamMember.length-1; i++)
{
String[] result = teamMember[i].split(",");
panel.add(new JLabel(result[1]));
panel.add(new JLabel(result[0]));
panel.add(new JLabel(df.format(Double.pa
}
this.getContentPane().add(
//((JComponent)this.getCon
//((JComponent)this.getCon
}
private JLabel bottomMessage;
private void createStringInfoPanel()
{
JPanel panel = new JPanel();
bottomMessage = new JLabel("Info sorted by NAME INCREASING using SELECTION SORT");
panel.add(bottomMessage);
this.getContentPane().add(
}
private void createFileMenu()
{
JMenuItem item;
fileMenu = new JMenu("File");
item = new JMenuItem("Quit");
item.addActionListener(thi
fileMenu.add(item);
}
private void createSortMenu()
{
JMenuItem item;
sortMenu = new JMenu("Sort");
JMenuItem selectionMenu = new JMenu("Selection Sort");
item = new JMenuItem("Name");
item.addActionListener(new
selectionMenu.add(item);
item = new JMenuItem("PPG");
item.addActionListener(new
selectionMenu.add(item);
sortMenu.add(selectionMenu
}
private String sortByString,algoSortStrin
class sortByListener implements ItemListener
{
public void itemStateChanged(ItemEvent
{
if (nameButton.isSelected())
sortByString = "NAME";
if (ppgButton.isSelected())
sortByString = "PPG";
}
}
class sortAlgoListener implements ItemListener
{
public void itemStateChanged(ItemEvent
{
if (selectionButton.isSelecte
algoSortString = "SELECTION";
}
}
class sortTypeListener implements ItemListener
{
public void itemStateChanged(ItemEvent
{
if (incButton.isSelected())
typeSortString = "INCREASING";
}
}
class submitButtonListener implements ActionListener
{
public void actionPerformed(ActionEven
{
if (sortByString.equals("NAME
sortSelectNameIncAlgo();
if (sortByString.equals("PPG"
sortSelectPPGIncAlgo();
createPlayerInfoPanel();
bottomMessage.setText("Inf
}
}
class selectionMenuListener implements ActionListener
{
public void actionPerformed(ActionEven
{
String menuName = event.getActionCommand();
// THIS IS FOR SELECTION SORT ALWAYS [INCREASING]
if (menuName.equals("Name"))
{
sortSelectNameIncAlgo();
sortByString = "NAME";
}
else if (menuName.equals("PPG"))
{
sortSelectPPGIncAlgo();
sortByString = "PPG";
}
typeSortString = "INCREASING";
algoSortString = "SELECTION";
createPlayerInfoPanel();
bottomMessage.setText("Inf
}
}
public static void main(String[] args)
{
String[] teamMember = null;
teamMember = new String[5];
teamMember[0] = "Katie,Gearlds,15.6,3.4,3.
teamMember[1] = "Aya,Traore,13.0,2.3,4.9,3
teamMember[2] = "Lindsay,Wisdom,10.1,1.25,
teamMember[3] = "Erin,Lawless,9.7,1.07,3.8
teamMember[4] = "Sharika,Webb,4.8,3.43,3.0
NewClass bTeam = new NewClass(teamMember);
bTeam.setVisible(true);
}
public void actionPerformed(ActionEven
{
String menuName = event.getActionCommand();
if (menuName.equals("Quit"))
System.exit(0);
}
}
ASKER
I'll up the point value, this has been quite the annoyance.
ASKER
This being the problem I am having. :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Or alternately you could leave the panel and and instead clear and replaces its content.
ASKER
thanks alot. that worked perfect.
no worries :)