📄 erdsqlviewer.java
字号:
/* * ErdSQLViewer.java * * Copyright (C) 2002, 2003, 2004, 2005, 2006 Takis Diakoumis * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */package org.executequery.gui.erd;import java.awt.Container;import java.awt.Dimension;import java.awt.GridBagConstraints;import java.awt.GridBagLayout;import java.awt.Insets;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.BorderFactory;import javax.swing.JButton;import javax.swing.JDialog;/* ---------------------------------------------------------- * CVS NOTE: Changes to the CVS repository prior to the * release of version 3.0.0beta1 has meant a * resetting of CVS revision numbers. * ---------------------------------------------------------- *//** * * @author Takis Diakoumis * @version $Revision: 1.4 $ * @date $Date: 2006/05/14 06:56:52 $ */public class ErdSQLViewer extends ErdPrintableDialog { /** The controller for the ERD viewer */ private ErdViewerPanel parent; public ErdSQLViewer(ErdViewerPanel parent) { super("SQL Text"); this.parent = parent; try { jbInit(); } catch (Exception e) { e.printStackTrace(); } display(); } private void jbInit() throws Exception { sqlText.setSQLText(parent.getAllSQLText()); sqlText.setPreferredSize(new Dimension(530,175)); sqlText.setBorder(BorderFactory.createEtchedBorder()); JButton cancelButton = new JButton("Close"); JButton okButton = new JButton("Execute"); Dimension btnDim = new Dimension(80, 30); cancelButton.setPreferredSize(btnDim); okButton.setPreferredSize(btnDim); ActionListener btnListener = new ActionListener() { public void actionPerformed(ActionEvent e) { buttons_actionPerformed(e); } }; cancelButton.addActionListener(btnListener); okButton.addActionListener(btnListener); Container c = getContentPane(); c.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(5,5,5,5); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.fill = GridBagConstraints.BOTH; gbc.gridwidth = 2; gbc.weighty = 1.0; gbc.weightx = 1.0; c.add(sqlText, gbc); gbc.insets.top = 0; gbc.gridwidth = 1; gbc.anchor = GridBagConstraints.EAST; gbc.weighty = 0; gbc.fill = GridBagConstraints.VERTICAL; gbc.gridy = 1; c.add(okButton, gbc); gbc.insets.left = 0; gbc.gridx = 1; gbc.weightx = 0; c.add(cancelButton, gbc); this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); } private void execute() { setVisible(false); new ErdExecuteSQL(parent); // new ErdExecuteSQL(parent, sqlText.getSQLText()); dispose(); } private void buttons_actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command.equals("Close")) dispose(); else if (command.equals("Execute")) execute(); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -