AppletGameContainer.java 文件源码

java
阅读 29 收藏 0 点赞 0 评论 0

项目:Progetto-C 作者:
/**
 * Create a new panel to display the console output
 * 
 * @param e The exception causing the console to be displayed
 */
public ConsolePanel(Exception e) {
   setLayout(new BorderLayout());
   setBackground(Color.black);
   setForeground(Color.white);

   Font consoleFont = new Font("Arial", Font.BOLD, 14);

   Label slickLabel = new Label("SLICK CONSOLE", Label.CENTER);
   slickLabel.setFont(consoleFont);
   add(slickLabel, BorderLayout.PAGE_START);

   StringWriter sw = new StringWriter();
   e.printStackTrace(new PrintWriter(sw));

   textArea.setText(sw.toString());
   textArea.setEditable(false);
   add(textArea, BorderLayout.CENTER);

   // add a border on both sides of the console
   add(new Panel(), BorderLayout.LINE_START);
   add(new Panel(), BorderLayout.LINE_END);

   Panel bottomPanel = new Panel();
   bottomPanel.setLayout(new GridLayout(0, 1));
   Label infoLabel1 = new Label("An error occured while running the applet.", Label.CENTER);
   Label infoLabel2 = new Label("Plese contact support to resolve this issue.", Label.CENTER);
   infoLabel1.setFont(consoleFont);
   infoLabel2.setFont(consoleFont);
   bottomPanel.add(infoLabel1);
   bottomPanel.add(infoLabel2);
   add(bottomPanel, BorderLayout.PAGE_END);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号