RSS

Java Applet1

12 11月

 Java Applet1  /My Document/Develop/Java/Applet1.zip

 

 Applet1

import java.awt.*;
import javax.swing.JPanel;
import javax.swing.JApplet;
import javax.swing.JCheckBox;
import javax.swing.JButton;
import javax.swing.JLabel;
/*
 <applet code="JApplet1.class" width="400" height="100">
 </applet>
 */
public class JApplet1 extends JApplet {
 private static final long serialVersionUID = 1L;
 private JPanel jContentPane = null;
 private JCheckBox jCheckBox1 = null;
 private JButton jButton1 = null;
 private JLabel jLabel1 = null;
 /**
  * This is the default constructor
  */
 public JApplet1() {
  super();
 }
 /**
  * This method initializes this
  *
  * @return void
  */
 public void init() {
  this.setSize(300, 200);
  this.setContentPane(getJContentPane());
 }
 /**
  * This method initializes jContentPane
  *
  * @return javax.swing.JPanel
  */
 private JPanel getJContentPane() {
  if (jContentPane == null) {
   jLabel1 = new JLabel();
   jLabel1.setText("JLabel1");
   jContentPane = new JPanel();
   jContentPane.setLayout(new FlowLayout());
   jContentPane.add(getJCheckBox1());
   jContentPane.add(getJButton1());
   jContentPane.add(jLabel1);
  }
  return jContentPane;
 }
 /**
  * This method initializes jCheckBox 
  *  
  * @return javax.swing.JCheckBox 
  */
 private JCheckBox getJCheckBox1() {
  if (jCheckBox1 == null) {
   jCheckBox1 = new JCheckBox();
   jCheckBox1.setText("jCheckBox1");
  }
  return jCheckBox1;
 }
 /**
  * This method initializes jButton 
  *  
  * @return javax.swing.JButton 
  */
 private JButton getJButton1() {
  if (jButton1 == null) {
   jButton1 = new JButton();
   jButton1.setText("status");
   jButton1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent e) {
     showStatus(); // TODO Auto-generated Event stub actionPerformed()
    }
   });
  }
  return jButton1;
 }
 private void showStatus() {
  this.jLabel1.setText("jCheckBox1 = " + jCheckBox1.isSelected());
 }
}
 

 
Java Applet1 はコメントを受け付けていません。

投稿者: : 2010/11/12 投稿先 Java

 

タグ:

コメントは受け付けていません。