propertiesdialog.java
来自「优秀的打印控件全源代码,类似水晶表的设计器!」· Java 代码 · 共 385 行 · 第 1/2 页
JAVA
385 行
/* * ValuesDialog.java * * iReport -- Visual designer for generating JasperReports Documents * Copyright (C) 2002-2003 Giulio Toffoli gt@businesslogic.it * * 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 * (at your option) 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., 675 Mass Ave, Cambridge, MA 02139, USA. * * Giulio Toffoli * Via T.Aspetti, 233 * 35100 Padova ITALY * gt@businesslogic.it * * Created on 7 maggio 2003, 23.43 */package it.businesslogic.ireport.gui;import it.businesslogic.ireport.*;import javax.swing.table.*;import javax.swing.*;import javax.swing.event.*;import it.businesslogic.ireport.*;import it.businesslogic.ireport.util.*;import java.util.*;/** * * @author Administrator */public class PropertiesDialog extends javax.swing.JDialog { /** Creates new form ValuesDialog */ public PropertiesDialog(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); this.setSize(420, 250); //DefaultTableColumnModel dtcm = (DefaultTableColumnModel)jTableParameters.getColumnModel(); //DefaultTableCellRenderer tcr = (DefaultTableCellRenderer)dtcm.getColumn(0).getHeaderRenderer(); //new DefaultTableCellRenderer(); //tcr.setFont(jTableParameters.getFont()); //tcr.setBackground(this.getBackground()); //tcr.setBorder( new javax.swing.border.BevelBorder( javax.swing.border.BevelBorder.RAISED)); //dtcm.getColumn(0).setHeaderRenderer(tcr); DefaultListSelectionModel dlsm = (DefaultListSelectionModel)this.jTableProperties.getSelectionModel(); dlsm.addListSelectionListener(new javax.swing.event.ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { jTablePropertiesListSelectionValueChanged(e); } }); applyI18n(); // Open in center... it.businesslogic.ireport.util.Misc.centerFrame(this); } public void jTablePropertiesListSelectionValueChanged(javax.swing.event.ListSelectionEvent e) { if (this.jTableProperties.getSelectedRowCount() > 0) { this.jButtonModifyProperty.setEnabled(true); this.jButtonDeleteProperty.setEnabled(true); } else { this.jButtonModifyProperty.setEnabled(false); this.jButtonDeleteProperty.setEnabled(false); } } /** 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. */ private void initComponents() {//GEN-BEGIN:initComponents java.awt.GridBagConstraints gridBagConstraints; jPanelFields = new javax.swing.JPanel(); jScrollPane3 = new javax.swing.JScrollPane(); jTableProperties = new it.businesslogic.ireport.gui.JDragTable(); jPanelButtons2 = new javax.swing.JPanel(); jButtonNewProperty = new javax.swing.JButton(); jButtonModifyProperty = new javax.swing.JButton(); jButtonDeleteProperty = new javax.swing.JButton(); jPanel1 = new javax.swing.JPanel(); jButtonClose = new javax.swing.JButton(); setTitle("Values"); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); jPanelFields.setLayout(new java.awt.BorderLayout()); jScrollPane3.setBackground(new java.awt.Color(255, 255, 255)); jScrollPane3.setFont(new java.awt.Font("Dialog", 0, 11)); jScrollPane3.setPreferredSize(new java.awt.Dimension(32767, 32767)); jScrollPane3.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jScrollPane3MouseClicked(evt); } }); jTableProperties.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Name", "Value" } ) { Class[] types = new Class [] { java.lang.Object.class, java.lang.String.class }; boolean[] canEdit = new boolean [] { false, false }; public Class getColumnClass(int columnIndex) { return types [columnIndex]; } public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); jTableProperties.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jTablePropertiesMouseClicked(evt); } }); jScrollPane3.setViewportView(jTableProperties); jPanelFields.add(jScrollPane3, java.awt.BorderLayout.CENTER); jPanelButtons2.setLayout(new java.awt.GridBagLayout()); jPanelButtons2.setPreferredSize(new java.awt.Dimension(100, 100)); jPanelButtons2.setMinimumSize(new java.awt.Dimension(100, 10)); jButtonNewProperty.setText("New"); jButtonNewProperty.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonNewPropertyActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.insets = new java.awt.Insets(5, 4, 0, 4); jPanelButtons2.add(jButtonNewProperty, gridBagConstraints); jButtonModifyProperty.setText("Modify"); jButtonModifyProperty.setEnabled(false); jButtonModifyProperty.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonModifyPropertyActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.insets = new java.awt.Insets(3, 4, 0, 4); jPanelButtons2.add(jButtonModifyProperty, gridBagConstraints); jButtonDeleteProperty.setText("Delete"); jButtonDeleteProperty.setEnabled(false);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?