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

📄 swinglabel.java

📁 基于netbeans的java桌面应用程序合集
💻 JAVA
字号:
/*
 * SwingLabel.java
 *
 * Created on 2007年7月28日, 下午10:29
 */

package jlabel;

import javax.swing.SwingConstants;

/**
 *
 * @author  Administrator
 */
public class SwingLabel extends javax.swing.JFrame {
    
    /** Creates new form SwingLabel */
    public SwingLabel() {
        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=" 生成的代码 ">//GEN-BEGIN:initComponents
    private void initComponents() {
        jLabelImage = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        jLabelImage.setIcon(new javax.swing.ImageIcon("E:\\我的收藏\\large_7408b177.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()
                .addContainerGap()
                .add(jLabelImage, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 438, Short.MAX_VALUE)
                .add(34, 34, 34))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(21, 21, 21)
                .add(jLabelImage, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 297, Short.MAX_VALUE)
                .add(23, 23, 23))
        );
        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jLabelImageMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelImageMouseEntered
// TODO 将在此处添加您的处理代码:
 //       this.jLabelImage.setVerticalTextPosition(SwingConstans.BOTTOM);
    }//GEN-LAST:event_jLabelImageMouseEntered

    private void jLabelImageMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelImageMouseExited
// TODO 将在此处添加您的处理代码:
//        this.jLabelImage.setVerticalTextPosition(SwingConstants.Center);
    }//GEN-LAST:event_jLabelImageMouseExited

    private void jLabelImageMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelImageMouseClicked
// TODO 将在此处添加您的处理代码:
        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 SwingLabel().setVisible(true);
            }
        });
        
    }
    
    // 变量声明 - 不进行修改//GEN-BEGIN:variables
    private javax.swing.JLabel jLabelImage;
    // 变量声明结束//GEN-END:variables
    
}

⌨️ 快捷键说明

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