小编Joh*_*sta的帖子

下拉菜单无法按预期工作

import javax.swing.*;
public class MainP2 {
public MainP2() {
   JOptionPane.showMessageDialog(
          null,
          "Hi welcome to my square Pyramid calculator." + "\nPress Ok to begin.",
"CIS 2235", 
          JOptionPane.PLAIN_MESSAGE
   );
   String[] possibilities = {
           "adjust height", 
           "adjust baselength", 
           "adjust height and baselength", 
           "exit" 
   };
   String s = (String)JOptionPane.showInputDialog(
           null,
           "Choose one",
           "Customized Dialog",
           JOptionPane.PLAIN_MESSAGE,
           null,
           possibilities,
           possibilities[0]
   );
   //-----here's the problem with the code, am i calling it wrong?
   if(possibilities.equals(possibilities[0])){
           String myString = JOptionPane.showInputDialog(null,"Please enter height: ");
    }
}
public static void main …
Run Code Online (Sandbox Code Playgroud)

java swing

2
推荐指数
1
解决办法
172
查看次数

标签 统计

java ×1

swing ×1