import java.awt.Font; import java.awt.Frame; import java.awt.Label; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; @SuppressWarnings("serial") public class View extends Frame{ Label nameLabel,textLabel; public View(){ Font namefont = new Font("Times",0,20); nameLabel = new Label(); //nameLabel.setLocation(0,100); nameLabel.setText("Error"); nameLabel.setFont(namefont); nameLabel.setVisible(true); this.add(nameLabel); Font textFont = new Font("ヒラギノ明朝 Pro W3",0,12); textLabel = new Label(); //textLabel.setLocation(0, 80); textLabel.setText("Error"); textLabel.setFont(textFont); textLabel.setVisible(true); this.add(textLabel); addWindowListener(new ClosingWindowListener()); } public void setText(String text){ textLabel.setText(text); textLabel.setLocation(0,80); } public void setNameText(String text){ nameLabel.setText(text); nameLabel.setLocation(0, 40); } class ClosingWindowListener extends WindowAdapter{ public void windowClosing(WindowEvent e){ System.exit(0); } } }