JAVA源码程序——桌面应用程序QQ伸缩效果1xp

/*
 * play2.java
 *
 * Created on __DATE__, __TIME__
 */

package play;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.io.IOException;

//import javax.swing.JOptionPane;
//import javax.swing.UIManager;
//import javax.swing.UnsupportedLookAndFeelException;

import javax.swing.*;

import com.jtattoo.plaf.fast.FastLookAndFeel;

/**
 *
 * @author  __USER__
 */
public class Play2 extends javax.swing.JFrame {

	/** Creates new form play2 */
	public Play2() {
		initComponents();
		this.setResizable(false);
		Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
		this.setLocation(d.width - 200 - this.getWidth() / 2, 10);
	}

	//GEN-BEGIN:initComponents
	// <editor-fold defaultstate="collapsed" desc="Generated Code">
	private void initComponents() {

		jTabbedPane1 = new javax.swing.JTabbedPane();
		jPanel1 = new javax.swing.JPanel();
		jButton1 = new javax.swing.JButton();
		jButton2 = new javax.swing.JButton();
		jButton3 = new javax.swing.JButton();
		jButton4 = new javax.swing.JButton();
		jButton5 = new javax.swing.JButton();
		jButton6 = new javax.swing.JButton();
		jPanel2 = new javax.swing.JPanel();
		jButton7 = new javax.swing.JButton();
		jButton8 = new javax.swing.JButton();
		jButton9 = new javax.swing.JButton();
		jButton10 = new javax.swing.JButton();
		jButton11 = new javax.swing.JButton();
		jButton12 = new javax.swing.JButton();
		jPanel3 = new javax.swing.JPanel();
		jButton13 = new javax.swing.JButton();
		jButton14 = new javax.swing.JButton();
		jButton15 = new javax.swing.JButton();
		jButton16 = new javax.swing.JButton();
		jPanel4 = new javax.swing.JPanel();
		jLabel1 = new javax.swing.JLabel();

		setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
		setTitle("Sun");
		addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseEntered(java.awt.event.MouseEvent evt) {
				formMouseEntered(evt);
			}
			public void mouseReleased(java.awt.event.MouseEvent evt) {
				formMouseReleased(evt);
			}
		});

		jTabbedPane1.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseExited(java.awt.event.MouseEvent evt) {
				fromMouseExited(evt);
			}
		});

		jButton1.setText("\u6e56\u5317E\u4fe1");
		jButton1.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jButton1ActionPerformed(evt);
			}
		});

		jButton2.setText("\u5c0f\u9633\u6302\u673a\u9501");
		jButton2.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jButton2ActionPerformed(evt);
			}
		});

		jButton3.setText("Flash");
		jButton3.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jButton3ActionPerformed(evt);
			}
		});

		jButton4.setText("Photoshop");
		jButton4.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jButton4ActionPerformed(evt);
			}
		});

		jButton5.setText("Fireworks");
		jButton5.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jButton5ActionPerformed(evt);
			}
		});

		jButton6.setText("Dreamweaver");
		jButton6.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jButton6ActionPerformed(evt);
			}
		});

		javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(
				jPanel1);
		jPanel1.setLayout(jPanel1Layout);
		jPanel1Layout
				.setHorizontalGroup(jPanel1Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								jPanel1Layout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPanel1Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING)
														.addComponent(
																jButton2,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																137,
																Short.MAX_VALUE)
														.addComponent(
																jButton1,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																137,
																Short.MAX_VALUE)
														.addComponent(
																jButton3,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																137,
																Short.MAX_VALUE)
														.addComponent(
																jButton4,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																137,
																Short.MAX_VALUE)
														.addComponent(
																jButton5,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																137,
																Short.MAX_VALUE)
														.addComponent(
																jButton6,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																137,
																Short.MAX_VALUE))
										.addContainerGap()));
		jPanel1Layout
				.setVerticalGroup(jPanel1Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								jPanel1Layout
										.createSequentialGroup()
										.addContainerGap()
										.addComponent(jButton1)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
										.addComponent(jButton2)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
										.addComponent(jButton3)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
										.addComponent(jButton4)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
										.addComponent(jButton5)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
										.addComponent(jButton6)
										.addContainerGap(253, Short.MAX_VALUE)));

		jTabbedPane1.addTab("\u7a0b\u5e8f", jPanel1);

		jButton7.setText("MyEclipse");
		jButton7.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jButton7ActionPerformed(evt);
			}
		});

		jButton8.setText("Eclipse");
		jButton8.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jButton8ActionPerformed(evt);
			}
		});

		jButton9.setText("JDK API");
		jButton9.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jButton9ActionPerformed(evt);
			}
		});

		jButton10.setText("Java Decompiler");
		jButton10.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jButton10ActionPerformed(evt);
			}
		});

		jButton11.setText("JavaScript");
		jButton11.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jButton11ActionPerformed(evt);
			}
		});

		jButton12.setText("\u7cbe\u901aQracle10\u7f16\u7a0b");
		jButton12.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jButton12ActionPerformed(evt);
			}
		});

		javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(
				jPanel2);
		jPanel2.setLayout(jPanel2Layout);
		jPanel2Layout
				.setHorizontalGroup(jPanel2Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								jPanel2Layout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPanel2Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING)
														.addComponent(
																jButton7,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																137,
																Short.MAX_VALUE)
														.addComponent(
																jButton8,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																137,
																Short.MAX_VALUE)
														.addComponent(
																jButton9,
																javax.swing.GroupLayout.Alignment.TRAILING,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																137,
																Short.MAX_VALUE)
														.addComponent(
																jButton10,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																137,
																Short.MAX_VALUE)
														.addComponent(
																jButton11,
																javax.swing.GroupLayout.Alignment.TRAILING,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																137,
																Short.MAX_VALUE)
														.addComponent(
																jButton12,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																137,
																Short.MAX_VALUE))
										.addContainerGap()));
		jPanel2Layout
				.setVerticalGroup(jPanel2Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								jPanel2Layout
										.createSequentialGroup()
										.addContainerGap()
										.addComponent(jButton7)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
										.addComponent(jButton8)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
										.addComponent(jButton9)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
										.addComponent(jButton10)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
										.addComponent(jButton11)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
										.addComponent(jButton12)
										.addContainerGap(253, Short.MAX_VALUE)));

		jTabbedPane1.addTab("\u5de5\u4f5c", jPanel2);

		jButton13.setText("\u817e\u8bafQQ 2011");
		jButton13.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jButton13ActionPerformed(evt);
			}
		});

		jButton14.setText("\u817e\u8baf Web QQ ");
		jButton14.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jButton14ActionPerformed(evt);
			}
		});

		jButton15.setText("YY\u8bed\u97f32011");
		jButton15.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jButton15ActionPerformed(evt);
			}
		});

		jButton16.setText("FeiQiu\u98de\u79cb");
		jButton16.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jButton16ActionPerformed(evt);
			}
		});

		javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(
				jPanel3);
		jPanel3.setLayout(jPanel3Layout);
		jPanel3Layout
				.setHorizontalGroup(jPanel3Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								jPanel3Layout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPanel3Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING)
														.addComponent(
																jButton13,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																137,
																Short.MAX_VALUE)
														.addComponent(
																jButton14,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																137,
																Short.MAX_VALUE)
														.addComponent(
																jButton15,
																javax.swing.GroupLayout.Alignment.TRAILING,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																137,
																Short.MAX_VALUE)
														.addComponent(
																jButton16,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																137,
																Short.MAX_VALUE))
										.addContainerGap()));
		jPanel3Layout
				.setVerticalGroup(jPanel3Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								jPanel3Layout
										.createSequentialGroup()
										.addContainerGap()
										.addComponent(jButton13)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
										.addComponent(jButton14)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
										.addComponent(jButton15)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
										.addComponent(jButton16)
										.addContainerGap(327, Short.MAX_VALUE)));

		jTabbedPane1.addTab("\u804a\u5929", jPanel3);

		jLabel1.setIcon(new javax.swing.ImageIcon(
				"E:\\JAVA\\java\\play\\src\\play\\gu.png")); // NOI18N

		javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(
				jPanel4);
		jPanel4.setLayout(jPanel4Layout);
		jPanel4Layout.setHorizontalGroup(jPanel4Layout.createParallelGroup(
				javax.swing.GroupLayout.Alignment.LEADING).addGroup(
				javax.swing.GroupLayout.Alignment.TRAILING,
				jPanel4Layout
						.createSequentialGroup()
						.addContainerGap(38, Short.MAX_VALUE)
						.addComponent(jLabel1,
								javax.swing.GroupLayout.PREFERRED_SIZE, 91,
								javax.swing.GroupLayout.PREFERRED_SIZE)
						.addGap(28, 28, 28)));
		jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup(
				javax.swing.GroupLayout.Alignment.LEADING).addGroup(
				jPanel4Layout
						.createSequentialGroup()
						.addGap(31, 31, 31)
						.addComponent(jLabel1,
								javax.swing.GroupLayout.PREFERRED_SIZE, 398,
								javax.swing.GroupLayout.PREFERRED_SIZE)
						.addContainerGap(46, Short.MAX_VALUE)));

		jTabbedPane1.addTab("\u5173\u4e8e", jPanel4);

		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
				getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(layout.createParallelGroup(
				javax.swing.GroupLayout.Alignment.LEADING).addComponent(
				jTabbedPane1));
		layout.setVerticalGroup(layout.createParallelGroup(
				javax.swing.GroupLayout.Alignment.LEADING).addComponent(
				jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 505,
				Short.MAX_VALUE));

		pack();
	}// </editor-fold>
	//GEN-END:initComponents
		private void fromMouseExited(java.awt.event.MouseEvent evt) {
		//当鼠标移开时间调用
		java.awt.Point p = this.getLocation();
		int x = p.x; //往上下伸缩的
		int y = p.y; //往左右撮的
		int fheight = this.getHeight();
		if (y <= 1) {
			for (int i = y; i <= 1; i--) {
				this.setLocation(x, i);
				if (i + fheight == 3) {
					break;
				}
			}
		}
	}

	private void formMouseEntered(java.awt.event.MouseEvent evt) {
		// frame监听当鼠标进入frame的时间执行
		java.awt.Point p = this.getLocation();
		int x = p.x; //往左右伸缩的
		int y = p.y; //往上下撮的
		if (y <= 0) {
			for (int i = y; i < 2; i++) {
				this.setLocation(x, i);
			}
		}
	}

	private void formMouseReleased(java.awt.event.MouseEvent evt) {
		//当鼠标移动窗口并且移开时间调用
		java.awt.Point p = this.getLocation();
		int x = p.x; //往上下伸缩的
		int y = p.y; //往左右撮的
		int fheight = this.getHeight();
		if (y <= 0) {
			for (int i = y; i < 0; i--) {
				this.setLocation(x, i);
				if (i + fheight == 3) {
					break;
				}
			}
		}
	}

	Runtime run = Runtime.getRuntime();//★★★★★★★★★★★★★★★★★★★

	private void jButton16ActionPerformed(java.awt.event.ActionEvent evt) {
		try {
			run.exec("D:\\FeiQ.exe");
		} catch (IOException e) {
			JOptionPane.showMessageDialog(this, "没有搜索到指定程序,路径有误!");
		}
	}

	private void jButton15ActionPerformed(java.awt.event.ActionEvent evt) {
		try {
			run.exec("F:\\软盘\\YY\\yy-2.0\\Start.exe");
		} catch (IOException e) {
			JOptionPane.showMessageDialog(this, "没有搜索到指定程序,路径有误!");
		}
	}

	private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {
		try {
			run.exec("F:\\WEBQQ\\WebQQ增强版/WebQQ增强版.exe");
		} catch (IOException e) {
			JOptionPane.showMessageDialog(this, "没有搜索到指定程序,路径有误!");
		}
	}

	private void jButton13ActionPerformed(java.awt.event.ActionEvent evt) {
		try {
			run.exec("F:\\软盘\\QQ\\Bin\\QQ.exe");
		} catch (IOException e) {
			JOptionPane.showMessageDialog(this, "没有搜索到指定程序,路径有误!");
		}
	}

	private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
	}

	private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
	}

	private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
	}

	private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {
		try {
			run.exec("E:\\档案查询文件夹\\JDK1.6CN.CHM");
		} catch (IOException e) {
			JOptionPane.showMessageDialog(this, "没有搜索到指定程序,路径有误!");
		}
	}

	private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {
		try {
			run.exec("E:\\JAVA\\eclipse\\eclipse.exe");
		} catch (IOException e) {
			JOptionPane.showMessageDialog(this, "没有搜索到指定程序,路径有误!");
		}
	}

	private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {
		try {
			run.exec("F:\\myeclise\\MyEclipse 9\\myeclipse.exe");
		} catch (IOException e) {
			JOptionPane.showMessageDialog(this, "没有搜索到指定程序,路径有误!");
		}
	}

	private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {
		try {
			run.exec("F:/软盘\\网络四剑客/Adobe\\Adobe Dreamweaver CS3/Drreamweaver.exe");
		} catch (IOException e) {
			JOptionPane.showMessageDialog(this, "没有搜索到指定程序,路径有误!");
		}
	}

	private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
		try {
			run.exec("F:/软盘/网络四剑客\\Adobe\\Adobe Fireworks CS3\\Fireworks.exe");
		} catch (IOException e) {
			JOptionPane.showMessageDialog(this, "没有搜索到指定程序,路径有误!");
		}
	}

	private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
		try {
			run.exec("F:\\软盘\\网络四剑客\\Adobe\\Adobe Photoshop CS3\\Photoshop.exe");
		} catch (IOException e) {
			JOptionPane.showMessageDialog(this, "没有搜索到指定程序,路径有误!");
		}
	}

	private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
		try {
			run.exec("F:\\软盘\\网络四剑客\\Adobe\\Adobe Flash CS3\\Flash.exe");
		} catch (IOException e) {
			JOptionPane.showMessageDialog(this, "没有搜索到指定程序,路径有误!");
		}
	}

	private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
		try {
			run.exec("C:\\Users\\Administrator/Desktop/PianSun丶/挂机锁.exe");
		} catch (IOException e) {
			JOptionPane.showMessageDialog(this, "没有搜索到指定程序,路径有误!");
		}
	}

	private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
		try {
			run.exec("F:\\软盘\\翼信\\ECP\\Netkeeper\\bin\\NetKeeper.exe");
		} catch (IOException e) {
			JOptionPane.showMessageDialog(this, "没有搜索到指定程序,路径有误!");
		}
	}

	/**
	 * @param args the command line arguments
	 */
	public static void main(String args[]) {
		java.awt.EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					UIManager.setLookAndFeel(new FastLookAndFeel());
				} catch (UnsupportedLookAndFeelException e) {
					e.printStackTrace();
				}
				new Play2().setVisible(true);
			}
		});
	}

	//GEN-BEGIN:variables
	// Variables declaration - do not modify
	private javax.swing.JButton jButton1;
	private javax.swing.JButton jButton10;
	private javax.swing.JButton jButton11;
	private javax.swing.JButton jButton12;
	private javax.swing.JButton jButton13;
	private javax.swing.JButton jButton14;
	private javax.swing.JButton jButton15;
	private javax.swing.JButton jButton16;
	private javax.swing.JButton jButton2;
	private javax.swing.JButton jButton3;
	private javax.swing.JButton jButton4;
	private javax.swing.JButton jButton5;
	private javax.swing.JButton jButton6;
	private javax.swing.JButton jButton7;
	private javax.swing.JButton jButton8;
	private javax.swing.JButton jButton9;
	private javax.swing.JLabel jLabel1;
	private javax.swing.JPanel jPanel1;
	private javax.swing.JPanel jPanel2;
	private javax.swing.JPanel jPanel3;
	private javax.swing.JPanel jPanel4;
	private javax.swing.JTabbedPane jTabbedPane1;
	// End of variables declaration//GEN-END:variables

}
JAVA源码程序——桌面应用程序QQ伸缩效果1xp

你可能感兴趣的:(郏高阳,桌面程序,Java源码程序,QQ伸缩效果,靠边缘伸缩)