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

📄 easytoolbar_query.java

📁 一些平时可能用到的工具,比如导出数据,比较数据
💻 JAVA
字号:
package gongju;

import java.awt.BorderLayout;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.SimpleDateFormat;
import java.util.GregorianCalendar;

import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.JTextPane;

/**
 * This code was edited or generated using CloudGarden's Jigloo SWT/Swing GUI
 * Builder, which is free for non-commercial use. If Jigloo is being used
 * commercially (ie, by a corporation, company or business for any purpose
 * whatever) then you should purchase a license for each developer using Jigloo.
 * Please visit www.cloudgarden.com for details. Use of Jigloo implies
 * acceptance of these licensing terms. A COMMERCIAL LICENSE HAS NOT BEEN
 * PURCHASED FOR THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED LEGALLY FOR
 * ANY CORPORATE OR COMMERCIAL PURPOSE.
 */
public class Easytoolbar_query extends javax.swing.JFrame {
	private JPanel jPanel1;

	private JButton btnOK;

	private JTextField txtTYPE;

	private JButton btnCOPY;

	private JTextPane txtMSG;

	private JScrollPane jScrollPane1;

	private JComboBox cbxTYPE;

	private JLabel labTYPE;

	private JLabel labCOLNM;

	private JTextField txtCOLNM;

	private DefaultComboBoxModel cbxTYPEModel = new DefaultComboBoxModel(
			new String[] { "", "ComboBox", "CheckBox" });

	/**
	 * @param args
	 */
	public Easytoolbar_query() {
		super("EasyToolbar_query");
		init();
	}

	public void init() {
		{
			this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
			jPanel1 = new JPanel();
			getContentPane().add(jPanel1, BorderLayout.CENTER);
			jPanel1.setLayout(null);
			{
				txtCOLNM = new JTextField();
				jPanel1.add(txtCOLNM);
				txtCOLNM.setBounds(49, 7, 147, 28);
			}
			{
				btnOK = new JButton();
				jPanel1.add(btnOK);
				btnOK.setText("\u751f\u6210");
				btnOK.setBounds(203, 7, 70, 28);
				btnOK.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						ok();
					}
				});
			}
			{
				labCOLNM = new JLabel();
				jPanel1.add(labCOLNM);
				labCOLNM.setText("\u680f\u4f4d");
				labCOLNM.setBounds(7, 7, 35, 28);
			}
			{
				labTYPE = new JLabel();
				jPanel1.add(labTYPE);
				labTYPE.setText("\u7c7b\u578b");
				labTYPE.setBounds(7, 49, 35, 28);
			}
			{
				txtTYPE = new JTextField();
				jPanel1.add(txtTYPE);
				txtTYPE.setBounds(49, 49, 63, 28);
			}
			{

				cbxTYPE = new JComboBox();
				jPanel1.add(cbxTYPE);
				cbxTYPE.setModel(cbxTYPEModel);
				cbxTYPE.setBounds(119, 49, 91, 28);
				cbxTYPE.setEditable(false);
			}
			{
				jScrollPane1 = new JScrollPane();
				jPanel1.add(jScrollPane1);
				jScrollPane1.setBounds(0, 91, 287, 63);
				{
					txtMSG = new JTextPane();
					jScrollPane1.setViewportView(txtMSG);
				}
			}
			{
				btnCOPY = new JButton();
				jPanel1.add(btnCOPY);
				btnCOPY.setText("\u590d\u5236");
				btnCOPY.setBounds(217, 49, 63, 28);
				btnCOPY.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						copy();
					}
				});
			}
		}
		{
			this.setSize(296, 201);
			this.setVisible(true);
			this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		}

	}

	public void ok() {
		java.util.Date date = (new GregorianCalendar()).getTime();
		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd   HH:mm:ss");
		StringBuffer java = new StringBuffer();
		java.append("//" + format.format(date) + "\r\n");
		String colnm = txtCOLNM.getText().toUpperCase();
		if (colnm != null && !colnm.equals("")) {
			String[] temp_colnm = colnm.split(",");
			for (int i = 0; i < temp_colnm.length; i++) {
				java
						.append("vQueryName.add(\""
								+ temp_colnm[i]
								+ "\");\r\nvQueryType.add(SFConstForm.DB_VARCHAR2);\r\nvQueryRange.add(SFConstForm.RANGE_NO);\r\n");
			}
		}
		String typecolnm = txtTYPE.getText().toUpperCase();
		if (typecolnm != null && !typecolnm.equals("")) {
			String[] temp_typecolnm = typecolnm.split(",");
			int i = cbxTYPE.getSelectedIndex();
			switch (i) {
			case 1:
				for (int j = 0; j < temp_typecolnm.length; j++) {
					java.append("SFComboBox cbx" + temp_typecolnm[j]
							+ " = new SFComboBox();\r\n" + "cbx"
							+ temp_typecolnm[j] + ".setSfDataBinding(" + "v"
							+ temp_typecolnm[j] + ");\r\n"
							+ "QDialog.SF_REPLACE_COMPONENT(\""
							+ temp_typecolnm[j] + "\", cbx" + temp_typecolnm[j]
							+ ");\r\n");
				}

				break;
			case 2:
				for (int j = 0; j < temp_typecolnm.length; j++) {
					java.append("SFCheckBox chk" + temp_typecolnm[j]
							+ " = new SFCheckBox();\r\n"
							+ "QDialog.SF_REPLACE_COMPONENT(\""
							+ temp_typecolnm[j] + "\", chk" + temp_typecolnm[j]
							+ ");\r\n");
				}
				break;
			default:
				break;
			}
		}
		txtMSG.setText(java.toString());
	}

	public void copy() {
		Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();// ?锟給锟絫?锟脚

⌨️ 快捷键说明

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