求java问题解答,帮我看看这个程序哪里出错了呢???
importjavax.swing.*;publicclassFormatFrame2extendsJFrame{String[]formats={"Atom","Rss...
import javax.swing.*;
public class FormatFrame2 extends JFrame{
String[] formats = {"Atom","Rss 0.92","Rss 1.0","Rss 2.0"};
JComboBox formatBox = new JComboBox(formats);
public FormatFrame2(){
super("Choose a Format");
setSize(220,150);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel pane =new JPanel();
JLabel formatLabel =new JLabel("Output formats:");
pane.add(formatLabel);
pane.add(formatBox);
add(pane);
setVisible(true);
}
private static void setLookAndFeel(){
try {
UIManager.setLookAndFeel(
"com.sun.java.swing.plaf.nimbus.NimbusLookAmdFeel"
) ;
}catch(Exception exc){
System.out.println(exc.getMessage());
}
}
}
public static void main (String[]arguments){
FormatFrame2.setLookAndFeel();
FormatFrame2 ff = new FormatFrame2();
} 展开
public class FormatFrame2 extends JFrame{
String[] formats = {"Atom","Rss 0.92","Rss 1.0","Rss 2.0"};
JComboBox formatBox = new JComboBox(formats);
public FormatFrame2(){
super("Choose a Format");
setSize(220,150);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel pane =new JPanel();
JLabel formatLabel =new JLabel("Output formats:");
pane.add(formatLabel);
pane.add(formatBox);
add(pane);
setVisible(true);
}
private static void setLookAndFeel(){
try {
UIManager.setLookAndFeel(
"com.sun.java.swing.plaf.nimbus.NimbusLookAmdFeel"
) ;
}catch(Exception exc){
System.out.println(exc.getMessage());
}
}
}
public static void main (String[]arguments){
FormatFrame2.setLookAndFeel();
FormatFrame2 ff = new FormatFrame2();
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询