问题描述
好的,我知道问题的标题很烂,但我确实不能为该错误加上标题。所以问题是,在我的这段代码中,每当我在“输入员工收入:”部分中输入金额时,我最多只能输入100,这是我可以输入的最大值,我需要将其更改为最多100的输入,00甚至有可能吗?
这是我的代码
JButton btnNewButton_1 = new JButton("Add Employee");
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ArrayList<Integer> mony = new ArrayList<>();
ArrayList<String> employee = new ArrayList<>();
Stack<Integer> monyStack = new Stack<Integer>();
//IN NEED OF EDITING TO EXPAND THE VALUE ON STACK
int size = Integer.parseInt(JOptionPane.showInputDialog("Enter No. of Employees:"));
int counter = 0;
for (counter = 0; counter < size; counter++) {
String name = JOptionPane.showInputDialog("Enter Employee Name:");
employee.add(name);
int income = Integer.parseInt(JOptionPane.showInputDialog("Enter Employee Income: "));
mony.add(income);
monyStack.add(income);
}
// Sorting scores
lblNewLabel_EmpName.setText("Employee Names: " + employee);
lblNewLabel_EmpIncome.setText("Employees Income: " + monyStack);
ProjectSortMethods.selectionSort(monyStack);
lblNewLabel_Sorted.setText("Sorted Employees Income: " + monyStack);
String[] ss = new String[size];
int ct = 0;
int ite = 0;
int b = 0;
for (int a = 0; a < size * 10; a++) {
if ((monyStack.get(ite)) != (mony.get(ct))) {
ct++;
} else if ((monyStack.get(ite)) == (mony.get(ct))) {
ss[b] = employee.get(ct).toString() + ":" + monyStack.get(ite).toString();
b++;
ite++;
ct=0;
}
if(ite == size) {
break;
}
}
lblNewLabel_6 .setText("Employees Income (lowest-highest): ");
lblNewLabel_7.setText(Arrays.toString(ss));
}
});
btnNewButton_1.setBackground(new Color(47,90,120));
btnNewButton_1.setForeground(new Color (255,255,255));
btnNewButton_1.setBounds(188,324,118,29);
panel1.add(btnNewButton_1);
希望你能帮助我
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)