📄 listpropertydialog.java
字号:
/*
* YALE - Yet Another Learning Environment
* Copyright (C) 2001-2004
* Simon Fischer, Ralf Klinkenberg, Ingo Mierswa,
* Katharina Morik, Oliver Ritthoff
* Artificial Intelligence Unit
* Computer Science Department
* University of Dortmund
* 44221 Dortmund, Germany
* email: yale-team@lists.sourceforge.net
* web: http://yale.cs.uni-dortmund.de/
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*/
package edu.udo.cs.yale.gui;
import edu.udo.cs.yale.operator.Operator;
import edu.udo.cs.yale.operator.parameter.*;
import javax.swing.JPanel;
import javax.swing.JDialog;
import javax.swing.JButton;
import javax.swing.JScrollPane;
import java.awt.BorderLayout;
import javax.swing.BorderFactory;
import javax.swing.table.DefaultTableModel;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
/** A Dialog displaying a ListPropertyTable.
* @see edu.udo.cs.yale.gui.ListPropertyTable */
public class ListPropertyDialog extends JDialog {
private boolean ok = false;
private ListPropertyTable listPropertyTable;
private List parameterList;
public ListPropertyDialog(final ParameterTypeList type, List parameterList, Operator operator) {
super(YaleGUI.getMainFrame(), "Parameter List: " + type.getKey(), true);
this.parameterList = parameterList;
listPropertyTable = new ListPropertyTable(type, parameterList, operator);
getContentPane().setLayout(new BorderLayout());
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
JButton addButton = new JButton("Add");
addButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
listPropertyTable.addRow();
}
});
buttonPanel.add(addButton);
JButton removeButton = new JButton("Remove");
removeButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
listPropertyTable.removeSelected();
}
});
buttonPanel.add(removeButton);
JButton okButton = new JButton("Ok");
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { ok(); }
});
buttonPanel.add(okButton);
JButton cancelButton = new JButton("Cancel");
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { cancel(); }
});
buttonPanel.add(cancelButton);
getContentPane().add(buttonPanel, BorderLayout.SOUTH);
JScrollPane scrollpane = new JScrollPane(listPropertyTable);
getContentPane().add(scrollpane, BorderLayout.CENTER);
setSize(400, 200);
}
private void ok() {
ok = true;
listPropertyTable.getParameterList(parameterList);
dispose();
}
private void cancel() {
ok = false;
dispose();
}
public boolean isOk() {
return ok;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -