?? constrainteditor.java
字號:
/** * Copyright 2004 Carlos Silva A. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */package jgantt.view.dialogs;import java.awt.GridBagConstraints;import java.awt.GridBagLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JComboBox;import javax.swing.JComponent;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.JTextField;import jgantt.Messages;import jgantt.model.Constraint;import jgantt.view.adapters.ProjectViewModel;/** * ProjectEditor, edita las caracteristicas de un proyecto: * <ul> * <li> fechad de inicio * </ul> * * <p>$Date: 2005/03/25 14:58:31 $</p> * @version $Revision: 1.6 $ * @author {user} */public class ConstraintEditor extends JPanel implements ActionListener { /** * */ private static final long serialVersionUID = 3544667395307680562L; JTextField delayEdit ; JComboBox modeCombo; ProjectViewModel pvModel; Constraint constraint; protected void addComp(JComponent cmp, GridBagLayout gridbag, GridBagConstraints c) { gridbag.setConstraints(cmp, c); add(cmp); } /** * Constructor for TaskEditor */ public ConstraintEditor(Constraint ct) { super(); delayEdit = new JTextField(String.valueOf(ct.getDelay()),4); constraint = ct; modeCombo = new JComboBox(); modeCombo.addItem( Messages.getString("ConstraintEditor.mode.end_begin") ); //$NON-NLS-1$ modeCombo.addItem( Messages.getString("ConstraintEditor.mode.end_end") ); //$NON-NLS-1$ modeCombo.addItem( Messages.getString("ConstraintEditor.mode.begin_begin") ); //$NON-NLS-1$ modeCombo.addItem( Messages.getString("ConstraintEditor.mode.begin_end") ); //$NON-NLS-1$ GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); setLayout(gridbag); c.fill = GridBagConstraints.BOTH; c.weightx = 1.0; c.gridwidth = 1; addComp(new JLabel(Messages.getString("ConstraintEditor.delayLabel"), JLabel.LEFT), gridbag,c); //$NON-NLS-1$ addComp(delayEdit, gridbag,c); c.gridwidth = GridBagConstraints.REMAINDER; //end row addComp(new JLabel(Messages.getString("ConstraintEditor.delayUnits"), JLabel.LEFT), gridbag,c); //$NON-NLS-1$ c.weightx = 0.0; c.gridwidth = 1; addComp(new JLabel(Messages.getString("ConstraintEditor.modeLabel"), JLabel.LEFT), gridbag,c); //$NON-NLS-1$ c.gridwidth = GridBagConstraints.REMAINDER; //end row addComp(modeCombo, gridbag,c); modeCombo.addActionListener(this); delayEdit.addActionListener(this); } /** * cambios en los controles. */ public void actionPerformed(ActionEvent event) { //System.out.println("actionPerformed "+event.getSource()); if (event.getSource()==modeCombo) { byte d = (byte) (modeCombo.getSelectedIndex()); constraint.setMode(d); }else if (event.getSource()==delayEdit) { int d = Integer.parseInt(delayEdit.getText()); constraint.setDelay( d ); } }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -