⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 labelexample.java

📁 its a kind of tutorial.
💻 JAVA
字号:
// Filename LabelExample.java.
// Provides an example of the AWT Label class,  
// illustrating the three possible alignments. 
// Written for the Java interface book Chapter 2 - see text.
//
// Fintan Culwin, v 0.2, April 1996

import java.awt.*;
import java.applet.*;

public class LabelExample extends Applet {


  public void init() {


  Label  leftLabel    = new Label( "Alignment left",   Label.LEFT );
  Label  centerLabel  = new Label( "Alignment center", Label.CENTER );
  Label  rightLabel   = new Label( "Alignment right",  Label.RIGHT );
  Font   theFont      = new Font( "TimesRoman", Font.PLAIN, 20);

     this.setFont( theFont);
     this.setLayout( new GridLayout( 3, 1, 0, 10));
     
     this.add( leftLabel);
     this.add( centerLabel);
     this.add( rightLabel);     
  } // end init()



   public static void main(String args[]) {

   Frame        frame      = new Frame("Label Example demo");
   LabelExample theExample = new LabelExample();

      theExample.init();
      frame.add("Center", theExample);

      frame.show();
      frame.setSize( frame.getPreferredSize());

   } // end fun main

} // end class LabelExample










⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -