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

📄 demojlabelframe.java

📁 精通NetBeans光盘源代码,很好很好的资料
💻 JAVA
字号:
/*
 * DemoJLabelFrame.java
 *
 * Created on 2006年3月15日, 下午3:50
 */

package org.netbeans.swing.container;

import javax.swing.SwingConstants;

/**
 *
 * @author  boyingking
 */
public class DemoJLabelFrame extends javax.swing.JFrame {
    
    /** Creates new form DemoJLabelFrame */
    public DemoJLabelFrame() {
        initComponents();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        jLabelImage = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("JLabel\u5e94\u7528\u793a\u4f8b");
        jLabelImage.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
        jLabelImage.setIcon(new javax.swing.ImageIcon("F:\\学习\\booking\\程序\\container\\0259.jpg"));
        jLabelImage.setText("\u6f14\u793a\u56fe\u7247");
        jLabelImage.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelImageMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jLabelImageMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                jLabelImageMouseExited(evt);
            }
        });

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(35, 35, 35)
                .add(jLabelImage)
                .addContainerGap(48, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(35, 35, 35)
                .add(jLabelImage)
                .addContainerGap(31, Short.MAX_VALUE))
        );
        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jLabelImageMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelImageMouseExited
// TODO add your handling code here:
        this.jLabelImage.setVerticalTextPosition(SwingConstants.CENTER);
    }//GEN-LAST:event_jLabelImageMouseExited

    private void jLabelImageMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelImageMouseEntered
// TODO add your handling code here:
        this.jLabelImage.setVerticalTextPosition(SwingConstants.BOTTOM);
    }//GEN-LAST:event_jLabelImageMouseEntered

    private void jLabelImageMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelImageMouseClicked
// TODO add your handling code here:
        this.jLabelImage.setVerticalTextPosition(SwingConstants.TOP);
    }//GEN-LAST:event_jLabelImageMouseClicked
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new DemoJLabelFrame().setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabelImage;
    // End of variables declaration//GEN-END:variables
    
}

⌨️ 快捷键说明

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